From 422e46ec5130d4d9332de591d10330d1b22d9d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Mon, 4 Jul 2005 14:52:51 +0000 Subject: [PATCH] =?UTF-8?q?ar=C5=9Fivin=20a=C3=A7=C4=B1ld=C4=B1=C4=9F?= =?UTF-8?q?=C4=B1=20dizin=20(srcDir)=20build=20i=C3=A7erisinde=20farkl?= =?UTF-8?q?=C4=B1=20yerlerde=20kullan=C4=B1l=C4=B1yor.=20bu=20y=C3=BCzden?= =?UTF-8?q?=20o=20dizine=20gitmek=20yerine=20(gotoSrcDir)=20o=20dizini=20a?= =?UTF-8?q?lan=20bir=20fonksiyona=20ihtiyac=C4=B1m=C4=B1z=20vard=C4=B1.=20?= =?UTF-8?q?Yapt=C4=B1k...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ı. --- pisi/build.py | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/pisi/build.py b/pisi/build.py index c5213fb0..e38548c4 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -81,8 +81,7 @@ class PisiBuild: self.sourceArchive.unpack() ui.info(" unpacked (%s)\n" % self.ctx.pkg_work_dir()) - self.applyPatches() - + # Compile actions.py try: specdir = os.path.dirname(self.ctx.pspecfile) self.actionScript = open("/".join([specdir, \ @@ -91,10 +90,6 @@ class PisiBuild: ui.error ("Action Script: %s\n" % e) return - #we'll need this our working directory after actionscript - #finished its work in the work_dir - curDir = os.getcwd() - localSymbols = globalSymbols = {} # Set needed evironment variables for actions API self.setEnvorinment() @@ -104,8 +99,16 @@ class PisiBuild: except SyntaxError, e: ui.error ("Error : %s\n" % e) return - # Go to source directory - self.gotoSrcDir(globalSymbols) + # Get the source directory + 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 self.configureSource(localSymbols) @@ -128,13 +131,14 @@ class PisiBuild: patchFile = os.path.join(files_dir, patch.filename) if patch.compressionType: patchFile = util.uncompress(patchFile, + compressType = patch.compressionType, targetDir=self.ctx.tmp_dir()) 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): - # put the evironment variables for actions API to use. + """Sets the environment variables for actions API to use""" evn = { "PKG_DIR": self.ctx.pkg_dir(), "WORK_DIR": self.ctx.pkg_work_dir(), @@ -145,19 +149,18 @@ class PisiBuild: } os.environ.update(evn) - def gotoSrcDir(self, globalSymbols): - """Changes the current working directory to package_work_dir() for - actions.py to do its work.""" + def pkgSrcDir(self, globalSymbols): + """Returns the real path of WorkDir for an unpacked archive.""" if 'WorkDir' in globalSymbols: path = os.path.join(self.ctx.pkg_work_dir(), globalSymbols['WorkDir']) else: path = os.path.join(self.ctx.pkg_work_dir(), self.spec.source.name \ + "-" + self.spec.source.version) - try: - os.chdir(path) - except OSError, e: + + if not os.path.exists(path): ui.error ("No such file or directory: %s\n" % e) - sys.exit() + sys.exit(1) + return path def configureSource(self, localSymbols): """Calls the corresponding function in actions.py. This time its