commit:     ff639628515f63af8ca3fc70e519556722f34478
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Aug  9 17:25:00 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Aug  9 17:25:00 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=ff639628

bin/grsup: copy in the make.conf from remote git repo.

 bin/grsup | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/bin/grsup b/bin/grsup
index 0e05dbf..30e43bf 100755
--- a/bin/grsup
+++ b/bin/grsup
@@ -205,6 +205,24 @@ def main():
     newconf = '%s/core%s' % (libdir, CONST.WORLD_CONFIG)
     shutil.copy(newconf, CONST.WORLD_CONFIG)
 
+    # Copy the new make.conf to CONST.PORTAGE_CONFIGDIR
+    # If a raw new make.conf exists, pick it, else pick the highest cycle no.
+    newmakeconf = os.path.join(libdir, 'core/etc/portage/make.conf')
+    if os.path.isfile(newmakeconf):
+        shutil.copy(newmakeconf, CONST.PORTAGE_CONFIGDIR)
+    else:
+        cycled_files = {}
+        for f in glob.glob('%s.*' % newmakeconf):
+            m = re.search('^(.+)\.CYCLE\.(\d+)', f)
+            if m:
+                cycle_no = int(m.group(2))
+                cycled_files[cycle_no] = m.group(0)
+        try:
+            max_cycle_no = max(cycled_files)
+            shutil.copy(cycled_files[max_cycle_no], CONST.PORTAGE_CONFIGDIR)
+        except ValueError:
+            pass
+
     if os.path.isfile(CONST.PORTAGE_DIRTYFILE):
         WorldConf.clean()
     open(CONST.PORTAGE_DIRTYFILE, 'a').close()

Reply via email to