[elbe-devel] [PATCH v2] Replaced handmade dsc-file parsing by functionality of the deb822 package
Philipp Arras
philipp.arras at linutronix.de
Mon May 8 11:15:21 CEST 2017
Signed-off-by: Philipp Arras <philipp.arras at linutronix.de>
---
elbepack/soapclient.py | 30 +++++++++++-------------------
1 file changed, 11 insertions(+), 19 deletions(-)
diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
index 6cf2295..4f0f63d 100644
--- a/elbepack/soapclient.py
+++ b/elbepack/soapclient.py
@@ -30,6 +30,7 @@ import sys
import os
from datetime import datetime
+import deb822 # package for dealing with Debian related data
from elbepack.filesystem import Filesystem
from elbepack.elbexml import ElbeXML, ValidationMode
@@ -711,26 +712,17 @@ class UploadPackageAction(RepoAction):
# Parse .dsc-File and append neccessary source files to files
if filetype == '.dsc':
- sources = []
- p=0
-
- with open(filename) as f:
- lines = f.read().splitlines()
-
- for l in lines:
- if l.startswith('Files'):
- p=1
- continue
- elif p==1 and l=="":
- p=0
- break
- if p: files.append(l.split()[2])
+ for f in deb822.Dsc(file(filename))['Files']:
+ files.append(f['name'])
- # Check whether source files are available
- for f in sources:
- if not os.path.isfile(f):
- print("Source file %s not found although being specified in %s." % (f, filename))
- sys.exit(20)
+ # Check whether all files are available
+ abort = False
+ for f in files:
+ if not os.path.isfile(f):
+ print("File %s not found." % f)
+ abort = True
+ # Abort if one or more source files are missing
+ if abort: sys.exit(20)
print ("Start uploading file(s)...")
for f in files:
--
2.1.4
More information about the elbe-devel
mailing list