aboutsummaryrefslogtreecommitdiff
path: root/git-import-dsc
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2006-10-06 19:17:14 +0200
committerGuido Guenther <agx@bogon.sigxcpu.org>2006-10-06 19:17:14 +0200
commit16425af87c8e566f5eff6b255c55ebf9159708c2 (patch)
treec20a8ce5846a3fa60e9ac60d5b32a34c3ccc1110 /git-import-dsc
parent29948a722e3a63668c29239e072381731070e017 (diff)
more robust regex matching, sanitze all version numbers before running git-tagdebian/0.2.7
Diffstat (limited to 'git-import-dsc')
-rwxr-xr-xgit-import-dsc18
1 files changed, 12 insertions, 6 deletions
diff --git a/git-import-dsc b/git-import-dsc
index 59d7b5ed..156aa804 100755
--- a/git-import-dsc
+++ b/git-import-dsc
@@ -24,6 +24,8 @@ import tempfile
import glob
from optparse import OptionParser
from git_buildpackage import *
+from git_buildpackage.git_utils import *
+from git_buildpackage.deb_utils import *
gitAdd=GitAdd()
gitCommitAll=GitCommitAll()
@@ -31,9 +33,10 @@ gitTag=GitTag()
class DscPackage(object):
"""Parse the dsc file for verions, package names, etc"""
- pkgre=re.compile('Source: (?P<pkg>[\w\-]+)')
- versionre=re.compile('Version: (?P<upstream>[a-z\d\.\+]+)(-(?P<debian>[a-z\d\.~\+]+))?')
- tarre=re.compile ('^ [\da-z]+ \d+ (?P<tar>[a-z\d\-]+_[a-z\d\.\~\+\-]+(\.orig)?\.tar\.gz)')
+ pkgre=re.compile('Source:\s+(?P<pkg>.+)\s*')
+ versionre=re.compile("Version:\s(\d+\:)?(?P<upstream>[%s]+)(-(?P<debian>[%s]+))?\s*$" %
+ (debian_version_chars, debian_version_chars))
+ tarre=re.compile('^\s\w+\s\d+\s+(?P<tar>[^_]+_[^_]+(\.orig)?\.tar\.(gz|bz2))')
def __init__(self, dscfile):
self.dscfile=os.path.abspath(dscfile)
@@ -45,9 +48,12 @@ class DscPackage(object):
if m.group('debian'):
self.debian_version = m.group('debian')
self.native = False
+ print "Upstream version:", self.upstream_version
+ print "Debian version:", self.debian_version
else:
print "Debian Native Package"
self.native = True # Debian native package
+ print "Version:", self.upstream_version
continue
m=self.pkgre.match(line)
if m:
@@ -61,7 +67,7 @@ class DscPackage(object):
self.tgz = dir+m.group('tar')
continue
f.close()
-
+
def import_upstream(src, dirs, upstream_branch):
try:
@@ -78,7 +84,7 @@ def import_upstream(src, dirs, upstream_branch):
GitInitDB()()
gitAdd(['.'])
gitCommitAll(msg="Imported %s version %s" % (['upstream','Debian'][src.native],src.upstream_version,))
- gitTag(src.upstream_version)
+ gitTag(sanitize_version(src.upstream_version))
if not src.native:
GitBranch()(upstream_branch)
except CommandExecFailed:
@@ -93,7 +99,7 @@ def apply_debian_patch(src, dirs):
DpkgSourceExtract()(src.dscfile, dirs['dpkg-src'])
os.chdir(dirs['git'])
GitLoadDirs()(dirs['dpkg-src'], 'Imported Debian patch')
- gitTag('%s-%s' % (src.upstream_version, src.debian_version))
+ gitTag(sanitize_version('%s-%s' % (src.upstream_version, src.debian_version)))
except CommandExecFailed:
print >>sys.stderr,"Failed to import Debian package"
return 1