* make use of component.xml's during build

* fix: component.name is string
* add a summary field to component
* I creep across the land
This commit is contained in:
Eray Özkural
2005-11-14 13:52:27 +00:00
parent fe12811b77
commit a54a57d541
5 changed files with 42 additions and 15 deletions
+2 -1
View File
@@ -92,7 +92,8 @@ Legend:
/ revise writing, error checking, printing and tests / revise writing, error checking, printing and tests
/ components and distribution (eray) / components and distribution (eray)
+ requirements + requirements
+ xml format + xml format, add to PSPEC
+ index component.xml's and make use of them in build
- query components: list of components/packages in a component - query components: list of components/packages in a component
- install/remove components - install/remove components
- safety switch: preserve system:base, install system:devel for build, etc. - safety switch: preserve system:base, install system:devel for build, etc.
+23 -10
View File
@@ -32,6 +32,7 @@ from pisi.files import Files, File as FileInfo
from pisi.files import Files from pisi.files import Files
from pisi.metadata import MetaData from pisi.metadata import MetaData
from pisi.package import Package from pisi.package import Package
import pisi.component as component
class Error(pisi.Error): class Error(pisi.Error):
@@ -84,7 +85,7 @@ from pisi.specfile import SpecFile
class BuildContext(object): class BuildContext(object):
"""Build Context Singleton""" """Build Context"""
def __init__(self, pspecfile): def __init__(self, pspecfile):
super(BuildContext, self).__init__() super(BuildContext, self).__init__()
@@ -94,9 +95,6 @@ class BuildContext(object):
self.pspecfile = pspecfile self.pspecfile = pspecfile
spec = SpecFile() spec = SpecFile()
spec.read(pspecfile) spec.read(pspecfile)
# FIXME: following checks the integrity but does nothing when it is wrong
# -gurer
#spec.verify() # check pspec integrity
self.spec = spec self.spec = spec
# directory accessor functions # directory accessor functions
@@ -121,7 +119,7 @@ class Builder:
"""Provides the package build and creation routines""" """Provides the package build and creation routines"""
def __init__(self, pspec): def __init__(self, pspec):
self.bctx = BuildContext(pspec) self.bctx = BuildContext(pspec)
self.pspecDir = os.path.dirname(os.path.realpath(self.bctx.pspecfile)) self.pspecdir = os.path.dirname(os.path.realpath(self.bctx.pspecfile))
self.spec = self.bctx.spec self.spec = self.bctx.spec
self.sourceArchive = SourceArchive(self.bctx) self.sourceArchive = SourceArchive(self.bctx)
@@ -153,7 +151,9 @@ class Builder:
self.patch_exists() self.patch_exists()
self.check_build_dependencies() self.check_build_dependencies()
self.fetch_component()
self.fetch_source_archive() self.fetch_source_archive()
self.unpack_source_archive() self.unpack_source_archive()
@@ -190,6 +190,19 @@ class Builder:
os.environ["PATH"] = "/usr/lib/ccache/bin/:" + os.environ["PATH"] os.environ["PATH"] = "/usr/lib/ccache/bin/:" + os.environ["PATH"]
ctx.ui.info(_("CCache detected...")) ctx.ui.info(_("CCache detected..."))
def fetch_component(self):
if not self.spec.source.partOf:
parentdir = os.path.realpath(self.pspecdir + '/../')
url = util.join_path(parentdir, 'component.xml')
from pisi.fetcher import fetch_url
progress = ctx.ui.Progress
fetch_url(url, self.bctx.pkg_work_dir(), progress)
comp = component.Component()
comp.read(util.join_path(self.bctx.pkg_work_dir(), 'component.xml'))
ctx.ui.info(_('Source is part of %s component') % comp.name)
self.spec.source.partOf = comp.name
self.spec.override_tags()
def fetch_source_archive(self): def fetch_source_archive(self):
ctx.ui.info(_("Fetching source from: %s") % self.spec.source.archive.uri) ctx.ui.info(_("Fetching source from: %s") % self.spec.source.archive.uri)
self.sourceArchive.fetch() self.sourceArchive.fetch()
@@ -295,7 +308,7 @@ 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(util.join_path(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 = util.join_path(files_dir, patch.filename) patchFile = util.join_path(files_dir, patch.filename)
@@ -303,7 +316,7 @@ class Builder:
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(util.join_path(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:
@@ -484,7 +497,7 @@ class Builder:
for package in self.spec.packages: for package in self.spec.packages:
# store additional files # store additional files
c = os.getcwd() c = os.getcwd()
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
tmp_aF = [] tmp_aF = []
for afile in package.additionalFiles: for afile in package.additionalFiles:
@@ -524,7 +537,7 @@ class Builder:
package_names.append(name) package_names.append(name)
# 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 = util.join_path(ctx.const.comar_dir, fname = util.join_path(ctx.const.comar_dir,
pcomar.script) pcomar.script)
+14 -3
View File
@@ -36,19 +36,30 @@ class Distribution:
class Component(xmlfile.XmlFile): class Component(xmlfile.XmlFile):
"part-of representation for component declarations" "representation for component declarations"
__metaclass__ = autoxml.autoxml __metaclass__ = autoxml.autoxml
tag = "PISI" tag = "PISI"
t_Name = [autoxml.Text, autoxml.mandatory] # fully qualified name t_Name = [autoxml.String, autoxml.mandatory] # fully qualified name
#t_PartOf = [autoxml.Text, autoxml.mandatory]
# component name in other languages, for instance in Turkish
# LocalName for system.base could be sistem.taban or "Taban Sistem",
# this could be useful for GUIs
t_LocalName = [autoxml.LocalText, autoxml.mandatory] t_LocalName = [autoxml.LocalText, autoxml.mandatory]
# Information about the component
t_Summary = [autoxml.LocalText, autoxml.mandatory]
t_Description = [autoxml.LocalText, autoxml.mandatory] t_Description = [autoxml.LocalText, autoxml.mandatory]
#t_Icon = [autoxml.Binary, autoxml.mandatory] #t_Icon = [autoxml.Binary, autoxml.mandatory]
# Dependencies to other components
t_Dependencies = [ [autoxml.String], autoxml.optional, "Dependencies/Component"] t_Dependencies = [ [autoxml.String], autoxml.optional, "Dependencies/Component"]
# TODO: this is probably not necessary since we use fully qualified
# module names (like in Java)
#t_PartOf = [autoxml.Text, autoxml.mandatory]
#FIXME: recursive declarations do not work! #FIXME: recursive declarations do not work!
#class ComponentTree(xmlfile.XmlFile): #class ComponentTree(xmlfile.XmlFile):
+1
View File
@@ -71,6 +71,7 @@ class MetaData(xmlfile.XmlFile):
#t_History = [ [Update], autoxml.mandatory] #t_History = [ [Update], autoxml.mandatory]
def from_spec(self, src, pkg): def from_spec(self, src, pkg):
# this just copies fields, it doesn't fix every necessary field
self.source.name = src.name self.source.name = src.name
self.source.homepage = src.homepage self.source.homepage = src.homepage
self.source.packager = src.packager self.source.packager = src.packager
+2 -1
View File
@@ -45,7 +45,8 @@ class SourceArchive:
if not self.is_cached(interactive): if not self.is_cached(interactive):
if interactive: if interactive:
progress = ctx.ui.Progress progress = ctx.ui.Progress
else: progress = None else:
progress = None
fetch_url(self.url, ctx.config.archives_dir(), progress) fetch_url(self.url, ctx.config.archives_dir(), progress)
def is_cached(self, interactive=True): def is_cached(self, interactive=True):