Fix the gbs export doesn't generate patches when packaging non-native package. 62/299962/2
authorwanchao-xu <wanchao.xu@samsung.com>
Fri, 13 Oct 2023 01:43:36 +0000 (09:43 +0800)
committerwanchao-xu <wanchao.xu@samsung.com>
Fri, 13 Oct 2023 02:24:53 +0000 (10:24 +0800)
Reason:
The packages can be divided into 2 categories: native packages and non-native (or upstream) packages.
Please refer to https://docs.tizen.org/platform/reference/gbs/gbs-maintenance-models/.
If the package has export branch and upstream branch, but the export branch is not based on upstream,
gbs will export this package as no-native without auto-generate patches.

Solution:
Export the package as native package if the export branch is not based on upstream.

Change-Id: I16f12acc9ab2111f8f5b2e966bbf6b4d56ae5086
Signed-off-by: wanchao-xu <wanchao.xu@samsung.com>
gitbuildsys/cmd_export.py

index 43245ac..37e9bd6 100644 (file)
@@ -163,18 +163,18 @@ def create_gbp_export_args(repo, commit, export_dir, tmp_dir, spec, args,
     if force_native or is_native_pkg(repo, args) or args.no_patch_export:
         argv.append('--git-native=on')
     else:
-        argv.append('--git-native=off')
         # Check if the revision seems to be of an orphan development branch
-        is_orphan = False
         export_commitish = 'HEAD' if commit == 'WC.UNTRACKED' else commit
         try:
             repo.get_merge_base(export_commitish, upstream_branch)
         except GitRepositoryError:
-            is_orphan = True
-        # Development branch in orphan packaging model is identified in the conf
-        orphan_packaging = configmgr.get('packaging_branch', 'orphan-devel')
-
-        if not is_orphan:
+            log.warn("No common ancestor between export commit and upstream, "
+                     "enable native packaging mode")
+            argv.append('--git-native=on')
+        else:
+            argv.append('--git-native=off')
+            # Development branch in orphan packaging model is identified in the conf
+            orphan_packaging = configmgr.get('packaging_branch', 'orphan-devel')
             argv.extend(["--git-patch-export",
                          "--git-patch-export-compress=100k",
                          "--git-patch-export-squash-until=%s" %
@@ -187,8 +187,8 @@ def create_gbp_export_args(repo, commit, export_dir, tmp_dir, spec, args,
                 export_rev = orphan_packaging
                 argv.extend(["--git-patch-export-rev=%s" % commit])
 
-        if repo.has_branch("pristine-tar"):
-            argv.extend(["--git-pristine-tar"])
+            if repo.has_branch("pristine-tar"):
+                argv.extend(["--git-pristine-tar"])
 
     argv.append("--git-export=%s" % export_rev)