From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 54AB1138247 for ; Fri, 29 Nov 2013 23:25:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 33BCEE0B17; Fri, 29 Nov 2013 23:24:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 97DA5E0B17 for ; Fri, 29 Nov 2013 23:24:58 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5123533F217 for ; Fri, 29 Nov 2013 23:24:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D4A22E5529 for ; Fri, 29 Nov 2013 23:24:55 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1385767263.c145e3cfcc016694f76488c21caaae37e3f3664e.vapier@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: bin/egencache pym/portage/const.py X-VCS-Directories: bin/ pym/portage/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: c145e3cfcc016694f76488c21caaae37e3f3664e X-VCS-Branch: master Date: Fri, 29 Nov 2013 23:24:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 3834f668-b5b5-45f2-9d99-043c84327c44 X-Archives-Hash: be4ce712ec7a732c17cba997757361c4 commit: c145e3cfcc016694f76488c21caaae37e3f3664e Author: Sebastian Luther gmx de> AuthorDate: Fri Nov 29 18:02:21 2013 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Fri Nov 29 23:21:03 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c145e3cf egencache: --write-timestamp to create metadata/timestamp.chk This is required to sync repositories using rsnyc. URL: https://bugs.gentoo.org/488972 --- bin/egencache | 14 ++++++++++++++ pym/portage/const.py | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/bin/egencache b/bin/egencache index 54c517e..915adc8 100755 --- a/bin/egencache +++ b/bin/egencache @@ -48,6 +48,7 @@ portage._internal_caller = True from portage import os, _encodings, _unicode_encode, _unicode_decode from _emerge.MetadataRegen import MetadataRegen from portage.cache.cache_errors import CacheError, StatCollision +from portage.const import TIMESTAMP_FORMAT from portage.manifest import guessManifestFileType from portage.package.ebuild._parallel_manifest.ManifestScheduler import ManifestScheduler from portage.util import cmp_sort_key, writemsg_level @@ -133,6 +134,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 +1067,16 @@ 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: + with open(timestamp_path, 'w') as f: + f.write(time.strftime('%s\n' % TIMESTAMP_FORMAT, time.gmtime())) + except IOError: + ret.append(os.EX_IOERR) + else: + ret.append(os.EX_OK) + return max(ret) if __name__ == "__main__": diff --git a/pym/portage/const.py b/pym/portage/const.py index 214ede4..b2e970e 100644 --- a/pym/portage/const.py +++ b/pym/portage/const.py @@ -175,6 +175,10 @@ if "PORTAGE_OVERRIDE_EPREFIX" in os.environ: VCS_DIRS = ("CVS", "RCS", "SCCS", ".bzr", ".git", ".hg", ".svn") SUPPORTED_BINPKG_FORMATS = ("tar", "rpm") + +# Time formats used in various places like metadata.chk. +TIMESTAMP_FORMAT = "%a, %d %b %Y %H:%M:%S +0000" # to be used with time.gmtime() + # =========================================================================== # END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT # ===========================================================================