Çağlar'ın istediği parçalı paket oluşturma.
İki yeni komut eklendi... build-unpack: gerekiyorsa tüm dosyaları ve source archive'i fetch eder, yamaları da uygulayarak kaynağı açar. build-runactions: fetch + unpack + actions.py içerisindeki fonksiyonların çalıştırılması. build: eskiden olduğu gibi tümü ile paketi oluşturur. Çağlar, işlevleri daha fazla bölmemi istersen söyle. Hatırladığım kadarı ile bu kadarını istiyordun diye böyle yaptım...
This commit is contained in:
+39
-27
@@ -74,45 +74,27 @@ class PisiBuild:
|
|||||||
self.actionGlobals = None
|
self.actionGlobals = None
|
||||||
self.srcDir = None
|
self.srcDir = None
|
||||||
|
|
||||||
def build(self):
|
|
||||||
"""Build the package in one shot."""
|
|
||||||
if not self.spec.verify():
|
if not self.spec.verify():
|
||||||
ui.error("PSPEC file is not valid")
|
ui.error("PSPEC file is not valid")
|
||||||
raise PisiBuildError, "invalid PSPEC file %s" % self.ctx.pspecfile
|
raise PisiBuildError, "invalid PSPEC file %s" % self.ctx.pspecfile
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
"""Build the package in one shot."""
|
||||||
|
|
||||||
ui.info("Building PISI source package: %s\n" % self.spec.source.name)
|
ui.info("Building PISI source package: %s\n" % self.spec.source.name)
|
||||||
|
|
||||||
ui.info("Fetching source from: %s\n" % self.spec.source.archiveUri)
|
self.fetchSourceArchive()
|
||||||
self.sourceArchive.fetch()
|
|
||||||
ui.info("Source archive is stored: %s/%s\n"
|
|
||||||
%(self.ctx.archives_dir(), self.spec.source.archiveName))
|
|
||||||
|
|
||||||
self.solveBuildDependencies()
|
|
||||||
|
|
||||||
ui.info("Unpacking archive...")
|
self.unpackSourceArchive()
|
||||||
self.sourceArchive.unpack()
|
|
||||||
ui.info(" unpacked (%s)\n" % self.ctx.pkg_work_dir())
|
|
||||||
|
|
||||||
self.compileActionScript()
|
self.compileActionScript()
|
||||||
self.srcDir = self.pkgSrcDir()
|
|
||||||
|
|
||||||
|
self.solveBuildDependencies()
|
||||||
|
|
||||||
|
# apply the patches and prepare a source directory for build.
|
||||||
self.applyPatches()
|
self.applyPatches()
|
||||||
|
|
||||||
# we'll need our working directory after actionscript
|
self.runActions()
|
||||||
# finished its work in the archive source directory.
|
|
||||||
curDir = os.getcwd()
|
|
||||||
os.chdir(self.srcDir)
|
|
||||||
|
|
||||||
# Run configure, build and install phase
|
|
||||||
ui.action("Setting up source...\n")
|
|
||||||
self.runActionFunction(const.setup_func)
|
|
||||||
ui.action("Building source...\n")
|
|
||||||
self.runActionFunction(const.build_func)
|
|
||||||
ui.action("Intalling...\n")
|
|
||||||
# install function is mandatory!
|
|
||||||
self.runActionFunction(const.install_func, True)
|
|
||||||
|
|
||||||
os.chdir(curDir)
|
|
||||||
|
|
||||||
# after all, we are ready to build/prepare the packages
|
# after all, we are ready to build/prepare the packages
|
||||||
self.buildPackages()
|
self.buildPackages()
|
||||||
@@ -129,6 +111,35 @@ class PisiBuild:
|
|||||||
}
|
}
|
||||||
os.environ.update(evn)
|
os.environ.update(evn)
|
||||||
|
|
||||||
|
def fetchSourceArchive(self):
|
||||||
|
ui.info("Fetching source from: %s\n" % self.spec.source.archiveUri)
|
||||||
|
self.sourceArchive.fetch()
|
||||||
|
ui.info("Source archive is stored: %s/%s\n"
|
||||||
|
%(self.ctx.archives_dir(), self.spec.source.archiveName))
|
||||||
|
|
||||||
|
|
||||||
|
def unpackSourceArchive(self):
|
||||||
|
ui.info("Unpacking archive...")
|
||||||
|
self.sourceArchive.unpack()
|
||||||
|
ui.info(" unpacked (%s)\n" % self.ctx.pkg_work_dir())
|
||||||
|
|
||||||
|
def runActions(self):
|
||||||
|
# we'll need our working directory after actionscript
|
||||||
|
# finished its work in the archive source directory.
|
||||||
|
curDir = os.getcwd()
|
||||||
|
os.chdir(self.srcDir)
|
||||||
|
|
||||||
|
# Run configure, build and install phase
|
||||||
|
ui.action("Setting up source...\n")
|
||||||
|
self.runActionFunction(const.setup_func)
|
||||||
|
ui.action("Building source...\n")
|
||||||
|
self.runActionFunction(const.build_func)
|
||||||
|
ui.action("Intalling...\n")
|
||||||
|
# install function is mandatory!
|
||||||
|
self.runActionFunction(const.install_func, True)
|
||||||
|
|
||||||
|
os.chdir(curDir)
|
||||||
|
|
||||||
def compileActionScript(self):
|
def compileActionScript(self):
|
||||||
"""Compiles actions.py and sets the actionLocals and actionGlobals"""
|
"""Compiles actions.py and sets the actionLocals and actionGlobals"""
|
||||||
specdir = os.path.dirname(self.ctx.pspecfile)
|
specdir = os.path.dirname(self.ctx.pspecfile)
|
||||||
@@ -146,6 +157,7 @@ class PisiBuild:
|
|||||||
|
|
||||||
self.actionLocals = localSymbols
|
self.actionLocals = localSymbols
|
||||||
self.actionGlobals = globalSymbols
|
self.actionGlobals = globalSymbols
|
||||||
|
self.srcDir = self.pkgSrcDir()
|
||||||
|
|
||||||
def pkgSrcDir(self):
|
def pkgSrcDir(self):
|
||||||
"""Returns the real path of WorkDir for an unpacked archive."""
|
"""Returns the real path of WorkDir for an unpacked archive."""
|
||||||
|
|||||||
+46
-1
@@ -12,6 +12,8 @@ import pisi.toplevel
|
|||||||
def cmdObject(cmd, fail=False):
|
def cmdObject(cmd, fail=False):
|
||||||
commands = {"help": Help,
|
commands = {"help": Help,
|
||||||
"build": Build,
|
"build": Build,
|
||||||
|
"build-unpack": BuildUnpack,
|
||||||
|
"build-runactions": BuildRunActions,
|
||||||
"info": Info,
|
"info": Info,
|
||||||
"install": Install,
|
"install": Install,
|
||||||
"list-installed": ListInstalled,
|
"list-installed": ListInstalled,
|
||||||
@@ -368,4 +370,47 @@ TODO: Some description...
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# Partial build commands
|
||||||
|
|
||||||
|
class BuildUnpack(Command):
|
||||||
|
"""Unpack source using a pspec.xml file
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
build-unpack pspec.xml
|
||||||
|
|
||||||
|
You can give an URI of the pspec.xml file. PISI will fetch all
|
||||||
|
necessary files and unpack the source and prepare a source directory
|
||||||
|
for you.
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
super(BuildUnpack, self).__init__()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if not self.args:
|
||||||
|
self.help()
|
||||||
|
return
|
||||||
|
|
||||||
|
for arg in self.args:
|
||||||
|
pisi.toplevel.build_unpack(arg, self.authInfo)
|
||||||
|
|
||||||
|
class BuildRunActions(Command):
|
||||||
|
"""Unpack source using a pspec.xml file
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
build-runactions pspec.xml
|
||||||
|
|
||||||
|
You can give an URI of the pspec.xml file. PISI will fetch all
|
||||||
|
necessary files and unpack the source, prepare a source directory and
|
||||||
|
run the functions in actions.py.
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
super(BuildRunActions, self).__init__()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if not self.args:
|
||||||
|
self.help()
|
||||||
|
return
|
||||||
|
|
||||||
|
for arg in self.args:
|
||||||
|
pisi.toplevel.build_runactions(arg, self.authInfo)
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ where <command> is one of:
|
|||||||
|
|
||||||
help
|
help
|
||||||
build
|
build
|
||||||
|
build-unpack
|
||||||
|
build-runactions
|
||||||
index
|
index
|
||||||
info
|
info
|
||||||
install
|
install
|
||||||
|
|||||||
+23
-1
@@ -131,7 +131,8 @@ def update_repo(repo):
|
|||||||
ui.info('* Package db updated.\n')
|
ui.info('* Package db updated.\n')
|
||||||
|
|
||||||
|
|
||||||
def build(pspecfile, authInfo=None):
|
# build functions...
|
||||||
|
def prepare_for_build(pspecfile, authInfo=None):
|
||||||
from build import PisiBuild
|
from build import PisiBuild
|
||||||
|
|
||||||
url = PUrl(pspecfile)
|
url = PUrl(pspecfile)
|
||||||
@@ -141,5 +142,26 @@ def build(pspecfile, authInfo=None):
|
|||||||
url.uri = fs.fetch_all()
|
url.uri = fs.fetch_all()
|
||||||
|
|
||||||
pb = PisiBuild(url.uri)
|
pb = PisiBuild(url.uri)
|
||||||
|
return pb
|
||||||
|
|
||||||
|
def build_unpack(pspecfile, authInfo=None):
|
||||||
|
pb = prepare_for_build(pspecfile, authInfo)
|
||||||
|
pb.fetchSourceArchive()
|
||||||
|
pb.unpackSourceArchive()
|
||||||
|
pb.compileActionScript()
|
||||||
|
pb.applyPatches()
|
||||||
|
|
||||||
|
def build_runactions(pspecfile, authInfo=None):
|
||||||
|
pb = prepare_for_build(pspecfile, authInfo)
|
||||||
|
pb.fetchSourceArchive()
|
||||||
|
pb.unpackSourceArchive()
|
||||||
|
pb.compileActionScript()
|
||||||
|
pb.applyPatches()
|
||||||
|
pb.runActions()
|
||||||
|
|
||||||
|
def build(pspecfile, authInfo=None):
|
||||||
|
pb = prepare_for_build(pspecfile, authInfo)
|
||||||
pb.build()
|
pb.build()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user