[merge] cleanup from -catbox branch/merge quilt support
This commit is contained in:
+22
-21
@@ -265,12 +265,12 @@ def check_file(file, mode = os.F_OK):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
# FIXME: check_dir is not a good name considering it can also create the dir
|
# FIXME: check_dir is not a good name considering it can also create the dir
|
||||||
def check_dir(dir):
|
def check_dir(d):
|
||||||
"""Make sure given directory path exists."""
|
"""Make sure given directory path exists."""
|
||||||
# FIXME: What is first strip doing there?
|
# FIXME: What is first strip doing there?
|
||||||
dir = dir.strip().rstrip("/")
|
d = d.strip().rstrip("/")
|
||||||
if not os.access(dir, os.F_OK):
|
if not os.access(d, os.F_OK):
|
||||||
os.makedirs(dir)
|
os.makedirs(d)
|
||||||
|
|
||||||
def clean_dir(path):
|
def clean_dir(path):
|
||||||
"""Remove all content of a directory."""
|
"""Remove all content of a directory."""
|
||||||
@@ -393,8 +393,8 @@ def get_file_hashes(top, excludePrefix=None, removePrefix=None):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
#bug 397
|
#bug 397
|
||||||
for dir in dirs:
|
for directory in dirs:
|
||||||
d = join_path(root, dir)
|
d = join_path(root, directory)
|
||||||
if os.path.islink(d) and not has_excluded_prefix(d):
|
if os.path.islink(d) and not has_excluded_prefix(d):
|
||||||
yield (d, sha1_sum(os.readlink(d), True))
|
yield (d, sha1_sum(os.readlink(d), True))
|
||||||
excludePrefix.append(remove_prefix(removePrefix, d) + "/")
|
excludePrefix.append(remove_prefix(removePrefix, d) + "/")
|
||||||
@@ -455,7 +455,7 @@ def sha1_data(data):
|
|||||||
return m.hexdigest()
|
return m.hexdigest()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except Exception, e: #FIXME: what exception could we catch here, replace with that.
|
except Exception: #FIXME: what exception could we catch here, replace with that.
|
||||||
raise Error(_("Cannot calculate SHA1 hash of given data"))
|
raise Error(_("Cannot calculate SHA1 hash of given data"))
|
||||||
|
|
||||||
def uncompress(patchFile, compressType="gz", targetDir=None):
|
def uncompress(patchFile, compressType="gz", targetDir=None):
|
||||||
@@ -488,8 +488,20 @@ def do_patch(sourceDir, patchFile, level = 0):
|
|||||||
level = 0
|
level = 0
|
||||||
|
|
||||||
check_file(patchFile)
|
check_file(patchFile)
|
||||||
(ret, out, err) = run_batch("patch -p%d < \"%s\"" %
|
|
||||||
(level, patchFile))
|
if ctx.get_option('use_quilt'):
|
||||||
|
patchesDir = join_path(sourceDir, ctx.const.quilt_dir_suffix)
|
||||||
|
# Make sure sourceDir/patches directory exists and if not create one!
|
||||||
|
if not os.path.exists(patchesDir):
|
||||||
|
os.makedirs(patchesDir)
|
||||||
|
# Import original patch into quilt tree
|
||||||
|
(ret, out, err) = run_batch('quilt import -p %d -n %s \"%s\"' % (level, os.path.basename(patchFile), patchFile))
|
||||||
|
# run quilt push to apply original patch into tree
|
||||||
|
(ret, out, err) = run_batch('quilt push')
|
||||||
|
else:
|
||||||
|
# run GNU patch to apply original patch into tree
|
||||||
|
(ret, out, err) = run_batch("patch -p%d < \"%s\"" % (level, patchFile))
|
||||||
|
|
||||||
if ret:
|
if ret:
|
||||||
if out is None and err is None:
|
if out is None and err is None:
|
||||||
# Which means stderr and stdout directed so they are None
|
# Which means stderr and stdout directed so they are None
|
||||||
@@ -605,24 +617,13 @@ def is_package_name(fn, package_name = None):
|
|||||||
# get version string, skip separator '-'
|
# get version string, skip separator '-'
|
||||||
verstr = fn[len(package_name) + 1:
|
verstr = fn[len(package_name) + 1:
|
||||||
len(fn)-len(ctx.const.package_suffix)]
|
len(fn)-len(ctx.const.package_suffix)]
|
||||||
import string
|
|
||||||
for x in verstr.split('-'):
|
for x in verstr.split('-'):
|
||||||
# weak rule: version components after '-' start with a digit
|
# weak rule: version components after '-' start with a digit
|
||||||
if x is '' or (not x[0] in string.digits):
|
if x == '' or (not x[0] in string.digits):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def env_update():
|
|
||||||
import pisi.environment
|
|
||||||
ctx.ui.info(_('Updating environment...'))
|
|
||||||
|
|
||||||
env_dir = join_path(ctx.config.dest_dir(), "/etc/env.d")
|
|
||||||
if not os.path.exists(env_dir):
|
|
||||||
os.makedirs(env_dir, 0755)
|
|
||||||
|
|
||||||
pisi.environment.update_environment(ctx.config.dest_dir())
|
|
||||||
|
|
||||||
def parse_package_name(package_name):
|
def parse_package_name(package_name):
|
||||||
"""Separate package name and version string.
|
"""Separate package name and version string.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user