From 3ad295b4b91c011ac01c587a934b3936e94e4c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Thu, 29 Sep 2005 15:34:33 +0000 Subject: [PATCH] * 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 --- pisi/build.py | 30 +++++++++++++++++++++--------- pisi/cli/__init__.py | 10 +++++++--- pisi/ui.py | 2 +- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/pisi/build.py b/pisi/build.py index 35c8a137..bda49ae9 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -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.")) diff --git a/pisi/cli/__init__.py b/pisi/cli/__init__.py index e71ec80d..eb75695a 100644 --- a/pisi/cli/__init__.py +++ b/pisi/cli/__init__.py @@ -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')) diff --git a/pisi/ui.py b/pisi/ui.py index e29e6bde..50e3ad52 100644 --- a/pisi/ui.py +++ b/pisi/ui.py @@ -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