[library-web] pack git modules with a renamed parent directory



commit 3637359d93d732a148c37368a8e173edf3f1df21
Author: Frédéric Péters <fpeters 0d be>
Date:   Wed Jan 29 20:41:37 2014 +0000

    pack git modules with a renamed parent directory

 src/lgo.py |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/lgo.py b/src/lgo.py
index 67e4229..a9a69c8 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -338,15 +338,20 @@ class Lgo(App):
 
             file(hash_filename, 'w').write(new_hash)
 
-            filename = '%s-%s.tar.gz' % (module_name, fake_version_number)
+            base_filename = '%s-%s' % (module_name, fake_version_number)
+            filename = '%s.tar.gz' % base_filename
             filepath = os.path.join(base_git_dir, filename)
 
             if new_hash != old_hash and os.path.exists(filepath):
                 os.unlink(filepath)
 
             if not os.path.exists(filepath):
-                subprocess.Popen(['tar', 'czhf', filename, module_name + '/',
+                os.rename(os.path.join(base_git_dir, module_name),
+                        os.path.join(base_git_dir, base_filename))
+                subprocess.Popen(['tar', 'czhf', filename, base_filename + '/',
                         '--exclude=.git'], cwd=base_git_dir).wait()
+                os.rename(os.path.join(base_git_dir, base_filename),
+                        os.path.join(base_git_dir, module_name))
             return filepath
         elif url.startswith('gnome://'):
             # special schema for modules on ftp.gnome.org; URL scheme is
@@ -630,8 +635,6 @@ class Lgo(App):
 
         if self.config.fast_mode:
             ext_dirname = os.path.join(app.config.private_dir, 'extracts', tarball_name)
-            if ext_dirname.endswith('.999'): # git snapshot
-                ext_dirname = os.path.join(app.config.private_dir, 'extracts', base_tarball_name)
             stamp_file = ext_dirname + '.extract-stamp'
         else:
             stamp_file = None
@@ -649,7 +652,7 @@ class Lgo(App):
                 logging.debug('removing old copy of files from %s' % base_tarball_name)
                 shutil.rmtree(ext_dirname, ignore_errors = True)
             tar = tarfile.open(filename, 'r')
-        elif stamp_file and os.path.exists(stamp_file) and not tarball_name.endswith('.999'):
+        elif stamp_file and os.path.exists(stamp_file):
             tar = utils.FakeTarFile(ext_dirname)
         else:
             tar = tarfile.open(filename, 'r')


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