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 1RH6Ph-0001xF-Td for garchives@archives.gentoo.org; Fri, 21 Oct 2011 04:08:58 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 60EA121C06B; Fri, 21 Oct 2011 04:08:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 22D2D21C06B for ; Fri, 21 Oct 2011 04:08:50 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 850DA1B4010 for ; Fri, 21 Oct 2011 04:08:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id E971880042 for ; Fri, 21 Oct 2011 04:08:48 +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: <0966be903d19dd9999568de3baa3f9815e1e4369.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/repoman/, bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/repoman pym/repoman/utilities.py X-VCS-Directories: pym/repoman/ bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 0966be903d19dd9999568de3baa3f9815e1e4369 Date: Fri, 21 Oct 2011 04:08:48 +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: b3be599c98aa4524ef9b20a031a49a6a commit: 0966be903d19dd9999568de3baa3f9815e1e4369 Author: Zac Medico gentoo org> AuthorDate: Fri Oct 21 04:07:34 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Oct 21 04:07:34 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D0966be90 UpdateChangeLog: split out get_committer_name() --- bin/repoman | 11 +++++++---- pym/repoman/utilities.py | 44 ++++++++++++++++++++++++----------------= ---- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/bin/repoman b/bin/repoman index 5b01825..bf91b85 100755 --- a/bin/repoman +++ b/bin/repoman @@ -2447,6 +2447,7 @@ else: =20 if options.echangelog in ('y', 'force'): logging.info("checking for unmodified ChangeLog files") + committer_name =3D utilities.get_committer_name(env=3Drepoman_settings= ) for x in sorted(vcs_files_to_cps( chain(myupdates, mymanifests, myremoved))): catdir, pkgdir =3D x.split("/") @@ -2468,10 +2469,12 @@ else: clnew =3D [elem[cdrlen:] for elem in mynew if elem.startswith(checkdi= r_relative)] clremoved =3D [elem[cdrlen:] for elem in myremoved if elem.startswith= (checkdir_relative)] clchanged =3D [elem[cdrlen:] for elem in mychanged if elem.startswith= (checkdir_relative)] - new_changelog =3D utilities.UpdateChangeLog(checkdir_relative, \ - catdir, pkgdir, \ - clnew, clremoved, clchanged, \ - changelog_msg, options.pretend, repodir) + new_changelog =3D utilities.UpdateChangeLog(checkdir_relative, + committer_name, changelog_msg, + os.path.join(repodir, 'skel.ChangeLog'), + catdir, pkgdir, + new=3Dclnew, removed=3Dclremoved, changed=3Dclchanged, + pretend=3Doptions.pretend) if new_changelog is None: writemsg_level("!!! Updating the ChangeLog failed\n", \ level=3Dlogging.ERROR, noiselevel=3D-1) diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index c1a9da8..0ecc92c 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -16,6 +16,7 @@ __all__ =3D [ "format_qa_output", "get_commit_message_with_editor", "get_commit_message_with_stdin", + "get_committer_name", "have_profile_dir", "parse_metadata_use", "UnknownHerdsError", @@ -588,30 +589,34 @@ def update_copyright(fn_path, year, pretend): util.apply_stat_permissions(fn_path, fn_stat) fn_hdl.close() =20 -def UpdateChangeLog(pkgdir, category, package, new, removed, changed, \ - msg, pretend, repodir): +def get_committer_name(env=3DNone): + """Generate a committer string like echangelog does.""" + if env is None: + env =3D os.environ + if 'GENTOO_COMMITTER_NAME' in env and \ + 'GENTOO_COMMITTER_EMAIL' in env: + user =3D '%s <%s>' % (env['GENTOO_COMMITTER_NAME'], + env['GENTOO_COMMITTER_EMAIL']) + elif 'GENTOO_AUTHOR_NAME' in env and \ + 'GENTOO_AUTHOR_EMAIL' in env: + user =3D '%s <%s>' % (env['GENTOO_AUTHOR_NAME'], + env['GENTOO_AUTHOR_EMAIL']) + elif 'ECHANGELOG_USER' in env: + user =3D env['ECHANGELOG_USER'] + else: + pwd_struct =3D pwd.getpwuid(os.getuid()) + gecos =3D pwd_struct.pw_gecos.split(',')[0] # bug #80011 + user =3D '%s <%s@gentoo.org>' % (gecos, pwd_struct.pw_name) + return user + +def UpdateChangeLog(pkgdir, user, msg, skel_path, category, package, + new=3D(), removed=3D(), changed=3D(), pretend=3DFalse): """ Write an entry to an existing ChangeLog, or create a new one. Updates copyright year on changed files, and updates the header of ChangeLog with the contents of skel.ChangeLog. """ =20 - # figure out who to write as - if 'GENTOO_COMMITTER_NAME' in os.environ and \ - 'GENTOO_COMMITTER_EMAIL' in os.environ: - user =3D '%s <%s>' % (os.environ['GENTOO_COMMITTER_NAME'], \ - os.environ['GENTOO_COMMITTER_EMAIL']) - elif 'GENTOO_AUTHOR_NAME' in os.environ and \ - 'GENTOO_AUTHOR_EMAIL' in os.environ: - user =3D '%s <%s>' % (os.environ['GENTOO_AUTHOR_NAME'], \ - os.environ['GENTOO_AUTHOR_EMAIL']) - elif 'ECHANGELOG_USER' in os.environ: - user =3D os.environ['ECHANGELOG_USER'] - else: - pwd_struct =3D pwd.getpwuid(os.getuid()) - gecos =3D pwd_struct.pw_gecos.split(',')[0] # bug #80011 - user =3D '%s <%s@gentoo.org>' % (gecos, pwd_struct.pw_name) - if '