diff --git a/bin/is b/bin/is index bbb0ece8764868bc9cf7ab9886d72a9e7c58247d..bf6da20e178dd40306ca1ec7260cd252c94ebd04 100755 --- a/bin/is +++ b/bin/is @@ -35,7 +35,8 @@ def load_repositories(args): # load repo configs if args.repo_path is not None: # 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: # from config for repoconf in RepoConfigFile(args.repo_config).repos: diff --git a/installsystems/repository.py b/installsystems/repository.py index 04b8f4a46d3ea6b16ec44b0608814d21448472c0..c0a3845cc9bdcd66e01d5f83c1fd9ae90b87990f 100644 --- a/installsystems/repository.py +++ b/installsystems/repository.py @@ -476,7 +476,7 @@ class RepositoryManager(object): self.cache_path = None debug("No repository cache") else: - if istools.pathtype(cache_path) != "file": + if not istools.isfile(cache_path): raise NotImplementedError("Repository cache must be local") self.cache_path = os.path.abspath(cache_path) # must_path is a list of directory which must exists diff --git a/installsystems/tools.py b/installsystems/tools.py index 30b06d16be2980bb0c38ad8fd16c4035317f4a65..e061d08cef85b5f3a734c3d541c2ea0e77b0ca27 100644 --- a/installsystems/tools.py +++ b/installsystems/tools.py @@ -28,6 +28,14 @@ def md5sum(path=None, fileobj=None): m.update(buf) return m.hexdigest() +def smd5sum(buf): + ''' + Compute md5 of a string + ''' + m = hashlib.md5() + m.update(buf) + return m.hexdigest() + def copyfileobj(sfile, dfile): ''' Copy data from sfile to dfile computing length and md5 on the fly