* workaround: add an option called --ignore-file-conflicts. use
responsibly. :P * an --at option for add-repo for the position of repo to be inserted in the list of repos. (we already got it in the API, this is just CLI)
This commit is contained in:
@@ -164,7 +164,11 @@ class Install(AtomicOperation):
|
|||||||
file_conflicts_str = ""
|
file_conflicts_str = ""
|
||||||
for (pkg, existing_file) in file_conflicts:
|
for (pkg, existing_file) in file_conflicts:
|
||||||
file_conflicts_str += _("%s from %s package") % (existing_file.path, pkg)
|
file_conflicts_str += _("%s from %s package") % (existing_file.path, pkg)
|
||||||
raise Error(_('File conflicts:\n%s') % file_conflicts_str)
|
msg = _('File conflicts:\n%s') % file_conflicts_str
|
||||||
|
if ctx.get_option('ignore_file_conflicts'):
|
||||||
|
ctx.ui.warning(msg)
|
||||||
|
else:
|
||||||
|
raise Error(msg)
|
||||||
|
|
||||||
def check_reinstall(self):
|
def check_reinstall(self):
|
||||||
"check reinstall, confirm action, and schedule reinstall"
|
"check reinstall, confirm action, and schedule reinstall"
|
||||||
|
|||||||
+10
-3
@@ -521,6 +521,8 @@ expanded to package names.
|
|||||||
default=False, help=_("Bypass ldconfig phase"))
|
default=False, help=_("Bypass ldconfig phase"))
|
||||||
p.add_option("", "--reinstall", action="store_true",
|
p.add_option("", "--reinstall", action="store_true",
|
||||||
default=False, help=_("Reinstall already installed packages"))
|
default=False, help=_("Reinstall already installed packages"))
|
||||||
|
p.add_option("", "--ignore-file-conflicts", action="store_true",
|
||||||
|
default=False, help=_("Ignore file conflicts"))
|
||||||
buildno_opts(self)
|
buildno_opts(self)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -915,8 +917,8 @@ If no repository is given, all repositories are updated.
|
|||||||
name = ("update-repo", "ur")
|
name = ("update-repo", "ur")
|
||||||
|
|
||||||
def options(self):
|
def options(self):
|
||||||
self.parser.add_option("-f", "--force", action="store_true",
|
self.parser.add_option("-f", "--force", action="store",
|
||||||
default=False,
|
default=0,
|
||||||
help=_("update database in any case"))
|
help=_("update database in any case"))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -951,6 +953,11 @@ NB: We support only local files (e.g., /a/b/c) and http:// URIs at the moment
|
|||||||
|
|
||||||
name = ("add-repo", "ar")
|
name = ("add-repo", "ar")
|
||||||
|
|
||||||
|
def options(self):
|
||||||
|
self.parser.add_option("", "--at", action="store",
|
||||||
|
type="int", default=False,
|
||||||
|
help=_("add repository at given position (0 is first)"))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
if len(self.args)==2 or len(self.args)==0:
|
if len(self.args)==2 or len(self.args)==0:
|
||||||
@@ -961,7 +968,7 @@ NB: We support only local files (e.g., /a/b/c) and http:// URIs at the moment
|
|||||||
else:
|
else:
|
||||||
name = 'pardus-1-test'
|
name = 'pardus-1-test'
|
||||||
indexuri = 'http://paketler.pardus.org.tr/pardus-1-test/pisi-index.xml.bz2'
|
indexuri = 'http://paketler.pardus.org.tr/pardus-1-test/pisi-index.xml.bz2'
|
||||||
pisi.api.add_repo(name, indexuri)
|
pisi.api.add_repo(name, indexuri, ctx.get_option('at'))
|
||||||
if ctx.ui.confirm(_('Update PISI database for repository %s?') % name):
|
if ctx.ui.confirm(_('Update PISI database for repository %s?') % name):
|
||||||
pisi.api.update_repo(name)
|
pisi.api.update_repo(name)
|
||||||
self.finalize()
|
self.finalize()
|
||||||
|
|||||||
+4
-5
@@ -82,13 +82,12 @@ class RepoDB(object):
|
|||||||
raise Error(_('Repository %s already exists') % name)
|
raise Error(_('Repository %s already exists') % name)
|
||||||
self.d.put("repo-" + name, repo_info, txn)
|
self.d.put("repo-" + name, repo_info, txn)
|
||||||
order = self.d.get("order", txn)
|
order = self.d.get("order", txn)
|
||||||
if at:
|
if at == None:
|
||||||
|
order.append(name)
|
||||||
|
else:
|
||||||
if at<0 or at>len(order):
|
if at<0 or at>len(order):
|
||||||
raise Error(_("Cannot add repository at position %s" % at))
|
raise Error(_("Cannot add repository at position %s" % at))
|
||||||
order.insert(name, at)
|
order.insert(at, name)
|
||||||
else:
|
|
||||||
order.append(name)
|
|
||||||
|
|
||||||
self.d.put("order", order, txn)
|
self.d.put("order", order, txn)
|
||||||
self.d.txn_proc(proc, txn)
|
self.d.txn_proc(proc, txn)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user