public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync
@ 2015-11-02 18:18 Michał Górny
  2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 1/4] egencache --update-changelogs: Support setting ChangeLog file name Michał Górny
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Michał Górny @ 2015-11-02 18:18 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: robbat2

Hi,

A quick batch of patches fulfilling Infra requests needed for ChangeLog
generation on rsync mirrors and fixing some minor issues.

--
Best regards,
Michał Górny



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [gentoo-portage-dev] [PATCH 1/4] egencache --update-changelogs: Support setting ChangeLog file name
  2015-11-02 18:18 [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Michał Górny
@ 2015-11-02 18:18 ` Michał Górny
  2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 2/4] egencache --update-changelogs: Ignore all ChangeLog* files Michał Górny
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2015-11-02 18:18 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: robbat2, Michał Górny

---
 bin/egencache | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/bin/egencache b/bin/egencache
index 6407a44..11f49c6 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -170,6 +170,12 @@ def parse_args(args):
 		help="output file for use.local.desc data (or '-' for stdout)",
 		dest="uld_output")
 
+	uc = parser.add_argument_group('--update-changelogs options')
+	uc.add_argument("--changelog-output",
+		help="output filename for change logs",
+		dest="changelog_output",
+		default="ChangeLog")
+
 	options, args = parser.parse_known_args(args)
 
 	if options.jobs:
@@ -739,7 +745,7 @@ class _special_filename(_filename_base):
 			return self.file_name < other.file_name
 
 class GenChangeLogs(object):
-	def __init__(self, portdb):
+	def __init__(self, portdb, changelog_output):
 		self.returncode = os.EX_OK
 		self._portdb = portdb
 		self._wrapper = textwrap.TextWrapper(
@@ -747,6 +753,7 @@ class GenChangeLogs(object):
 				initial_indent = '  ',
 				subsequent_indent = '  '
 			)
+		self._changelog_output = changelog_output
 
 	@staticmethod
 	def grab(cmd):
@@ -756,7 +763,7 @@ class GenChangeLogs(object):
 
 	def generate_changelog(self, cp):
 		try:
-			output = io.open('ChangeLog',
+			output = io.open(self._changelog_output,
 				mode='w', encoding=_encodings['repo.content'],
 				errors='backslashreplace')
 		except IOError as e:
@@ -1132,7 +1139,8 @@ def egencache_main(args):
 		ret.append(gen_desc.returncode)
 
 	if options.update_changelogs:
-		gen_clogs = GenChangeLogs(portdb)
+		gen_clogs = GenChangeLogs(portdb,
+			changelog_output=options.changelog_output)
 		gen_clogs.run()
 		ret.append(gen_clogs.returncode)
 
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-portage-dev] [PATCH 2/4] egencache --update-changelogs: Ignore all ChangeLog* files
  2015-11-02 18:18 [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Michał Górny
  2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 1/4] egencache --update-changelogs: Support setting ChangeLog file name Michał Górny
@ 2015-11-02 18:18 ` Michał Górny
  2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 3/4] egencache --update-changelogs: Replace $Header$ with autogen note Michał Górny
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2015-11-02 18:18 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: robbat2, Michał Górny

---
 bin/egencache | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/egencache b/bin/egencache
index 11f49c6..f3eaa5c 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -816,7 +816,7 @@ class GenChangeLogs(object):
 					f = l.split()
 					if f[1] == 'Manifest':
 						pass # XXX: remanifest commits?
-					elif f[1] == 'ChangeLog':
+					elif f[1].startswith('ChangeLog'):
 						pass
 					elif f[0].startswith('A'):
 						changed.append(_special_filename("+", f[1]))
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-portage-dev] [PATCH 3/4] egencache --update-changelogs: Replace $Header$ with autogen note
  2015-11-02 18:18 [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Michał Górny
  2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 1/4] egencache --update-changelogs: Support setting ChangeLog file name Michał Górny
  2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 2/4] egencache --update-changelogs: Ignore all ChangeLog* files Michał Górny
@ 2015-11-02 18:18 ` Michał Górny
  2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 4/4] egencache --update-changelogs: Support reversing order Michał Górny
  2015-11-02 19:18 ` [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Zac Medico
  4 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2015-11-02 18:18 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: robbat2, Michał Górny

---
 bin/egencache | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/egencache b/bin/egencache
index f3eaa5c..984d9f2 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -776,7 +776,7 @@ class GenChangeLogs(object):
 		output.write(textwrap.dedent('''\
 			# ChangeLog for %s
 			# Copyright 1999-%s Gentoo Foundation; Distributed under the GPL v2
-			# $Header: $
+			# (auto-generated from git log)
 
 			''' % (cp, time.strftime('%Y'))))
 
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-portage-dev] [PATCH 4/4] egencache --update-changelogs: Support reversing order
  2015-11-02 18:18 [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Michał Górny
                   ` (2 preceding siblings ...)
  2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 3/4] egencache --update-changelogs: Replace $Header$ with autogen note Michał Górny
@ 2015-11-02 18:18 ` Michał Górny
  2015-11-02 19:18 ` [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Zac Medico
  4 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2015-11-02 18:18 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: robbat2, Michał Górny

---
 bin/egencache | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/bin/egencache b/bin/egencache
index 984d9f2..51d115a 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -171,6 +171,9 @@ def parse_args(args):
 		dest="uld_output")
 
 	uc = parser.add_argument_group('--update-changelogs options')
+	uc.add_argument("--changelog-reversed",
+		action="store_true",
+		help="log commits in reverse order (oldest first)")
 	uc.add_argument("--changelog-output",
 		help="output filename for change logs",
 		dest="changelog_output",
@@ -745,7 +748,7 @@ class _special_filename(_filename_base):
 			return self.file_name < other.file_name
 
 class GenChangeLogs(object):
-	def __init__(self, portdb, changelog_output):
+	def __init__(self, portdb, changelog_output, changelog_reversed):
 		self.returncode = os.EX_OK
 		self._portdb = portdb
 		self._wrapper = textwrap.TextWrapper(
@@ -754,6 +757,7 @@ class GenChangeLogs(object):
 				subsequent_indent = '  '
 			)
 		self._changelog_output = changelog_output
+		self._changelog_reversed = changelog_reversed
 
 	@staticmethod
 	def grab(cmd):
@@ -781,7 +785,11 @@ class GenChangeLogs(object):
 			''' % (cp, time.strftime('%Y'))))
 
 		# now grab all the commits
-		commits = self.grab(['git', 'rev-list', 'HEAD', '--', '.']).split()
+		revlist_cmd = ['git', 'rev-list']
+		if self._changelog_reversed:
+			revlist_cmd.append('--reverse')
+		revlist_cmd.extend(['HEAD', '--', '.'])
+		commits = self.grab(revlist_cmd).split()
 
 		for c in commits:
 			# Explaining the arguments:
@@ -1140,7 +1148,8 @@ def egencache_main(args):
 
 	if options.update_changelogs:
 		gen_clogs = GenChangeLogs(portdb,
-			changelog_output=options.changelog_output)
+			changelog_output=options.changelog_output,
+			changelog_reversed=options.changelog_reversed)
 		gen_clogs.run()
 		ret.append(gen_clogs.returncode)
 
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync
  2015-11-02 18:18 [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Michał Górny
                   ` (3 preceding siblings ...)
  2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 4/4] egencache --update-changelogs: Support reversing order Michał Górny
@ 2015-11-02 19:18 ` Zac Medico
  2015-11-02 21:46   ` [gentoo-portage-dev] [PATCH 1/2] egencache --update-changelogs: Support setting ChangeLog file name Michał Górny
  2015-11-02 23:05   ` [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Alexander Berntsen
  4 siblings, 2 replies; 9+ messages in thread
From: Zac Medico @ 2015-11-02 19:18 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: robbat2

On 11/02/2015 10:18 AM, Michał Górny wrote:
> Hi,
> 
> A quick batch of patches fulfilling Infra requests needed for ChangeLog
> generation on rsync mirrors and fixing some minor issues.
> 
> --
> Best regards,
> Michał Górny
> 
> 

The whole series looks good, except it's missing updates to man/egencache.1.
-- 
Thanks,
Zac


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [gentoo-portage-dev] [PATCH 1/2] egencache --update-changelogs: Support setting ChangeLog file name
  2015-11-02 19:18 ` [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Zac Medico
@ 2015-11-02 21:46   ` Michał Górny
  2015-11-02 21:46     ` [gentoo-portage-dev] [PATCH 2/2] egencache --update-changelogs: Support reversing order Michał Górny
  2015-11-02 23:05   ` [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Alexander Berntsen
  1 sibling, 1 reply; 9+ messages in thread
From: Michał Górny @ 2015-11-02 21:46 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: robbat2, Michał Górny

---
 bin/egencache   | 14 +++++++++++---
 man/egencache.1 |  6 ++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/bin/egencache b/bin/egencache
index 30311eb..984d9f2 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -170,6 +170,12 @@ def parse_args(args):
 		help="output file for use.local.desc data (or '-' for stdout)",
 		dest="uld_output")
 
+	uc = parser.add_argument_group('--update-changelogs options')
+	uc.add_argument("--changelog-output",
+		help="output filename for change logs",
+		dest="changelog_output",
+		default="ChangeLog")
+
 	options, args = parser.parse_known_args(args)
 
 	if options.jobs:
@@ -739,7 +745,7 @@ class _special_filename(_filename_base):
 			return self.file_name < other.file_name
 
 class GenChangeLogs(object):
-	def __init__(self, portdb):
+	def __init__(self, portdb, changelog_output):
 		self.returncode = os.EX_OK
 		self._portdb = portdb
 		self._wrapper = textwrap.TextWrapper(
@@ -747,6 +753,7 @@ class GenChangeLogs(object):
 				initial_indent = '  ',
 				subsequent_indent = '  '
 			)
+		self._changelog_output = changelog_output
 
 	@staticmethod
 	def grab(cmd):
@@ -756,7 +763,7 @@ class GenChangeLogs(object):
 
 	def generate_changelog(self, cp):
 		try:
-			output = io.open('ChangeLog',
+			output = io.open(self._changelog_output,
 				mode='w', encoding=_encodings['repo.content'],
 				errors='backslashreplace')
 		except IOError as e:
@@ -1132,7 +1139,8 @@ def egencache_main(args):
 		ret.append(gen_desc.returncode)
 
 	if options.update_changelogs:
-		gen_clogs = GenChangeLogs(portdb)
+		gen_clogs = GenChangeLogs(portdb,
+			changelog_output=options.changelog_output)
 		gen_clogs.run()
 		ret.append(gen_clogs.returncode)
 
diff --git a/man/egencache.1 b/man/egencache.1
index abbbdb9..b4a95b3 100644
--- a/man/egencache.1
+++ b/man/egencache.1
@@ -40,6 +40,12 @@ information about why this is necessary.
 .br
 Defaults to /var/cache/edb/dep.
 .TP
+.BR "\-\-changelog\-output=FILENAME"
+Specifies the file name used to store autogenerated ChangeLogs inside
+the package directories.
+.br
+Defaults to ChangeLog.
+.TP
 .BR "\-\-config\-root=PORTAGE_CONFIGROOT"
 Location of portage config files.
 .br
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-portage-dev] [PATCH 2/2] egencache --update-changelogs: Support reversing order
  2015-11-02 21:46   ` [gentoo-portage-dev] [PATCH 1/2] egencache --update-changelogs: Support setting ChangeLog file name Michał Górny
@ 2015-11-02 21:46     ` Michał Górny
  0 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2015-11-02 21:46 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: robbat2, Michał Górny

---
 bin/egencache   | 15 ++++++++++++---
 man/egencache.1 |  4 ++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/bin/egencache b/bin/egencache
index 984d9f2..51d115a 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -171,6 +171,9 @@ def parse_args(args):
 		dest="uld_output")
 
 	uc = parser.add_argument_group('--update-changelogs options')
+	uc.add_argument("--changelog-reversed",
+		action="store_true",
+		help="log commits in reverse order (oldest first)")
 	uc.add_argument("--changelog-output",
 		help="output filename for change logs",
 		dest="changelog_output",
@@ -745,7 +748,7 @@ class _special_filename(_filename_base):
 			return self.file_name < other.file_name
 
 class GenChangeLogs(object):
-	def __init__(self, portdb, changelog_output):
+	def __init__(self, portdb, changelog_output, changelog_reversed):
 		self.returncode = os.EX_OK
 		self._portdb = portdb
 		self._wrapper = textwrap.TextWrapper(
@@ -754,6 +757,7 @@ class GenChangeLogs(object):
 				subsequent_indent = '  '
 			)
 		self._changelog_output = changelog_output
+		self._changelog_reversed = changelog_reversed
 
 	@staticmethod
 	def grab(cmd):
@@ -781,7 +785,11 @@ class GenChangeLogs(object):
 			''' % (cp, time.strftime('%Y'))))
 
 		# now grab all the commits
-		commits = self.grab(['git', 'rev-list', 'HEAD', '--', '.']).split()
+		revlist_cmd = ['git', 'rev-list']
+		if self._changelog_reversed:
+			revlist_cmd.append('--reverse')
+		revlist_cmd.extend(['HEAD', '--', '.'])
+		commits = self.grab(revlist_cmd).split()
 
 		for c in commits:
 			# Explaining the arguments:
@@ -1140,7 +1148,8 @@ def egencache_main(args):
 
 	if options.update_changelogs:
 		gen_clogs = GenChangeLogs(portdb,
-			changelog_output=options.changelog_output)
+			changelog_output=options.changelog_output,
+			changelog_reversed=options.changelog_reversed)
 		gen_clogs.run()
 		ret.append(gen_clogs.returncode)
 
diff --git a/man/egencache.1 b/man/egencache.1
index b4a95b3..2465ddf 100644
--- a/man/egencache.1
+++ b/man/egencache.1
@@ -46,6 +46,10 @@ the package directories.
 .br
 Defaults to ChangeLog.
 .TP
+.BR "\-\-changelog\-reversed"
+Reverses the commit order in ChangeLogs. The oldest commits are output
+first, the newest last.
+.TP
 .BR "\-\-config\-root=PORTAGE_CONFIGROOT"
 Location of portage config files.
 .br
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync
  2015-11-02 19:18 ` [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Zac Medico
  2015-11-02 21:46   ` [gentoo-portage-dev] [PATCH 1/2] egencache --update-changelogs: Support setting ChangeLog file name Michał Górny
@ 2015-11-02 23:05   ` Alexander Berntsen
  1 sibling, 0 replies; 9+ messages in thread
From: Alexander Berntsen @ 2015-11-02 23:05 UTC (permalink / raw
  To: gentoo-portage-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 02/11/15 20:18, Zac Medico wrote:
> The whole series looks good, except it's missing updates to 
> man/egencache.1.
This was my main feedback as well. LGTM now.

- -- 
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCgAGBQJWN+xHAAoJENQqWdRUGk8BsiEQAItn7kXGuNGi3gFF1eEYcDcO
w8l5kQwU964T7xgwzKSdUJpTwli36AmcCDXL+yL/zsCysSi9tUwSHiKCieKpRbnf
+IN2jZ0us79QJ8uJXB+R/bxG2kNkAu/e0Gv9xrcAdQe92+IjZymWN6EfDVOjm/A/
Un/lvscXfTsb2D9WAKIEM1QeSCmuUtKAuMecOTCxBJ7YBohZoeFNVVz5WDpw9AzY
vZMfZXK/pyZKKyYxuaNip/qi7ve7BEtSTrfNqXngY3Xpy/QLTYTETo2JgCbHflC/
gLu6IjPGYMW98oMEBDV9hVcyaYV2ppnB2QhJpvPgfHGlf0w0dqyr/rZKShaO597v
zBzVsaXsxtBSn+ITxHlkl90v7zEv68lM4MdGkqWEqXFVvFHQvQlsqRnaMlXkFgPv
t98q+C6wB8Q7RghOKdN3wjvmziMVApdiQ1H7vKI7PokG9ICiWPZcf9ZlM7X7VI2N
xWvFL0VAkbTebWJX2lP6pckSNJKKB7n9ahPXz5ph3J9ycNOYcnEOyOqvhxO2M2GD
lFkAi/0u7PnqFqdjB+0SNHbsv+KJpIf1aLbzKumfcIHrpSngemRFqL89Yzfht48D
YN3D9WKAn4gZ8uFJR2rveDZeZrQqyUmnF4PXKW2NdjR1zpWfj+Sd3/hOApQpPlms
NVOzT1Y8Cl8z0rWO03xV
=bTSu
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-11-02 23:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-02 18:18 [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Michał Górny
2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 1/4] egencache --update-changelogs: Support setting ChangeLog file name Michał Górny
2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 2/4] egencache --update-changelogs: Ignore all ChangeLog* files Michał Górny
2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 3/4] egencache --update-changelogs: Replace $Header$ with autogen note Michał Górny
2015-11-02 18:18 ` [gentoo-portage-dev] [PATCH 4/4] egencache --update-changelogs: Support reversing order Michał Górny
2015-11-02 19:18 ` [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Zac Medico
2015-11-02 21:46   ` [gentoo-portage-dev] [PATCH 1/2] egencache --update-changelogs: Support setting ChangeLog file name Michał Górny
2015-11-02 21:46     ` [gentoo-portage-dev] [PATCH 2/2] egencache --update-changelogs: Support reversing order Michał Górny
2015-11-02 23:05   ` [gentoo-portage-dev] [PATCHES] egencache --update-changelogs: fixes for infra rsync Alexander Berntsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox