* find which repo a package is in
* eger paket install edilmemisse dependency'sini check edemeyiz * packageURI'in olmasi gerekmiyor metadata'da illa * install isini yeniden duzenle * multi install: ilerleme * alpha-light.sh'i yeni komutlara gore yap
This commit is contained in:
@@ -200,8 +200,7 @@ class ListInstalled(Command):
|
||||
self.init_db()
|
||||
from pisi.installdb import installdb
|
||||
for pkg in installdb.list_installed():
|
||||
from pisi.packagedb import packagedb
|
||||
package = packagedb.get_package(pkg)
|
||||
package = pisi.packagedb.get_package(pkg)
|
||||
if not self.options.long:
|
||||
print package.name, '-', package.summary
|
||||
else:
|
||||
|
||||
+11
-6
@@ -6,12 +6,14 @@ import packagedb
|
||||
from ui import ui
|
||||
from version import Version
|
||||
|
||||
def satisfiesDep(pkg, depinfo):
|
||||
def satisfiesDep(pkg_name, depinfo):
|
||||
"""determine if a package satisfies given dependency spec"""
|
||||
if not installdb.is_installed(pkg_name):
|
||||
return False
|
||||
if not installdb.is_installed(depinfo.package):
|
||||
return False
|
||||
else:
|
||||
(version, release) = installdb.get_info(pkg)
|
||||
(version, release) = installdb.get_version(pkg_name)
|
||||
ret = True
|
||||
if depinfo.versionFrom:
|
||||
ret &= Version(version) >= Version(depinfo.versionFrom)
|
||||
@@ -28,9 +30,12 @@ def runtimeDeps(pkg):
|
||||
|
||||
def satisfiesRuntimeDeps(pkg):
|
||||
deps = runtimeDeps(pkg)
|
||||
# print 'runtimedeps = ', deps
|
||||
return reduce(lambda x,y:x and y,
|
||||
map(lambda x: satisfiesDep(pkg, x), deps),True)
|
||||
for dep in deps:
|
||||
if not satisfiesDep(pkg, dep):
|
||||
ui.error('Package %s does not satisfy dependency %s\n' %
|
||||
(pkg,dep.package))
|
||||
return False
|
||||
return True
|
||||
|
||||
def installable(pkg):
|
||||
"""calculate if pkg is installable currently
|
||||
@@ -41,6 +46,6 @@ def installable(pkg):
|
||||
elif satisfiesRuntimeDeps(pkg):
|
||||
return True
|
||||
else:
|
||||
ui.info("package " + pkg + " does not satisfy dependencies\n");
|
||||
#ui.info("package " + pkg + " does not satisfy dependencies\n");
|
||||
return False
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ from constants import const
|
||||
from ui import ui
|
||||
from installdb import installdb
|
||||
import packagedb
|
||||
from packagedb import inst_packagedb
|
||||
import dependency
|
||||
from metadata import MetaData
|
||||
import comariface
|
||||
|
||||
@@ -67,7 +67,6 @@ class PackageInfo(specfile.PackageInfo):
|
||||
ret = ret and self.distribution!=None
|
||||
ret = ret and self.distributionRelease!=None
|
||||
ret = ret and self.architecture!=None and self.installedSize!=None
|
||||
ret = ret and self.packageURI!=None
|
||||
return ret
|
||||
|
||||
def __str__(self):
|
||||
|
||||
+16
-23
@@ -6,7 +6,7 @@ from config import config
|
||||
from constants import const
|
||||
from ui import ui
|
||||
from purl import PUrl
|
||||
import util
|
||||
import util, packagedb
|
||||
|
||||
# single package operations
|
||||
|
||||
@@ -36,8 +36,8 @@ def remove_single(package_name):
|
||||
inst_packagedb.remove_package(package_name)
|
||||
removeScripts(package_name)
|
||||
|
||||
# TODO: repository'den okuma isi yas burada, bu degisecek
|
||||
def install_single(pkg):
|
||||
"""install a single package from URI or ID"""
|
||||
url = PUrl(pkg)
|
||||
# Check if we are dealing with a remote file or a real path of
|
||||
# package filename. Otherwise we'll try installing a package from
|
||||
@@ -45,31 +45,24 @@ def install_single(pkg):
|
||||
if url.isRemoteFile() or os.path.exists(url.uri):
|
||||
install_single_package(pkg)
|
||||
else:
|
||||
from os.path import join
|
||||
install_single_name(pkg)
|
||||
|
||||
# TODO: tabii burada repodb falan kullanilmali cok inefficient
|
||||
(repo, index) = util.repo_index()
|
||||
|
||||
# search pkg in index for it's presence in repository
|
||||
# TODO: normalde hicbir zaman boyle linear search yapilmamali
|
||||
# buyuk olabilecek listeler uzerinden
|
||||
for package in index.packages:
|
||||
if package.name == pkg:
|
||||
version = package.history[0].version
|
||||
release = package.history[0].release
|
||||
|
||||
name = util.package_name(pkg, version, release)
|
||||
package_uri = join(repo, name[0], name)
|
||||
|
||||
ui.info("Installing %s from repository %s\n" %(name, repo))
|
||||
install_package(package_uri)
|
||||
return
|
||||
ui.error("Package %s not found in the index file.\n" %pkg)
|
||||
|
||||
def install_single_package(pkg_location):
|
||||
def install_single_uri(pkg_location):
|
||||
from install import Installer
|
||||
Installer(pkg_location).install()
|
||||
|
||||
def install_single_name(name):
|
||||
"""install a single package from ID"""
|
||||
# find package in repository
|
||||
repo = packagedb.which_repo(name)
|
||||
if repo:
|
||||
pkg = packagedb.get_package(name)
|
||||
ui.info("Installing %s from repository %s\n" %(name, repo))
|
||||
ui.debug("Package URI: %s\n" % pkg.packageURI)
|
||||
install_single_uri(pkg.packageURI)
|
||||
else:
|
||||
ui.error("Package %s not found in the repository file.\n" % pkg)
|
||||
|
||||
# deneme, don't remove ulan
|
||||
class AtomicOperation(object):
|
||||
def __init__(self, package, ignore_dep = False):
|
||||
|
||||
@@ -71,6 +71,12 @@ def has_package(name):
|
||||
return True
|
||||
return False
|
||||
|
||||
def which_repo(name):
|
||||
for repo in packagedbs.keys():
|
||||
if get_db(repo).has_package(name):
|
||||
return repo
|
||||
return None
|
||||
|
||||
def get_package(name):
|
||||
for repo in packagedbs.keys():
|
||||
if get_db(repo).has_package(name):
|
||||
|
||||
@@ -77,6 +77,8 @@ def install_pkg_names(A):
|
||||
l = G_f.topological_sort()
|
||||
l.reverse()
|
||||
print l
|
||||
for x in l:
|
||||
operations.install_single_name(x)
|
||||
|
||||
def remove(packages):
|
||||
#TODO: this for loop is just a placeholder
|
||||
|
||||
@@ -5,7 +5,9 @@ PATH=$PATH:.
|
||||
set -x
|
||||
pisi-cli build packages/z/zip/pspec.xml packages/u/unzip/pspec.xml
|
||||
pisi-cli index .
|
||||
pisi-cli updatedb pisi-index.xml
|
||||
pisi-cli add-repo repo1 pisi-index.xml
|
||||
pisi-cli update-repo repo1
|
||||
# database contents
|
||||
find tmp -iname '*.bdb' | xargs tools/cat-db.py
|
||||
#find tmp -iname '*.bdb' | xargs tools/cat-db.py
|
||||
pisi-cli install zip
|
||||
pisi-cli list-installed
|
||||
|
||||
Reference in New Issue
Block a user