* implement TODO in get_build_number that I wrote yesterday:

search multiple old packages instead of one.
* remove common
* cosmetic changes
This commit is contained in:
Eray Özkural
2005-08-16 09:00:00 +00:00
parent 692a518f1b
commit 24defe191d
4 changed files with 20 additions and 54 deletions
+13 -9
View File
@@ -294,26 +294,30 @@ class PisiBuild:
#NOTE: not functional yet..
old_package_fn = None
# find previous build in config.options.output_dir
# FIXME: get the newest version, make this into another fxn
found = []
for root, dirs, files in os.walk(config.options.output_dir):
if old_package_fn:
break
for fn in files:
if fn.startswith(package_name + '-') and \
fn.endswith(const.package_prefix):
old_package_fn = os.path.join(root, fn)
ui.info('(found old version %s)' % old_package_fn)
break
if not old_package_fn:
old_pkg = Package(old_package_fn, 'r')
from os.path import join
old_pkg.read(join(config.tmp_dir(), 'oldpkg'))
old_build = old_pkg.metadata.package.build
found.append( (old_package_fn, old_build) )
if not found:
return 0
ui.warning('(no previous build found, setting build no to 0.)')
else:
old_pkg = Package(old_package_fn, 'r')
from os.path import join
old_pkg.read(join(config.tmp_dir(), 'oldpkg'))
a = filter(lambda (x,y): y != None, found)
if a:
a.sort(lambda x,y : cmp(x[1],y[1]))
old_build = a[0][1]
else:
old_build = None
# TODO: compare old files.xml with the new one..
changed = True
old_build = old_pkg.metadata.package.build
if old_build is None:
ui.warning('(old package lacks a build no, setting build no to 0.)')
return 0
+3 -4
View File
@@ -15,7 +15,6 @@ from optparse import OptionParser
import pisi
from pisi.uri import URI
from pisi.cli.common import *
def commands_string():
@@ -438,8 +437,8 @@ Usage: list-installed
list = installdb.list_installed()
list.sort()
if self.options.install_info:
print 'Package Name |St| Version| Rel.| Build| Distro| Date'
print '============================================================================='
print 'Package Name |St| Version| Rel.| Build| Distro| Date'
print '========================================================================'
for pkg in list:
package = pisi.packagedb.inst_packagedb.get_package(pkg)
inst_info = installdb.get_info(pkg)
@@ -447,7 +446,7 @@ Usage: list-installed
print package
print inst_info
elif self.options.install_info:
print '%15s | %s ' % (package.name, inst_info.one_liner())
print '%-15s | %s ' % (package.name, inst_info.one_liner())
else:
print '%15s - %s ' % (package.name, package.summary)
self.finalize()
-38
View File
@@ -1,38 +0,0 @@
# 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.
#
usage_text1 = """%prog <command> [options] [arguments]
where <command> is one of:
"""
usage_text2 = """
Use \"%prog help <command>\" for help on a specific command.
"""
def commonopts(parser):
p = parser
p.add_option("-D", "--destdir", action="store")
p.add_option("", "--yes-all", action="store_true",
default=False, help = "assume yes in all yes/no queries")
p.add_option("-u", "--username", action="store")
p.add_option("-p", "--password", action="store")
p.add_option("-P", action="store_true", dest="getpass", default=False,
help="Get password from the command line")
p.add_option("-v", "--verbose", action="store_true",
dest="verbose", default=False,
help="detailed output")
p.add_option("-d", "--debug", action="store_true",
default=True, help="show debugging information")
p.add_option("-n", "--dry-run", action="store_true", default=False,
help = "do not perform any action, just show what\
would be done")
return p
+4 -3
View File
@@ -4,12 +4,12 @@ pwd
PATH=$PATH:.
set -x -e
pisi-cli build tests/zip/pspec.xml tests/unzip/pspec.xml
#pisi-cli --ignore-build-no build tests/zip/pspec.xml tests/unzip/pspec.xml
pisi-cli --yes-all --ignore-comar install unzip-5.50-1.pisi zip-2.3-1.pisi
mkdir -p myrepo
cd myrepo
../pisi-cli build ../tests/zip2/pspec.xml ../tests/unzip2/pspec.xml
#../pisi-cli --ignore-build-no build ../tests/zip2/pspec.xml ../tests/unzip2/pspec.xml
cd ..
pisi-cli --absolute-uris index myrepo
pisi-cli remove-repo repo1
@@ -17,5 +17,6 @@ pisi-cli add-repo repo1 pisi-index.xml
pisi-cli list-repo
pisi-cli update-repo repo1
pisi-cli list-available
pisi-cli --install-info list-installed
pisi-cli --ignore-comar upgrade zip
pisi-cli list-installed
pisi-cli --install-info list-installed