1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-13 17:16:23 +01:00

Merge pull request #1010 from Firstyear/format-in-sccache-file-uri

Allow formatting of the sccache uri
This commit is contained in:
Daniel Mach 2022-03-15 13:23:55 +01:00 committed by GitHub
commit 546991a201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 11 deletions

View File

@ -682,16 +682,6 @@ def main(apiurl, opts, argv):
if opts.pkg_ccache:
buildargs.append('--pkg-ccache=%s' % opts.pkg_ccache)
xp.append('ccache')
if opts.sccache_uri or config['sccache_uri'] or opts.sccache or config['sccache']:
if opts.pkg_ccache or opts.ccache or config['ccache']:
raise oscerr.WrongArgs('Error: sccache and ccache can not be enabled at the same time')
if opts.sccache_uri:
buildargs.append('--sccache-uri=%s' % opts.sccache_uri)
elif config['sccache_uri']:
buildargs.append('--sccache-uri=%s' % config['sccache_uri'])
else:
buildargs.append('--sccache')
xp.append('sccache')
if opts.linksources:
buildargs.append('--linksources')
if opts.baselibs:
@ -779,6 +769,21 @@ def main(apiurl, opts, argv):
except:
pass
# We configure sccache after pacname, so that in default cases we can have an sccache for each
# package to prevent cross-cache polutions. It helps to make the local-use case a bit nicer.
if opts.sccache_uri or config['sccache_uri'] or opts.sccache or config['sccache']:
if opts.pkg_ccache or opts.ccache or config['ccache']:
raise oscerr.WrongArgs('Error: sccache and ccache can not be enabled at the same time')
sccache_arg = "--sccache-uri=/var/tmp/osbuild-sccache-{pkgname}.tar"
if opts.sccache_uri:
sccache_arg = '--sccache-uri=%s' % opts.sccache_uri
elif config['sccache_uri']:
sccache_arg = '--sccache-uri=%s' % config['sccache_uri']
# Format the package name.
sccache_arg = sccache_arg.format(pkgname=pacname)
buildargs.append(sccache_arg)
xp.append('sccache')
# define buildinfo & config local cache
bi_file = None
bc_file = None

View File

@ -304,9 +304,14 @@ apiurl = %(apiurl)s
# ccache = 1
# Enable sccache in build roots. Conflicts with ccache.
# Equivalent to sccache_uri = file:///var/tmp/osbuild-sccache-{pkgname}.tar
# sccache = 1
# Optional remote URI for sccache storage.
# Optional URI for sccache storage. Maybe a file://, redis:// or other URI supported
# by the configured sccache install. This uri MAY take {pkgname} as a special parameter
# which will be replaced with the name of the package to be built.
# sccache_uri = file:///var/tmp/osbuild-sccache-{pkgname}.tar.lzop
# sccache_uri = file:///var/tmp/osbuild-sccache-{pkgname}.tar
# sccache_uri = redis://127.0.0.1:6379
# extra packages to install when building packages locally (osc build)