Compare commits

...

2 Commits

Author SHA1 Message Date
Martchus 4850ada836 Add instructions for sharing ccache with other user 2021-07-20 18:55:25 +02:00
Martchus bbc7c3a533 Ignore empty packages within the cache dir
Those are most likely leftovers from  previous failed download attempts and
can be ignored. (Existing files are overridden.)
2021-07-17 23:58:37 +02:00
2 changed files with 19 additions and 4 deletions

View File

@ -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).

View File

@ -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();