* 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()
|
self.init_db()
|
||||||
from pisi.installdb import installdb
|
from pisi.installdb import installdb
|
||||||
for pkg in installdb.list_installed():
|
for pkg in installdb.list_installed():
|
||||||
from pisi.packagedb import packagedb
|
package = pisi.packagedb.get_package(pkg)
|
||||||
package = packagedb.get_package(pkg)
|
|
||||||
if not self.options.long:
|
if not self.options.long:
|
||||||
print package.name, '-', package.summary
|
print package.name, '-', package.summary
|
||||||
else:
|
else:
|
||||||
|
|||||||
+11
-6
@@ -6,12 +6,14 @@ import packagedb
|
|||||||
from ui import ui
|
from ui import ui
|
||||||
from version import Version
|
from version import Version
|
||||||
|
|
||||||
def satisfiesDep(pkg, depinfo):
|
def satisfiesDep(pkg_name, depinfo):
|
||||||
"""determine if a package satisfies given dependency spec"""
|
"""determine if a package satisfies given dependency spec"""
|
||||||
|
if not installdb.is_installed(pkg_name):
|
||||||
|
return False
|
||||||
if not installdb.is_installed(depinfo.package):
|
if not installdb.is_installed(depinfo.package):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
(version, release) = installdb.get_info(pkg)
|
(version, release) = installdb.get_version(pkg_name)
|
||||||
ret = True
|
ret = True
|
||||||
if depinfo.versionFrom:
|
if depinfo.versionFrom:
|
||||||
ret &= Version(version) >= Version(depinfo.versionFrom)
|
ret &= Version(version) >= Version(depinfo.versionFrom)
|
||||||
@@ -28,9 +30,12 @@ def runtimeDeps(pkg):
|
|||||||
|
|
||||||
def satisfiesRuntimeDeps(pkg):
|
def satisfiesRuntimeDeps(pkg):
|
||||||
deps = runtimeDeps(pkg)
|
deps = runtimeDeps(pkg)
|
||||||
# print 'runtimedeps = ', deps
|
for dep in deps:
|
||||||
return reduce(lambda x,y:x and y,
|
if not satisfiesDep(pkg, dep):
|
||||||
map(lambda x: satisfiesDep(pkg, x), deps),True)
|
ui.error('Package %s does not satisfy dependency %s\n' %
|
||||||
|
(pkg,dep.package))
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def installable(pkg):
|
def installable(pkg):
|
||||||
"""calculate if pkg is installable currently
|
"""calculate if pkg is installable currently
|
||||||
@@ -41,6 +46,6 @@ def installable(pkg):
|
|||||||
elif satisfiesRuntimeDeps(pkg):
|
elif satisfiesRuntimeDeps(pkg):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
ui.info("package " + pkg + " does not satisfy dependencies\n");
|
#ui.info("package " + pkg + " does not satisfy dependencies\n");
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from constants import const
|
|||||||
from ui import ui
|
from ui import ui
|
||||||
from installdb import installdb
|
from installdb import installdb
|
||||||
import packagedb
|
import packagedb
|
||||||
|
from packagedb import inst_packagedb
|
||||||
import dependency
|
import dependency
|
||||||
from metadata import MetaData
|
from metadata import MetaData
|
||||||
import comariface
|
import comariface
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ class PackageInfo(specfile.PackageInfo):
|
|||||||
ret = ret and self.distribution!=None
|
ret = ret and self.distribution!=None
|
||||||
ret = ret and self.distributionRelease!=None
|
ret = ret and self.distributionRelease!=None
|
||||||
ret = ret and self.architecture!=None and self.installedSize!=None
|
ret = ret and self.architecture!=None and self.installedSize!=None
|
||||||
ret = ret and self.packageURI!=None
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
+16
-23
@@ -6,7 +6,7 @@ from config import config
|
|||||||
from constants import const
|
from constants import const
|
||||||
from ui import ui
|
from ui import ui
|
||||||
from purl import PUrl
|
from purl import PUrl
|
||||||
import util
|
import util, packagedb
|
||||||
|
|
||||||
# single package operations
|
# single package operations
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@ def remove_single(package_name):
|
|||||||
inst_packagedb.remove_package(package_name)
|
inst_packagedb.remove_package(package_name)
|
||||||
removeScripts(package_name)
|
removeScripts(package_name)
|
||||||
|
|
||||||
# TODO: repository'den okuma isi yas burada, bu degisecek
|
|
||||||
def install_single(pkg):
|
def install_single(pkg):
|
||||||
|
"""install a single package from URI or ID"""
|
||||||
url = PUrl(pkg)
|
url = PUrl(pkg)
|
||||||
# Check if we are dealing with a remote file or a real path of
|
# Check if we are dealing with a remote file or a real path of
|
||||||
# package filename. Otherwise we'll try installing a package from
|
# 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):
|
if url.isRemoteFile() or os.path.exists(url.uri):
|
||||||
install_single_package(pkg)
|
install_single_package(pkg)
|
||||||
else:
|
else:
|
||||||
from os.path import join
|
install_single_name(pkg)
|
||||||
|
|
||||||
# TODO: tabii burada repodb falan kullanilmali cok inefficient
|
def install_single_uri(pkg_location):
|
||||||
(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):
|
|
||||||
from install import Installer
|
from install import Installer
|
||||||
Installer(pkg_location).install()
|
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
|
# deneme, don't remove ulan
|
||||||
class AtomicOperation(object):
|
class AtomicOperation(object):
|
||||||
def __init__(self, package, ignore_dep = False):
|
def __init__(self, package, ignore_dep = False):
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ def has_package(name):
|
|||||||
return True
|
return True
|
||||||
return False
|
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):
|
def get_package(name):
|
||||||
for repo in packagedbs.keys():
|
for repo in packagedbs.keys():
|
||||||
if get_db(repo).has_package(name):
|
if get_db(repo).has_package(name):
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ def install_pkg_names(A):
|
|||||||
l = G_f.topological_sort()
|
l = G_f.topological_sort()
|
||||||
l.reverse()
|
l.reverse()
|
||||||
print l
|
print l
|
||||||
|
for x in l:
|
||||||
|
operations.install_single_name(x)
|
||||||
|
|
||||||
def remove(packages):
|
def remove(packages):
|
||||||
#TODO: this for loop is just a placeholder
|
#TODO: this for loop is just a placeholder
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ PATH=$PATH:.
|
|||||||
set -x
|
set -x
|
||||||
pisi-cli build packages/z/zip/pspec.xml packages/u/unzip/pspec.xml
|
pisi-cli build packages/z/zip/pspec.xml packages/u/unzip/pspec.xml
|
||||||
pisi-cli index .
|
pisi-cli index .
|
||||||
pisi-cli updatedb pisi-index.xml
|
pisi-cli add-repo repo1 pisi-index.xml
|
||||||
|
pisi-cli update-repo repo1
|
||||||
# database contents
|
# 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 install zip
|
||||||
|
pisi-cli list-installed
|
||||||
|
|||||||
Reference in New Issue
Block a user