Gentoo Archives: gentoo-portage-dev

From: SebastianLuther@×××.de
To: gentoo-portage-dev@l.g.o
Cc: Sebastian Luther <SebastianLuther@×××.de>
Subject: [gentoo-portage-dev] [PATCH] egencache: --write-timestamp to create metadata/timestamp.chk
Date: Wed, 27 Nov 2013 10:31:29
Message-Id: 1385548277-18122-1-git-send-email-SebastianLuther@gmx.de
1 From: Sebastian Luther <SebastianLuther@×××.de>
2
3 This is required to sync repositories using rsnyc.
4
5 URL: https://bugs.gentoo.org/488972
6 ---
7 bin/egencache | 18 ++++++++++++++++++
8 1 file changed, 18 insertions(+)
9
10 diff --git a/bin/egencache b/bin/egencache
11 index 54c517e..6ff1dcb 100755
12 --- a/bin/egencache
13 +++ b/bin/egencache
14 @@ -133,6 +133,9 @@ def parse_args(args):
15 common.add_argument("--ignore-default-opts",
16 action="store_true",
17 help="do not use the EGENCACHE_DEFAULT_OPTS environment variable")
18 + common.add_argument("--write-timestamp",
19 + action="store_true",
20 + help="write metdata/timestamp.chk as required for rsync repositories")
21
22 update = parser.add_argument_group('--update options')
23 update.add_argument("--cache-dir",
24 @@ -1063,6 +1066,21 @@ def egencache_main(args):
25 gen_clogs.run()
26 ret.append(gen_clogs.returncode)
27
28 + if options.write_timestamp:
29 + timestamp_path = os.path.join(repo_path, "metadata", "timestamp.chk")
30 + try:
31 + timestampfile = open(timestamp_path, "w")
32 + try:
33 + timestampfile.write(
34 + time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()))
35 + timestampfile.write("\n")
36 + finally:
37 + timestampfile.close()
38 + except IOError:
39 + ret.append(1)
40 + else:
41 + ret.append(os.EX_OK)
42 +
43 return max(ret)
44
45 if __name__ == "__main__":
46 --
47 1.8.1.5

Replies