1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-14 00:06:15 +01:00

Add support for --overlay and --rsync-{src,dest} to build and osc.

--overlay OVERLAY
              Copy overlay filesystem to buildroot after installing
              all RPMs. This must be a valid directory.
--rsync-src RSYNCSRC
              Copy overlay folder (RSYNCSRC) to a folder (RSYNCDEST)
              inside the buildroot using rsync.
              It will "%define RSYNCDONE 1" for handling %setup in your
              specfile. E.g.:
              %prep
              %if 0%{?RSYNCDONE}
              %setup -n aaa_base -T -D -b 5 -b 7
              %else
              %setup -n aaa_base -b 5 -b 7
              %endif
--rsync-dest RSYNCDEST

Todo: tell rpmbuild not to delete the folders.
This commit is contained in:
Jan-Simon Möller 2009-08-18 21:28:33 +00:00
parent 4e32d4dc41
commit 853c2c5dcb
2 changed files with 40 additions and 1 deletions

View File

@ -502,11 +502,44 @@ def main(opts, argv):
vm_options+=" --memory " + config['build-memory']
print 'Running build'
cmd = '%s --root=%s --rpmlist=%s --dist=%s --arch=%s %s %s %s' \
# special handling for overlay and rsync-src/dest
specialcmdopts = " "
if opts.rsyncsrc or opts.rsyncdest :
if not opts.rsyncsrc or not opts.rsyncdest:
print "When using --rsync-{src,dest} both parameters have to be specified."
sys.exit(1)
myrsyncsrc = os.path.expanduser(os.path.expandvars(opts.rsyncsrc))
myrsyncdest = ""
if os.path.isdir(myrsyncsrc):
myrsyncsrc = os.path.abspath(myrsyncsrc)
else:
print "--rsync-src " + str(opts.rsyncsrc) + " is no valid directory!"
sys.exit(1)
# can't check destination - its in the target chroot ;) - but we can check for sanity
if not opts.rsyncdest.startswith("/"):
print "--rsync-dest " + str(opts.rsyncsrc) + " is no absolute path (starting with '/')!"
sys.exit(1)
myrsyncdest = os.path.expandvars(opts.rsyncdest)
specialcmdopts += '--rsync-src=%s --rsync-dest=%s' \
% (myrsyncsrc,
myrsyncdest)
if opts.overlay:
myoverlay = os.path.expanduser(os.path.expandvars(opts.overlay))
if not os.path.isdir(myoverlay):
print "--overlay " + str(opts.overlay) + " is no valid directory!"
sys.exit(1)
myoverlay = os.path.abspath(myoverlay)
specialcmdopts += '--overlay=%s' \
% (myoverlay)
cmd = '%s --root=%s --rpmlist=%s --dist=%s %s --arch=%s %s %s %s' \
% (config['build-cmd'],
config['build-root'],
rpmlist_file.name,
bc_file.name,
specialcmdopts,
bi.buildarch,
vm_options,
build_descr,

View File

@ -2239,6 +2239,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='Delete old build root before initializing it')
@cmdln.option('--no-changelog', action='store_true',
help='don\'t update the package changelog from a changes file')
@cmdln.option('--rsync-src', metavar='RSYNCSRCPATH', dest='rsyncsrc',
help='Copy folder to buildroot after installing all RPMs. Use together with --rsync-dest. This is the path on the HOST filesystem e.g. /tmp/linux-kernel-tree. It defines RSYNCDONE 1 .')
@cmdln.option('--rsync-dest', metavar='RSYNCDESTPATH', dest='rsyncdest',
help='Copy folder to buildroot after installing all RPMs. Use together with --rsync-src. This is the path on the TARGET filesystem e.g. /usr/src/packages/BUILD/linux-2.6 .')
@cmdln.option('--overlay', metavar='OVERLAY',
help='Copy overlay filesystem to buildroot after installing all RPMs .')
@cmdln.option('--noinit', '--no-init', action='store_true',
help='Skip initialization of build root and start with build immediately.')
@cmdln.option('--nochecks', '--no-checks', action='store_true',