* implement info command for names
* show list of files in info, there are two options for that: --files, --files-path * neler yapmisiz breh breh
This commit is contained in:
@@ -74,10 +74,10 @@ Legend:
|
||||
3. Beta
|
||||
|
||||
- i18n support
|
||||
/ upgrade (eray)
|
||||
+ upgrade (eray)
|
||||
+ upgrade operation
|
||||
+ test upgrade op
|
||||
- system-wide upgrade (upgrade-all) komutu
|
||||
+ system-wide upgrade (upgrade-all) komutu
|
||||
/ multiple package repository (eray)
|
||||
+ decide how to implement
|
||||
/ make a package and sourcedb for each repo
|
||||
@@ -137,3 +137,4 @@ Legend:
|
||||
/ design decisions
|
||||
/ extend XML specs to support that
|
||||
- cross-platform building support
|
||||
|
||||
|
||||
+18
-3
@@ -385,6 +385,14 @@ Usage: info <package1> <package2> ... <packagen>
|
||||
def name(self):
|
||||
return ("info", "i")
|
||||
|
||||
def options(self):
|
||||
self.parser.add_option("-f", "--files", action="store_true",
|
||||
default=False,
|
||||
help="Show a list of package files.")
|
||||
self.parser.add_option("-F", "--files-path", action="store_true",
|
||||
default=False,
|
||||
help="Show only paths.")
|
||||
|
||||
def run(self):
|
||||
if not self.args:
|
||||
self.help()
|
||||
@@ -398,9 +406,16 @@ Usage: info <package1> <package2> ... <packagen>
|
||||
def printinfo(self, arg):
|
||||
import os.path
|
||||
|
||||
if os.path.exists(arg):
|
||||
metadata, files = pisi.toplevel.info(arg)
|
||||
print metadata.package
|
||||
metadata, files = pisi.toplevel.info(arg)
|
||||
print metadata.package
|
||||
if self.options.files or self.options.files_path:
|
||||
print
|
||||
print 'Files:'
|
||||
for fileinfo in files.list:
|
||||
if self.options.files:
|
||||
print fileinfo
|
||||
else:
|
||||
print fileinfo.path
|
||||
|
||||
|
||||
class Index(Command):
|
||||
|
||||
+6
-1
@@ -60,8 +60,13 @@ class FileInfo:
|
||||
err.has_tag(self.path, "File", "Path")
|
||||
err.has_tag(self.type, "File", "Type")
|
||||
err.has_tag(self.size, "File", "Size")
|
||||
err.has_tag(self.hash, "File", "Hash")
|
||||
err.has_tag(self.hash, "File", "SHA1Sum")
|
||||
return err.list
|
||||
|
||||
def __str__(self):
|
||||
s = "%s, type: %s, size: %s, sha1sum: %s" % (self.path, self.type,
|
||||
self.size, self.hash)
|
||||
return s
|
||||
|
||||
class Files(XmlFile):
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ def remove_single(package_name):
|
||||
# with a prefix and leaving the user to edit it. In the future
|
||||
# we'll have a plan for these configuration files.
|
||||
if fileinfo.type == const.conf:
|
||||
os.rename(fpath, fpath+".pisi")
|
||||
os.rename(fpath, fpath + ".pisi")
|
||||
else:
|
||||
os.unlink(fpath)
|
||||
installdb.remove(package_name)
|
||||
|
||||
+8
-1
@@ -272,7 +272,7 @@ class SourceInfo:
|
||||
|
||||
return err.list
|
||||
|
||||
class PackageInfo(object):
|
||||
class PackageInfo:
|
||||
"""A structure to hold package information. Package information is
|
||||
located under <Package> tag in PSPEC file. Opposite to Source each
|
||||
PSPEC file can have more than one Package tag."""
|
||||
@@ -349,6 +349,13 @@ class PackageInfo(object):
|
||||
s += '\nDescription: ' + self.description
|
||||
return s
|
||||
|
||||
def pkg_dir(self):
|
||||
packageDir = self.name + '-' \
|
||||
+ self.version + '-' \
|
||||
+ self.release
|
||||
|
||||
return join( config.lib_dir(), packageDir)
|
||||
|
||||
class SpecFile(XmlFile):
|
||||
"""A class for reading/writing from/to a PSPEC (PISI SPEC) file."""
|
||||
|
||||
|
||||
+24
-2
@@ -17,6 +17,7 @@ ver = sys.version_info
|
||||
if ver[0] <= 2 and ver[1] < 4:
|
||||
from sets import Set as set
|
||||
|
||||
import pisi
|
||||
from pisi.config import config
|
||||
from pisi.constants import const
|
||||
from pisi.ui import ui
|
||||
@@ -30,7 +31,7 @@ from pisi.repodb import repodb
|
||||
from pisi.installdb import installdb
|
||||
from pisi.index import Index
|
||||
|
||||
class Error:
|
||||
class Error(pisi.Error):
|
||||
pass
|
||||
|
||||
def install(packages):
|
||||
@@ -340,13 +341,34 @@ def configure_pending():
|
||||
# configure them in reverse topological order of configuration dependency
|
||||
pass
|
||||
|
||||
def info(package_name):
|
||||
def info(package):
|
||||
if package.endswith(const.package_prefix):
|
||||
return info_file(package)
|
||||
else:
|
||||
return info_name(package)
|
||||
|
||||
def info_file(package):
|
||||
from package import Package
|
||||
|
||||
if not os.path.exist(package):
|
||||
raise Error ('File %s not found' % package)
|
||||
|
||||
package = Package(package_name)
|
||||
package.read()
|
||||
return package.metadata, package.files
|
||||
|
||||
def info_name(package_name):
|
||||
if packagedb.has_package(package_name):
|
||||
package = packagedb.get_package(package_name)
|
||||
from pisi.metadata import MetaData
|
||||
metadata = MetaData()
|
||||
metadata.package = package
|
||||
#FIXME: get it from sourcedb
|
||||
metadata.source = None
|
||||
files = installdb.files(package.name)
|
||||
return metadata, files
|
||||
else:
|
||||
raise Error('Package %s not installed' % package_name)
|
||||
|
||||
def index(repo_dir = '.'):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user