Skip to content
Snippets Groups Projects
Commit 4575bdb3 authored by Seblu's avatar Seblu
Browse files

temporary repo now have a unique identifier

THis is very useful to be able to list it !
parent 851fc98a
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,8 @@ def load_repositories(args): ...@@ -35,7 +35,8 @@ def load_repositories(args):
# load repo configs # load repo configs
if args.repo_path is not None: if args.repo_path is not None:
# from command line # from command line
repoman.register(RepositoryConfig(None, path=args.repo_path)) repoman.register(RepositoryConfig(istools.smd5sum(args.repo_path)[:8],
path=args.repo_path))
else: else:
# from config # from config
for repoconf in RepoConfigFile(args.repo_config).repos: for repoconf in RepoConfigFile(args.repo_config).repos:
......
...@@ -476,7 +476,7 @@ class RepositoryManager(object): ...@@ -476,7 +476,7 @@ class RepositoryManager(object):
self.cache_path = None self.cache_path = None
debug("No repository cache") debug("No repository cache")
else: else:
if istools.pathtype(cache_path) != "file": if not istools.isfile(cache_path):
raise NotImplementedError("Repository cache must be local") raise NotImplementedError("Repository cache must be local")
self.cache_path = os.path.abspath(cache_path) self.cache_path = os.path.abspath(cache_path)
# must_path is a list of directory which must exists # must_path is a list of directory which must exists
......
...@@ -28,6 +28,14 @@ def md5sum(path=None, fileobj=None): ...@@ -28,6 +28,14 @@ def md5sum(path=None, fileobj=None):
m.update(buf) m.update(buf)
return m.hexdigest() return m.hexdigest()
def smd5sum(buf):
'''
Compute md5 of a string
'''
m = hashlib.md5()
m.update(buf)
return m.hexdigest()
def copyfileobj(sfile, dfile): def copyfileobj(sfile, dfile):
''' '''
Copy data from sfile to dfile computing length and md5 on the fly Copy data from sfile to dfile computing length and md5 on the fly
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment