diff --git a/librepomgr/buildactions/conductbuild.cpp b/librepomgr/buildactions/conductbuild.cpp index cce22aa..379dc3c 100644 --- a/librepomgr/buildactions/conductbuild.cpp +++ b/librepomgr/buildactions/conductbuild.cpp @@ -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"); diff --git a/librepomgr/serversetup.h b/librepomgr/serversetup.h index 635da3d..4e3969f 100644 --- a/librepomgr/serversetup.h +++ b/librepomgr/serversetup.h @@ -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 makechrootpkgFlags; std::vector 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; diff --git a/librepomgr/tests/buildactions.cpp b/librepomgr/tests/buildactions.cpp index c069639..f5028f1 100644 --- a/librepomgr/tests/buildactions.cpp +++ b/librepomgr/tests/buildactions.cpp @@ -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,