removed extra print statement
[build.git] / module-tools.py
index 10ce428..6a2b77c 100755 (executable)
@@ -643,7 +643,6 @@ that for other purposes than tagging""" % options.workdir
 
         elif self.repository.type == "git":
             if hasattr(self,'branch'):
-                print "to branch", self.branch
                 self.repository.to_branch(self.branch)
             elif hasattr(self,'tagname'):
                 self.repository.to_tag(self.tagname)
@@ -1249,8 +1248,17 @@ def modules_diff(first, second):
 
     return diff, new_modules, removed_modules
 
-def release_changelog(options, buildtag_old, buildtag_new, tagfile):
+def release_changelog(options, buildtag_old, buildtag_new):
+
+    tagfile = options.distrotags[0]
+    if not tagfile:
+        print "ERROR: provide a tagfile name (eg. onelab, onelab-k27, planetlab)"
+        return
+    tagfile = "%s-tags.mk" % tagfile
     
+    print '----'
+    print '----'
+    print '----'
     print '= build tag %s to %s =' % (buildtag_old, buildtag_new)
     print '== distro %s (%s to %s) ==' % (tagfile, buildtag_old, buildtag_new)
 
@@ -1258,42 +1266,49 @@ def release_changelog(options, buildtag_old, buildtag_new, tagfile):
     build.init_module_dir()
     first = build.get_modules(tagfile)
 
-    print '* from', buildtag_old, build.repository.gitweb()
+    print ' * from', buildtag_old, build.repository.gitweb()
 
     build = Build("build@%s" % buildtag_new, options)
     build.init_module_dir()
     second = build.get_modules(tagfile)
 
-    print '* to', buildtag_new, build.repository.gitweb()
+    print ' * to', buildtag_new, build.repository.gitweb()
 
     diff, new_modules, removed_modules = modules_diff(first, second)
 
-    for module in diff:
 
+    def get_module(name, tag):
+        if not tag or  tag == "trunk":
+            return Module("%s" % (module), options)
+        else:
+            return Module("%s@%s" % (module, tag), options)
+
+
+    for module in diff:
         print '=== %s - %s to %s : package %s ===' % (tagfile, buildtag_old, buildtag_new, module)
 
         first, second = diff[module]
-        m = Module("%s@%s" % (module, first), options)
-        os.system('rm -rf %s' % m.module_dir)
+        m = get_module(module, first)
+        os.system('rm -rf %s' % m.module_dir) # cleanup module dir
         m.init_module_dir()
 
         if m.repository.type == "svn":
-            print '* from', first, m.repository.url()
+            print ' * from', first, m.repository.url()
         else:
-            print '* from', first, m.repository.gitweb()
+            print ' * from', first, m.repository.gitweb()
 
         specfile = m.main_specname()
         (tmpfd, tmpfile) = tempfile.mkstemp()
         os.system("cp -f /%s %s" % (specfile, tmpfile))
         
-        m = Module("%s@%s" % (module, second), options)
+        m = get_module(module, second)
         m.init_module_dir()
         specfile = m.main_specname()
 
         if m.repository.type == "svn":
-            print '* to', second, m.repository.url()
+            print ' * to', second, m.repository.url()
         else:
-            print '* to', second, m.repository.gitweb()
+            print ' * to', second, m.repository.gitweb()
 
         print '{{{'
         os.system("diff -u %s %s" % (tmpfile, specfile))