From-Import-Removal

This commit is contained in:
Faik Uygur
2007-04-27 08:04:16 +00:00
parent 9eae2deb7f
commit 0c0b7e43b6
+98 -100
View File
@@ -15,30 +15,28 @@
import os import os
import sys import sys
import glob import glob
from copy import deepcopy import copy
from os.path import basename, dirname import stat
from stat import S_IMODE import pwd
from pwd import getpwnam import grp
from grp import getgrnam
import gettext import gettext
__trans = gettext.translation('pisi', fallback=True) __trans = gettext.translation('pisi', fallback=True)
_ = __trans.ugettext _ = __trans.ugettext
import pisi import pisi
from pisi.specfile import SpecFile import pisi.specfile
import pisi.util as util import pisi.util
from pisi.util import join_path as join, parenturi import pisi.file
from pisi.file import File
import pisi.context as ctx import pisi.context as ctx
import pisi.dependency as dependency import pisi.dependency as dependency
import pisi.operations as operations import pisi.operations as operations
from pisi.sourcearchive import SourceArchive import pisi.sourcearchive
from pisi.files import Files, FileInfo import pisi.files
from pisi.fetcher import fetch_url import pisi.fetcher
from pisi.uri import URI import pisi.uri
from pisi.metadata import MetaData import pisi.metadata
from pisi.package import Package import pisi.package
import pisi.component as component import pisi.component as component
import pisi.archive as archive import pisi.archive as archive
import pisi.actionsapi.variables import pisi.actionsapi.variables
@@ -53,7 +51,7 @@ def get_file_type(path, pinfo_list, install_dir):
"""Return the file type of a path according to the given PathInfo """Return the file type of a path according to the given PathInfo
list""" list"""
Match = lambda x: [match for match in glob.glob(install_dir + x) if join(install_dir, path).find(match) > -1] Match = lambda x: [match for match in glob.glob(install_dir + x) if pisi.util.join_path(install_dir, path).find(match) > -1]
def Sort(x): def Sort(x):
x.sort(reverse=True) x.sort(reverse=True)
@@ -83,7 +81,7 @@ def check_path_collision(package, pkgList):
# don't throw collision error for these files. # don't throw collision error for these files.
# we'll handle this in gen_files_xml.. # we'll handle this in gen_files_xml..
continue continue
if util.subpath(pinfo.path, path.path): if pisi.util.subpath(pinfo.path, path.path):
collisions.append(path.path) collisions.append(path.path)
ctx.ui.debug(_('Path %s belongs in multiple packages') % ctx.ui.debug(_('Path %s belongs in multiple packages') %
path.path) path.path)
@@ -102,7 +100,7 @@ class Builder:
src = sf.source src = sf.source
if src: if src:
src_uri = URI(src.sourceURI) src_uri = pisi.uri.URI(src.sourceURI)
if src_uri.is_absolute_path(): if src_uri.is_absolute_path():
src_path = str(src_uri) src_path = str(src_uri)
else: else:
@@ -120,8 +118,8 @@ class Builder:
def __init__(self, specuri): def __init__(self, specuri):
# process args # process args
if not isinstance(specuri, URI): if not isinstance(specuri, pisi.uri.URI):
specuri = URI(specuri) specuri = pisi.uri.URI(specuri)
# read spec file, we'll need it :) # read spec file, we'll need it :)
self.set_spec_file(specuri) self.set_spec_file(specuri)
@@ -129,9 +127,9 @@ class Builder:
if specuri.is_remote_file(): if specuri.is_remote_file():
self.specdir = self.fetch_files() self.specdir = self.fetch_files()
else: else:
self.specdir = dirname(self.specuri.get_uri()) self.specdir = os.path.dirname(self.specuri.get_uri())
self.sourceArchive = SourceArchive(self.spec, self.pkg_work_dir()) self.sourceArchive = pisi.sourcearchive.SourceArchive(self.spec, self.pkg_work_dir())
self.set_environment_vars() self.set_environment_vars()
@@ -141,9 +139,9 @@ class Builder:
def set_spec_file(self, specuri): def set_spec_file(self, specuri):
if not specuri.is_remote_file(): if not specuri.is_remote_file():
specuri = URI(os.path.realpath(specuri.get_uri())) # FIXME: doesn't work for file:// specuri = pisi.uri.URI(os.path.realpath(specuri.get_uri())) # FIXME: doesn't work for file://
self.specuri = specuri self.specuri = specuri
spec = SpecFile() spec = pisi.specfile.SpecFile()
spec.read(specuri, ctx.config.tmp_dir()) spec.read(specuri, ctx.config.tmp_dir())
self.spec = spec self.spec = spec
@@ -155,7 +153,7 @@ class Builder:
"package build directory" "package build directory"
packageDir = self.spec.source.name + '-' + \ packageDir = self.spec.source.name + '-' + \
self.spec.getSourceVersion() + '-' + self.spec.getSourceRelease() self.spec.getSourceVersion() + '-' + self.spec.getSourceRelease()
return util.join_path(ctx.config.dest_dir(), ctx.config.values.dirs.tmp_dir, return pisi.util.join_path(ctx.config.dest_dir(), ctx.config.values.dirs.tmp_dir,
packageDir) packageDir)
def pkg_work_dir(self): def pkg_work_dir(self):
@@ -168,11 +166,11 @@ class Builder:
return self.pkg_dir() + ctx.const.install_dir_suffix return self.pkg_dir() + ctx.const.install_dir_suffix
def set_state(self, state): def set_state(self, state):
stateFile = util.join_path(self.pkg_work_dir(), "pisiBuildState") stateFile = pisi.util.join_path(self.pkg_work_dir(), "pisiBuildState")
open(stateFile, "w").write(state) open(stateFile, "w").write(state)
def get_state(self): def get_state(self):
stateFile = util.join_path(self.pkg_work_dir(), "pisiBuildState") stateFile = pisi.util.join_path(self.pkg_work_dir(), "pisiBuildState")
if not os.path.exists(stateFile): # no state if not os.path.exists(stateFile): # no state
return None return None
return open(stateFile, "r").read() return open(stateFile, "r").read()
@@ -236,10 +234,10 @@ class Builder:
ctx.ui.info(_("CCache detected...")) ctx.ui.info(_("CCache detected..."))
def fetch_files(self): def fetch_files(self):
self.specdiruri = dirname(self.specuri.get_uri()) self.specdiruri = os.path.dirname(self.specuri.get_uri())
pkgname = basename(self.specdiruri) pkgname = os.path.basename(self.specdiruri)
self.destdir = join(ctx.config.tmp_dir(), pkgname) self.destdir = pisi.util.join_path(ctx.config.tmp_dir(), pkgname)
#self.location = dirname(self.url.uri) #self.location = os.path.dirname(self.url.uri)
self.fetch_actionsfile() self.fetch_actionsfile()
self.fetch_patches() self.fetch_patches()
@@ -249,51 +247,51 @@ class Builder:
return self.destdir return self.destdir
def fetch_actionsfile(self): def fetch_actionsfile(self):
actionsuri = join(self.specdiruri, ctx.const.actions_file) actionsuri = pisi.util.join_path(self.specdiruri, ctx.const.actions_file)
self.download(actionsuri, self.destdir) self.download(actionsuri, self.destdir)
def fetch_patches(self): def fetch_patches(self):
spec = self.spec spec = self.spec
for patch in spec.source.patches: for patch in spec.source.patches:
file_name = basename(patch.filename) file_name = os.path.basename(patch.filename)
dir_name = dirname(patch.filename) dir_name = os.path.dirname(patch.filename)
patchuri = join(self.specdiruri, patchuri = pisi.util.join_path(self.specdiruri,
ctx.const.files_dir, dir_name, file_name) ctx.const.files_dir, dir_name, file_name)
self.download(patchuri, join(self.destdir, ctx.const.files_dir, dir_name)) self.download(patchuri, pisi.util.join_path(self.destdir, ctx.const.files_dir, dir_name))
def fetch_comarfiles(self): def fetch_comarfiles(self):
spec = self.spec spec = self.spec
for package in spec.packages: for package in spec.packages:
for pcomar in package.providesComar: for pcomar in package.providesComar:
comaruri = join(self.specdiruri, comaruri = pisi.util.join_path(self.specdiruri,
ctx.const.comar_dir, pcomar.script) ctx.const.comar_dir, pcomar.script)
self.download(comaruri, join(self.destdir, ctx.const.comar_dir)) self.download(comaruri, pisi.util.join_path(self.destdir, ctx.const.comar_dir))
def fetch_additionalFiles(self): def fetch_additionalFiles(self):
spec = self.spec spec = self.spec
for pkg in spec.packages: for pkg in spec.packages:
for afile in pkg.additionalFiles: for afile in pkg.additionalFiles:
file_name = basename(afile.filename) file_name = os.path.basename(afile.filename)
dir_name = dirname(afile.filename) dir_name = os.path.dirname(afile.filename)
afileuri = join(self.specdiruri, afileuri = pisi.util.join_path(self.specdiruri,
ctx.const.files_dir, dir_name, file_name) ctx.const.files_dir, dir_name, file_name)
self.download(afileuri, join(self.destdir, ctx.const.files_dir, dir_name)) self.download(afileuri, pisi.util.join_path(self.destdir, ctx.const.files_dir, dir_name))
def download(self, uri, transferdir): def download(self, uri, transferdir):
# fix auth info and download # fix auth info and download
uri = File.make_uri(uri) uri = pisi.file.File.make_uri(uri)
File.download(uri, transferdir) pisi.file.File.download(uri, transferdir)
def fetch_component(self): def fetch_component(self):
if not self.spec.source.partOf: if not self.spec.source.partOf:
ctx.ui.warning(_('PartOf tag not defined, looking for component')) ctx.ui.warning(_('PartOf tag not defined, looking for component'))
diruri = parenturi(self.specuri.get_uri()) diruri = pisi.util.parenturi(self.specuri.get_uri())
parentdir = parenturi(diruri) parentdir = pisi.util.parenturi(diruri)
url = util.join_path(parentdir, 'component.xml') url = pisi.util.join_path(parentdir, 'component.xml')
progress = ctx.ui.Progress progress = ctx.ui.Progress
if URI(url).is_remote_file(): if pisi.uri.URI(url).is_remote_file():
fetch_url(url, self.pkg_work_dir(), progress) pisi.fetcher.fetch_url(url, self.pkg_work_dir(), progress)
path = util.join_path(self.pkg_work_dir(), 'component.xml') path = pisi.util.join_path(self.pkg_work_dir(), 'component.xml')
else: else:
if not os.path.exists(url): if not os.path.exists(url):
raise Exception(_('Cannot find component.xml in upper directory')) raise Exception(_('Cannot find component.xml in upper directory'))
@@ -335,7 +333,7 @@ class Builder:
# Before install make sure install_dir is clean # Before install make sure install_dir is clean
if os.path.exists(self.pkg_install_dir()): if os.path.exists(self.pkg_install_dir()):
util.clean_dir(self.pkg_install_dir()) pisi.util.clean_dir(self.pkg_install_dir())
# install function is mandatory! # install function is mandatory!
self.run_action_function(ctx.const.install_func, True) self.run_action_function(ctx.const.install_func, True)
@@ -356,7 +354,7 @@ class Builder:
for root, dirs, files in os.walk(install_dir): for root, dirs, files in os.walk(install_dir):
for file_ in files: for file_ in files:
already_in_package = False already_in_package = False
fpath = util.join_path(root, file_) fpath = pisi.util.join_path(root, file_)
for path in all_paths_in_packages: for path in all_paths_in_packages:
if not fpath.find(path): if not fpath.find(path):
already_in_package = True already_in_package = True
@@ -367,7 +365,7 @@ class Builder:
def compile_action_script(self): def compile_action_script(self):
"""Compiles given actions.py to check syntax error in it and sets the actionLocals and actionGlobals""" """Compiles given actions.py to check syntax error in it and sets the actionLocals and actionGlobals"""
fname = util.join_path(self.specdir, ctx.const.actions_file) fname = pisi.util.join_path(self.specdir, ctx.const.actions_file)
try: try:
localSymbols = globalSymbols = {} localSymbols = globalSymbols = {}
buf = open(fname).read() buf = open(fname).read()
@@ -385,7 +383,7 @@ class Builder:
"""Compiles comar scripts to check syntax errors""" """Compiles comar scripts to check syntax errors"""
for package in self.spec.packages: for package in self.spec.packages:
for pcomar in package.providesComar: for pcomar in package.providesComar:
fname = util.join_path(self.specdir, ctx.const.comar_dir, fname = pisi.util.join_path(self.specdir, ctx.const.comar_dir,
pcomar.script) pcomar.script)
try: try:
@@ -403,7 +401,7 @@ class Builder:
except KeyError: except KeyError:
workdir = self.spec.source.name + "-" + self.spec.getSourceVersion() workdir = self.spec.source.name + "-" + self.spec.getSourceVersion()
return util.join_path(self.pkg_work_dir(), workdir) return pisi.util.join_path(self.pkg_work_dir(), workdir)
def run_action_function(self, func, mandatory=False): def run_action_function(self, func, mandatory=False):
"""Calls the corresponding function in actions.py. """Calls the corresponding function in actions.py.
@@ -437,7 +435,7 @@ class Builder:
extra_names = filter(lambda x: not ctx.installdb.is_installed(x), extra_names) extra_names = filter(lambda x: not ctx.installdb.is_installed(x), extra_names)
if extra_names: if extra_names:
ctx.ui.warning(_('Safety switch: following extra packages in system.devel will be installed: ') + ctx.ui.warning(_('Safety switch: following extra packages in system.devel will be installed: ') +
util.strlist(extra_names)) pisi.util.strlist(extra_names))
extra_deps = [dependency.Dependency(package = x) for x in extra_names] extra_deps = [dependency.Dependency(package = x) for x in extra_names]
build_deps.extend(extra_deps) build_deps.extend(extra_deps)
else: else:
@@ -453,7 +451,7 @@ class Builder:
if dep_unsatis: if dep_unsatis:
ctx.ui.info(_("Unsatisfied Build Dependencies:") + ' ' ctx.ui.info(_("Unsatisfied Build Dependencies:") + ' '
+ util.strlist([str(x) for x in dep_unsatis]) ) + pisi.util.strlist([str(x) for x in dep_unsatis]) )
def fail(): def fail():
raise Error(_('Cannot build package due to unsatisfied build dependencies')) raise Error(_('Cannot build package due to unsatisfied build dependencies'))
@@ -477,33 +475,33 @@ class Builder:
def patch_exists(self): def patch_exists(self):
"""check existence of patch files declared in PSPEC""" """check existence of patch files declared in PSPEC"""
files_dir = os.path.abspath(util.join_path(self.specdir, files_dir = os.path.abspath(pisi.util.join_path(self.specdir,
ctx.const.files_dir)) ctx.const.files_dir))
for patch in self.spec.source.patches: for patch in self.spec.source.patches:
patchFile = util.join_path(files_dir, patch.filename) patchFile = pisi.util.join_path(files_dir, patch.filename)
if not os.access(patchFile, os.F_OK): if not os.access(patchFile, os.F_OK):
raise Error(_("Patch file is missing: %s\n") % patch.filename) raise Error(_("Patch file is missing: %s\n") % patch.filename)
def apply_patches(self): def apply_patches(self):
files_dir = os.path.abspath(util.join_path(self.specdir, files_dir = os.path.abspath(pisi.util.join_path(self.specdir,
ctx.const.files_dir)) ctx.const.files_dir))
for patch in self.spec.source.patches: for patch in self.spec.source.patches:
patchFile = util.join_path(files_dir, patch.filename) patchFile = pisi.util.join_path(files_dir, patch.filename)
if patch.compressionType: if patch.compressionType:
patchFile = util.uncompress(patchFile, patchFile = pisi.util.uncompress(patchFile,
compressType=patch.compressionType, compressType=patch.compressionType,
targetDir=ctx.config.tmp_dir()) targetDir=ctx.config.tmp_dir())
ctx.ui.action(_("* Applying patch: %s") % patch.filename) ctx.ui.action(_("* Applying patch: %s") % patch.filename)
util.do_patch(self.srcDir, patchFile, level=patch.level) pisi.util.do_patch(self.srcDir, patchFile, level=patch.level)
def generate_static_package_object(self): def generate_static_package_object(self):
ar_files = [] ar_files = []
for root, dirs, files in os.walk(self.pkg_install_dir()): for root, dirs, files in os.walk(self.pkg_install_dir()):
for f in files: for f in files:
if f.endswith(ctx.const.ar_file_suffix) and util.is_ar_file(util.join_path(root, f)): if f.endswith(ctx.const.ar_file_suffix) and pisi.util.is_ar_file(pisi.util.join_path(root, f)):
ar_files.append(util.join_path(root, f)) ar_files.append(pisi.util.join_path(root, f))
if not len(ar_files): if not len(ar_files):
return None return None
@@ -529,7 +527,7 @@ class Builder:
for root, dirs, files in os.walk(self.pkg_debug_dir()): for root, dirs, files in os.walk(self.pkg_debug_dir()):
for f in files: for f in files:
if f.endswith(ctx.const.debug_file_suffix): if f.endswith(ctx.const.debug_file_suffix):
debug_files.append(util.join_path(root, f)) debug_files.append(pisi.util.join_path(root, f))
if not len(debug_files): if not len(debug_files):
return None return None
@@ -557,16 +555,16 @@ class Builder:
install_dir = self.pkg_install_dir() install_dir = self.pkg_install_dir()
try: try:
nostrip = self.actionGlobals['NoStrip'] nostrip = self.actionGlobals['NoStrip']
util.strip_directory(install_dir, nostrip) pisi.util.strip_directory(install_dir, nostrip)
except KeyError: except KeyError:
util.strip_directory(install_dir) pisi.util.strip_directory(install_dir)
def gen_metadata_xml(self, package, build_no=None): def gen_metadata_xml(self, package, build_no=None):
"""Generate the metadata.xml file for build source. """Generate the metadata.xml file for build source.
metadata.xml is composed of the information from specfile plus metadata.xml is composed of the information from specfile plus
some additional information.""" some additional information."""
metadata = MetaData() metadata = pisi.metadata.MetaData()
metadata.from_spec(self.spec.source, package, self.spec.history) metadata.from_spec(self.spec.source, package, self.spec.history)
metadata.package.distribution = ctx.config.values.general.distribution metadata.package.distribution = ctx.config.values.general.distribution
@@ -585,7 +583,7 @@ class Builder:
def gen_files_xml(self, package): def gen_files_xml(self, package):
"""Generates files.xml using the path definitions in specfile and """Generates files.xml using the path definitions in specfile and
the files produced by the build system.""" the files produced by the build system."""
files = Files() files = pisi.files.Files()
if package.debug_package: if package.debug_package:
install_dir = self.pkg_debug_dir() install_dir = self.pkg_debug_dir()
@@ -604,34 +602,34 @@ class Builder:
d = {} d = {}
def add_path(path): def add_path(path):
# add the files under material path # add the files under material path
for fpath, fhash in util.get_file_hashes(path, collisions, install_dir): for fpath, fhash in pisi.util.get_file_hashes(path, collisions, install_dir):
if ctx.get_option('create_static') \ if ctx.get_option('create_static') \
and fpath.endswith(ctx.const.ar_file_suffix) \ and fpath.endswith(ctx.const.ar_file_suffix) \
and not package.name.endswith(ctx.const.static_name_suffix) \ and not package.name.endswith(ctx.const.static_name_suffix) \
and util.is_ar_file(fpath): and pisi.util.is_ar_file(fpath):
# if this is an ar file, and this package is not a static package, # if this is an ar file, and this package is not a static package,
# don't include this file into the package. # don't include this file into the package.
continue continue
frpath = util.removepathprefix(install_dir, fpath) # relative path frpath = pisi.util.removepathprefix(install_dir, fpath) # relative path
ftype, permanent = get_file_type(frpath, package.files, install_dir) ftype, permanent = get_file_type(frpath, package.files, install_dir)
fsize = util.dir_size(fpath) fsize = pisi.util.dir_size(fpath)
if not os.path.islink(fpath): if not os.path.islink(fpath):
st = os.stat(fpath) st = os.stat(fpath)
else: else:
st = os.lstat(fpath) st = os.lstat(fpath)
d[frpath] = FileInfo(path=frpath, type=ftype, permanent=permanent, d[frpath] = pisi.files.FileInfo(path=frpath, type=ftype, permanent=permanent,
size=fsize, hash=fhash, uid=str(st.st_uid), gid=str(st.st_gid), size=fsize, hash=fhash, uid=str(st.st_uid), gid=str(st.st_gid),
mode=oct(S_IMODE(st.st_mode))) mode=oct(stat.S_IMODE(st.st_mode)))
for pinfo in package.files: for pinfo in package.files:
wildcard_path = util.join_path(install_dir, pinfo.path) wildcard_path = pisi.util.join_path(install_dir, pinfo.path)
for path in glob.glob(wildcard_path): for path in glob.glob(wildcard_path):
add_path(path) add_path(path)
for (p, fileinfo) in d.iteritems(): for (p, fileinfo) in d.iteritems():
files.append(fileinfo) files.append(fileinfo)
files_xml_path = util.join_path(self.pkg_dir(), ctx.const.files_xml) files_xml_path = pisi.util.join_path(self.pkg_dir(), ctx.const.files_xml)
files.write(files_xml_path) files.write(files_xml_path)
self.files = files self.files = files
@@ -640,10 +638,10 @@ class Builder:
# find previous build in packages dir # find previous build in packages dir
found = [] found = []
def locate_old_package(old_package_fn): def locate_old_package(old_package_fn):
if util.is_package_name(os.path.basename(old_package_fn), package_name): if pisi.util.is_package_name(os.path.basename(old_package_fn), package_name):
try: try:
old_pkg = Package(old_package_fn, 'r') old_pkg = pisi.package.Package(old_package_fn, 'r')
old_pkg.read(util.join_path(ctx.config.tmp_dir(), 'oldpkg')) old_pkg.read(pisi.util.join_path(ctx.config.tmp_dir(), 'oldpkg'))
ctx.ui.info(_('(found old version %s)') % old_package_fn) ctx.ui.info(_('(found old version %s)') % old_package_fn)
if str(old_pkg.metadata.package.name) != package_name: if str(old_pkg.metadata.package.name) != package_name:
ctx.ui.warning(_('Skipping %s with wrong pkg name ') % ctx.ui.warning(_('Skipping %s with wrong pkg name ') %
@@ -656,12 +654,12 @@ class Builder:
for root, dirs, files in os.walk(ctx.config.compiled_packages_dir()): for root, dirs, files in os.walk(ctx.config.compiled_packages_dir()):
for file in files: for file in files:
locate_old_package(join(root,file)) locate_old_package(pisi.util.join_path(root,file))
outdir=ctx.get_option('output_dir') outdir=ctx.get_option('output_dir')
if not outdir: if not outdir:
outdir = '.' outdir = '.'
for file in [join(outdir,entry) for entry in os.listdir(outdir)]: for file in [pisi.util.join_path(outdir,entry) for entry in os.listdir(outdir)]:
if os.path.isfile(file): if os.path.isfile(file):
locate_old_package(file) locate_old_package(file)
@@ -696,8 +694,8 @@ class Builder:
old_package_fn, old_build = old_package_info old_package_fn, old_build = old_package_info
# compare old files.xml with the new one.. # compare old files.xml with the new one..
old_pkg = Package(old_package_fn, 'r') old_pkg = pisi.package.Package(old_package_fn, 'r')
old_pkg.read(util.join_path(ctx.config.tmp_dir(), 'oldpkg')) old_pkg.read(pisi.util.join_path(ctx.config.tmp_dir(), 'oldpkg'))
changed = False changed = False
fnew = self.files.list fnew = self.files.list
@@ -791,18 +789,18 @@ class Builder:
for afile in package.additionalFiles: for afile in package.additionalFiles:
src = os.path.join(ctx.const.files_dir, afile.filename) src = os.path.join(ctx.const.files_dir, afile.filename)
dest = os.path.join(install_dir + os.path.dirname(afile.target), os.path.basename(afile.target)) dest = os.path.join(install_dir + os.path.dirname(afile.target), os.path.basename(afile.target))
util.copy_file(src, dest) pisi.util.copy_file(src, dest)
if afile.permission: if afile.permission:
# mode is octal! # mode is octal!
os.chmod(dest, int(afile.permission, 8)) os.chmod(dest, int(afile.permission, 8))
if afile.owner: if afile.owner:
try: try:
os.chown(dest, getpwnam(afile.owner)[2], -1) os.chown(dest, pwd.getpwnam(afile.owner)[2], -1)
except KeyError: except KeyError:
ctx.ui.warning(_("No user named '%s' found on the system") % afile.owner) ctx.ui.warning(_("No user named '%s' found on the system") % afile.owner)
if afile.group: if afile.group:
try: try:
os.chown(dest, -1, getgrnam(afile.group)[2]) os.chown(dest, -1, grp.getgrnam(afile.group)[2])
except KeyError: except KeyError:
ctx.ui.warning(_("No group named '%s' found on the system") % afile.group) ctx.ui.warning(_("No group named '%s' found on the system") % afile.group)
os.chdir(c) os.chdir(c)
@@ -827,10 +825,10 @@ class Builder:
build_no, old_build_no = self.calc_build_no(old_package_info) build_no, old_build_no = self.calc_build_no(old_package_info)
self.metadata.package.build = build_no self.metadata.package.build = build_no
self.metadata.write(util.join_path(self.pkg_dir(), ctx.const.metadata_xml)) self.metadata.write(pisi.util.join_path(self.pkg_dir(), ctx.const.metadata_xml))
# Calculate new and oldpackage names for buildfarm # Calculate new and oldpackage names for buildfarm
name = util.package_name(package.name, name = pisi.util.package_name(package.name,
self.spec.getSourceVersion(), self.spec.getSourceVersion(),
self.spec.getSourceRelease(), self.spec.getSourceRelease(),
self.metadata.package.build) self.metadata.package.build)
@@ -842,12 +840,12 @@ class Builder:
ctx.ui.info(_("Creating PiSi package %s.") % name) ctx.ui.info(_("Creating PiSi package %s.") % name)
pkg = Package(name, 'w') pkg = pisi.package.Package(name, 'w')
# add comar files to package # add comar files to package
os.chdir(self.specdir) os.chdir(self.specdir)
for pcomar in package.providesComar: for pcomar in package.providesComar:
fname = util.join_path(ctx.const.comar_dir, fname = pisi.util.join_path(ctx.const.comar_dir,
pcomar.script) pcomar.script)
pkg.add_to_package(fname) pkg.add_to_package(fname)
@@ -859,23 +857,23 @@ class Builder:
# Now it is time to add files to the packages using newly # Now it is time to add files to the packages using newly
# created files.xml # created files.xml
files = Files() files = pisi.files.Files()
files.read(ctx.const.files_xml) files.read(ctx.const.files_xml)
if ctx.get_option('package_format') == "1.0": if ctx.get_option('package_format') == "1.0":
for finfo in files.list: for finfo in files.list:
orgname = arcname = join("install", finfo.path) orgname = arcname = pisi.util.join_path("install", finfo.path)
if package.debug_package: if package.debug_package:
orgname = join("debug", finfo.path) orgname = pisi.util.join_path("debug", finfo.path)
pkg.add_to_package(orgname, arcname) pkg.add_to_package(orgname, arcname)
pkg.close() pkg.close()
else: # default package format is 1.1, so make it fallback. else: # default package format is 1.1, so make it fallback.
ctx.build_leftover = join(self.pkg_dir(), ctx.const.install_tar_lzma) ctx.build_leftover = pisi.util.join_path(self.pkg_dir(), ctx.const.install_tar_lzma)
tar = archive.ArchiveTar(ctx.const.install_tar_lzma, "tarlzma") tar = archive.ArchiveTar(ctx.const.install_tar_lzma, "tarlzma")
for finfo in files.list: for finfo in files.list:
orgname = arcname = join("install", finfo.path) orgname = arcname = pisi.util.join_path("install", finfo.path)
if package.debug_package: if package.debug_package:
orgname = join("debug", finfo.path) orgname = pisi.util.join_path("debug", finfo.path)
tar.add_to_archive(orgname, arcname.lstrip("install")) tar.add_to_archive(orgname, arcname.lstrip("install"))
tar.close() tar.close()
pkg.add_to_package(ctx.const.install_tar_lzma) pkg.add_to_package(ctx.const.install_tar_lzma)
@@ -900,7 +898,7 @@ class Builder:
if ctx.config.values.general.autoclean is True: if ctx.config.values.general.autoclean is True:
ctx.ui.info(_("Cleaning Build Directory...")) ctx.ui.info(_("Cleaning Build Directory..."))
util.clean_dir(self.pkg_dir()) pisi.util.clean_dir(self.pkg_dir())
else: else:
ctx.ui.info(_("Keeping Build Directory")) ctx.ui.info(_("Keeping Build Directory"))
@@ -910,7 +908,7 @@ class Builder:
# and left environment variables go directly into initial dict # and left environment variables go directly into initial dict
# making actionsapi.variables.exportFlags() useless... # making actionsapi.variables.exportFlags() useless...
os.environ = {} os.environ = {}
os.environ = deepcopy(ctx.config.environ) os.environ = copy.deepcopy(ctx.config.environ)
return self.new_packages, self.old_packages return self.new_packages, self.old_packages