arşivin açıldığı dizin (srcDir) build içerisinde farklı yerlerde
kullanılıyor. bu yüzden o dizine gitmek yerine (gotoSrcDir) o dizini alan bir fonksiyona ihtiyacımız vardı. Yaptık... do_patch artık srcDir'da çalışıyor, pkg_work_dir()'da değil. build.py'nin biraz kirli olduğunu düşünüyorum. Bu akşam biraz temizleyeceğim bu dosyayı.
This commit is contained in:
+20
-17
@@ -81,8 +81,7 @@ class PisiBuild:
|
|||||||
self.sourceArchive.unpack()
|
self.sourceArchive.unpack()
|
||||||
ui.info(" unpacked (%s)\n" % self.ctx.pkg_work_dir())
|
ui.info(" unpacked (%s)\n" % self.ctx.pkg_work_dir())
|
||||||
|
|
||||||
self.applyPatches()
|
# Compile actions.py
|
||||||
|
|
||||||
try:
|
try:
|
||||||
specdir = os.path.dirname(self.ctx.pspecfile)
|
specdir = os.path.dirname(self.ctx.pspecfile)
|
||||||
self.actionScript = open("/".join([specdir, \
|
self.actionScript = open("/".join([specdir, \
|
||||||
@@ -91,10 +90,6 @@ class PisiBuild:
|
|||||||
ui.error ("Action Script: %s\n" % e)
|
ui.error ("Action Script: %s\n" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
#we'll need this our working directory after actionscript
|
|
||||||
#finished its work in the work_dir
|
|
||||||
curDir = os.getcwd()
|
|
||||||
|
|
||||||
localSymbols = globalSymbols = {}
|
localSymbols = globalSymbols = {}
|
||||||
# Set needed evironment variables for actions API
|
# Set needed evironment variables for actions API
|
||||||
self.setEnvorinment()
|
self.setEnvorinment()
|
||||||
@@ -104,8 +99,16 @@ class PisiBuild:
|
|||||||
except SyntaxError, e:
|
except SyntaxError, e:
|
||||||
ui.error ("Error : %s\n" % e)
|
ui.error ("Error : %s\n" % e)
|
||||||
return
|
return
|
||||||
# Go to source directory
|
# Get the source directory
|
||||||
self.gotoSrcDir(globalSymbols)
|
self.srcDir = self.pkgSrcDir(globalSymbols)
|
||||||
|
|
||||||
|
# apply patches from specfile
|
||||||
|
self.applyPatches()
|
||||||
|
|
||||||
|
#we'll need this our working directory after actionscript
|
||||||
|
#finished its work in the work_dir
|
||||||
|
curDir = os.getcwd()
|
||||||
|
os.chdir(self.srcDir)
|
||||||
|
|
||||||
# Run configure, build and install phase
|
# Run configure, build and install phase
|
||||||
self.configureSource(localSymbols)
|
self.configureSource(localSymbols)
|
||||||
@@ -128,13 +131,14 @@ class PisiBuild:
|
|||||||
patchFile = os.path.join(files_dir, patch.filename)
|
patchFile = os.path.join(files_dir, patch.filename)
|
||||||
if patch.compressionType:
|
if patch.compressionType:
|
||||||
patchFile = util.uncompress(patchFile,
|
patchFile = util.uncompress(patchFile,
|
||||||
|
compressType = patch.compressionType,
|
||||||
targetDir=self.ctx.tmp_dir())
|
targetDir=self.ctx.tmp_dir())
|
||||||
|
|
||||||
ui.info("Applying patch: %s\n" % patch.filename)
|
ui.info("Applying patch: %s\n" % patch.filename)
|
||||||
util.do_patch(self.ctx.pkg_work_dir(), patchFile)
|
util.do_patch(self.srcDir, patchFile, level=patch.level)
|
||||||
|
|
||||||
def setEnvorinment(self):
|
def setEnvorinment(self):
|
||||||
# put the evironment variables for actions API to use.
|
"""Sets the environment variables for actions API to use"""
|
||||||
evn = {
|
evn = {
|
||||||
"PKG_DIR": self.ctx.pkg_dir(),
|
"PKG_DIR": self.ctx.pkg_dir(),
|
||||||
"WORK_DIR": self.ctx.pkg_work_dir(),
|
"WORK_DIR": self.ctx.pkg_work_dir(),
|
||||||
@@ -145,19 +149,18 @@ class PisiBuild:
|
|||||||
}
|
}
|
||||||
os.environ.update(evn)
|
os.environ.update(evn)
|
||||||
|
|
||||||
def gotoSrcDir(self, globalSymbols):
|
def pkgSrcDir(self, globalSymbols):
|
||||||
"""Changes the current working directory to package_work_dir() for
|
"""Returns the real path of WorkDir for an unpacked archive."""
|
||||||
actions.py to do its work."""
|
|
||||||
if 'WorkDir' in globalSymbols:
|
if 'WorkDir' in globalSymbols:
|
||||||
path = os.path.join(self.ctx.pkg_work_dir(), globalSymbols['WorkDir'])
|
path = os.path.join(self.ctx.pkg_work_dir(), globalSymbols['WorkDir'])
|
||||||
else:
|
else:
|
||||||
path = os.path.join(self.ctx.pkg_work_dir(), self.spec.source.name \
|
path = os.path.join(self.ctx.pkg_work_dir(), self.spec.source.name \
|
||||||
+ "-" + self.spec.source.version)
|
+ "-" + self.spec.source.version)
|
||||||
try:
|
|
||||||
os.chdir(path)
|
if not os.path.exists(path):
|
||||||
except OSError, e:
|
|
||||||
ui.error ("No such file or directory: %s\n" % e)
|
ui.error ("No such file or directory: %s\n" % e)
|
||||||
sys.exit()
|
sys.exit(1)
|
||||||
|
return path
|
||||||
|
|
||||||
def configureSource(self, localSymbols):
|
def configureSource(self, localSymbols):
|
||||||
"""Calls the corresponding function in actions.py. This time its
|
"""Calls the corresponding function in actions.py. This time its
|
||||||
|
|||||||
Reference in New Issue
Block a user