* 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:
+21
-9
@@ -362,10 +362,15 @@ class PisiBuild:
|
|||||||
"did we find the filename we were looking for?"
|
"did we find the filename we were looking for?"
|
||||||
if fn.startswith(package_name + '-'):
|
if fn.startswith(package_name + '-'):
|
||||||
if fn.endswith(ctx.const.package_prefix):
|
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)]
|
len(fn)-len(ctx.const.package_prefix)]
|
||||||
if verstr.count('-') <= 2:
|
import string
|
||||||
return True
|
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
|
return False
|
||||||
|
|
||||||
# find previous build in ctx.config.options.output_dir
|
# 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)
|
ctx.ui.info('(found old version %s)' % old_package_fn)
|
||||||
old_pkg = Package(old_package_fn, 'r')
|
old_pkg = Package(old_package_fn, 'r')
|
||||||
old_pkg.read(os.path.join(ctx.config.tmp_dir(), 'oldpkg'))
|
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
|
old_build = old_pkg.metadata.package.build
|
||||||
found.append( (old_package_fn, old_build) )
|
found.append( (old_package_fn, old_build) )
|
||||||
if not found:
|
if not found:
|
||||||
@@ -422,8 +431,12 @@ class PisiBuild:
|
|||||||
ctx.ui.warning('(old package lacks a build no, setting build no to 0.)')
|
ctx.ui.warning('(old package lacks a build no, setting build no to 0.)')
|
||||||
return 0
|
return 0
|
||||||
elif changed:
|
elif changed:
|
||||||
|
ctx.ui.info('There are changes, incrementing build no to %d' %
|
||||||
|
old_build + 1)
|
||||||
return old_build + 1
|
return old_build + 1
|
||||||
else:
|
else:
|
||||||
|
ctx.ui.info('There is no change from previous build %d ' %
|
||||||
|
old_build)
|
||||||
return old_build
|
return old_build
|
||||||
|
|
||||||
def build_packages(self):
|
def build_packages(self):
|
||||||
@@ -455,16 +468,14 @@ class PisiBuild:
|
|||||||
|
|
||||||
ctx.ui.action(_("** Building package %s") % package.name);
|
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)
|
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)
|
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')
|
pkg = Package(name, 'w')
|
||||||
|
|
||||||
# add comar files to package
|
# add comar files to package
|
||||||
@@ -491,3 +502,4 @@ class PisiBuild:
|
|||||||
os.chdir(c)
|
os.chdir(c)
|
||||||
self.set_state("buildpackages")
|
self.set_state("buildpackages")
|
||||||
util.xterm_title_reset()
|
util.xterm_title_reset()
|
||||||
|
ctx.ui.info(_("Done."))
|
||||||
|
|||||||
@@ -37,13 +37,17 @@ class CLI(UI):
|
|||||||
sys.stdout.write(str)
|
sys.stdout.write(str)
|
||||||
sys.stdout.flush()
|
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
|
# TODO: need to look at more kinds of info messages
|
||||||
# let's cheat from KDE :)
|
# let's cheat from KDE :)
|
||||||
|
if noln:
|
||||||
|
msgend = ''
|
||||||
|
else:
|
||||||
|
msgend = '\n'
|
||||||
if verbose and self.show_verbose:
|
if verbose and self.show_verbose:
|
||||||
self.output(msg + '\n')
|
self.output(msg + msgend)
|
||||||
elif not verbose:
|
elif not verbose:
|
||||||
self.output(msg + '\n')
|
self.output(msg + msgend)
|
||||||
|
|
||||||
def warning(self,msg):
|
def warning(self,msg):
|
||||||
self.output(colorize('Warning:' + msg + '\n', 'purple'))
|
self.output(colorize('Warning:' + msg + '\n', 'purple'))
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ class UI(object):
|
|||||||
def set_debug(self, flag):
|
def set_debug(self, flag):
|
||||||
self.show_debug = flag
|
self.show_debug = flag
|
||||||
|
|
||||||
def info(self, msg, verbose = False):
|
def info(self, msg, verbose = False, noln = False):
|
||||||
"give an informative message"
|
"give an informative message"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user