summarylogtreecommitdiffstats
path: root/0005-Add-support-for-rebuild-and-chroot-only-in-build.-re.patch
blob: 8a696477d42348586b153ef4aacb0d4473c4ada5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Marko Lemmetty <marko.lemmetty@jollamobile.com>
Date: Fri, 15 May 2020 15:04:41 +0300
Subject: [PATCH] Add support for --rebuild and --chroot-only in build.
 --rebuild sends --skip-prep to build and rpm to skip the %prep phase. This is
 useful in conjunction with the --rsync* options to enable rapid rebuilds in
 the clean rpmbuild environment.

    --chroot-only creates a chroot without doing a build - this can be used to
    build scratchbox2 targets
---
 osc/build.py       | 6 ++++++
 osc/commandline.py | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/osc/build.py b/osc/build.py
index 3f955f70c46dbcbec504dffb50ac993f1b53299b..d5c232643a3f701543a1fe8b97faa122d9f536b2 100644
--- a/osc/build.py
+++ b/osc/build.py
@@ -729,6 +729,12 @@ def main(apiurl, store, opts, argv):
         buildargs.append('--norootforbuild')
     if opts.clean:
         buildargs.append('--clean')
+    if opts.rebuild:
+        if not opts.rsyncsrc or not opts.rsyncdest:
+            print >>sys.stderr, 'Warning: --rebuild option is usually used with both --rsync-src and --rsync-dest'
+        buildargs.append('--skip-prep')
+    if opts.chroot_only:
+        buildargs.append('--chroot-only')
     if opts.nochecks:
         buildargs.append('--no-checks')
     if not opts.no_changelog:
diff --git a/osc/commandline.py b/osc/commandline.py
index 6e4b55ea04b037ae2fb0fb063a812849a0e523cc..b8906e79762235c514b6f32d0c8c7bd8c4474b0d 100644
--- a/osc/commandline.py
+++ b/osc/commandline.py
@@ -7130,6 +7130,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
                   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('--rebuild', action='store_true',
+                  help='During build, skip the %%prep and %%clean phases; requires --rsync options')
+    @cmdln.option('--chroot-only', action='store_true',
+                  help='Only initialise build root and skip build.')
     @cmdln.option('--nochecks', '--no-checks', action='store_true',
                   help='Do not run build checks on the resulting packages.')
     @cmdln.option('--no-verify', '--noverify', action='store_true',