* implement --ignore-build-no option in build

* install remains
* implement a warning function
This commit is contained in:
Eray Özkural
2005-08-15 13:14:12 +00:00
parent 93e5602464
commit 4dde6f68f0
6 changed files with 62 additions and 9 deletions
+13 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Project SYSTEM "Project-3.7.dtd">
<!-- Project file for project pisi -->
<!-- Saved: 2005-08-14, 19:43:08 -->
<!-- Saved: 2005-08-15, 15:35:13 -->
<!-- Copyright (C) 2005 PiSi Development Team, -->
<Project version="3.7">
<ProgLanguage mixed="0">Python</ProgLanguage>
@@ -322,6 +322,18 @@
<Other>
<Name>pisi-cli</Name>
</Other>
<Other>
<Dir>tests</Dir>
<Name>beta-light.sh</Name>
</Other>
<Other>
<Dir>tests</Dir>
<Name>beta-upgrade.sh</Name>
</Other>
<Other>
<Dir>tests</Dir>
<Name>beta.sh</Name>
</Other>
</Others>
<MainScript>
<Name>pisi-cli</Name>
+14 -3
View File
@@ -248,9 +248,6 @@ class PisiBuild:
metadata = MetaData()
metadata.from_spec(self.spec.source, package)
# FIXME: MEREEEEEN :)
metadata.package.build = 0 # BOGUS. WRONG.
metadata.package.distribution = config.values.general.distribution
metadata.package.distributionRelease = config.values.general.distribution_release
metadata.package.architecture = "Any"
@@ -262,6 +259,20 @@ class PisiBuild:
d = self.ctx.pkg_install_dir()
size = util.dir_size(d)
metadata.package.installedSize = str(size)
# build no
# FIXME: @!#$%^*( MEREEEEEN :)
if config.options.ignore_build_no:
metadata.package.build = None # means, build no information n/a
ui.warning('Build number is not available.')
else:
found = False
# TODO: find previous build in config.options.output_dir
if not found:
metadata.package.build = None
# TODO: else: check if metadata has changed in any significant way
# TODO: see if any file has changed except metadata
metadata.write(os.path.join(self.ctx.pkg_dir(), const.metadata_xml))
def gen_files_xml(self, package):
+21
View File
@@ -179,6 +179,13 @@ If run without parameters, it prints the general help."""
self.finalize()
def buildno_opts(self):
self.parser.add_option("", "--ignore-build-no", action="store_true",
default=False,
help="Don't take build no into account.")
class Build(Command):
"""Build a PISI package using a pspec.xml file
@@ -193,6 +200,9 @@ fetch all necessary files and build the package for you.
def name(self):
return ("build", "bi")
def options(self):
buildno_opts(self)
def run(self):
if not self.args:
self.help()
@@ -251,6 +261,10 @@ specified a package name, it should exist in a specified repository.
def name(self):
return ("install", "it")
def options(self):
super(Install, self).options()
buildno_opts(self)
def run(self):
if not self.args:
self.help()
@@ -275,6 +289,9 @@ specified a package name, it should exist in a specified repository.
def name(self):
return ("upgrade", "up")
def options(self):
buildno_opts(self)
def run(self):
if not self.args:
self.help()
@@ -391,6 +408,7 @@ source and binary packages.
return
self.finalize()
class ListInstalled(Command):
"""Print the list of all installed packages
@@ -446,6 +464,7 @@ Synchronizes the PiSi databases with the current repository.
pisi.toplevel.update_repo(repo)
self.finalize()
class AddRepo(Command):
"""Add a repository
@@ -584,6 +603,7 @@ class ListPending(Command):
self.finalize()
class SearchAvailable(Command):
"""Search in available packages
@@ -593,6 +613,7 @@ FIXME: this is bogus
"""
pass
# Partial build commands
class BuildUntil(Command):
+8 -3
View File
@@ -53,7 +53,11 @@ class PackageInfo(specfile.PackageInfo):
specfile.PackageInfo.__init__(self, node)
self.version = getNodeText(node, "Version")
self.release = getNodeText(node, "Release")
self.build = int(getNodeText(node, "Build"))
build_ = getNodeText(node, "Build")
if build_:
self.build = int(build_)
else:
self.build = None
self.distribution = getNodeText(node, "Distribution")
self.distributionRelease = getNodeText(node, "DistributionRelease")
self.architecture = getNodeText(node, "Architecture")
@@ -64,7 +68,8 @@ class PackageInfo(specfile.PackageInfo):
def elt(self, xml):
node = specfile.PackageInfo.elt(self, xml)
xml.addTextNodeUnder(node, "Build", str(self.build))
if self.build:
xml.addTextNodeUnder(node, "Build", str(self.build))
xml.addTextNodeUnder(node, "Distribution", self.distribution)
xml.addTextNodeUnder(node, "DistributionRelease", self.distributionRelease)
xml.addTextNodeUnder(node, "Architecture", self.architecture)
@@ -76,7 +81,7 @@ class PackageInfo(specfile.PackageInfo):
def has_errors(self):
# FIXME: there should be real error msgs
# and comment the logic here please, it isn't very clear -gurer
ret = (specfile.PackageInfo.has_errors(self) == None) and self.build!=None
ret = (specfile.PackageInfo.has_errors(self) == None)
ret = ret and self.distribution!=None
ret = ret and self.distributionRelease!=None
ret = ret and self.architecture!=None and self.installedSize!=None
+5 -1
View File
@@ -46,8 +46,12 @@ class CLI:
sys.stdout.write(msg)
sys.stdout.flush()
def warning(self,msg):
sys.stdout.write(colorize('Warning:' + msg, 'purple'))
sys.stdout.flush()
def error(self,msg):
sys.stdout.write(colorize(msg, 'red'))
sys.stdout.write(colorize('Error:' + msg, 'red'))
sys.stdout.flush()
def action(self,msg):
+1 -1
View File
@@ -4,7 +4,7 @@ pwd
PATH=$PATH:.
set -x -e
pisi-cli --ignore-comar remove unzip
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 index .
pisi-cli add-repo repo1 pisi-index.xml
pisi-cli list-repo