X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=module-tools.py;h=d8f7d3ab67eb6887a84d899b9d6c76aa6c2b283a;hb=80759a73171ef9421cd1e5e44f1b83234ae4d339;hp=37ed75147608c160a6ec05ac0f41d7b5e757eaf6;hpb=6169214866ebd076176f61ea834b5d074bc3157f;p=build.git diff --git a/module-tools.py b/module-tools.py index 37ed7514..d8f7d3ab 100755 --- a/module-tools.py +++ b/module-tools.py @@ -269,7 +269,7 @@ class Module: @staticmethod def html_dump_header(title): nowdate=time.strftime("%Y-%m-%d") - nowtime=time.strftime("%H:%M") + nowtime=time.strftime("%H:%M (%Z)") print """ @@ -986,7 +986,7 @@ will be based on latest tag %s and *not* on the current trunk"""%(self.name,bran # create commit log file tmp="/tmp/branching-%d"%os.getpid() f=open(tmp,"w") - f.write("Branch %s for module %s created (as new trunk) from tag %s\n"%(new_trunk_name,self.name,latest_tag_name)) + f.write("Branch %s for module %s created (as new trunk) from tag %s\n"%(branch_name,self.name,latest_tag_name)) f.close() # review the renumbering changes in trunk @@ -1011,13 +1011,19 @@ Please make sure you mention as appropriate ############################## class Package: - def __init__(self, package, module, svnpath, spec): + def __init__(self, package, module, svnpath, spec,options): self.package=package self.module=module - self.svnpath=svnpath + self.svnrev = None + self.svnpath=svnpath + if svnpath.rfind('@') > 0: + self.svnpath, self.svnrev = svnpath.split('@') self.spec=spec - self.specpath="%s/%s"%(svnpath,spec) + self.specpath="%s/%s"%(self.svnpath,self.spec) + if self.svnrev: + self.specpath += "@%s" % self.svnrev self.basename=os.path.basename(svnpath) + self.options=options # returns a http URL to the trac path where full diff can be viewed (between self and pkg) # typically http://svn.planet-lab.org/changeset?old_path=Monitor%2Ftags%2FMonitor-1.0-7&new_path=Monitor%2Ftags%2FMonitor-1.0-13 @@ -1033,6 +1039,12 @@ class Package: return "%s://%s/changeset?old_path=%s&new_path=%s"%(method,hostname,self_path,pkg_path) else: return None + + def inline_full_diff (self, pkg): + print '{{{' + command='svn diff %s %s'%(self.svnpath,pkg.svnpath) + Command(command,self.options).run() + print '}}}' def details (self): return "[%s %s] [%s (spec)]"%(self.svnpath,self.basename,self.specpath) @@ -1041,10 +1053,14 @@ class Build (Module): # we cannot get build's svnpath as for other packages as we'd get something in svn+ssh # xxx quick & dirty - def __init__ (self, buildtag,options): + def __init__ (self, buildtag, options): self.buildtag=buildtag + if buildtag == "trunk": + module_name="build" + self.display="trunk" + self.svnpath="http://svn.planet-lab.org/svn/build/trunk" # if the buildtag start with a : (to use a branch rather than a tag) - if buildtag.find(':') == 0 : + elif buildtag.find(':') == 0 : module_name="build%(buildtag)s"%locals() self.display=buildtag[1:] self.svnpath="http://svn.planet-lab.org/svn/build/branches/%s"%self.display @@ -1071,6 +1087,9 @@ class Build (Module): make_options="--no-print-directory -C %s stage1=true PLDISTRO=%s PLDISTROTAGS=%s 2> /dev/null"%(self.edge_dir(),distro,distrotag) command="make %s packages"%make_options make_packages=Command(command,self.options).output_of() + if self.options.verbose: + print 'obtaining packages information with command:' + print command pkg_line=re.compile("\Apackage=(?P[^\s]+)\s+ref_module=(?P[^\s]+)\s.*\Z") for line in make_packages.split("\n"): if not line: @@ -1089,7 +1108,7 @@ class Build (Module): svnpath=Command(command,self.options).output_of().strip() command="make %s +%s-SPEC"%(make_options,package) spec=Command(command,self.options).output_of().strip() - result[package]=Package(package,module,svnpath,spec) + result[module]=Package(package,module,svnpath,spec,self.options) return result def get_distrotags (self): @@ -1155,20 +1174,32 @@ class Release: # parse make packages packages_new=build_new.get_packages(distrotag) pnames_new=set(packages_new.keys()) - if options.verbose: print 'got packages for ',build_new.display packages_old=build_old.get_packages(distrotag) pnames_old=set(packages_old.keys()) - if options.verbose: print 'got packages for ',build_old.display - # get created, deprecated, and preserved package names + # get names of created, deprecated, and preserved modules pnames_created = list(pnames_new-pnames_old) - pnames_created.sort() pnames_deprecated = list(pnames_old-pnames_new) - pnames_deprecated.sort() pnames = list(pnames_new.intersection(pnames_old)) + + pnames_created.sort() + pnames_deprecated.sort() pnames.sort() - if options.verbose: print "Found new/deprecated/preserved pnames",pnames_new,pnames_deprecated,pnames + if options.verbose: + print '--------------------' + print 'got packages for ',build_new.display + print pnames_new + print '--------------------' + print 'got packages for ',build_old.display + print pnames_old + print '--------------------' + print "Found new modules",pnames_created + print '--------------------' + print "Found deprecated modules",pnames_deprecated + print '--------------------' + print "Found preserved modules",pnames + print '--------------------' # display created and deprecated for name in pnames_created: @@ -1203,20 +1234,25 @@ class Release: print '=== %s - %s to %s : package %s === #package-%s-%s-%s'%( distrotag,build_old.display,build_new.display,name,name,distro,build_new.display) print ' * from %s to %s'%(pobj_old.details(),pobj_new.details()) - trac_diff_url=pobj_old.trac_full_diff(pobj_new) - if trac_diff_url: - print ' * [%s View full diff]'%trac_diff_url - print '{{{' - for line in specdiff.split('\n'): - if not line: - continue - if Release.discard_matcher.match(line): - continue - if line[0] in ['@']: - print '----------' - elif line[0] in ['+','-']: - print_fold(line) - print '}}}' + if options.inline_diff: + pobj_old.inline_full_diff(pobj_new) + else: + trac_diff_url=pobj_old.trac_full_diff(pobj_new) + if trac_diff_url: + print ' * [%s View full diff]'%trac_diff_url + else: + print ' * No full diff available' + print '{{{' + for line in specdiff.split('\n'): + if not line: + continue + if Release.discard_matcher.match(line): + continue + if line[0] in ['@']: + print '----------' + elif line[0] in ['+','-']: + print_fold(line) + print '}}}' ############################## class Main: @@ -1242,6 +1278,8 @@ Branches: release-changelog 4.2-rc25 4.2-rc24 4.2-rc23 4.2-rc22 You can refer to a (build) branch by prepending a colon, like in release-changelog :4.2 4.2-rc25 + You can refer to the build trunk by just mentioning 'trunk', e.g. + release-changelog -t coblitz-tags.mk coblitz-2.01-rc6 trunk """ common_usage="""More help: see http://svn.planet-lab.org/wiki/ModuleTools""" @@ -1280,7 +1318,7 @@ Branches: break if not mode: print "Unsupported command",sys.argv[0] - print "Supported commands:" + Modes.modes.keys.join(" ") + print "Supported commands:" + " ".join(Main.modes.keys()) sys.exit(1) if mode not in Main.release_modes: @@ -1336,6 +1374,8 @@ Branches: else: parser.add_option("-n","--dry-run",action="store_true",dest="dry_run",default=False, help="dry run - shell commands are only displayed") + parser.add_option("-i","--inline-diff",action="store_true",dest="inline_diff",default=False, + help="calls svn diff on whole module, not just only the spec file") parser.add_option("-t","--distrotags",action="callback",callback=Main.optparse_list, dest="distrotags", default=[], nargs=1,type="string", help="""specify distro-tags files, e.g. onelab-tags-4.2.mk