os.path.join'i sevmiyor onun yerine util altındaki path_join'imizi kullanıyoruz..
gereksiz bir iki satırı çıkardım bir de..
This commit is contained in:
+17
-19
@@ -107,9 +107,8 @@ class BuildContext(object):
|
|||||||
"package build directory"
|
"package build directory"
|
||||||
packageDir = self.spec.source.name + '-' + \
|
packageDir = self.spec.source.name + '-' + \
|
||||||
self.spec.source.version + '-' + self.spec.source.release
|
self.spec.source.version + '-' + self.spec.source.release
|
||||||
from pisi.util import join_path as join
|
return util.join_path(ctx.config.dest_dir(), ctx.config.values.dirs.tmp_dir,
|
||||||
return join( ctx.config.dest_dir(), ctx.config.values.dirs.tmp_dir,
|
packageDir)
|
||||||
packageDir )
|
|
||||||
|
|
||||||
def pkg_work_dir(self):
|
def pkg_work_dir(self):
|
||||||
return self.pkg_dir() + ctx.const.work_dir_suffix
|
return self.pkg_dir() + ctx.const.work_dir_suffix
|
||||||
@@ -133,11 +132,11 @@ class Builder:
|
|||||||
self.srcDir = None
|
self.srcDir = None
|
||||||
|
|
||||||
def set_state(self, state):
|
def set_state(self, state):
|
||||||
stateFile = os.path.join(self.bctx.pkg_work_dir(), "pisiBuildState")
|
stateFile = util.join_path(self.bctx.pkg_work_dir(), "pisiBuildState")
|
||||||
open(stateFile, "w").write(state)
|
open(stateFile, "w").write(state)
|
||||||
|
|
||||||
def get_state(self):
|
def get_state(self):
|
||||||
stateFile = os.path.join(self.bctx.pkg_work_dir(), "pisiBuildState")
|
stateFile = util.join_path(self.bctx.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()
|
||||||
@@ -228,7 +227,7 @@ class Builder:
|
|||||||
def compile_action_script(self):
|
def compile_action_script(self):
|
||||||
"""Compiles actions.py and sets the actionLocals and actionGlobals"""
|
"""Compiles actions.py and sets the actionLocals and actionGlobals"""
|
||||||
specdir = os.path.dirname(self.bctx.pspecfile)
|
specdir = os.path.dirname(self.bctx.pspecfile)
|
||||||
scriptfile = os.path.join(specdir, ctx.const.actions_file)
|
scriptfile = util.join_path(specdir, ctx.const.actions_file)
|
||||||
try:
|
try:
|
||||||
localSymbols = globalSymbols = {}
|
localSymbols = globalSymbols = {}
|
||||||
buf = open(scriptfile).read()
|
buf = open(scriptfile).read()
|
||||||
@@ -249,7 +248,7 @@ class Builder:
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
workdir = self.spec.source.name + "-" + self.spec.source.version
|
workdir = self.spec.source.name + "-" + self.spec.source.version
|
||||||
|
|
||||||
return os.path.join(self.bctx.pkg_work_dir(), workdir)
|
return util.join_path(self.bctx.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.
|
||||||
@@ -296,19 +295,19 @@ 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(os.path.join(self.pspecDir,
|
files_dir = os.path.abspath(util.join_path(self.pspecDir,
|
||||||
ctx.const.files_dir))
|
ctx.const.files_dir))
|
||||||
for patch in self.spec.source.patches:
|
for patch in self.spec.source.patches:
|
||||||
patchFile = os.path.join(files_dir, patch.filename)
|
patchFile = 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(os.path.join(self.pspecDir,
|
files_dir = os.path.abspath(util.join_path(self.pspecDir,
|
||||||
ctx.const.files_dir))
|
ctx.const.files_dir))
|
||||||
|
|
||||||
for patch in self.spec.source.patches:
|
for patch in self.spec.source.patches:
|
||||||
patchFile = os.path.join(files_dir, patch.filename)
|
patchFile = util.join_path(files_dir, patch.filename)
|
||||||
if patch.compressionType:
|
if patch.compressionType:
|
||||||
patchFile = util.uncompress(patchFile,
|
patchFile = util.uncompress(patchFile,
|
||||||
compressType=patch.compressionType,
|
compressType=patch.compressionType,
|
||||||
@@ -353,7 +352,7 @@ class Builder:
|
|||||||
else:
|
else:
|
||||||
metadata.package.build = self.calc_build_no(metadata.package.name)
|
metadata.package.build = self.calc_build_no(metadata.package.name)
|
||||||
|
|
||||||
metadata_xml_path = os.path.join(self.bctx.pkg_dir(), ctx.const.metadata_xml)
|
metadata_xml_path = util.join_path(self.bctx.pkg_dir(), ctx.const.metadata_xml)
|
||||||
metadata.write(metadata_xml_path)
|
metadata.write(metadata_xml_path)
|
||||||
self.metadata = metadata
|
self.metadata = metadata
|
||||||
|
|
||||||
@@ -393,7 +392,7 @@ class Builder:
|
|||||||
for (p, fileinfo) in d.iteritems():
|
for (p, fileinfo) in d.iteritems():
|
||||||
files.append(fileinfo)
|
files.append(fileinfo)
|
||||||
|
|
||||||
files_xml_path = os.path.join(self.bctx.pkg_dir(), ctx.const.files_xml)
|
files_xml_path = util.join_path(self.bctx.pkg_dir(), ctx.const.files_xml)
|
||||||
files.write(files_xml_path)
|
files.write(files_xml_path)
|
||||||
self.files = files
|
self.files = files
|
||||||
|
|
||||||
@@ -406,10 +405,10 @@ class Builder:
|
|||||||
for fn in files:
|
for fn in files:
|
||||||
fn = fn.decode('utf-8')
|
fn = fn.decode('utf-8')
|
||||||
if util.is_package_name(fn, package_name):
|
if util.is_package_name(fn, package_name):
|
||||||
old_package_fn = os.path.join(root, fn)
|
old_package_fn = util.join_path(root, fn)
|
||||||
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(util.join_path(ctx.config.tmp_dir(), 'oldpkg'))
|
||||||
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 ' %
|
||||||
old_package_fn)
|
old_package_fn)
|
||||||
@@ -438,7 +437,7 @@ class Builder:
|
|||||||
|
|
||||||
# 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 = Package(old_package_fn, 'r')
|
||||||
old_pkg.read(os.path.join(ctx.config.tmp_dir(), 'oldpkg'))
|
old_pkg.read(util.join_path(ctx.config.tmp_dir(), 'oldpkg'))
|
||||||
|
|
||||||
# FIXME: TAKE INTO ACCOUNT MINOR CHANGES IN METADATA
|
# FIXME: TAKE INTO ACCOUNT MINOR CHANGES IN METADATA
|
||||||
changed = False
|
changed = False
|
||||||
@@ -485,9 +484,8 @@ class Builder:
|
|||||||
os.chdir(self.pspecDir)
|
os.chdir(self.pspecDir)
|
||||||
install_dir = self.bctx.pkg_dir() + ctx.const.install_dir_suffix
|
install_dir = self.bctx.pkg_dir() + ctx.const.install_dir_suffix
|
||||||
for afile in package.additionalFiles:
|
for afile in package.additionalFiles:
|
||||||
wildcard_path = util.join_path(ctx.const.files_dir, afile.filename)
|
|
||||||
destdir = util.join_path(install_dir, os.path.dirname(afile.target))
|
destdir = util.join_path(install_dir, os.path.dirname(afile.target))
|
||||||
for src in glob.glob(wildcard_path):
|
for src in glob.glob(util.join_path(ctx.const.files_dir, afile.filename)):
|
||||||
destfile = os.path.basename(afile.target)
|
destfile = os.path.basename(afile.target)
|
||||||
if not destfile: destfile = os.path.basename(src)
|
if not destfile: destfile = os.path.basename(src)
|
||||||
ctx.ui.debug(_("Copying additional file: '%s' to '%s' as '%s'") \
|
ctx.ui.debug(_("Copying additional file: '%s' to '%s' as '%s'") \
|
||||||
@@ -518,7 +516,7 @@ class Builder:
|
|||||||
# add comar files to package
|
# add comar files to package
|
||||||
os.chdir(self.pspecDir)
|
os.chdir(self.pspecDir)
|
||||||
for pcomar in package.providesComar:
|
for pcomar in package.providesComar:
|
||||||
fname = os.path.join(ctx.const.comar_dir,
|
fname = util.join_path(ctx.const.comar_dir,
|
||||||
pcomar.script)
|
pcomar.script)
|
||||||
pkg.add_to_package(fname)
|
pkg.add_to_package(fname)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user