[PATCH 2/4] Add the hashtype to the 'sources' file

Mathieu Bridon bochecha at fedoraproject.org
Thu Feb 5 16:35:46 UTC 2015


From: Mathieu Bridon <bochecha at daitauha.fr>

It is added to each new line of the file. Existing lines are left
untouched.

This is fine, because the reading of the file is capable (as per
previous commit) to handle both type of lines indiscriminately.
---
 src/pyrpkg/__init__.py | 2 +-
 src/pyrpkg/sources.py  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py
index f9606fe..38fe7e6 100644
--- a/src/pyrpkg/__init__.py
+++ b/src/pyrpkg/__init__.py
@@ -2271,7 +2271,7 @@ class Commands(object):
             self.log.info("Uploading: %s  %s" % (file_hash, f))
             file_basename = os.path.basename(f)
             if (file_hash, file_basename) not in sources:
-                sources.append((file_hash, file_basename))
+                sources.append((self.lookasidehash, file_hash, file_basename))
 
             # Add this file to .gitignore if it's not already there:
             if not gitignore.match(file_basename):
diff --git a/src/pyrpkg/sources.py b/src/pyrpkg/sources.py
index 8d8b277..c4c31be 100644
--- a/src/pyrpkg/sources.py
+++ b/src/pyrpkg/sources.py
@@ -50,7 +50,7 @@ def _parse_line(line):
 
 
 def _format_line(entry):
-    if len(entry) != 0 and len(entry) != 2:
+    if len(entry) not in (0, 2, 3):
         raise ValueError("Incorrect number of fields for entry: %r."
                          % (entry,))
     return "  ".join(entry)
-- 
2.1.0



More information about the buildsys mailing list