Gentoo Archives: gentoo-portage-dev

From: SebastianLuther@×××.de
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] egencache: --write-timestamp to create metadata/timestamp.chk
Date: Fri, 29 Nov 2013 13:36:58
Message-Id: 1385732203-11569-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 | 13 +++++++++++++
8 1 file changed, 13 insertions(+)
9
10 diff --git a/bin/egencache b/bin/egencache
11 index 54c517e..c8d41bf 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,16 @@ 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 + with open(timestamp_path, "w") as f:
32 + f.write(time.strftime("%a, %d %b %Y %H:%M:%S +0000\n", time.gmtime()))
33 + except IOError:
34 + ret.append(1)
35 + else:
36 + ret.append(os.EX_OK)
37 +
38 return max(ret)
39
40 if __name__ == "__main__":
41 --
42 1.8.1.5

Replies