[library-web] handle latest stable version being master



commit 61e95961c777a5520985a25154d2ea0a30a36ca8
Author: Frédéric Péters <fpeters 0d be>
Date:   Tue Jan 28 13:08:53 2014 +0000

    handle latest stable version being master
    
    And other somehow related changes :/

 src/lgo.py           |   16 ++++++++++++----
 src/modtypes/base.py |    4 +++-
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/lgo.py b/src/lgo.py
index d2155cb..129a3dc 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -132,6 +132,8 @@ class FtpDotGnomeDotOrg:
 class Lgo(App):
     '''Main Application Class'''
 
+    latest_stable_release = None
+
     def run(self):
         self.ftp_gnome_org = FtpDotGnomeDotOrg(self.config)
         self.overlay = Overlay(os.path.join(data_dir, 'overlay.xml'))
@@ -240,6 +242,8 @@ class Lgo(App):
                         not r == self.config.version_max:
                     logging.debug('skipping release %s, not the last in serie' % r)
                     continue
+            else:
+                self.latest_stable_release = r
 
             handled_releases.append(r)
 
@@ -304,11 +308,15 @@ class Lgo(App):
                 'refs/heads/%s' % branch_name], cwd=module_git_clone_dir)
             subp.wait()
             if subp.returncode != 0:
-                logging.debug('branch do not exist, skipping')
-                return
+                if self.latest_stable_release and fake_version_number.startswith(self.latest_stable_release):
+                    subprocess.Popen(['git', 'checkout', 'master'],
+                            cwd=module_git_clone_dir).wait()
+                else:
+                    logging.debug('branch do not exist, skipping')
+                    return
             filename = '%s-%s.tar.gz' % (module_name, fake_version_number)
-            subprocess.Popen(['tar', 'czf', filename, module_name],
-                    cwd=base_git_dir).wait()
+            subprocess.Popen(['tar', 'czhf', filename, module_name + '/',
+                    '--exclude=.git'], cwd=base_git_dir).wait()
             return os.path.join(base_git_dir, filename)
         elif url.startswith('gnome://'):
             # special schema for modules on ftp.gnome.org; URL scheme is
diff --git a/src/modtypes/base.py b/src/modtypes/base.py
index 411602a..ca337eb 100644
--- a/src/modtypes/base.py
+++ b/src/modtypes/base.py
@@ -39,6 +39,7 @@ class DocModule(object):
     channel = None
     nightly = False
     extra_devel_releases = None
+    git_version = False
 
     def create_from_tar(cls, tar, tarinfo, makefile_am, nightly = False):
         self = cls()
@@ -72,6 +73,7 @@ class DocModule(object):
             self.version = self.version[:-4]
         if self.version.endswith('.999'):
             self.version = self.version[:-4]
+            self.git_version = True
 
         if nightly or self.version == 'nightly':
             self.nightly = True
@@ -134,7 +136,7 @@ class DocModule(object):
             doc.versions = [self.one_dot_version]
             app.documents.append(doc)
         else:
-            if doc._last_version == self.version:
+            if doc._last_version == self.version and not self.git_version:
                 # file was already processed in a previous moduleset
                 return None
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]