From 4575bdb3dae17b2f15a8c537a460a27258bb029b Mon Sep 17 00:00:00 2001
From: Seblu <sebastien.luttringer@smartjog.com>
Date: Thu, 25 Aug 2011 10:39:16 +0200
Subject: [PATCH] temporary repo now have a unique identifier

THis is very useful to be able to list it !
---
 bin/is                       | 3 ++-
 installsystems/repository.py | 2 +-
 installsystems/tools.py      | 8 ++++++++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/bin/is b/bin/is
index bbb0ece..bf6da20 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 04b8f4a..c0a3845 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 30b06d1..e061d08 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
-- 
GitLab