From: Sebastian Luther <sebastianlut...@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 via email to