From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1REm93-0007UQ-Lb for garchives@archives.gentoo.org; Fri, 14 Oct 2011 18:06:09 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2589521C068; Fri, 14 Oct 2011 18:06:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id DACD921C068 for ; Fri, 14 Oct 2011 18:06:01 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 564D9645F3 for ; Fri, 14 Oct 2011 18:06:01 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 7EBB280042 for ; Fri, 14 Oct 2011 18:06:00 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: man/, bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/repoman man/repoman.1 X-VCS-Directories: man/ bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: f03e9dbd874e6731683c0050d827318bd14360fb Date: Fri, 14 Oct 2011 18:06:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: bc8c7dfa6ef941f9ecb9403d28ca7ddf commit: f03e9dbd874e6731683c0050d827318bd14360fb Author: Zac Medico gentoo org> AuthorDate: Fri Oct 14 17:55:31 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Oct 14 17:55:31 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Df03e9dbd repoman: add --echangelog=3D for bug #337853 This option will call echangelog for each package that has modified files and does not have a modified ChangeLog. Gentoo's council has decided that this option will be enabled by default for the "gentoo" repository. If desired, we can add a metadata/layout.conf setting so that other repositories can control the default behavior. --- bin/repoman | 174 ++++++++++++++++++++++++++++++++++++++-------------= ----- man/repoman.1 | 3 + 2 files changed, 121 insertions(+), 56 deletions(-) diff --git a/bin/repoman b/bin/repoman index 65c1f40..47ae974 100755 --- a/bin/repoman +++ b/bin/repoman @@ -18,6 +18,7 @@ import optparse import re import signal import stat +import subprocess import sys import tempfile import textwrap @@ -195,6 +196,10 @@ def ParseArgs(argv, qahelp): parser.add_option('-q', '--quiet', dest=3D"quiet", action=3D"count", de= fault=3D0, help=3D'do not print unnecessary messages') =20 + parser.add_option( + '--echangelog', type=3D'choice', choices=3D('y', 'n'), metavar=3D"", + help=3D'for commit mode, call echangelog if ChangeLog is unmodified') + parser.add_option('-f', '--force', dest=3D'force', default=3DFalse, act= ion=3D'store_true', help=3D'Commit with QA violations') =20 @@ -539,12 +544,6 @@ else: else: vcs =3D None =20 -# Note: We don't use ChangeLogs in distributed SCMs. -# It will be generated on server side from scm log, -# before package moves to the rsync server. -# This is needed because we try to avoid merge collisions. -check_changelog =3D vcs in ('cvs', 'svn') - # Disable copyright/mtime check if vcs does not preserve mtime (bug #324= 075). vcs_preserves_mtime =3D vcs not in ('git',) =20 @@ -634,6 +633,30 @@ if "commit" =3D=3D options.mode and \ print(prefix + line) sys.exit(1) =20 +if options.echangelog is None and \ + repo_config.name =3D=3D "gentoo": + # Bug #337853 - gentoo's council says to enable + # --echangelog by default for the "gentoo" repo + options.echangelog =3D 'y' + +if vcs is None: + options.echangelog =3D 'n' + +if 'commit' =3D=3D options.mode and \ + options.echangelog =3D=3D 'y' and \ + find_binary('echangelog') is None: + logging.error("echangelog not found, and --echangelog is enabled") + sys.exit(1) + +# The --echangelog option causes automatic ChangeLog generation, +# which invalidates changelog.ebuildadded and changelog.missing +# checks. +# Note: We don't use ChangeLogs in distributed SCMs. +# It will be generated on server side from scm log, +# before package moves to the rsync server. +# This is needed because we try to avoid merge collisions. +check_changelog =3D options.echangelog !=3D 'y' and vcs in ('cvs', 'svn'= ) + # Generate an appropriate PORTDIR_OVERLAY value for passing into the # profile-specific config constructor calls. env =3D os.environ.copy() @@ -2339,6 +2362,95 @@ else: mydirty =3D [] =20 print("* %s files being committed..." % green(str(len(myupdates))), end= =3D' ') + + commitmessage =3D options.commitmsg + if options.commitmsgfile: + try: + f =3D io.open(_unicode_encode(options.commitmsgfile, + encoding=3D_encodings['fs'], errors=3D'strict'), + mode=3D'r', encoding=3D_encodings['content'], errors=3D'replace') + commitmessage =3D f.read() + f.close() + del f + except (IOError, OSError) as e: + if e.errno =3D=3D errno.ENOENT: + portage.writemsg("!!! File Not Found: --commitmsgfile=3D'%s'\n" % op= tions.commitmsgfile) + else: + raise + # We've read the content so the file is no longer needed. + commitmessagefile =3D None + if not commitmessage or not commitmessage.strip(): + try: + editor =3D os.environ.get("EDITOR") + if editor and utilities.editor_is_executable(editor): + commitmessage =3D utilities.get_commit_message_with_editor( + editor, message=3Dqa_output) + else: + commitmessage =3D utilities.get_commit_message_with_stdin() + except KeyboardInterrupt: + exithandler() + if not commitmessage or not commitmessage.strip(): + print("* no commit message? aborting commit.") + sys.exit(1) + commitmessage =3D commitmessage.rstrip() + changelog_msg =3D commitmessage + portage_version =3D getattr(portage, "VERSION", None) + if portage_version is None: + sys.stderr.write("Failed to insert portage version in message!\n") + sys.stderr.flush() + portage_version =3D "Unknown" + unameout =3D platform.system() + " " + if platform.system() in ["Darwin", "SunOS"]: + unameout +=3D platform.processor() + else: + unameout +=3D platform.machine() + commitmessage +=3D "\n\n(Portage version: %s/%s/%s" % \ + (portage_version, vcs, unameout) + if options.force: + commitmessage +=3D ", RepoMan options: --force" + commitmessage +=3D ")" + + if options.ask and userquery('Commit changes?', True) !=3D 'Yes': + print("* aborting commit.") + sys.exit(1) + + if options.echangelog =3D=3D 'y': + logging.info("checking for unmodified ChangeLog files") + for x in scanlist: + catdir, pkgdir =3D x.split("/") + checkdir =3D repodir + "/" + x + checkdir_relative =3D "" + if repolevel < 3: + checkdir_relative =3D os.path.join(pkgdir, checkdir_relative) + if repolevel < 2: + checkdir_relative =3D os.path.join(catdir, checkdir_relative) + checkdir_relative =3D os.path.join(".", checkdir_relative) + + changelog_path =3D os.path.join(checkdir_relative, "ChangeLog") + changelog_modified =3D changelog_path in modified_changelogs + if changelog_modified: + continue + + checkdir_modified =3D False + checkdir_pattern =3D checkdir_relative.rstrip(os.sep) + os.sep + for f in chain(myupdates, myremoved): + if f.startswith(checkdir_pattern): + checkdir_modified =3D True + break + if not checkdir_modified: + continue + + myupdates.append(changelog_path) + logging.info("calling echangelog for package %s" % x) + echangelog_args =3D ["echangelog", "--vcs", vcs, changelog_msg] + if options.pretend: + print("(%s)" % (" ".join(echangelog_args),)) + continue + retcode =3D subprocess.call(echangelog_args, cwd=3Dcheckdir) + if retcode !=3D os.EX_OK: + logging.error("echangelog exited with '%s' status" % retcode) + sys.exit(retcode) + if vcs not in ('cvs', 'svn'): # With git, bzr and hg, there's never any keyword expansion, so # there's no need to regenerate manifests and all files will be @@ -2393,56 +2505,6 @@ else: logging.info("myupdates: %s", myupdates) logging.info("myheaders: %s", myheaders) =20 - commitmessage =3D options.commitmsg - if options.commitmsgfile: - try: - f =3D io.open(_unicode_encode(options.commitmsgfile, - encoding=3D_encodings['fs'], errors=3D'strict'), - mode=3D'r', encoding=3D_encodings['content'], errors=3D'replace') - commitmessage =3D f.read() - f.close() - del f - except (IOError, OSError) as e: - if e.errno =3D=3D errno.ENOENT: - portage.writemsg("!!! File Not Found: --commitmsgfile=3D'%s'\n" % op= tions.commitmsgfile) - else: - raise - # We've read the content so the file is no longer needed. - commitmessagefile =3D None - if not commitmessage or not commitmessage.strip(): - try: - editor =3D os.environ.get("EDITOR") - if editor and utilities.editor_is_executable(editor): - commitmessage =3D utilities.get_commit_message_with_editor( - editor, message=3Dqa_output) - else: - commitmessage =3D utilities.get_commit_message_with_stdin() - except KeyboardInterrupt: - exithandler() - if not commitmessage or not commitmessage.strip(): - print("* no commit message? aborting commit.") - sys.exit(1) - commitmessage =3D commitmessage.rstrip() - portage_version =3D getattr(portage, "VERSION", None) - if portage_version is None: - sys.stderr.write("Failed to insert portage version in message!\n") - sys.stderr.flush() - portage_version =3D "Unknown" - unameout =3D platform.system() + " " - if platform.system() in ["Darwin", "SunOS"]: - unameout +=3D platform.processor() - else: - unameout +=3D platform.machine() - commitmessage +=3D "\n\n(Portage version: %s/%s/%s" % \ - (portage_version, vcs, unameout) - if options.force: - commitmessage +=3D ", RepoMan options: --force" - commitmessage +=3D ")" - - if options.ask and userquery('Commit changes?', True) !=3D 'Yes': - print("* aborting commit.") - sys.exit(1) - # Handle the case where committed files have keywords which # will change and need a priming commit before the Manifest # can be committed. diff --git a/man/repoman.1 b/man/repoman.1 index bc54657..4d3a59b 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -41,6 +41,9 @@ Forces the metadata.xml parse check to be carried out \fB-v\fR, \fB--verbose\fR Displays every package name while checking .TP +\fB\-\-echangelog=3D\fR +For commit mode, call echangelog if ChangeLog is unmodified +.TP \fB\-\-if\-modified=3D\fR Only check packages that have uncommitted modifications .TP