public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: SebastianLuther@gmx.de
To: gentoo-portage-dev@lists.gentoo.org
Cc: Sebastian Luther <SebastianLuther@gmx.de>
Subject: [gentoo-portage-dev] [PATCH] egencache: --write-timestamp to create metadata/timestamp.chk
Date: Wed, 27 Nov 2013 11:31:17 +0100	[thread overview]
Message-ID: <1385548277-18122-1-git-send-email-SebastianLuther@gmx.de> (raw)

From: Sebastian Luther <SebastianLuther@gmx.de>

This is required to sync repositories using rsnyc.

URL: https://bugs.gentoo.org/488972
---
 bin/egencache | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/bin/egencache b/bin/egencache
index 54c517e..6ff1dcb 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -133,6 +133,9 @@ def parse_args(args):
 	common.add_argument("--ignore-default-opts",
 		action="store_true",
 		help="do not use the EGENCACHE_DEFAULT_OPTS environment variable")
+	common.add_argument("--write-timestamp",
+		action="store_true",
+		help="write metdata/timestamp.chk as required for rsync repositories")
 
 	update = parser.add_argument_group('--update options')
 	update.add_argument("--cache-dir",
@@ -1063,6 +1066,21 @@ def egencache_main(args):
 		gen_clogs.run()
 		ret.append(gen_clogs.returncode)
 
+	if options.write_timestamp:
+		timestamp_path = os.path.join(repo_path, "metadata", "timestamp.chk")
+		try:
+			timestampfile = open(timestamp_path, "w")
+			try:
+				timestampfile.write(
+					time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()))
+				timestampfile.write("\n")
+			finally:
+				timestampfile.close()
+		except IOError:
+			ret.append(1)
+		else:
+			ret.append(os.EX_OK)
+
 	return max(ret)
 
 if __name__ == "__main__":
-- 
1.8.1.5



             reply	other threads:[~2013-11-27 10:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 10:31 SebastianLuther [this message]
2013-11-27 21:20 ` [gentoo-portage-dev] [PATCH] egencache: --write-timestamp to create metadata/timestamp.chk Mike Frysinger
2013-11-27 21:41   ` Sebastian Luther
2013-11-27 21:45     ` Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2013-11-29 13:36 SebastianLuther
2013-11-29 14:17 ` Mike Frysinger

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=1385548277-18122-1-git-send-email-SebastianLuther@gmx.de \
    --to=sebastianluther@gmx.de \
    --cc=gentoo-portage-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