merge latest patch
authorwangbiao <biao716.wang@samsung.com>
Tue, 21 Nov 2023 09:03:33 +0000 (18:03 +0900)
committerwangbiao <biao716.wang@samsung.com>
Tue, 21 Nov 2023 09:03:33 +0000 (18:03 +0900)
Change-Id: I079eaed15df7ff80d87d84b24c82a4ef3bcdee78
Signed-off-by: wangbiao <biao716.wang@samsung.com>
gitbuildsys/cmd_export.py
gitbuildsys/conf.py

index e5b11915edbbc4407f7afc3f7906307128ec059b..3eec315bd462d5705aa5410f58f03daee5a1b9ba 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)
 
index a0fd40ae7ac949bfc2c40696698d4a9db4e69f6b..08f936a9829086403069eff3ed9789b12708d2f2 100644 (file)
@@ -67,7 +67,7 @@ class BrainConfigParser(SafeConfigParser):
 
         return SafeConfigParser._read(self, fptr, fname)
 
-    def _set_into_file(self, section, option, value, replace_opt=None):
+    def _set_into_file(self, section, option, value, replace_opt=None, comment=None):
         """Set the value in the file contents
 
         Parsing logic and lot of the code was copied directly from the
@@ -76,8 +76,13 @@ class BrainConfigParser(SafeConfigParser):
         cursect = None                        # None, or a str
         optname = None
         new_line = '%s = %s\n' % (option, value)
+        new_lineno = None
         new_line_written = False
         last_section_line = None
+        # add line break for comment
+        if comment is not None:
+            if not comment.endswith('\n'):
+                comment += '\n'
 
         lineno = -1
         for lineno in range(len(self._flines)):
@@ -118,6 +123,7 @@ class BrainConfigParser(SafeConfigParser):
                            (optname == option or optname == replace_opt):
                             if not new_line_written:
                                 self._flines[lineno] = new_line
+                                new_lineno = lineno
                                 new_line_written = True
                             else:
                                 # Just remove all matching lines, if we've
@@ -132,14 +138,25 @@ class BrainConfigParser(SafeConfigParser):
         # Insert new key
         if not new_line_written:
             if last_section_line is not None:
-                self._flines.insert(last_section_line + 1, new_line)
+                if comment is not None:
+                    self._flines.insert(last_section_line + 1, comment)
+                    self._flines.insert(last_section_line + 2, new_line)
+                else:
+                    self._flines.insert(last_section_line + 1, new_line)
             else:
                 if lineno >= 0:
                     self._flines.insert(lineno + 1, '\n')
                 self._flines.insert(lineno + 2, '[%s]\n' % section)
-                self._flines.insert(lineno + 3, new_line)
+                if comment is not None:
+                    self._flines.insert(lineno + 3, comment)
+                    self._flines.insert(lineno + 4, new_line)
+                else:
+                    self._flines.insert(lineno + 3, new_line)
+        else:
+            if comment is not None and new_lineno is not None:
+                self._flines.insert(new_lineno, comment)
 
-    def set_into_file(self, section, option, value, replace_opt=None):
+    def set_into_file(self, section, option, value, replace_opt=None, comment=None):
         """When set new value, need to update the readin file lines,
         which can be saved back to file later.
         """
@@ -151,7 +168,7 @@ class BrainConfigParser(SafeConfigParser):
 
         # If the code reach here, it means the section and key are ok
         try:
-            self._set_into_file(section, option, value, replace_opt)
+            self._set_into_file(section, option, value, replace_opt, comment)
         except Exception as err:
             # This really shouldn't happen, we've already once parsed the file
             # contents successfully.
@@ -196,36 +213,33 @@ profile = profile.tizen
 #user =
 #CAUTION: please use the key name "passwd" to reset plaintext password
 #passwd =
-obs = obs.tizen
 #Comma separated list of repositories
-repos = repo.tizen_latest
-#repos = repo.tizen_main, repo.tizen_base
+repos = repo.tizen_base, repo.tizen_unified
 #Build config for gbs build
+#Specify build conf for a specific profile by using shell-style variable references
 #buildconf = <patch/to/build-config-file>
 #Comma separated list of additional packages be excluded building
 #exclude_packages = libtool,gettext
 
 
-[obs.tizen]
-#OBS API URL pointing to a remote OBS.
-url = https://api.tizen.org
-#Optional user and password, set if differ from profile's user and password
-#user =
-#passwd =
-
 #Repo section example
-[repo.tizen_latest]
-#Build against repo's URL
-url = http://download.tizen.org/releases/daily/trunk/ivi/latest/
-#Optional user and password, set if differ from profile's user and password
+[repo.tizen_base]
+#Stable release version of tizen base repo
+url = http://download.tizen.org/releases/milestone/TIZEN/Tizen/Tizen-Base/latest/repos/standard/packages/
+#Latest snapshots version of tizen base repo
+#url = http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base/latest/repos/standard/packages/
 #user =
 #passwd =
 
-#Individual repo is also supported
-#[repo.tizen_base]
-#url = http://download.tizen.org/releases/daily/trunk/ivi/latest/repos/base/ia32/packages/
-#[repo.tizen_main]
-#url = http://download.tizen.org/releases/daily/trunk/ivi/latest/repos/ivi/ia32/packages/
+[repo.tizen_unified]
+#Stable release version of tizen unified repo
+url = http://download.tizen.org/releases/milestone/TIZEN/Tizen/Tizen-Unified/latest/repos/standard/packages/
+#Latest snapshots version of tizen unified repo
+#url = http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified/latest/repos/standard/packages/
+
+[repo.my_local]
+#local repo must be an absolute path
+#url = <Full_Path_of_Local_Repository>
 '''
 
     # make the manager class as singleton
@@ -347,7 +361,7 @@ url = http://download.tizen.org/releases/daily/trunk/ivi/latest/
     def _check_passwd(self):
         'convert passwd item to passwdx and then update origin conf files'
         dirty = set()
-
+        comment = "# WARNING: passwordx can be decoded, don't expose gbs.conf to the outside"
         all_sections = set()
         for layer in self._cfgparsers:
             for sec in layer.sections():