aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2008-04-12 13:42:08 +0200
committerGuido Guenther <agx@sigxcpu.org>2008-04-12 13:42:08 +0200
commit33b31ef170ed55454dc6ce60920d2825192d03f1 (patch)
treeb1fa9553edfff8f23db047471eb8ebc91601f68b
parentcfd2958072a71ab5651bfc771605943e48e9921a (diff)
better handle broken dsc files
-rwxr-xr-xgit-import-dsc9
1 files changed, 8 insertions, 1 deletions
diff --git a/git-import-dsc b/git-import-dsc
index 59d2c215..87fd90f2 100755
--- a/git-import-dsc
+++ b/git-import-dsc
@@ -38,6 +38,9 @@ class DscFile(object):
diff_re = re.compile('^\s\w+\s\d+\s+(?P<diff>[^_]+_[^_]+\.diff.(gz|bz2))')
def __init__(self, dscfile):
+ self.pkg = ""
+ self.tgz = ""
+ self.diff = ""
self.dscfile = os.path.abspath(dscfile)
f = file(self.dscfile)
fromdir = os.path.dirname(os.path.abspath(dscfile))
@@ -65,6 +68,10 @@ class DscFile(object):
self.diff = os.path.join(fromdir, m.group('diff'))
continue
f.close()
+ if not self.pkg:
+ raise GbpError, "Cannot parse package name from %s" % self.dscfile
+ elif not self.tgz:
+ raise GbpError, "Cannot parse archive name from %s" % self.dscfile
def parse_dsc(dscfile):
@@ -134,7 +141,7 @@ def apply_debian_patch(src, dirs, options):
try:
os.chdir(dirs['git'])
repo = GitRepository('.')
- if src.__dict__.has_key('diff') and not git_apply_patch(src.diff):
+ if src.diff and not git_apply_patch(src.diff):
raise GbpError
os.chmod('debian/rules', 0755)
if not repo.is_clean()[0]: