From 1f09bf6b44f6bde07db993604686059990dab841 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 3 Oct 2008 16:58:09 +0000 Subject: [PATCH] Merged from trunk -r11602:11613 | 11603 | Generate an eqawarn message if econf is called from | | zmedico | src_compile and src_configure is also defined. Thanks to | | | Betelgeuse for the patch which I've modified to be silent in | | | EAPI 0 or 1 in case ebuilds want to define src_configure in | | | those EAPIs and call it manually from src_compile. | | 11604 | Bug #239272 - Handle InvalidAtom exception inside | | zmedico | depgraph.validate_blockers(). | | 11605 | When parsing PORTAGE_ELOG_SYSTEM, stack values in a dict so | | zmedico | that things like "echo:info echo:qa" stack like one might | | | expect. Thanks to Betelgeuse for reporting. | | 11606 | Call elog_process before calling the "clean" phase for | | zmedico | --buildpkgonly mode. | | 11607 | Fix broken logic in Scheduler._main_loop() which would allow | | zmedico | the main loop to exit while one or more merges are still | | | scheduled. Thanks to Patrick Lauer for reporting. | | 11608 | Optimize display_preserved_libs() by using a single | | zmedico | getFileOwnerMap() to look up all the files. | | 11609 | In JobStatusDisplay._update(), set _displayed = True when | | zmedico | ruturning early due to stdout not being a tty. This fixes a | | | problem excess output which was reported by Daniel Robbins. | | 11610 | Implement a new "changelog.ebuildadded" check which causes | | zmedico | repoman to bail out if an ebuild has been added and the | | | ChangeLog has not been modified. This was requested by Robin | | | H Johnson since it is a requirement for the | | | packages.gentoo.org ChangeLog code. | | 11611 | Remove pointless copying of the owners dict inside | | zmedico | display_preserved_libs(). | | 11613 | Fix `svn status` output parsing for compatibility with | | zmedico | subversion-1.6. Thanks to Arfrever for this patch. | svn path=/main/branches/prefix/; revision=11616 --- bin/ebuild.sh | 4 +++ bin/repoman | 57 ++++++++++++++++++++++++++---------- man/repoman.1 | 3 ++ pym/_emerge/__init__.py | 36 ++++++++++++++++++----- pym/portage/elog/__init__.py | 20 +++++++++---- 5 files changed, 91 insertions(+), 29 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index f039b1d8a..77603e61d 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -436,6 +436,10 @@ econf() { local x local LOCAL_EXTRA_ECONF="${EXTRA_ECONF}" + ! hasq "$EAPI" 0 1 && [[ $EBUILD_PHASE = compile && \ + $(type -t src_configure) = function ]] && \ + eqawarn "econf called in src_compile instead of src_configure" + if [ -z "${ECONF_SOURCE}" ]; then ECONF_SOURCE="." fi diff --git a/bin/repoman b/bin/repoman index a567a2455..aed13254e 100755 --- a/bin/repoman +++ b/bin/repoman @@ -22,7 +22,7 @@ import tempfile import time import platform -from itertools import izip +from itertools import chain, izip from stat import S_ISDIR, ST_CTIME try: @@ -249,6 +249,7 @@ qahelp={ "desktop.invalid":"desktop-file-validate reports errors in a *.desktop file", "ebuild.invalidname":"Ebuild files with a non-parseable or syntactically incorrect name (or using 2.1 versioning extensions)", "ebuild.namenomatch":"Ebuild files that do not have the same name as their parent directory", + "changelog.ebuildadded":"An ebuild was added but the ChangeLog was not modified", "changelog.missing":"Missing ChangeLog files", "ebuild.notadded":"Ebuilds that exist but have not been added to cvs", "ebuild.patches":"PATCHES variable should be a bash array to ensure white space safety", @@ -743,11 +744,21 @@ else: print green("\nRepoMan scours the neighborhood...") new_ebuilds = set() +modified_changelogs = set() if vcs == "cvs": mycvstree = cvstree.getentries("./", recursive=1) + mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./") mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./") + +if vcs == "svn": + svnstatus = os.popen("svn status").readlines() + mychanged = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem and elem[:1] in "MR" ] + mynew = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem.startswith("A") ] + +if vcs: new_ebuilds.update(x for x in mynew if x.endswith(".ebuild")) - del mycvstree, mynew + modified_changelogs.update(x for x in chain(mychanged, mynew) \ + if os.path.basename(x) == "ChangeLog") have_masked = False dofail = 0 @@ -1026,11 +1037,29 @@ for x in scanlist: del metadata_bad + changelog_path = "ChangeLog" + if repolevel < 3: + changelog_path = os.path.join(pkgdir, changelog_path) + if repolevel < 2: + changelog_path = os.path.join(catdir, changelog_path) + changelog_path = os.path.join(".", changelog_path) + changelog_modified = changelog_path in modified_changelogs + allmasked = True for y in ebuildlist: relative_path = os.path.join(x, y + ".ebuild") full_path = os.path.join(repodir, relative_path) + ebuild_path = y + ".ebuild" + if repolevel < 3: + ebuild_path = os.path.join(pkgdir, ebuild_path) + if repolevel < 2: + ebuild_path = os.path.join(catdir, ebuild_path) + ebuild_path = os.path.join(".", ebuild_path) + if not changelog_modified and ebuild_path in new_ebuilds: + stats['changelog.ebuildadded'] += 1 + fails['changelog.ebuildadded'].append(relative_path) + if stat.S_IMODE(os.stat(full_path).st_mode) & 0111: stats["file.executable"] += 1 fails["file.executable"].append(x+"/"+y+".ebuild") @@ -1119,12 +1148,6 @@ for x in scanlist: not keyword.startswith("-"): stable_keywords.append(keyword) if stable_keywords: - ebuild_path = y + ".ebuild" - if repolevel < 3: - ebuild_path = os.path.join(pkgdir, ebuild_path) - if repolevel < 2: - ebuild_path = os.path.join(catdir, ebuild_path) - ebuild_path = os.path.join(".", ebuild_path) if ebuild_path in new_ebuilds: stable_keywords.sort() stats["KEYWORDS.stable"] += 1 @@ -1674,9 +1697,10 @@ else: sys.exit(1) if vcs == "cvs": - mycvstree=portage.cvstree.getentries("./",recursive=1) - mychanged=portage.cvstree.findchanged(mycvstree,recursive=1,basedir="./") - mynew=portage.cvstree.findnew(mycvstree,recursive=1,basedir="./") + if myautoadd: + mycvstree = cvstree.getentries("./", recursive=1) + mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir="./") + mynew = cvstree.findnew(mycvstree, recursive=1, basedir="./") myremoved=portage.cvstree.findremoved(mycvstree,recursive=1,basedir="./") bin_blob_pattern = re.compile("^-kb$") no_expansion = set(portage.cvstree.findoption(mycvstree, bin_blob_pattern, @@ -1684,10 +1708,11 @@ else: if vcs == "svn": - svnstatus = os.popen("svn status").readlines() - mychanged = [ elem.rstrip()[7:] for elem in svnstatus if elem and elem[:1] in "MR" ] - mynew = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("A") ] - myremoved = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("D") ] + if myautoadd: + svnstatus = os.popen("svn status").readlines() + mychanged = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem and elem[:1] in "MR" ] + mynew = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem.startswith("A") ] + myremoved = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem.startswith("D") ] # in contrast to CVS, SVN expands nothing by default. # bin_blobs historically # were just there to see what files need to be checked for @@ -1699,7 +1724,7 @@ else: # 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] \ + expansion = set("./" + prop.split(" - ")[0] \ for prop in props if " - " in prop) if vcs: diff --git a/man/repoman.1 b/man/repoman.1 index befd96b92..dc9cb30e2 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -183,6 +183,9 @@ Ebuilds that have a missing or empty SLOT variable .B SRC_URI.mirror A uri listed in profiles/thirdpartymirrors is found in SRC_URI .TP +.B changelog.ebuildadded +An ebuild was added but the ChangeLog was not modified +.TP .B changelog.missing Missing ChangeLog files .TP diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index a4416cbd9..9c24d8838 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2565,6 +2565,7 @@ class EbuildBuild(CompositeTask): if self._default_exit(packager) == os.EX_OK and \ self.opts.buildpkgonly: # Need to call "clean" phase for buildpkgonly mode + portage.elog.elog_process(self.pkg.cpv, self.settings) phase = "clean" clean_phase = EbuildPhase(background=self.background, pkg=self.pkg, phase=phase, @@ -5921,10 +5922,16 @@ class depgraph(object): blocker_cache[cpv] = \ blocker_cache.BlockerData(counter, blocker_atoms) if blocker_atoms: - for myatom in blocker_atoms: - blocker = Blocker(atom=portage.dep.Atom(myatom), - eapi=pkg.metadata["EAPI"], root=myroot) - self._blocker_parents.add(blocker, pkg) + try: + for atom in blocker_atoms: + blocker = Blocker(atom=portage.dep.Atom(atom), + eapi=pkg.metadata["EAPI"], root=myroot) + self._blocker_parents.add(blocker, pkg) + except portage.exception.InvalidAtom, e: + depstr = " ".join(vardb.aux_get(pkg.cpv, dep_keys)) + show_invalid_depstring_notice( + pkg, depstr, "Invalid Atom: %s" % (e,)) + return False for cpv in stale_cache: del blocker_cache[cpv] blocker_cache.flush() @@ -8750,6 +8757,7 @@ class JobStatusDisplay(object): out = self.out if not self._isatty: out.write(self._format_msg(msg) + self._term_codes['newline']) + self._displayed = True return if self._displayed: @@ -9892,7 +9900,7 @@ class Scheduler(PollScheduler): while True: self._schedule() - if not self._jobs or merge_queue: + if not (self._jobs or merge_queue): break if self._poll_event_handlers: self._poll_loop() @@ -10942,13 +10950,25 @@ def display_preserved_libs(vardbapi): print colorize("WARN", "!!!") + " existing preserved libs:" plibdata = vardbapi.plib_registry.getPreservedLibs() linkmap = vardbapi.linkmap + + consumer_map = {} + search_for_owners = set() for cpv in plibdata: - print colorize("WARN", ">>>") + " package: %s" % cpv for f in plibdata[cpv]: - print colorize("WARN", " * ") + " - %s" % f + if f in consumer_map: + continue consumers = list(linkmap.findConsumers(f)) consumers.sort() - owners = vardbapi._owners.getFileOwnerMap(consumers[:MAX_DISPLAY+2]) + consumer_map[f] = consumers + search_for_owners.update(consumers[:MAX_DISPLAY+1]) + + owners = vardbapi._owners.getFileOwnerMap(search_for_owners) + + for cpv in plibdata: + print colorize("WARN", ">>>") + " package: %s" % cpv + for f in plibdata[cpv]: + print colorize("WARN", " * ") + " - %s" % f + consumers = consumer_map[f] for c in consumers[:MAX_DISPLAY]: print colorize("WARN", " * ") + " used by %s (%s)" % (c, ", ".join([x.mycpv for x in owners[c]])) if len(consumers) == MAX_DISPLAY + 1: diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index 8c81e260b..b24c9d9dd 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -91,6 +91,19 @@ def elog_process(cpv, mysettings, phasefilter=None): all_logentries[key], _preserve_logentries[key] = phasefilter(all_logentries[key]) my_elog_classes = set(mysettings.get("PORTAGE_ELOG_CLASSES", "").split()) + logsystems = {} + for token in mysettings.get("PORTAGE_ELOG_SYSTEM", "").split(): + if ":" in token: + s, levels = token.split(":", 1) + levels = levels.split(",") + else: + s = token + levels = () + levels_set = logsystems.get(s) + if levels_set is None: + levels_set = set() + logsystems[s] = levels_set + levels_set.update(levels) for key in all_logentries: default_logentries = filter_loglevels(all_logentries[key], my_elog_classes) @@ -106,12 +119,9 @@ def elog_process(cpv, mysettings, phasefilter=None): default_logentries, default_fulllog) # pass the processing to the individual modules - logsystems = mysettings["PORTAGE_ELOG_SYSTEM"].split() - for s in logsystems: + for s, levels in logsystems.iteritems(): # allow per module overrides of PORTAGE_ELOG_CLASSES - if ":" in s: - s, levels = s.split(":", 1) - levels = levels.split(",") + if levels: mod_logentries = filter_loglevels(all_logentries[key], levels) mod_fulllog = _combine_logentries(mod_logentries) else: -- 2.26.2