public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: man/, bin/
Date: Fri, 14 Oct 2011 18:06:00 +0000 (UTC)	[thread overview]
Message-ID: <f03e9dbd874e6731683c0050d827318bd14360fb.zmedico@gentoo> (raw)

commit:     f03e9dbd874e6731683c0050d827318bd14360fb
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 14 17:55:31 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Oct 14 17:55:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f03e9dbd

repoman: add --echangelog=<y|n> 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="quiet", action="count", default=0,
 		help='do not print unnecessary messages')
 
+	parser.add_option(
+		'--echangelog', type='choice', choices=('y', 'n'), metavar="<y|n>",
+		help='for commit mode, call echangelog if ChangeLog is unmodified')
+
 	parser.add_option('-f', '--force', dest='force', default=False, action='store_true',
 		help='Commit with QA violations')
 
@@ -539,12 +544,6 @@ else:
 	else:
 		vcs = None
 
-# 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 = vcs in ('cvs', 'svn')
-
 # Disable copyright/mtime check if vcs does not preserve mtime (bug #324075).
 vcs_preserves_mtime = vcs not in ('git',)
 
@@ -634,6 +633,30 @@ if "commit" == options.mode and \
 		print(prefix + line)
 	sys.exit(1)
 
+if options.echangelog is None and \
+	repo_config.name == "gentoo":
+	# Bug #337853 - gentoo's council says to enable
+	# --echangelog by default for the "gentoo" repo
+	options.echangelog = 'y'
+
+if vcs is None:
+	options.echangelog = 'n'
+
+if 'commit' == options.mode and \
+	options.echangelog == '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 = options.echangelog != 'y' and vcs in ('cvs', 'svn')
+
 # Generate an appropriate PORTDIR_OVERLAY value for passing into the
 # profile-specific config constructor calls.
 env = os.environ.copy()
@@ -2339,6 +2362,95 @@ else:
 	mydirty = []
 
 	print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
+
+	commitmessage = options.commitmsg
+	if options.commitmsgfile:
+		try:
+			f = io.open(_unicode_encode(options.commitmsgfile,
+			encoding=_encodings['fs'], errors='strict'),
+			mode='r', encoding=_encodings['content'], errors='replace')
+			commitmessage = f.read()
+			f.close()
+			del f
+		except (IOError, OSError) as e:
+			if e.errno == errno.ENOENT:
+				portage.writemsg("!!! File Not Found: --commitmsgfile='%s'\n" % options.commitmsgfile)
+			else:
+				raise
+		# We've read the content so the file is no longer needed.
+		commitmessagefile = None
+	if not commitmessage or not commitmessage.strip():
+		try:
+			editor = os.environ.get("EDITOR")
+			if editor and utilities.editor_is_executable(editor):
+				commitmessage = utilities.get_commit_message_with_editor(
+					editor, message=qa_output)
+			else:
+				commitmessage = 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 = commitmessage.rstrip()
+	changelog_msg = commitmessage
+	portage_version = 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 = "Unknown"
+	unameout = platform.system() + " "
+	if platform.system() in ["Darwin", "SunOS"]:
+		unameout += platform.processor()
+	else:
+		unameout += platform.machine()
+	commitmessage += "\n\n(Portage version: %s/%s/%s" % \
+		(portage_version, vcs, unameout)
+	if options.force:
+		commitmessage += ", RepoMan options: --force"
+	commitmessage += ")"
+
+	if options.ask and userquery('Commit changes?', True) != 'Yes':
+		print("* aborting commit.")
+		sys.exit(1)
+
+	if options.echangelog == 'y':
+		logging.info("checking for unmodified ChangeLog files")
+		for x in scanlist:
+			catdir, pkgdir = x.split("/")
+			checkdir = repodir + "/" + x
+			checkdir_relative = ""
+			if repolevel < 3:
+				checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+			if repolevel < 2:
+				checkdir_relative = os.path.join(catdir, checkdir_relative)
+			checkdir_relative = os.path.join(".", checkdir_relative)
+
+			changelog_path = os.path.join(checkdir_relative, "ChangeLog")
+			changelog_modified = changelog_path in modified_changelogs
+			if changelog_modified:
+				continue
+
+			checkdir_modified = False
+			checkdir_pattern = checkdir_relative.rstrip(os.sep) + os.sep
+			for f in chain(myupdates, myremoved):
+				if f.startswith(checkdir_pattern):
+					checkdir_modified = True
+					break
+			if not checkdir_modified:
+				continue
+
+			myupdates.append(changelog_path)
+			logging.info("calling echangelog for package %s" % x)
+			echangelog_args = ["echangelog", "--vcs", vcs, changelog_msg]
+			if options.pretend:
+				print("(%s)" % (" ".join(echangelog_args),))
+				continue
+			retcode = subprocess.call(echangelog_args, cwd=checkdir)
+			if retcode != 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)
 
-	commitmessage = options.commitmsg
-	if options.commitmsgfile:
-		try:
-			f = io.open(_unicode_encode(options.commitmsgfile,
-			encoding=_encodings['fs'], errors='strict'),
-			mode='r', encoding=_encodings['content'], errors='replace')
-			commitmessage = f.read()
-			f.close()
-			del f
-		except (IOError, OSError) as e:
-			if e.errno == errno.ENOENT:
-				portage.writemsg("!!! File Not Found: --commitmsgfile='%s'\n" % options.commitmsgfile)
-			else:
-				raise
-		# We've read the content so the file is no longer needed.
-		commitmessagefile = None
-	if not commitmessage or not commitmessage.strip():
-		try:
-			editor = os.environ.get("EDITOR")
-			if editor and utilities.editor_is_executable(editor):
-				commitmessage = utilities.get_commit_message_with_editor(
-					editor, message=qa_output)
-			else:
-				commitmessage = 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 = commitmessage.rstrip()
-	portage_version = 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 = "Unknown"
-	unameout = platform.system() + " "
-	if platform.system() in ["Darwin", "SunOS"]:
-		unameout += platform.processor()
-	else:
-		unameout += platform.machine()
-	commitmessage += "\n\n(Portage version: %s/%s/%s" % \
-		(portage_version, vcs, unameout)
-	if options.force:
-		commitmessage += ", RepoMan options: --force"
-	commitmessage += ")"
-
-	if options.ask and userquery('Commit changes?', True) != '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=<y|n>\fR
+For commit mode, call echangelog if ChangeLog is unmodified
+.TP
 \fB\-\-if\-modified=<y|n>\fR
 Only check packages that have uncommitted modifications
 .TP



             reply	other threads:[~2011-10-14 18:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14 18:06 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-08-30 17:05 [gentoo-commits] proj/portage:master commit in: man/, bin/ Zac Medico
2013-08-22  4:06 Zac Medico
2013-08-22  2:01 Zac Medico
2013-08-04 20:51 Zac Medico
2013-07-23 20:42 Arfrever Frehtes Taifersar Arahesis
2013-07-13  9:35 Arfrever Frehtes Taifersar Arahesis
2013-05-18 18:47 Zac Medico
2013-04-28 22:06 Zac Medico
2012-10-31 21:32 Zac Medico
2012-10-11  3:10 Zac Medico
2012-09-24 20:26 Zac Medico
2012-09-24  3:47 Mike Frysinger
2012-06-17 15:46 Zac Medico
2012-03-17 21:33 Zac Medico
2012-03-11  2:56 Mike Frysinger
2012-03-11  2:44 Mike Frysinger
2012-01-02  7:48 Zac Medico
2011-12-22 23:43 Zac Medico
2011-12-21 20:08 Zac Medico
2011-12-21 20:04 Zac Medico
2011-10-17  4:22 Zac Medico
2011-08-31  3:05 Zac Medico
2011-08-13 13:52 Zac Medico
2011-08-11  3:00 Zac Medico
2011-06-24 10:23 Zac Medico
2011-05-01 15:58 Zac Medico
2011-05-01 14:52 Arfrever Frehtes Taifersar Arahesis
2011-05-01  1:23 Arfrever Frehtes Taifersar Arahesis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f03e9dbd874e6731683c0050d827318bd14360fb.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox