yanlış yere commit etmişim catbox altında deneyip daha sonra merge etmek istiyordum, komple geri alıyorum :(
This commit is contained in:
+14
-11
@@ -90,6 +90,7 @@ def init(database = True, write = True,
|
|||||||
ctx.stderr = stderr
|
ctx.stderr = stderr
|
||||||
|
|
||||||
# FIXME: something is wrong here... see __init__.py also. Why do we import pisi.api in __init__.py
|
# FIXME: something is wrong here... see __init__.py also. Why do we import pisi.api in __init__.py
|
||||||
|
import pisi.config
|
||||||
ctx.config = pisi.config.Config(options)
|
ctx.config = pisi.config.Config(options)
|
||||||
|
|
||||||
if signal_handling:
|
if signal_handling:
|
||||||
@@ -162,6 +163,8 @@ def list_available(repo = None):
|
|||||||
return set(ctx.packagedb.list_packages(repo = repo))
|
return set(ctx.packagedb.list_packages(repo = repo))
|
||||||
|
|
||||||
def list_upgradable():
|
def list_upgradable():
|
||||||
|
ignore_build = ctx.get_option('ignore_build_no')
|
||||||
|
|
||||||
return filter(pisi.operations.is_upgradable, ctx.installdb.list_installed())
|
return filter(pisi.operations.is_upgradable, ctx.installdb.list_installed())
|
||||||
|
|
||||||
def package_graph(A, repo = pisi.itembyrepodb.installed, ignore_installed = False):
|
def package_graph(A, repo = pisi.itembyrepodb.installed, ignore_installed = False):
|
||||||
@@ -355,14 +358,14 @@ def search_in_packages(terms, packages, repo = pisi.itembyrepodb.all):
|
|||||||
def check(package):
|
def check(package):
|
||||||
md, files = info(package, True)
|
md, files = info(package, True)
|
||||||
corrupt = []
|
corrupt = []
|
||||||
for f in files.list:
|
for file in files.list:
|
||||||
if f.hash and f.type != "config" \
|
if file.hash and file.type != "config" \
|
||||||
and not os.path.islink('/' + f.path):
|
and not os.path.islink('/' + file.path):
|
||||||
ctx.ui.info(_("Checking /%s ") % f.path, noln=True, verbose=True)
|
ctx.ui.info(_("Checking /%s ") % file.path, noln=True, verbose=True)
|
||||||
try:
|
try:
|
||||||
if f.hash != pisi.util.sha1_file('/' + f.path):
|
if file.hash != pisi.util.sha1_file('/' + file.path):
|
||||||
corrupt.append(f)
|
corrupt.append(file)
|
||||||
ctx.ui.error(_("\nCorrupt file: %s") % f)
|
ctx.ui.error(_("\nCorrupt file: %s") % file)
|
||||||
else:
|
else:
|
||||||
ctx.ui.info(_("OK"), verbose=True)
|
ctx.ui.info(_("OK"), verbose=True)
|
||||||
except pisi.util.FileError,e:
|
except pisi.util.FileError,e:
|
||||||
@@ -459,7 +462,7 @@ def rebuild_repo(repo):
|
|||||||
|
|
||||||
def rebuild_db(files=False):
|
def rebuild_db(files=False):
|
||||||
|
|
||||||
assert not ctx.database
|
assert ctx.database == False
|
||||||
|
|
||||||
# Bug 2596
|
# Bug 2596
|
||||||
# finds and cleans duplicate package directories under '/var/lib/pisi/package'
|
# finds and cleans duplicate package directories under '/var/lib/pisi/package'
|
||||||
@@ -510,7 +513,7 @@ def rebuild_db(files=False):
|
|||||||
percent = progress.update(processed),
|
percent = progress.update(processed),
|
||||||
info = _("Rebuilding package database"))
|
info = _("Rebuilding package database"))
|
||||||
|
|
||||||
def reload_indices():
|
def reload_indices(txn):
|
||||||
index_dir = ctx.config.index_dir()
|
index_dir = ctx.config.index_dir()
|
||||||
if os.path.exists(index_dir): # it may have been erased, or we may be upgrading from a previous version -- exa
|
if os.path.exists(index_dir): # it may have been erased, or we may be upgrading from a previous version -- exa
|
||||||
for repo in os.listdir(index_dir):
|
for repo in os.listdir(index_dir):
|
||||||
@@ -524,7 +527,7 @@ def rebuild_db(files=False):
|
|||||||
shelve.check_dbversion('filesdbversion', pisi.__filesdbversion__, write=False)
|
shelve.check_dbversion('filesdbversion', pisi.__filesdbversion__, write=False)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except Exception: #FIXME: what exception could we catch here, replace with that.
|
except Exception, e: #FIXME: what exception could we catch here, replace with that.
|
||||||
files = True # exception means the files db version was wrong
|
files = True # exception means the files db version was wrong
|
||||||
shelve.init_dbenv(write=True, writeversion=True)
|
shelve.init_dbenv(write=True, writeversion=True)
|
||||||
destroy(files) # bye bye
|
destroy(files) # bye bye
|
||||||
@@ -540,7 +543,7 @@ def rebuild_db(files=False):
|
|||||||
clean_duplicates()
|
clean_duplicates()
|
||||||
txn = ctx.dbenv.txn_begin()
|
txn = ctx.dbenv.txn_begin()
|
||||||
reload_packages(files, txn)
|
reload_packages(files, txn)
|
||||||
reload_indices()
|
reload_indices(txn)
|
||||||
txn.commit()
|
txn.commit()
|
||||||
|
|
||||||
############# FIXME: this was a quick fix. ##############################
|
############# FIXME: this was a quick fix. ##############################
|
||||||
|
|||||||
+17
-14
@@ -15,12 +15,15 @@ import gettext
|
|||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
|
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import bsddb3.db as db
|
import bsddb3.db as db
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
import pisi
|
import pisi
|
||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
|
import pisi.packagedb as packagedb
|
||||||
|
import pisi.dependency as dependency
|
||||||
import pisi.conflict
|
import pisi.conflict
|
||||||
import pisi.util as util
|
import pisi.util as util
|
||||||
import pisi.metadata
|
import pisi.metadata
|
||||||
@@ -146,7 +149,7 @@ class Install(AtomicOperation):
|
|||||||
# check comar
|
# check comar
|
||||||
if self.metadata.package.providesComar and ctx.comar:
|
if self.metadata.package.providesComar and ctx.comar:
|
||||||
import pisi.comariface as comariface
|
import pisi.comariface as comariface
|
||||||
comariface.get_comar()
|
com = comariface.get_comar()
|
||||||
|
|
||||||
def check_relations(self):
|
def check_relations(self):
|
||||||
# check dependencies
|
# check dependencies
|
||||||
@@ -162,10 +165,10 @@ class Install(AtomicOperation):
|
|||||||
|
|
||||||
# check file conflicts
|
# check file conflicts
|
||||||
file_conflicts = []
|
file_conflicts = []
|
||||||
for f in self.files.list:
|
for file in self.files.list:
|
||||||
if ctx.filesdb.has_file(f.path):
|
if ctx.filesdb.has_file(file.path):
|
||||||
pkg, existing_file = ctx.filesdb.get_file(f.path)
|
pkg, existing_file = ctx.filesdb.get_file(file.path)
|
||||||
dst = pisi.util.join_path(ctx.config.dest_dir(), f.path)
|
dst = pisi.util.join_path(ctx.config.dest_dir(), file.path)
|
||||||
if pkg != self.pkginfo.name and not os.path.isdir(dst):
|
if pkg != self.pkginfo.name and not os.path.isdir(dst):
|
||||||
file_conflicts.append( (pkg, existing_file) )
|
file_conflicts.append( (pkg, existing_file) )
|
||||||
if file_conflicts:
|
if file_conflicts:
|
||||||
@@ -275,8 +278,8 @@ class Install(AtomicOperation):
|
|||||||
fpath = pisi.util.join_path(ctx.config.dest_dir(), config.path)
|
fpath = pisi.util.join_path(ctx.config.dest_dir(), config.path)
|
||||||
if os.path.exists(fpath) and not os.path.isdir(fpath):
|
if os.path.exists(fpath) and not os.path.isdir(fpath):
|
||||||
if os.path.islink(fpath):
|
if os.path.islink(fpath):
|
||||||
f = os.readlink(fpath)
|
file = os.readlink(fpath)
|
||||||
if os.path.exists(f) and pisi.util.sha1_data(f) != config.hash:
|
if os.path.exists(file) and pisi.util.sha1_data(file) != config.hash:
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
if pisi.util.sha1_file(fpath) != config.hash:
|
if pisi.util.sha1_file(fpath) != config.hash:
|
||||||
@@ -355,13 +358,13 @@ class Install(AtomicOperation):
|
|||||||
config_overlaps = newconfig & oldconfig
|
config_overlaps = newconfig & oldconfig
|
||||||
if config_overlaps:
|
if config_overlaps:
|
||||||
files = filter(lambda x: x.path in config_overlaps, old)
|
files = filter(lambda x: x.path in config_overlaps, old)
|
||||||
for f in files:
|
for file in files:
|
||||||
check_config_changed(f)
|
check_config_changed(file)
|
||||||
else:
|
else:
|
||||||
for f in self.files.list:
|
for file in self.files.list:
|
||||||
if f.type == 'config':
|
if file.type == 'config':
|
||||||
# there may be left over config files
|
# there may be left over config files
|
||||||
check_config_changed(f)
|
check_config_changed(file)
|
||||||
|
|
||||||
if self.package_fname.endswith(ctx.const.delta_package_suffix):
|
if self.package_fname.endswith(ctx.const.delta_package_suffix):
|
||||||
relocate_files()
|
relocate_files()
|
||||||
@@ -508,7 +511,7 @@ class Remove(AtomicOperation):
|
|||||||
try:
|
try:
|
||||||
if pisi.util.sha1_file(fpath) == fileinfo.hash:
|
if pisi.util.sha1_file(fpath) == fileinfo.hash:
|
||||||
os.unlink(fpath)
|
os.unlink(fpath)
|
||||||
except pisi.util.FileError:
|
except pisi.util.FileError, e:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(fpath) or os.path.islink(fpath):
|
if os.path.isfile(fpath) or os.path.islink(fpath):
|
||||||
@@ -540,7 +543,7 @@ class Remove(AtomicOperation):
|
|||||||
def remove_db(self, txn):
|
def remove_db(self, txn):
|
||||||
ctx.installdb.remove(self.package_name, txn)
|
ctx.installdb.remove(self.package_name, txn)
|
||||||
ctx.filesdb.remove_files(self.files, txn)
|
ctx.filesdb.remove_files(self.files, txn)
|
||||||
ctx.packagedb.remove_tracking_package(self.package_name, txn)
|
pisi.packagedb.remove_tracking_package(self.package_name, txn)
|
||||||
|
|
||||||
|
|
||||||
def remove_single(package_name):
|
def remove_single(package_name):
|
||||||
|
|||||||
+8
-7
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
# python standard library
|
# python standard library
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import glob
|
import glob
|
||||||
import copy
|
import copy
|
||||||
import stat
|
import stat
|
||||||
@@ -416,7 +417,7 @@ class Builder:
|
|||||||
self.actionLocals[func]()
|
self.actionLocals[func]()
|
||||||
else:
|
else:
|
||||||
if mandatory:
|
if mandatory:
|
||||||
raise Error(_("unable to call function from actions: %s") % func)
|
Error, _("unable to call function from actions: %s") %func
|
||||||
|
|
||||||
os.chdir(curDir)
|
os.chdir(curDir)
|
||||||
return True
|
return True
|
||||||
@@ -559,7 +560,7 @@ class Builder:
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pisi.util.strip_directory(install_dir)
|
pisi.util.strip_directory(install_dir)
|
||||||
|
|
||||||
def gen_metadata_xml(self, package):
|
def gen_metadata_xml(self, package, build_no=None):
|
||||||
"""Generate the metadata.xml file for build source.
|
"""Generate the metadata.xml file for build source.
|
||||||
|
|
||||||
metadata.xml is composed of the information from specfile plus
|
metadata.xml is composed of the information from specfile plus
|
||||||
@@ -662,15 +663,15 @@ class Builder:
|
|||||||
ctx.ui.warning('Package file %s may be corrupt. Skipping.' % old_package_fn)
|
ctx.ui.warning('Package file %s may be corrupt. Skipping.' % old_package_fn)
|
||||||
|
|
||||||
for root, dirs, files in os.walk(ctx.config.compiled_packages_dir()):
|
for root, dirs, files in os.walk(ctx.config.compiled_packages_dir()):
|
||||||
for f in files:
|
for file in files:
|
||||||
locate_old_package(pisi.util.join_path(root,f))
|
locate_old_package(pisi.util.join_path(root,file))
|
||||||
|
|
||||||
outdir=ctx.get_option('output_dir')
|
outdir=ctx.get_option('output_dir')
|
||||||
if not outdir:
|
if not outdir:
|
||||||
outdir = '.'
|
outdir = '.'
|
||||||
for f in [pisi.util.join_path(outdir,entry) for entry in os.listdir(outdir)]:
|
for file in [pisi.util.join_path(outdir,entry) for entry in os.listdir(outdir)]:
|
||||||
if os.path.isfile(f):
|
if os.path.isfile(file):
|
||||||
locate_old_package(f)
|
locate_old_package(file)
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
return (1, None)
|
return (1, None)
|
||||||
|
|||||||
+26
-24
@@ -99,9 +99,9 @@ class Command(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def commands_string():
|
def commands_string():
|
||||||
s = ''
|
s = ''
|
||||||
l = [x.name[0] for x in Command.cmd]
|
list = [x.name[0] for x in Command.cmd]
|
||||||
l.sort()
|
list.sort()
|
||||||
for name in l:
|
for name in list:
|
||||||
commandcls = Command.cmd_dict[name]
|
commandcls = Command.cmd_dict[name]
|
||||||
trans = gettext.translation('pisi', fallback=True)
|
trans = gettext.translation('pisi', fallback=True)
|
||||||
summary = trans.ugettext(commandcls.__doc__).split('\n')[0]
|
summary = trans.ugettext(commandcls.__doc__).split('\n')[0]
|
||||||
@@ -173,12 +173,12 @@ class Command(object):
|
|||||||
|
|
||||||
# make destdir absolute
|
# make destdir absolute
|
||||||
if self.options.destdir:
|
if self.options.destdir:
|
||||||
d = str(self.options.destdir)
|
dir = str(self.options.destdir)
|
||||||
import os.path
|
import os.path
|
||||||
if not os.path.exists(d):
|
if not os.path.exists(dir):
|
||||||
pisi.cli.printu(_('Destination directory %s does not exist. Creating directory.\n') % d)
|
pisi.cli.printu(_('Destination directory %s does not exist. Creating directory.\n') % dir)
|
||||||
os.makedirs(d)
|
os.makedirs(dir)
|
||||||
self.options.destdir = os.path.realpath(d)
|
self.options.destdir = os.path.realpath(dir)
|
||||||
|
|
||||||
def check_auth_info(self):
|
def check_auth_info(self):
|
||||||
username = self.options.username
|
username = self.options.username
|
||||||
@@ -528,7 +528,7 @@ and creates a delta pisi package with the changed files between two releases.
|
|||||||
|
|
||||||
self.init(database=False, write=False)
|
self.init(database=False, write=False)
|
||||||
|
|
||||||
if len(self.args) != 2:
|
if len(self.args) is not 2:
|
||||||
self.help()
|
self.help()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -728,9 +728,9 @@ expanded to package names.
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
patterns = []
|
patterns = []
|
||||||
f = ctx.get_option('exclude_from')
|
file = ctx.get_option('exclude_from')
|
||||||
if os.path.exists(f):
|
if os.path.exists(file):
|
||||||
for line in open(f, "r").readlines():
|
for line in open(file, "r").readlines():
|
||||||
if not line.startswith('#') and not line == '\n':
|
if not line.startswith('#') and not line == '\n':
|
||||||
patterns.append(line.strip())
|
patterns.append(line.strip())
|
||||||
if patterns:
|
if patterns:
|
||||||
@@ -750,8 +750,8 @@ expanded to package names.
|
|||||||
|
|
||||||
if not match:
|
if not match:
|
||||||
# match pattern in component names
|
# match pattern in component names
|
||||||
for compare in fnmatch.filter(ctx.componentdb.list_components(), pattern):
|
for cmp in fnmatch.filter(ctx.componentdb.list_components(), pattern):
|
||||||
packages = packages - set(ctx.componentdb.get_union_packages(compare, walk=True))
|
packages = packages - set(ctx.componentdb.get_union_packages(cmp, walk=True))
|
||||||
|
|
||||||
return list(packages)
|
return list(packages)
|
||||||
|
|
||||||
@@ -966,6 +966,8 @@ Usage: info <package1> <package2> ... <packagen>
|
|||||||
ctx.ui.info(_("%s is not installed") % arg)
|
ctx.ui.info(_("%s is not installed") % arg)
|
||||||
|
|
||||||
def print_pkginfo(self, metadata, files, repo = None):
|
def print_pkginfo(self, metadata, files, repo = None):
|
||||||
|
import os.path
|
||||||
|
|
||||||
if ctx.get_option('short'):
|
if ctx.get_option('short'):
|
||||||
pkg = metadata.package
|
pkg = metadata.package
|
||||||
ctx.ui.info('%15s - %s' % (pkg.name, unicode(pkg.summary)))
|
ctx.ui.info('%15s - %s' % (pkg.name, unicode(pkg.summary)))
|
||||||
@@ -1379,12 +1381,12 @@ all repositories.
|
|||||||
|
|
||||||
component = ctx.get_option('component')
|
component = ctx.get_option('component')
|
||||||
if component:
|
if component:
|
||||||
l = ctx.componentdb.get_packages(component, walk=True, repo=repo)
|
list = ctx.componentdb.get_packages(component, walk=True, repo=repo)
|
||||||
else:
|
else:
|
||||||
l = ctx.packagedb.list_packages(repo)
|
list = ctx.packagedb.list_packages(repo)
|
||||||
installed_list = ctx.installdb.list_installed()
|
installed_list = ctx.installdb.list_installed()
|
||||||
l.sort()
|
list.sort()
|
||||||
for p in l:
|
for p in list:
|
||||||
package = ctx.packagedb.get_package(p)
|
package = ctx.packagedb.get_package(p)
|
||||||
if self.options.long:
|
if self.options.long:
|
||||||
ctx.ui.info(unicode(package))
|
ctx.ui.info(unicode(package))
|
||||||
@@ -1422,9 +1424,9 @@ repositories.
|
|||||||
|
|
||||||
self.init(database = True, write = False)
|
self.init(database = True, write = False)
|
||||||
|
|
||||||
l = ctx.componentdb.list_components()
|
list = ctx.componentdb.list_components()
|
||||||
l.sort()
|
list.sort()
|
||||||
for p in l:
|
for p in list:
|
||||||
component = ctx.componentdb.get_component(p)
|
component = ctx.componentdb.get_component(p)
|
||||||
if self.options.long:
|
if self.options.long:
|
||||||
ctx.ui.info(unicode(component))
|
ctx.ui.info(unicode(component))
|
||||||
@@ -1461,9 +1463,9 @@ Gives a brief list of sources published in the repositories.
|
|||||||
|
|
||||||
self.init(database = True, write = False)
|
self.init(database = True, write = False)
|
||||||
|
|
||||||
l = ctx.sourcedb.list()
|
list = ctx.sourcedb.list()
|
||||||
l.sort()
|
list.sort()
|
||||||
for p in l:
|
for p in list:
|
||||||
sf, repo = ctx.sourcedb.get_spec_repo(p)
|
sf, repo = ctx.sourcedb.get_spec_repo(p)
|
||||||
if self.options.long:
|
if self.options.long:
|
||||||
ctx.ui.info('[Repository: ' + repo + ']')
|
ctx.ui.info('[Repository: ' + repo + ']')
|
||||||
|
|||||||
+3
-3
@@ -82,9 +82,9 @@ class Config(object):
|
|||||||
return self.destdir
|
return self.destdir
|
||||||
|
|
||||||
def subdir(self, path):
|
def subdir(self, path):
|
||||||
subdir = pisi.util.join_path(self.dest_dir(), path)
|
dir = pisi.util.join_path(self.dest_dir(), path)
|
||||||
pisi.util.check_dir(subdir)
|
pisi.util.check_dir(dir)
|
||||||
return subdir
|
return dir
|
||||||
|
|
||||||
def lib_dir(self):
|
def lib_dir(self):
|
||||||
return self.subdir(self.values.dirs.lib_dir)
|
return self.subdir(self.values.dirs.lib_dir)
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import gettext
|
|||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
|
|
||||||
|
import pisi
|
||||||
|
|
||||||
class _constant:
|
class _constant:
|
||||||
"Constant members implementation"
|
"Constant members implementation"
|
||||||
class ConstError(TypeError):
|
class ConstError(TypeError):
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ import cPickle
|
|||||||
import bsddb3.db as db
|
import bsddb3.db as db
|
||||||
import bsddb3.dbobj as dbobj
|
import bsddb3.dbobj as dbobj
|
||||||
import string
|
import string
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
import pisi
|
import pisi
|
||||||
|
|
||||||
class CodingError(pisi.Error):
|
class CodingError(pisi.Error):
|
||||||
|
|||||||
+15
-15
@@ -74,8 +74,8 @@ def create_delta_package(old_package, new_package):
|
|||||||
ctx.build_leftover = util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar_lzma)
|
ctx.build_leftover = util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar_lzma)
|
||||||
|
|
||||||
tar = archive.ArchiveTar(util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar_lzma), "tarlzma")
|
tar = archive.ArchiveTar(util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar_lzma), "tarlzma")
|
||||||
for f in files_delta:
|
for file in files_delta:
|
||||||
tar.add_to_archive(f.path)
|
tar.add_to_archive(file.path)
|
||||||
tar.close()
|
tar.close()
|
||||||
|
|
||||||
os.chdir(ctx.config.tmp_dir())
|
os.chdir(ctx.config.tmp_dir())
|
||||||
@@ -99,34 +99,34 @@ def create_delta_package(old_package, new_package):
|
|||||||
def find_delta(oldfiles, newfiles):
|
def find_delta(oldfiles, newfiles):
|
||||||
|
|
||||||
hashto_files = {}
|
hashto_files = {}
|
||||||
for f in newfiles.list:
|
for file in newfiles.list:
|
||||||
hashto_files.setdefault(f.hash, []).append(f)
|
hashto_files.setdefault(file.hash, []).append(file)
|
||||||
|
|
||||||
files_new = sets.Set(map(lambda x:x.hash, newfiles.list))
|
files_new = sets.Set(map(lambda x:x.hash, newfiles.list))
|
||||||
files_old = sets.Set(map(lambda x:x.hash, oldfiles.list))
|
files_old = sets.Set(map(lambda x:x.hash, oldfiles.list))
|
||||||
files_delta = files_new - files_old
|
files_delta = files_new - files_old
|
||||||
|
|
||||||
deltas = []
|
deltas = []
|
||||||
for h in files_delta:
|
for hash in files_delta:
|
||||||
deltas.extend(hashto_files[h])
|
deltas.extend(hashto_files[hash])
|
||||||
|
|
||||||
return deltas
|
return deltas
|
||||||
|
|
||||||
def find_relocations(oldfiles, newfiles):
|
def find_relocations(oldfiles, newfiles):
|
||||||
|
|
||||||
files_new = {}
|
files_new = {}
|
||||||
for f in newfiles.list:
|
for file in newfiles.list:
|
||||||
files_new.setdefault(f.hash, []).append(f)
|
files_new.setdefault(file.hash, []).append(file)
|
||||||
|
|
||||||
files_old = {}
|
files_old = {}
|
||||||
for f in oldfiles.list:
|
for file in oldfiles.list:
|
||||||
files_old.setdefault(f.hash, []).append(f)
|
files_old.setdefault(file.hash, []).append(file)
|
||||||
|
|
||||||
relocations = []
|
relocations = []
|
||||||
for h in files_new.keys():
|
for hash in files_new.keys():
|
||||||
if h and h in files_old:
|
if hash and hash in files_old:
|
||||||
for i in range(len(files_new[h])):
|
for i in range(len(files_new[hash])):
|
||||||
if files_old[h][0].path != files_new[h][i].path:
|
if files_old[hash][0].path != files_new[hash][i].path:
|
||||||
relocations.append((files_old[h][0], files_new[h][i]))
|
relocations.append((files_old[hash][0], files_new[hash][i]))
|
||||||
|
|
||||||
return relocations
|
return relocations
|
||||||
|
|||||||
+5
-6
@@ -282,17 +282,17 @@ class FTPRangeHandler(urllib2.FTPHandler):
|
|||||||
path, attrs = urllib.splitattr(req.get_selector())
|
path, attrs = urllib.splitattr(req.get_selector())
|
||||||
dirs = path.split('/')
|
dirs = path.split('/')
|
||||||
dirs = map(urllib.unquote, dirs)
|
dirs = map(urllib.unquote, dirs)
|
||||||
dirs, f = dirs[:-1], dirs[-1]
|
dirs, file = dirs[:-1], dirs[-1]
|
||||||
if dirs and not dirs[0]:
|
if dirs and not dirs[0]:
|
||||||
dirs = dirs[1:]
|
dirs = dirs[1:]
|
||||||
try:
|
try:
|
||||||
fw = self.connect_ftp('', '', host, port, dirs)
|
fw = self.connect_ftp('', '', host, port, dirs)
|
||||||
t = f and 'I' or 'D'
|
type = file and 'I' or 'D'
|
||||||
for attr in attrs:
|
for attr in attrs:
|
||||||
attr, value = urllib.splitattr(attr)
|
attr, value = urllib.splitattr(attr)
|
||||||
if attr.lower() == 'type' and \
|
if attr.lower() == 'type' and \
|
||||||
value in ('a', 'A', 'i', 'I', 'd', 'D'):
|
value in ('a', 'A', 'i', 'I', 'd', 'D'):
|
||||||
t = value.upper()
|
type = value.upper()
|
||||||
|
|
||||||
rawr = req.headers.get('Range', None)
|
rawr = req.headers.get('Range', None)
|
||||||
if rawr:
|
if rawr:
|
||||||
@@ -300,7 +300,7 @@ class FTPRangeHandler(urllib2.FTPHandler):
|
|||||||
else:
|
else:
|
||||||
rest = 0
|
rest = 0
|
||||||
|
|
||||||
fp, retrlen = fw.retrfile(f, t, rest)
|
fp, retrlen = fw.retrfile(file, type, rest)
|
||||||
|
|
||||||
fb, lb = rest, retrlen
|
fb, lb = rest, retrlen
|
||||||
if retrlen is None or retrlen == 0:
|
if retrlen is None or retrlen == 0:
|
||||||
@@ -327,7 +327,7 @@ class FTPRangeHandler(urllib2.FTPHandler):
|
|||||||
raise IOError, (_('ftp error'), msg), sys.exc_info()[2]
|
raise IOError, (_('ftp error'), msg), sys.exc_info()[2]
|
||||||
|
|
||||||
def connect_ftp(self, user, passwd, host, port, dirs):
|
def connect_ftp(self, user, passwd, host, port, dirs):
|
||||||
fw = ftpwrapper(user, passwd, host, port, dirs)
|
fw = ftpwrapper('', '', host, port, dirs)
|
||||||
return fw
|
return fw
|
||||||
|
|
||||||
class ftpwrapper(urllib.ftpwrapper):
|
class ftpwrapper(urllib.ftpwrapper):
|
||||||
@@ -355,7 +355,6 @@ class ftpwrapper(urllib.ftpwrapper):
|
|||||||
if str(reason)[:3] == '501':
|
if str(reason)[:3] == '501':
|
||||||
# workaround for REST not suported error
|
# workaround for REST not suported error
|
||||||
fp, retrlen = self.retrfile(file, type)
|
fp, retrlen = self.retrfile(file, type)
|
||||||
# WTF? No global (RangeableFileObject) found. RangeableFileObject only defined in urlgrabber / caglar
|
|
||||||
fp = RangeableFileObject(fp, (rest,''))
|
fp = RangeableFileObject(fp, (rest,''))
|
||||||
return (fp, retrlen)
|
return (fp, retrlen)
|
||||||
elif str(reason)[:3] != '550':
|
elif str(reason)[:3] != '550':
|
||||||
|
|||||||
+3
-3
@@ -44,11 +44,11 @@ class Digraph(object):
|
|||||||
|
|
||||||
def edges(self):
|
def edges(self):
|
||||||
"return a list of edge descriptors"
|
"return a list of edge descriptors"
|
||||||
l = []
|
list = []
|
||||||
for u in self.__v:
|
for u in self.__v:
|
||||||
for v in self.__adj[u]:
|
for v in self.__adj[u]:
|
||||||
l.append( (u,v) )
|
list.append( (u,v) )
|
||||||
return l
|
return list
|
||||||
|
|
||||||
def from_list(self, el):
|
def from_list(self, el):
|
||||||
"convert a list of edges (u,v) to graph"
|
"convert a list of edges (u,v) to graph"
|
||||||
|
|||||||
@@ -23,12 +23,15 @@ import pisi
|
|||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
import pisi.specfile as specfile
|
import pisi.specfile as specfile
|
||||||
import pisi.metadata as metadata
|
import pisi.metadata as metadata
|
||||||
|
import pisi.packagedb as packagedb
|
||||||
|
import pisi.sourcedb as sourcedb
|
||||||
import pisi.util as util
|
import pisi.util as util
|
||||||
import pisi.package
|
import pisi.package
|
||||||
import pisi.pxml.xmlfile as xmlfile
|
import pisi.pxml.xmlfile as xmlfile
|
||||||
import pisi.file
|
import pisi.file
|
||||||
import pisi.pxml.autoxml as autoxml
|
import pisi.pxml.autoxml as autoxml
|
||||||
import pisi.component as component
|
import pisi.component as component
|
||||||
|
import pisi.specfile as specfile
|
||||||
|
|
||||||
class Error(pisi.Error):
|
class Error(pisi.Error):
|
||||||
pass
|
pass
|
||||||
|
|||||||
+10
-6
@@ -13,6 +13,10 @@
|
|||||||
# installation database
|
# installation database
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# System
|
||||||
|
import os
|
||||||
|
import fcntl
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
@@ -106,20 +110,20 @@ class InstallDB:
|
|||||||
|
|
||||||
def list_installed(self, txn = None):
|
def list_installed(self, txn = None):
|
||||||
def proc(txn):
|
def proc(txn):
|
||||||
l = []
|
list = []
|
||||||
for (pkg, info) in self.d.items(txn):
|
for (pkg, info) in self.d.items(txn):
|
||||||
if info.state=='i' or info.state=='ip':
|
if info.state=='i' or info.state=='ip':
|
||||||
l.append(pkg)
|
list.append(pkg)
|
||||||
return l
|
return list
|
||||||
return self.d.txn_proc(proc, txn)
|
return self.d.txn_proc(proc, txn)
|
||||||
|
|
||||||
def list_pending(self):
|
def list_pending(self):
|
||||||
# warning: reads the entire db
|
# warning: reads the entire db
|
||||||
d = {}
|
dict = {}
|
||||||
for (pkg, x) in self.dp.items():
|
for (pkg, x) in self.dp.items():
|
||||||
pkginfo = self.d[pkg]
|
pkginfo = self.d[pkg]
|
||||||
d[pkg] = pkginfo
|
dict[pkg] = pkginfo
|
||||||
return d
|
return dict
|
||||||
|
|
||||||
def get_info(self, pkg):
|
def get_info(self, pkg):
|
||||||
pkg = str(pkg)
|
pkg = str(pkg)
|
||||||
|
|||||||
@@ -10,11 +10,16 @@
|
|||||||
# Please read the COPYING file.
|
# Please read the COPYING file.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import fcntl
|
||||||
|
import types
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
|
|
||||||
import pisi
|
import pisi
|
||||||
|
import pisi.util as util
|
||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
import pisi.lockeddbshelve as shelve
|
import pisi.lockeddbshelve as shelve
|
||||||
|
|
||||||
@@ -85,6 +90,7 @@ class ItemByRepoDB(object):
|
|||||||
if repo == None:
|
if repo == None:
|
||||||
repo = repos
|
repo = repos
|
||||||
assert repo in [all, repos]
|
assert repo in [all, repos]
|
||||||
|
import pisi.repodb
|
||||||
order = [ 'repo-' + x for x in ctx.repodb.list() ]
|
order = [ 'repo-' + x for x in ctx.repodb.list() ]
|
||||||
if repo == all:
|
if repo == all:
|
||||||
order += ['trdparty', 'inst']
|
order += ['trdparty', 'inst']
|
||||||
|
|||||||
+10
-8
@@ -24,6 +24,7 @@ import pisi.util as util
|
|||||||
import pisi.dependency as dependency
|
import pisi.dependency as dependency
|
||||||
import pisi.conflict
|
import pisi.conflict
|
||||||
import pisi.pgraph as pgraph
|
import pisi.pgraph as pgraph
|
||||||
|
import pisi.packagedb as packagedb
|
||||||
import pisi.repodb
|
import pisi.repodb
|
||||||
import pisi.installdb
|
import pisi.installdb
|
||||||
import pisi.cli
|
import pisi.cli
|
||||||
@@ -245,7 +246,7 @@ def calculate_conflicts(order, packagedb):
|
|||||||
return (C, D, pkg_conflicts)
|
return (C, D, pkg_conflicts)
|
||||||
|
|
||||||
def remove_conflicting_packages(conflicts):
|
def remove_conflicting_packages(conflicts):
|
||||||
if not remove(conflicts, ignore_dep=True, ignore_safety=True):
|
if remove(conflicts, ignore_dep=True, ignore_safety=True) == False:
|
||||||
raise Error(_("Conflicts remain"))
|
raise Error(_("Conflicts remain"))
|
||||||
|
|
||||||
def check_conflicts(order, packagedb):
|
def check_conflicts(order, packagedb):
|
||||||
@@ -280,7 +281,7 @@ def is_upgradable(name, ignore_build = False):
|
|||||||
pkg = ctx.packagedb.get_package(name)
|
pkg = ctx.packagedb.get_package(name)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except Exception: #FIXME: what exception could we catch here, replace with that.
|
except Exception, e: #FIXME: what exception could we catch here, replace with that.
|
||||||
return False
|
return False
|
||||||
if ignore_build or (not build) or (not pkg.build):
|
if ignore_build or (not build) or (not pkg.build):
|
||||||
return pisi.version.Version(release) < pisi.version.Version(pkg.release)
|
return pisi.version.Version(release) < pisi.version.Version(pkg.release)
|
||||||
@@ -302,7 +303,7 @@ def upgrade_base(A = set(), ignore_package_conflicts = False):
|
|||||||
if extra_upgrades:
|
if extra_upgrades:
|
||||||
ctx.ui.warning(_('Safety switch: Following packages in system.base will be upgraded: ') +
|
ctx.ui.warning(_('Safety switch: Following packages in system.base will be upgraded: ') +
|
||||||
util.strlist(extra_upgrades))
|
util.strlist(extra_upgrades))
|
||||||
G_f, upgrade_order = plan_upgrade(extra_upgrades)
|
G_f, upgrade_order = plan_upgrade(extra_upgrades, ignore_build)
|
||||||
# return packages that must be added to any installation
|
# return packages that must be added to any installation
|
||||||
return set(install_order + upgrade_order)
|
return set(install_order + upgrade_order)
|
||||||
else:
|
else:
|
||||||
@@ -464,7 +465,7 @@ def upgrade_pkg_names(A = []):
|
|||||||
ctx.ui.debug('A = %s' % str(A))
|
ctx.ui.debug('A = %s' % str(A))
|
||||||
|
|
||||||
if not ctx.config.get_option('ignore_dependency'):
|
if not ctx.config.get_option('ignore_dependency'):
|
||||||
G_f, order = plan_upgrade(A)
|
G_f, order = plan_upgrade(A, ignore_build)
|
||||||
else:
|
else:
|
||||||
G_f = None
|
G_f = None
|
||||||
order = list(A)
|
order = list(A)
|
||||||
@@ -512,7 +513,7 @@ def upgrade_pkg_names(A = []):
|
|||||||
if 'pisi' in order:
|
if 'pisi' in order:
|
||||||
upgrade_pisi()
|
upgrade_pisi()
|
||||||
|
|
||||||
def plan_upgrade(A):
|
def plan_upgrade(A, ignore_build = False):
|
||||||
# try to construct a pisi graph of packages to
|
# try to construct a pisi graph of packages to
|
||||||
# install / reinstall
|
# install / reinstall
|
||||||
|
|
||||||
@@ -640,6 +641,7 @@ def plan_remove(A):
|
|||||||
while len(B) > 0:
|
while len(B) > 0:
|
||||||
Bp = set()
|
Bp = set()
|
||||||
for x in B:
|
for x in B:
|
||||||
|
pkg = ctx.packagedb.get_package(x, pisi.itembyrepodb.installed)
|
||||||
rev_deps = ctx.packagedb.get_rev_deps(x, pisi.itembyrepodb.installed)
|
rev_deps = ctx.packagedb.get_rev_deps(x, pisi.itembyrepodb.installed)
|
||||||
for (rev_dep, depinfo) in rev_deps:
|
for (rev_dep, depinfo) in rev_deps:
|
||||||
# we don't deal with uninstalled rev deps
|
# we don't deal with uninstalled rev deps
|
||||||
@@ -664,7 +666,7 @@ def expand_src_components(A):
|
|||||||
Ap.add(x)
|
Ap.add(x)
|
||||||
return Ap
|
return Ap
|
||||||
|
|
||||||
def emerge(A):
|
def emerge(A, rebuild_all = False):
|
||||||
|
|
||||||
# A was a list, remove duplicates and expand components
|
# A was a list, remove duplicates and expand components
|
||||||
A = [str(x) for x in A]
|
A = [str(x) for x in A]
|
||||||
@@ -680,7 +682,7 @@ def emerge(A):
|
|||||||
# FIXME: Errr... order_build changes type conditionally and this
|
# FIXME: Errr... order_build changes type conditionally and this
|
||||||
# is not good. - baris
|
# is not good. - baris
|
||||||
if not ctx.config.get_option('ignore_dependency'):
|
if not ctx.config.get_option('ignore_dependency'):
|
||||||
G_f, order_inst, order_build = plan_emerge(A)
|
G_f, order_inst, order_build = plan_emerge(A, rebuild_all)
|
||||||
else:
|
else:
|
||||||
G_f = None
|
G_f = None
|
||||||
order_inst = []
|
order_inst = []
|
||||||
@@ -721,7 +723,7 @@ installed in the respective order to satisfy dependencies:
|
|||||||
if 'pisi' in order_build or (('pisi' in U) and pisi_installed):
|
if 'pisi' in order_build or (('pisi' in U) and pisi_installed):
|
||||||
upgrade_pisi()
|
upgrade_pisi()
|
||||||
|
|
||||||
def plan_emerge(A):
|
def plan_emerge(A, rebuild_all):
|
||||||
|
|
||||||
# try to construct a pisi graph of packages to
|
# try to construct a pisi graph of packages to
|
||||||
# install / reinstall
|
# install / reinstall
|
||||||
|
|||||||
+7
-1
@@ -17,12 +17,18 @@ we basically store everything in PackageInfo class
|
|||||||
yes, we are cheap
|
yes, we are cheap
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import fcntl
|
||||||
|
import types
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
|
|
||||||
import pisi
|
import pisi
|
||||||
|
import pisi.util as util
|
||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
|
import pisi.lockeddbshelve as shelve
|
||||||
import pisi.itembyrepodb
|
import pisi.itembyrepodb
|
||||||
|
|
||||||
class Error(pisi.Error):
|
class Error(pisi.Error):
|
||||||
@@ -55,7 +61,7 @@ class PackageDB(object):
|
|||||||
def get_package(self, name, repo=None, txn = None):
|
def get_package(self, name, repo=None, txn = None):
|
||||||
try:
|
try:
|
||||||
return self.d.get_item(name, repo, txn=txn)
|
return self.d.get_item(name, repo, txn=txn)
|
||||||
except pisi.itembyrepodb.NotfoundError:
|
except pisi.itembyrepodb.NotfoundError, e:
|
||||||
raise Error(_('Package %s not found') % name)
|
raise Error(_('Package %s not found') % name)
|
||||||
|
|
||||||
def get_package_repo(self, name, repo=None, txn = None):
|
def get_package_repo(self, name, repo=None, txn = None):
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ class PGraph(graph.Digraph):
|
|||||||
pkg2 = self.packagedb.get_package(conflinfo.package, self.repo)
|
pkg2 = self.packagedb.get_package(conflinfo.package, self.repo)
|
||||||
pkg2data = (pkg2.version, pkg2.release)
|
pkg2data = (pkg2.version, pkg2.release)
|
||||||
|
|
||||||
# FIXME: WTF? /usr/lib/pardus/pisi/pgraph.py:80: Invalid arguments to (add_biedge), got 5, expected between 2 and 3 / caglar
|
|
||||||
self.add_biedge(str(pkg), str(conflinfo.package), ('c', conflinfo)
|
self.add_biedge(str(pkg), str(conflinfo.package), ('c', conflinfo)
|
||||||
, pkg1data, pkg2data )
|
, pkg1data, pkg2data )
|
||||||
|
|
||||||
|
|||||||
+7
-3
@@ -10,6 +10,8 @@
|
|||||||
# Please read the COPYING file.
|
# Please read the COPYING file.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os, fcntl
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
@@ -17,6 +19,8 @@ _ = __trans.ugettext
|
|||||||
import pisi
|
import pisi
|
||||||
import pisi.lockeddbshelve as shelve
|
import pisi.lockeddbshelve as shelve
|
||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
|
import pisi.packagedb as packagedb
|
||||||
|
import pisi.util as util
|
||||||
|
|
||||||
class Error(pisi.Error):
|
class Error(pisi.Error):
|
||||||
pass
|
pass
|
||||||
@@ -97,9 +101,9 @@ class RepoDB(object):
|
|||||||
name = str(name)
|
name = str(name)
|
||||||
def proc(txn):
|
def proc(txn):
|
||||||
self.d.delete("repo-" + name, txn)
|
self.d.delete("repo-" + name, txn)
|
||||||
l = self.d.get("order", txn)
|
list = self.d.get("order", txn)
|
||||||
l.remove(name)
|
list.remove(name)
|
||||||
self.d.put("order", l, txn)
|
self.d.put("order", list, txn)
|
||||||
ctx.packagedb.remove_repo(name, txn=txn)
|
ctx.packagedb.remove_repo(name, txn=txn)
|
||||||
ctx.sourcedb.remove_repo(name, txn=txn)
|
ctx.sourcedb.remove_repo(name, txn=txn)
|
||||||
ctx.componentdb.remove_repo(name, txn=txn)
|
ctx.componentdb.remove_repo(name, txn=txn)
|
||||||
|
|||||||
+7
-2
@@ -20,11 +20,16 @@ store a set of repositories in which the source appears.
|
|||||||
the actual guy to take is determined from the repo order.
|
the actual guy to take is determined from the repo order.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import fcntl
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
|
|
||||||
|
import pisi.util as util
|
||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
|
import pisi.lockeddbshelve as shelve
|
||||||
import pisi.repodb
|
import pisi.repodb
|
||||||
import pisi.itembyrepodb
|
import pisi.itembyrepodb
|
||||||
|
|
||||||
@@ -50,13 +55,13 @@ class SourceDB(object):
|
|||||||
def get_spec(self, name, repo=None, txn = None):
|
def get_spec(self, name, repo=None, txn = None):
|
||||||
try:
|
try:
|
||||||
return self.d.get_item(name, repo, txn)
|
return self.d.get_item(name, repo, txn)
|
||||||
except pisi.itembyrepodb.NotfoundError:
|
except pisi.itembyrepodb.NotfoundError, e:
|
||||||
raise NotfoundError(_("Source package %s not found") % name)
|
raise NotfoundError(_("Source package %s not found") % name)
|
||||||
|
|
||||||
def get_spec_repo(self, name, repo=None, txn = None):
|
def get_spec_repo(self, name, repo=None, txn = None):
|
||||||
try:
|
try:
|
||||||
return self.d.get_item_repo(name, repo, txn)
|
return self.d.get_item_repo(name, repo, txn)
|
||||||
except pisi.itembyrepodb.NotfoundError:
|
except pisi.itembyrepodb.NotfoundError, e:
|
||||||
raise NotfoundError(_("Source package %s not found") % name)
|
raise NotfoundError(_("Source package %s not found") % name)
|
||||||
|
|
||||||
def pkgtosrc(self, name, txn = None):
|
def pkgtosrc(self, name, txn = None):
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
# generic user interface
|
# generic user interface
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pisi
|
||||||
|
import pisi.context as ctx
|
||||||
|
|
||||||
(installed, upgraded, removed, installing, removing, configuring, configured, extracting,
|
(installed, upgraded, removed, installing, removing, configuring, configured, extracting,
|
||||||
downloading, packagestogo, updatingrepo, cached) = range(12)
|
downloading, packagestogo, updatingrepo, cached) = range(12)
|
||||||
|
|
||||||
|
|||||||
+10
-9
@@ -72,7 +72,7 @@ def multisplit(str, chars):
|
|||||||
"""Split str with any of the chars."""
|
"""Split str with any of the chars."""
|
||||||
l = [str]
|
l = [str]
|
||||||
for c in chars:
|
for c in chars:
|
||||||
l = concat(map(lambda x:x.split(c)), l)
|
l = concat(map(lambda x:x.split(c), l))
|
||||||
return l
|
return l
|
||||||
|
|
||||||
def same(l):
|
def same(l):
|
||||||
@@ -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(d):
|
def check_dir(dir):
|
||||||
"""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?
|
||||||
d = d.strip().rstrip("/")
|
dir = dir.strip().rstrip("/")
|
||||||
if not os.access(d, os.F_OK):
|
if not os.access(dir, os.F_OK):
|
||||||
os.makedirs(d)
|
os.makedirs(dir)
|
||||||
|
|
||||||
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 directory in dirs:
|
for dir in dirs:
|
||||||
d = join_path(root, directory)
|
d = join_path(root, dir)
|
||||||
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: #FIXME: what exception could we catch here, replace with that.
|
except Exception, e: #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):
|
||||||
@@ -607,9 +607,10 @@ 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 == '' or (not x[0] in string.digits):
|
if x is '' or (not x[0] in string.digits):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user