2 Commits

Author SHA1 Message Date
Martchus 4850ada836 Add instructions for sharing ccache with other user 2 months ago
Martchus bbc7c3a533 Ignore empty packages within the cache dir 2 months ago
  1. 16
      README.md
  2. 7
      librepomgr/buildactions/reloadlibrarydependencies.cpp

16
README.md

@ -215,6 +215,22 @@ you start the server with has permissions to read and write there. Otherwise the
configure errors can be confusing. Internally the server is mounting that directory like
described in [the wiki](https://wiki.archlinux.org/index.php/Ccache#makechrootpkg).
If you want to use the existing `ccache` directory owned by your current user, you could do
the following to grant the `buildservice` user access to it:
1. Add new group for accessing the cache and add the users to it:
`sudo groupadd ccache`, `sudo usermod -a -G ccache "$USER"`, `sudo usermod -a -G ccache buildservice`
2. Set group ownership: `sudo chown -R $USER:ccache $ccache_dir`
3. Ensure dirs are readable by the group and that the group is inherited:
`sudo find "$ccache_dir" -type d -exec chmod 2775 {} \+`
4. Ensure that all files are readable by the group:
`sudo find "$ccache_dir" -type f -exec chmod 664 {} \+`
5. Add `umask = 002` to the ccache config so new files/dirs created by it are fully accessible by
the group.
6. Patch `devtools` so additional groups are configured within the container (see
https://github.com/Martchus/devtools/commit/b981c6afe81219ff4ca1ea34d0be5cc681408962)
Note that ccache *slows* down the initial compilation. It is only useful to enable it if rebuilds
with only slight changes are expected. Currently it is *not* possible to enable/disable ccache usage
per package (e.g. via a regex).

7
librepomgr/buildactions/reloadlibrarydependencies.cpp

@ -133,14 +133,13 @@ void ReloadLibraryDependencies::run()
const auto &arch = packageInfo->arch;
if (!db->localPkgDir.empty()) {
path = db->localPkgDir % '/' + fileName;
} else if (std::filesystem::exists(cachePath = cacheDir + fileName, ec)) {
} else if (std::filesystem::file_size(cachePath = cacheDir + fileName, ec) && !ec) {
path = std::move(cachePath);
} else if (std::filesystem::exists(cachePath = cacheDir % arch % '/' + fileName, ec)) {
} else if (std::filesystem::file_size(cachePath = cacheDir % arch % '/' + fileName, ec) && !ec) {
path = std::move(cachePath);
} else {
for (const auto &possibleCachePath : m_setup.config.packageCacheDirs) {
std::error_code ecFileExists;
if (std::filesystem::exists(path = possibleCachePath % '/' + fileName, ecFileExists)) {
if (std::filesystem::file_size(path = possibleCachePath % '/' + fileName, ec) && !ec) {
break;
}
path.clear();

Loading…
Cancel
Save