SpecFile should never ever ruin the generated PSPEC file.
If build process needs this, we should do it there...
This commit is contained in:
+30
-8
@@ -151,7 +151,7 @@ class Builder:
|
||||
def pkg_dir(self):
|
||||
"package build directory"
|
||||
packageDir = self.spec.source.name + '-' + \
|
||||
self.spec.source.version + '-' + self.spec.source.release
|
||||
self.spec.getSourceVersion() + '-' + self.spec.getSourceRelease()
|
||||
return util.join_path(ctx.config.dest_dir(), ctx.config.values.dirs.tmp_dir,
|
||||
packageDir)
|
||||
|
||||
@@ -212,8 +212,8 @@ class Builder:
|
||||
"WORK_DIR": self.pkg_work_dir(),
|
||||
"INSTALL_DIR": self.pkg_install_dir(),
|
||||
"SRC_NAME": self.spec.source.name,
|
||||
"SRC_VERSION": self.spec.source.version,
|
||||
"SRC_RELEASE": self.spec.source.release
|
||||
"SRC_VERSION": self.spec.getSourceVersion(),
|
||||
"SRC_RELEASE": self.spec.getSourceRelease()
|
||||
}
|
||||
os.environ.update(env)
|
||||
|
||||
@@ -297,7 +297,6 @@ class Builder:
|
||||
comp.read(path)
|
||||
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):
|
||||
ctx.ui.info(_("Fetching source from: %s") % self.spec.source.archive.uri)
|
||||
@@ -393,7 +392,7 @@ class Builder:
|
||||
try:
|
||||
workdir = self.actionGlobals['WorkDir']
|
||||
except KeyError:
|
||||
workdir = self.spec.source.name + "-" + self.spec.source.version
|
||||
workdir = self.spec.source.name + "-" + self.spec.getSourceVersion()
|
||||
|
||||
return util.join_path(self.pkg_work_dir(), workdir)
|
||||
|
||||
@@ -559,7 +558,7 @@ class Builder:
|
||||
metadata.xml is composed of the information from specfile plus
|
||||
some additional information."""
|
||||
metadata = MetaData()
|
||||
metadata.from_spec(self.spec.source, package)
|
||||
metadata.from_spec(self.spec.source, package, self.spec.history)
|
||||
|
||||
metadata.package.distribution = ctx.config.values.general.distribution
|
||||
metadata.package.distributionRelease = ctx.config.values.general.distribution_release
|
||||
@@ -747,6 +746,29 @@ class Builder:
|
||||
self.old_packages = []
|
||||
|
||||
for package in self.spec.packages:
|
||||
|
||||
# removing "farce" in specfile.py:SpecFile.override_tags
|
||||
# this block of code came here... SpecFile should never
|
||||
# ever ruin the generated PSPEC file. If build process
|
||||
# needs this, we should do it in here... (bug: #3773)
|
||||
if not package.summary:
|
||||
package.summary = self.spec.source.summary
|
||||
if not package.description:
|
||||
# TODO: remove this if statement with the part in
|
||||
# specfile.py:SpecFile
|
||||
if not self.spec.source.description:
|
||||
self.spec.dirtyWorkAround()
|
||||
|
||||
package.description = self.spec.source.description
|
||||
if not package.partOf:
|
||||
package.partOf = self.spec.source.partOf
|
||||
if not package.license:
|
||||
package.license = self.spec.source.license
|
||||
if not package.icon:
|
||||
package.icon = self.spec.source.icon
|
||||
|
||||
|
||||
|
||||
old_package_name = None
|
||||
# store additional files
|
||||
c = os.getcwd()
|
||||
@@ -781,8 +803,8 @@ class Builder:
|
||||
|
||||
# Calculate new and oldpackage names for buildfarm
|
||||
name = util.package_name(package.name,
|
||||
self.spec.source.version,
|
||||
self.spec.source.release,
|
||||
self.spec.getSourceVersion(),
|
||||
self.spec.getSourceRelease(),
|
||||
self.metadata.package.build)
|
||||
|
||||
outdir = ctx.get_option('output_dir')
|
||||
|
||||
+4
-2
@@ -72,7 +72,7 @@ class MetaData(xmlfile.XmlFile):
|
||||
t_Package = [ Package, autoxml.mandatory]
|
||||
#t_History = [ [Update], autoxml.mandatory]
|
||||
|
||||
def from_spec(self, src, pkg):
|
||||
def from_spec(self, src, pkg, history):
|
||||
# this just copies fields, it doesn't fix every necessary field
|
||||
self.source.name = src.name
|
||||
self.source.homepage = src.homepage
|
||||
@@ -82,6 +82,8 @@ class MetaData(xmlfile.XmlFile):
|
||||
self.package.summary = pkg.summary
|
||||
self.package.description = pkg.description
|
||||
self.package.icon = pkg.icon
|
||||
# merge pkg.isA with src.isA
|
||||
pkg.isA.extend(src.isA)
|
||||
self.package.isA = pkg.isA
|
||||
self.package.partOf = pkg.partOf
|
||||
self.package.license = pkg.license
|
||||
@@ -89,7 +91,7 @@ class MetaData(xmlfile.XmlFile):
|
||||
self.package.componentDependencies = pkg.componentDependencies
|
||||
self.package.files = pkg.files
|
||||
# FIXME: no need to copy full history with comments
|
||||
self.package.history = src.history
|
||||
self.package.history = history
|
||||
self.package.conflicts = pkg.conflicts
|
||||
self.package.providesComar = pkg.providesComar
|
||||
#self.package.requiresComar = pkg.requiresComar
|
||||
|
||||
+7
-50
@@ -232,57 +232,14 @@ class SpecFile(XmlFile):
|
||||
t_History = [ [Update], autoxml.mandatory]
|
||||
t_Components = [ [component.Component], autoxml.optional, "Component"]
|
||||
|
||||
def read_hook(self, errs):
|
||||
"""Read PSPEC file"""
|
||||
self.merge_tags()
|
||||
self.override_tags()
|
||||
def getSourceVersion(self):
|
||||
return self.history[0].version
|
||||
|
||||
def merge_tags(self):
|
||||
"""Merge tags from Source in Packages. Some tags in Packages merged
|
||||
with the tags from Source. There is a more detailed
|
||||
description in documents."""
|
||||
|
||||
# FIXME: copy only needed information
|
||||
# no need to keep full history with comments in metadata.xml
|
||||
self.source.history = self.history
|
||||
|
||||
# To avoid tag duplication in PSPEC we need to get
|
||||
# the last version and release information
|
||||
# from the most recent History/Update.
|
||||
if not self.source.version:
|
||||
self.source.version = self.history[0].version
|
||||
if not self.source.release:
|
||||
self.source.release = self.history[0].release
|
||||
|
||||
tmp = []
|
||||
for pkg in self.packages:
|
||||
pkg.isA.extend(self.source.isA)
|
||||
pkg.history = self.history
|
||||
tmp.append(pkg)
|
||||
self.packages = tmp
|
||||
|
||||
def override_tags(self):
|
||||
"""Override tags from Source in Packages. Some tags in Packages
|
||||
overrides the tags from Source. There is a more detailed
|
||||
description in documents."""
|
||||
def getSourceRelease(self):
|
||||
return self.history[0].release
|
||||
|
||||
def dirtyWorkAround(self):
|
||||
#TODO: Description should be mandatory. Remove this crap when repo is ready.
|
||||
#http://liste.pardus.org.tr/gelistirici/2006-September/002332.html
|
||||
if not self.source.description:
|
||||
self.source.description = autoxml.LocalText("Description")
|
||||
self.source.description["en"] = self.source.summary["en"]
|
||||
|
||||
tmp = []
|
||||
for pkg in self.packages:
|
||||
if not pkg.summary:
|
||||
pkg.summary = self.source.summary
|
||||
if not pkg.description:
|
||||
pkg.description = self.source.description
|
||||
if not pkg.partOf:
|
||||
pkg.partOf = self.source.partOf
|
||||
if not pkg.license:
|
||||
pkg.license = self.source.license
|
||||
if not pkg.icon:
|
||||
pkg.icon = self.source.icon
|
||||
tmp.append(pkg)
|
||||
self.packages = tmp
|
||||
self.source.description = autoxml.LocalText("Description")
|
||||
self.source.description["en"] = self.source.summary["en"]
|
||||
|
||||
Reference in New Issue
Block a user