diff --git a/pisi/actionsapi/pisitools.py b/pisi/actionsapi/pisitools.py index af9f321c..3e73d08c 100644 --- a/pisi/actionsapi/pisitools.py +++ b/pisi/actionsapi/pisitools.py @@ -10,6 +10,9 @@ # # Please read the COPYING file. +'''supports globs in sourceFile arguments''' + + # Standart Python Modules import os import glob @@ -35,7 +38,6 @@ from pisi.actionsapi import error def dobin(sourceFile, destinationDirectory = '/usr/bin'): '''insert a executable file into /bin or /usr/bin''' - ''' example call: pisitools.dobin("bin/xloadimage", "/bin", "xload") ''' executable_insinto(join_path(get.installDIR(), destinationDirectory), sourceFile) @@ -56,7 +58,7 @@ def doexe(sourceFile, destinationDirectory): def dohard(sourceFile, destinationFile): '''creates hard link between sourceFile and destinationFile''' #FIXME: How can i use hard-links in Python? - pass + ctx.ui.warning('*** Hard links not implemented yet') def dohtml(*sourceFiles): '''inserts the files in the list of files into /usr/share/doc/PACKAGE/html''' diff --git a/pisi/actionsapi/pisitoolsfunctions.py b/pisi/actionsapi/pisitoolsfunctions.py index 53eac30d..1fa7be63 100644 --- a/pisi/actionsapi/pisitoolsfunctions.py +++ b/pisi/actionsapi/pisitoolsfunctions.py @@ -50,6 +50,7 @@ def executable_insinto(destinationDirectory, *sourceFiles): for sourceFile in sourceFiles: for source in glob.glob(sourceFile): + # FIXME: use an internal install routine for these system('install -m0755 -o root -g root %s %s' % (source, destinationDirectory)) def readable_insinto(destinationDirectory, *sourceFiles): diff --git a/pisi/api.py b/pisi/api.py index d2c0d221..e34c4a39 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -180,7 +180,7 @@ def configure_pending(): def info(package): - if package.endswith(ctx.const.package_prefix): + if package.endswith(ctx.const.package_suffix): return info_file(package) else: return info_name(package) diff --git a/pisi/build.py b/pisi/build.py index 5ed949cd..2295a66d 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -492,11 +492,7 @@ class Builder: os.chmod(dest, int(afile.permission, 8)) os.chdir(c) - - name = util.package_name(package.name, - self.spec.source.version, - self.spec.source.release) - + ctx.ui.action(_("** Building package %s") % package.name); ctx.ui.info(_("Generating %s,") % ctx.const.files_xml) @@ -507,6 +503,10 @@ class Builder: ctx.ui.info(_("Creating PISI package %s.") % name) + name = util.package_name(package.name, + self.spec.source.version, + self.spec.source.release, + self.metadata.build) pkg = Package(name, 'w') # add comar files to package diff --git a/pisi/constants.py b/pisi/constants.py index 55e128a1..dfb4d9d8 100644 --- a/pisi/constants.py +++ b/pisi/constants.py @@ -46,7 +46,7 @@ class Constants: def __init__(self): # prefix for package names - self.__c.package_prefix = ".pisi" + self.__c.package_suffix = ".pisi" # directory suffixes for build self.__c.work_dir_suffix = "/work" diff --git a/pisi/index.py b/pisi/index.py index aab13506..58ab6148 100644 --- a/pisi/index.py +++ b/pisi/index.py @@ -71,7 +71,7 @@ class Index(XmlFile): self.repo_dir = repo_uri for root, dirs, files in os.walk(repo_uri): for fn in files: - if fn.endswith(ctx.const.package_prefix): + if fn.endswith(ctx.const.package_suffix): ctx.ui.info(_('Adding %s to package index') %fn) self.add_package(os.path.join(root, fn), repo_uri) diff --git a/pisi/operations.py b/pisi/operations.py index df52a0a7..346667bc 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -60,7 +60,7 @@ def install_pkg_files(package_URIs): ctx.ui.debug('A = %s' % str(package_URIs)) for x in package_URIs: - if not x.endswith(ctx.const.package_prefix): + if not x.endswith(ctx.const.package_suffix): raise Error(_('Mixing file names and package names not supported yet.')) if ctx.config.get_option('ignore_dependency'): diff --git a/pisi/util.py b/pisi/util.py index 1b2d0107..d94cbb58 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -476,17 +476,21 @@ def clean_locks(top = '.'): # Package/Repository Related Functions # ######################################## -def package_name(name, version, release): - return name + '-' + version + '-' + release + ctx.const.package_prefix +def package_name(name, version, release, build): + fn = name + '-' + version + '-' + release + if build: + fn += '-' + build + fn += ctx.const.package_suffix + return fn def is_package_name(fn, package_name = None): "check if fn is a valid filename for given package_name" "if not given a package name, see if fn fits the package name rules" if (package_name==None) or fn.startswith(package_name + '-'): - if fn.endswith(ctx.const.package_prefix): + if fn.endswith(ctx.const.package_suffix): # get version string, skip separator '-' verstr = fn[len(package_name) + 1: - len(fn)-len(ctx.const.package_prefix)] + len(fn)-len(ctx.const.package_suffix)] import string for x in verstr.split('-'): # weak rule: version components after '-' start with a digit diff --git a/tests/constantstests.py b/tests/constantstests.py index eb678e21..45a61b1c 100644 --- a/tests/constantstests.py +++ b/tests/constantstests.py @@ -19,7 +19,7 @@ class ContextTestCase(unittest.TestCase): # test if we can get a const attribute? try: - test = const.package_prefix + test = const.package_suffix self.assertNotEqual(test, "") except AttributeError: self.fail("Couldn't get const attribute")