* revamp build context too, simplify this stuff
* make build run again, packagers GA :) * more fixes to come
This commit is contained in:
+1
-1
@@ -138,7 +138,7 @@ class PisiBuild:
|
|||||||
ui.info("Fetching source from: %s\n" % self.spec.source.archiveUri)
|
ui.info("Fetching source from: %s\n" % self.spec.source.archiveUri)
|
||||||
self.sourceArchive.fetch()
|
self.sourceArchive.fetch()
|
||||||
ui.info("Source archive is stored: %s/%s\n"
|
ui.info("Source archive is stored: %s/%s\n"
|
||||||
%(self.ctx.archives_dir(), self.spec.source.archiveName))
|
%(config.archives_dir(), self.spec.source.archiveName))
|
||||||
|
|
||||||
def unpackSourceArchive(self):
|
def unpackSourceArchive(self):
|
||||||
ui.info("Unpacking archive...")
|
ui.info("Unpacking archive...")
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ class Config(object):
|
|||||||
self.values = ConfigurationFile("/etc/pisi/pisi.conf")
|
self.values = ConfigurationFile("/etc/pisi/pisi.conf")
|
||||||
self.destdir = self.values.general.destinationdirectory
|
self.destdir = self.values.general.destinationdirectory
|
||||||
|
|
||||||
|
def __call__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
# directory accessor functions
|
# directory accessor functions
|
||||||
# here is how it goes
|
# here is how it goes
|
||||||
# x_dir: system wide directory for storing info type x
|
# x_dir: system wide directory for storing info type x
|
||||||
|
|||||||
+26
-38
@@ -16,49 +16,37 @@
|
|||||||
# Eray Ozkural <eray@uludag.org.tr>
|
# Eray Ozkural <eray@uludag.org.tr>
|
||||||
|
|
||||||
from constants import const
|
from constants import const
|
||||||
from config import Config
|
from config import config
|
||||||
from specfile import SpecFile
|
from specfile import SpecFile
|
||||||
|
|
||||||
class BuildContext(object):
|
class BuildContext(object):
|
||||||
"""Build Context Singleton"""
|
"""Build Context Singleton"""
|
||||||
|
|
||||||
class ctximpl(Config.configimpl): # singleton implementation
|
|
||||||
|
|
||||||
def __init(self):
|
|
||||||
super(ctximpl, self).__init__()
|
|
||||||
|
|
||||||
def setSpecFile(self, pspecfile):
|
|
||||||
self.pspecfile = pspecfile
|
|
||||||
spec = SpecFile()
|
|
||||||
spec.read(pspecfile)
|
|
||||||
spec.verify() # check pspec integrity
|
|
||||||
self.spec = spec
|
|
||||||
|
|
||||||
# directory accessor functions
|
|
||||||
|
|
||||||
# pkg_x_dir: per package directory for storing info type x
|
|
||||||
|
|
||||||
def pkg_dir(self):
|
|
||||||
"package build directory"
|
|
||||||
packageDir = self.spec.source.name + '-' \
|
|
||||||
+ self.spec.source.version + '-' + self.spec.source.release
|
|
||||||
|
|
||||||
return self.destdir + self.values.dirs.tmp_dir \
|
|
||||||
+ '/' + packageDir
|
|
||||||
|
|
||||||
def pkg_work_dir(self):
|
|
||||||
return self.pkg_dir() + const.work_dir_suffix
|
|
||||||
|
|
||||||
def pkg_install_dir(self):
|
|
||||||
return self.pkg_dir() + const.install_dir_suffix
|
|
||||||
|
|
||||||
__instance = ctximpl() # singleton implementation
|
|
||||||
|
|
||||||
def __init__(self, pspecfile):
|
def __init__(self, pspecfile):
|
||||||
self.__instance.setSpecFile(pspecfile)
|
super(BuildContext, self).__init__()
|
||||||
|
self.setSpecFile(pspecfile)
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def setSpecFile(self, pspecfile):
|
||||||
return getattr(self.__instance, attr)
|
self.pspecfile = pspecfile
|
||||||
|
spec = SpecFile()
|
||||||
|
spec.read(pspecfile)
|
||||||
|
spec.verify() # check pspec integrity
|
||||||
|
self.spec = spec
|
||||||
|
|
||||||
def __setattr__(self, attr, value):
|
# directory accessor functions
|
||||||
setattr(self.__instance, attr, value)
|
|
||||||
|
# pkg_x_dir: per package directory for storing info type x
|
||||||
|
|
||||||
|
def pkg_dir(self):
|
||||||
|
"package build directory"
|
||||||
|
packageDir = self.spec.source.name + '-' + \
|
||||||
|
self.spec.source.version + '-' + self.spec.source.release
|
||||||
|
|
||||||
|
return config.destdir + config.values.dirs.tmp_dir \
|
||||||
|
+ '/' + packageDir
|
||||||
|
|
||||||
|
def pkg_work_dir(self):
|
||||||
|
return self.pkg_dir() + const.work_dir_suffix
|
||||||
|
|
||||||
|
def pkg_install_dir(self):
|
||||||
|
return self.pkg_dir() + const.install_dir_suffix
|
||||||
|
|||||||
Reference in New Issue
Block a user