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
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",
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__":
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
# ===========================================================================