public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
Date: Sat, 19 Sep 2015 04:36:27 +0000 (UTC)	[thread overview]
Message-ID: <1442633931.95d50e712f5d08a0da63887453e4537654b7a810.dolsen@gentoo> (raw)

commit:     95d50e712f5d08a0da63887453e4537654b7a810
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 03:25:28 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 03:38:51 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=95d50e71

repoman/actions.py: Split out the changelog code to it's own function

 pym/repoman/actions.py | 191 +++++++++++++++++++++++++------------------------
 1 file changed, 99 insertions(+), 92 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index d2d3461..2794307 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -129,102 +129,14 @@ class Actions(object):
 				print("* no commit message?  aborting commit.")
 				sys.exit(1)
 		commitmessage = commitmessage.rstrip()
-		changelog_msg = commitmessage
+
+		myupdates, broken_changelog_manifests = self.changelogs(
+					myupdates, mymanifests, myremoved, mychanged, myautoadd,
+					mynew, commitmessage)
 
 		commit_footer = self.get_commit_footer()
 		commitmessage += commit_footer
 
-		broken_changelog_manifests = []
-		if self.options.echangelog in ('y', 'force'):
-			logging.info("checking for unmodified ChangeLog files")
-			committer_name = utilities.get_committer_name(env=self.repoman_settings)
-			for x in sorted(vcs_files_to_cps(
-				chain(myupdates, mymanifests, myremoved),
-				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
-				catdir, pkgdir = x.split("/")
-				checkdir = self.repo_settings.repodir + "/" + x
-				checkdir_relative = ""
-				if self.scanner.repolevel < 3:
-					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
-				if self.scanner.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 self.scanner.changed.changelogs
-				if changelog_modified and self.options.echangelog != 'force':
-					continue
-
-				# get changes for this package
-				cdrlen = len(checkdir_relative)
-				check_relative = lambda e: e.startswith(checkdir_relative)
-				split_relative = lambda e: e[cdrlen:]
-				clnew = list(map(split_relative, filter(check_relative, mynew)))
-				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
-				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
-
-				# Skip ChangeLog generation if only the Manifest was modified,
-				# as discussed in bug #398009.
-				nontrivial_cl_files = set()
-				nontrivial_cl_files.update(clnew, clremoved, clchanged)
-				nontrivial_cl_files.difference_update(['Manifest'])
-				if not nontrivial_cl_files and self.options.echangelog != 'force':
-					continue
-
-				new_changelog = utilities.UpdateChangeLog(
-					checkdir_relative, committer_name, changelog_msg,
-					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
-					catdir, pkgdir,
-					new=clnew, removed=clremoved, changed=clchanged,
-					pretend=self.options.pretend)
-				if new_changelog is None:
-					writemsg_level(
-						"!!! Updating the ChangeLog failed\n",
-						level=logging.ERROR, noiselevel=-1)
-					sys.exit(1)
-
-				# if the ChangeLog was just created, add it to vcs
-				if new_changelog:
-					myautoadd.append(changelog_path)
-					# myautoadd is appended to myupdates below
-				else:
-					myupdates.append(changelog_path)
-
-				if self.options.ask and not self.options.pretend:
-					# regenerate Manifest for modified ChangeLog (bug #420735)
-					self.repoman_settings["O"] = checkdir
-					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
-				else:
-					broken_changelog_manifests.append(x)
-
-		if myautoadd:
-			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
-			add_cmd = [self.vcs_settings.vcs, "add"]
-			add_cmd += myautoadd
-			if self.options.pretend:
-				portage.writemsg_stdout(
-					"(%s)\n" % " ".join(add_cmd),
-					noiselevel=-1)
-			else:
-
-				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
-					not os.path.isabs(add_cmd[0]):
-					# Python 3.1 _execvp throws TypeError for non-absolute executable
-					# path passed as bytes (see http://bugs.python.org/issue8513).
-					fullname = find_binary(add_cmd[0])
-					if fullname is None:
-						raise portage.exception.CommandNotFound(add_cmd[0])
-					add_cmd[0] = fullname
-
-				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
-				retcode = subprocess.call(add_cmd)
-				if retcode != os.EX_OK:
-					logging.error(
-						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
-					sys.exit(retcode)
-
-			myupdates += myautoadd
-
 		print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
 
 		if self.vcs_settings.vcs not in ('cvs', 'svn'):
@@ -796,3 +708,98 @@ class Actions(object):
 				commit_footer += ", unsigned Manifest commit"
 			commit_footer += ")"
 		return commit_footer
+
+
+	def changelogs(self, myupdates, mymanifests, myremoved, mychanged, myautoadd,
+					mynew, changelog_msg):
+		broken_changelog_manifests = []
+		if self.options.echangelog in ('y', 'force'):
+			logging.info("checking for unmodified ChangeLog files")
+			committer_name = utilities.get_committer_name(env=self.repoman_settings)
+			for x in sorted(vcs_files_to_cps(
+				chain(myupdates, mymanifests, myremoved),
+				self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)):
+				catdir, pkgdir = x.split("/")
+				checkdir = self.repo_settings.repodir + "/" + x
+				checkdir_relative = ""
+				if self.scanner.repolevel < 3:
+					checkdir_relative = os.path.join(pkgdir, checkdir_relative)
+				if self.scanner.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 self.scanner.changed.changelogs
+				if changelog_modified and self.options.echangelog != 'force':
+					continue
+
+				# get changes for this package
+				cdrlen = len(checkdir_relative)
+				check_relative = lambda e: e.startswith(checkdir_relative)
+				split_relative = lambda e: e[cdrlen:]
+				clnew = list(map(split_relative, filter(check_relative, mynew)))
+				clremoved = list(map(split_relative, filter(check_relative, myremoved)))
+				clchanged = list(map(split_relative, filter(check_relative, mychanged)))
+
+				# Skip ChangeLog generation if only the Manifest was modified,
+				# as discussed in bug #398009.
+				nontrivial_cl_files = set()
+				nontrivial_cl_files.update(clnew, clremoved, clchanged)
+				nontrivial_cl_files.difference_update(['Manifest'])
+				if not nontrivial_cl_files and self.options.echangelog != 'force':
+					continue
+
+				new_changelog = utilities.UpdateChangeLog(
+					checkdir_relative, committer_name, changelog_msg,
+					os.path.join(self.repo_settings.repodir, 'skel.ChangeLog'),
+					catdir, pkgdir,
+					new=clnew, removed=clremoved, changed=clchanged,
+					pretend=self.options.pretend)
+				if new_changelog is None:
+					writemsg_level(
+						"!!! Updating the ChangeLog failed\n",
+						level=logging.ERROR, noiselevel=-1)
+					sys.exit(1)
+
+				# if the ChangeLog was just created, add it to vcs
+				if new_changelog:
+					myautoadd.append(changelog_path)
+					# myautoadd is appended to myupdates below
+				else:
+					myupdates.append(changelog_path)
+
+				if self.options.ask and not self.options.pretend:
+					# regenerate Manifest for modified ChangeLog (bug #420735)
+					self.repoman_settings["O"] = checkdir
+					digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
+				else:
+					broken_changelog_manifests.append(x)
+
+		if myautoadd:
+			print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...")
+			add_cmd = [self.vcs_settings.vcs, "add"]
+			add_cmd += myautoadd
+			if self.options.pretend:
+				portage.writemsg_stdout(
+					"(%s)\n" % " ".join(add_cmd),
+					noiselevel=-1)
+			else:
+
+				if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
+					not os.path.isabs(add_cmd[0]):
+					# Python 3.1 _execvp throws TypeError for non-absolute executable
+					# path passed as bytes (see http://bugs.python.org/issue8513).
+					fullname = find_binary(add_cmd[0])
+					if fullname is None:
+						raise portage.exception.CommandNotFound(add_cmd[0])
+					add_cmd[0] = fullname
+
+				add_cmd = [_unicode_encode(arg) for arg in add_cmd]
+				retcode = subprocess.call(add_cmd)
+				if retcode != os.EX_OK:
+					logging.error(
+						"Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode))
+					sys.exit(retcode)
+
+			myupdates += myautoadd
+		return myupdates, broken_changelog_manifests


             reply	other threads:[~2015-09-19  4:36 UTC|newest]

Thread overview: 216+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-19  4:36 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-05-03  9:33 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/ Brian Dolbec
2016-04-29 17:24 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-04-28 15:05 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-04-29 17:24 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-04-28 15:05 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-04-29 17:24 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-04-26 14:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-04-28 15:05 Brian Dolbec
2016-04-27  5:22 Brian Dolbec
2016-04-27  5:22 Brian Dolbec
2016-04-27  5:22 Brian Dolbec
2016-04-26 18:08 Zac Medico
2016-04-25 15:32 Brian Dolbec
2016-04-25 15:32 Brian Dolbec
2016-04-25 15:32 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-17 15:42 Brian Dolbec
2016-04-16 20:00 Zac Medico
2016-03-15 19:00 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-11  0:41 Brian Dolbec
2016-03-11  0:41 Brian Dolbec
2016-03-11  0:41 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-02-01  7:55 Zac Medico
2016-02-01  7:21 Zac Medico
2016-01-31 20:03 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-01-30  8:00 Brian Dolbec
2016-01-30  8:00 Brian Dolbec
2016-01-30  8:00 Brian Dolbec
2016-01-30  6:58 Brian Dolbec
2016-01-30  6:58 Brian Dolbec
2016-01-30  6:58 Brian Dolbec
2016-01-29  5:01 Brian Dolbec
2016-01-29  5:01 Brian Dolbec
2016-01-29  5:01 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-23  1:42 Brian Dolbec
2016-01-23  1:42 Brian Dolbec
2016-01-23  1:42 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-21 19:42 Brian Dolbec
2016-01-21 19:42 Brian Dolbec
2016-01-21 19:15 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-11  8:01 Brian Dolbec
2016-01-11  8:01 Brian Dolbec
2016-01-11  6:31 Brian Dolbec
2016-01-11  6:31 Brian Dolbec
2016-01-11  6:31 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10  3:26 Brian Dolbec
2016-01-10  3:26 Brian Dolbec
2016-01-10  3:26 Brian Dolbec
2016-01-06  4:21 Brian Dolbec
2016-01-06  4:21 Brian Dolbec
2015-12-30 23:38 Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  2:06 Brian Dolbec
2015-09-20  0:20 Brian Dolbec
2015-09-19 17:32 Brian Dolbec
2015-09-19 16:48 Brian Dolbec
2015-09-19 16:28 Brian Dolbec
2015-09-19 16:28 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  4:36 Brian Dolbec
2015-09-19  1:22 Brian Dolbec
2015-09-19  1:22 Brian Dolbec
2015-09-17 18:58 Brian Dolbec
2015-09-17 18:58 Brian Dolbec
2015-09-17 15:32 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  2:45 Brian Dolbec
2015-09-17  2:45 Brian Dolbec
2015-09-17  2:45 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2014-11-17  2:08 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-06-03 19:33 Brian Dolbec
2014-06-03 18:15 Brian Dolbec
2014-06-03 18:15 Brian Dolbec
2014-06-03 11:29 Tom Wijsman
2014-06-02 17:01 Tom Wijsman
2014-06-02 15:44 Brian Dolbec
2014-06-02 15:44 Brian Dolbec
2014-06-02 15:44 Brian Dolbec
2014-06-02 15:01 Tom Wijsman
2014-06-02 14:24 Brian Dolbec
2014-06-02 14:11 Tom Wijsman
2014-06-02  1:10 Brian Dolbec
2014-06-02  1:10 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-27  6:04 Brian Dolbec
2014-05-27  6:04 Brian Dolbec
2014-05-27  6:04 Brian Dolbec
2014-05-27  6:04 Brian Dolbec
2014-05-27  5:04 Brian Dolbec
2014-05-27  5:04 Brian Dolbec
2014-05-27  5:04 Brian Dolbec

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=1442633931.95d50e712f5d08a0da63887453e4537654b7a810.dolsen@gentoo \
    --to=dolsen@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