* fix: use build number in output filename
* package_prefix -> package_suffix :) * small comments
This commit is contained in:
@@ -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'''
|
||||
|
||||
@@ -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):
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
|
||||
+1
-1
@@ -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'):
|
||||
|
||||
+8
-4
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user