X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=module-tools.py;h=a1b628dce1320108573f197d71a209b3ffa20e72;hb=5c7d10fa224c309e742ea6b0411a755124ba48bc;hp=3ddfb6da9b485813a5afeb94c915541e3cbbfeca;hpb=6c6d41616d2c57a6d7157100d895a6dcffd15f78;p=build.git diff --git a/module-tools.py b/module-tools.py index 3ddfb6da..a1b628dc 100755 --- a/module-tools.py +++ b/module-tools.py @@ -446,7 +446,7 @@ class Module: # for parsing module spec name:branch matcher_branch_spec=re.compile("\A(?P[\w\.-]+):(?P[\w\.-]+)\Z") # special form for tagged module - for Build - matcher_tag_spec=re.compile("\A(?P[\w-]+)@(?P[\w\.-]+)\Z") + matcher_tag_spec=re.compile("\A(?P[\w\.-]+)@(?P[\w\.-]+)\Z") # parsing specfiles matcher_rpm_define=re.compile("%(define|global)\s+(\S+)\s+(\S*)\s*") @@ -1204,7 +1204,8 @@ class Build(Module): try: name, url = line.split(':=') name, git_or_svn_path = name.rsplit('-', 1) - modules[name.strip()] = (git_or_svn_path.strip(), url.strip()) + name = svn_to_git_name(name.strip()) + modules[name] = (git_or_svn_path.strip(), url.strip()) except: pass return modules @@ -1248,8 +1249,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) @@ -1257,36 +1267,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() - print '* from', first, m.repository.gitweb() + if m.repository.type == "svn": + print ' * from', first, m.repository.url() + else: + 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() - print '* to', second, m.repository.gitweb() + if m.repository.type == "svn": + print ' * to', second, m.repository.url() + else: + print ' * to', second, m.repository.gitweb() print '{{{' os.system("diff -u %s %s" % (tmpfile, specfile))