* implement a less strict and admissible version-string check for

finding old package names...
* be more informative when calculating build number
* arrange info stuff a bit
* ui.info'ya, implement etmesi sart olmamakla UI altsinifinin,
  yapabiliyorsan, line'i break etme sonunda gibi bir option var
  default false. kullanmiyoruz simdilik.
* zor bu isler gulum, tarzanca yapiyoruz iste.
* allahin izniyle ramazan bitmeden pisi'nin isi tamamen biter diyorum
This commit is contained in:
Eray Özkural
2005-09-29 15:34:33 +00:00
parent 252836e31b
commit 3ad295b4b9
3 changed files with 29 additions and 13 deletions
+21 -9
View File
@@ -362,10 +362,15 @@ class PisiBuild:
"did we find the filename we were looking for?"
if fn.startswith(package_name + '-'):
if fn.endswith(ctx.const.package_prefix):
verstr = fn[len(package_name):
# get version string, skip separator '-'
verstr = fn[len(package_name) + 1:
len(fn)-len(ctx.const.package_prefix)]
if verstr.count('-') <= 2:
return True
import string
for x in verstr.split('-'):
# weak rule: version components start with a digit
if x is '' or (not x[0] in string.digits):
return False
return True
return False
# find previous build in ctx.config.options.output_dir
@@ -378,6 +383,10 @@ class PisiBuild:
ctx.ui.info('(found old version %s)' % old_package_fn)
old_pkg = Package(old_package_fn, 'r')
old_pkg.read(os.path.join(ctx.config.tmp_dir(), 'oldpkg'))
if str(old_pkg.metadata.package.name) != package_name:
ctx.ui.warning('Skipping %s with wrong pkg name ' %
old_package_fn)
continue
old_build = old_pkg.metadata.package.build
found.append( (old_package_fn, old_build) )
if not found:
@@ -422,8 +431,12 @@ class PisiBuild:
ctx.ui.warning('(old package lacks a build no, setting build no to 0.)')
return 0
elif changed:
ctx.ui.info('There are changes, incrementing build no to %d' %
old_build + 1)
return old_build + 1
else:
ctx.ui.info('There is no change from previous build %d ' %
old_build)
return old_build
def build_packages(self):
@@ -455,16 +468,14 @@ class PisiBuild:
ctx.ui.action(_("** Building package %s") % package.name);
ctx.ui.action(_("Generating %s...") % ctx.const.files_xml)
ctx.ui.info(_("Generating %s,") % ctx.const.files_xml)
self.gen_files_xml(package)
ctx.ui.info(_(" done."))
ctx.ui.action(_("Generating %s...") % ctx.const.metadata_xml)
ctx.ui.info(_("Generating %s,") % ctx.const.metadata_xml)
self.gen_metadata_xml(package)
ctx.ui.info(_(" done."))
ctx.ui.action(_("Creating PISI package %s") % name)
ctx.ui.info(_("Creating PISI package %s.") % name)
pkg = Package(name, 'w')
# add comar files to package
@@ -491,3 +502,4 @@ class PisiBuild:
os.chdir(c)
self.set_state("buildpackages")
util.xterm_title_reset()
ctx.ui.info(_("Done."))
+7 -3
View File
@@ -37,13 +37,17 @@ class CLI(UI):
sys.stdout.write(str)
sys.stdout.flush()
def info(self, msg, verbose = False):
def info(self, msg, verbose = False, noln = False):
# TODO: need to look at more kinds of info messages
# let's cheat from KDE :)
if noln:
msgend = ''
else:
msgend = '\n'
if verbose and self.show_verbose:
self.output(msg + '\n')
self.output(msg + msgend)
elif not verbose:
self.output(msg + '\n')
self.output(msg + msgend)
def warning(self,msg):
self.output(colorize('Warning:' + msg + '\n', 'purple'))
+1 -1
View File
@@ -46,7 +46,7 @@ class UI(object):
def set_debug(self, flag):
self.show_debug = flag
def info(self, msg, verbose = False):
def info(self, msg, verbose = False, noln = False):
"give an informative message"
pass