Kaydet (Commit) f6e35ae3 authored tarafından Eray Özkural's avatar Eray Özkural

* pisimedia is a cute little script to install software from

  "application cd"s, let's give the users what they want :)
üst 2ad381cc
......@@ -343,12 +343,12 @@ def index(dirs=None, output='pisi-index.xml', skip_sources=False, skip_signing=F
index.write(output, sha1sum=True, compress=File.bz2, sign=File.detached)
ctx.ui.info(_('* Index file written'))
def add_repo(name, indexuri):
def add_repo(name, indexuri, at = None):
if ctx.repodb.has_repo(name):
raise Error(_('Repo %s already present.') % name)
repo = pisi.repodb.Repo(URI(indexuri))
ctx.repodb.add_repo(name, repo)
ctx.repodb.add_repo(name, repo, at = at)
ctx.ui.info(_('Repo %s added to system.') % name)
def remove_repo(name):
......@@ -73,7 +73,8 @@ class RepoDB(object):
name = str(name)
return self.d["repo-" + name]
def add_repo(self, name, repo_info, txn = None):
def add_repo(self, name, repo_info, txn = None, at = None):
"""add repository with name and repo_info at a given optional position"""
name = str(name)
assert (isinstance(repo_info,Repo))
def proc(txn):
......@@ -81,7 +82,13 @@ class RepoDB(object):
raise Error(_('Repository %s already exists') % name)
self.d.put("repo-" + name, repo_info, txn)
order = self.d.get("order", txn)
if at:
if at<0 or at>len(order):
raise Error(_("Cannot add repository at position %s" % at))
order.insert(name, at)
self.d.put("order", order, txn)
self.d.txn_proc(proc, txn)
# Copyright (C) 2005, TUBITAK/UEKAE
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
# Please read the COPYING file.
# Author: Eray Ozkural
import sys
import os
import pisi
import pisi.context as ctx
usage = "Usage: pisimedia <pisi-index.xml>"
if len(sys.argv)!=2:
print usage
#op = sys.argv[1]
#if not op in ['install', 'upgrade']:
# print usage
# sys.exit(2)
idx = sys.argv[1]
if not os.path.exists(idx):
print "pisi index %s cannot be found" % idx
tmpid = 0
tmprepo = 'pisimedia%d' % tmpid
while ctx.repodb.has_repo(tmprepo):
tmpid += 1
tmprepo = 'pisimedia%d' % tmpid
pisi.api.add_repo(tmprepo, idx, at = 0)
packages = ctx.packagedb.list_packages(repo=tmprepo)
pisi.api.install(packages, reinstall=True)
except Exception, e:
if ctx.repodb.has_repo(tmprepo):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment