diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-08-01 01:44:10 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-08-01 01:44:10 +0000 |
commit | 3030215a88791d9327b355cac28056eeb25f8177 (patch) | |
tree | 15aa374429500347efe6813e3ba76e421a8cb771 | |
parent | af68d7d489e1e6a65e4262ef67fdd14f061cdcff (diff) | |
download | portage-3030215a88791d9327b355cac28056eeb25f8177.tar.gz portage-3030215a88791d9327b355cac28056eeb25f8177.tar.bz2 portage-3030215a88791d9327b355cac28056eeb25f8177.zip |
Bug #229033 - Use `svn propget -R svn:keywords` to detect which will have
changed headers that require an additional manifest commit. Thanks to
Fabian Groffen for this patch which I've made some modifications to:
* For clarity, use separate "no_expansion" variable for cvs bin blobs.
* Fix svn keyword parsing to properly handle multiple keywords delimited
by newlines.
svn path=/main/trunk/; revision=11304
-rwxr-xr-x | bin/repoman | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/bin/repoman b/bin/repoman index 9b2423574..03ef5635c 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1747,19 +1747,28 @@ else: mynew=portage.cvstree.findnew(mycvstree,recursive=1,basedir="./") myremoved=portage.cvstree.findremoved(mycvstree,recursive=1,basedir="./") bin_blob_pattern = re.compile("^-kb$") - bin_blobs = set(portage.cvstree.findoption(mycvstree, bin_blob_pattern, + no_expansion = set(portage.cvstree.findoption(mycvstree, bin_blob_pattern, recursive=1, basedir="./")) if vcs == "svn": svnstatus = os.popen("svn status").readlines() mychanged = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("M") ] - for manifest in [ file for file in mychanged if '/Manifest' in file ]: - mychanged.remove(manifest) - mynew = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("A") ] + mynew = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("A") ] myremoved = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("D") ] - # no idea how to detect binaries in SVN - bin_blobs = [] + # in contrast to CVS, SVN expands nothing by default. + # bin_blobs historically + # were just there to see what files need to be checked for + # keyword expansion, which is exactly what we do here, so + # slightly change the semantic meaning of "bin_blob"... In the + # future we could store which keyword is expanded. + props = os.popen("svn propget -R svn:keywords").readlines() + + # For files with multiple props set, props are delimited by newlines, + # so exclude lines that don't contain " - " since each of those lines + # only a contain props for a file listed on a previous line. + expansion = set(prop.split(" - ")[0] \ + for prop in props if " - " in prop) if vcs: if not (mychanged or mynew or myremoved): @@ -1779,8 +1788,17 @@ else: headerstring = "'\$(Header|Id)" headerstring += ".*\$'" for myfile in myupdates: - if myfile in bin_blobs: - continue + + # for CVS, no_expansion contains files that are excluded from expansion + if vcs == "cvs": + if myfile in no_expansion: + continue + + # for SVN, expansion contains files that are included in expansion + elif vcs == "svn": + if myfile not in expansion: + continue + myout = commands.getstatusoutput("egrep -q "+headerstring+" "+myfile) if myout[0] == 0: myheaders.append(myfile) @@ -1835,6 +1853,8 @@ else: if myupdates or myremoved: myfiles = myupdates + myremoved + if not myheaders and "sign" not in repoman_settings.features: + myfiles += mymanifests fd, commitmessagefile = tempfile.mkstemp(".repoman.msg") mymsg = os.fdopen(fd, "w") mymsg.write(commitmessage) @@ -1921,8 +1941,8 @@ else: write_atomic(x, "".join(mylines)) manifest_commit_required = True - if myheaders or myupdates or myremoved or mynew: - myfiles=myheaders+myupdates+myremoved+mynew + if myupdates or myremoved or mynew: + myfiles=myupdates+myremoved+mynew for x in range(len(myfiles)-1, -1, -1): if myfiles[x].count("/") < 4-repolevel: del myfiles[x] |