Use arch-specific sub-directory within cache dir when conducting build

This commit is contained in:
Martchus 2022-05-31 20:27:42 +02:00
parent 0095424696
commit 645bb0fe54
3 changed files with 8 additions and 4 deletions

View File

@ -342,6 +342,9 @@ void ConductBuild::run()
}
setupReadLock.unlock();
// use arch-specific sub-directory within cache dir
m_globalPackageCacheDir = m_globalPackageCacheDir % '/' + m_buildPreparation.targetArch;
// fill omitted build progress configuration with defaults from global config
if (m_autoStaging && m_buildPreparation.stagingDb.empty()) {
reportError("Auto-staging is enabled but no staging database has been specified in build-preparation.json.");
@ -559,8 +562,7 @@ void ConductBuild::makePacmanConfigFile(
section.fields.erase(
std::remove_if(section.fields.begin(), section.fields.end(), [](const AdvancedIniFile::Field &field) { return field.key == "CacheDir"; }),
section.fields.end());
section.fields.emplace_back(
AdvancedIniFile::Field{ .key = "CacheDir", .value = m_globalPackageCacheDir % '/' + m_buildPreparation.targetArch });
section.fields.emplace_back(AdvancedIniFile::Field{ .key = "CacheDir", .value = m_globalPackageCacheDir });
auto archField = section.findField("Architecture");
if (archField == section.fieldEnd()) {
throw std::runtime_error("pacman.conf lacks Architecture option");

View File

@ -120,7 +120,7 @@ struct LIBREPOMGR_EXPORT ServiceSetup : public LibPkg::Lockable {
std::string makepkgConfigFilePath; // FIXME: not useful after all?; using config-$arch directory within chrootDir instead
std::vector<std::string> makechrootpkgFlags;
std::vector<std::string> makepkgFlags;
std::string packageCacheDir;
std::string packageCacheDir; // cache dir *without* architecture sub-folder (which is automatically added as needed)
std::uint64_t packageDownloadSizeLimit = 500 * 1024 * 1024;
std::string testFilesDir;
BuildPresets presets;

View File

@ -124,6 +124,7 @@ void BuildActionsTests::loadBasicTestSetup()
m_setup.building.repoAddPath = std::filesystem::absolute(testFilePath("scripts/fake_repo_add.sh"));
m_setup.building.gpgPath = std::filesystem::absolute(testFilePath("scripts/fake_gpg.sh"));
m_setup.building.defaultGpgKey = "1234567890";
m_setup.building.packageCacheDir = m_setup.building.workingDirectory + "/test-cache-dir";
m_setup.configFilePath = std::filesystem::absolute(testFilePath("test-config/server.conf"));
std::filesystem::remove_all(m_setup.workingDirectory);
@ -536,7 +537,8 @@ void BuildActionsTests::testConductingBuild()
readFile("building/build-data/conduct-build-test/boost/pkg/download.log"));
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"no staging needed: updpkgsums log", "fake updatepkgsums: \n"s, readFile("building/build-data/conduct-build-test/boost/pkg/updpkgsums.log"));
TESTUTILS_ASSERT_LIKE("no staging needed: build log", "fake makechrootpkg: -c -u -C -r .*chroot-dir/arch-x86_64 -l buildservice --\n"s,
TESTUTILS_ASSERT_LIKE("no staging needed: build log",
"fake makechrootpkg: -c -u -C .*building/test-cache-dir/x86_64 -r .*chroot-dir/arch-x86_64 -l buildservice --\n"s,
readFile("building/build-data/conduct-build-test/boost/pkg/build.log"));
TESTUTILS_ASSERT_LIKE("no staging needed: repo-add log",
"fake repo-add: boost.db.tar.zst boost(-libs)?-1\\.73\\.0-1-x86_64.pkg.tar.zst boost(-libs)?-1\\.73\\.0-1-x86_64.pkg.tar.zst\n"s,