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