Skip to content

Commit

Permalink
Merge pull request #1010 from Firstyear/format-in-sccache-file-uri
Browse files Browse the repository at this point in the history
Allow formatting of the sccache uri
  • Loading branch information
dmach committed Mar 15, 2022
2 parents 09810dd + e25682b commit 546991a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
25 changes: 15 additions & 10 deletions osc/build.py
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion osc/conf.py
Expand Up @@ -304,9 +304,14 @@ def _identify_osccookiejar():
# 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)
Expand Down

0 comments on commit 546991a

Please sign in to comment.