METADATA_DOWNLOAD_FILE = "repomd.json"
METADATA_DATABASE_FILE = "packages.solv"
-PACKAGE_FORMAT = 1
+PACKAGE_FORMAT = 2
# XXX implement this properly
-PACKAGE_FORMATS_SUPPORTED = [0, 1]
+PACKAGE_FORMATS_SUPPORTED = [0, 1, 2]
PACKAGE_EXTENSION = "pfm"
MAKEFILE_EXTENSION = "nm"
%(description)s
end
+ type = %(type)s
size = %(inst_size)d
end
items = [
(_("Name"), self.name),
- (_("Arch"), self.arch),
+ ]
+
+ # Show supported arches if available.
+ if hasattr(self, "supported_arches") and not self.supported_arches == "all":
+ arch = "%s (%s)" % (self.arch, self.supported_arches)
+ else:
+ arch = self.arch
+ items.append((_("Arch"), arch))
+
+ items += [
(_("Version"), self.version),
(_("Release"), self.release),
]
Calculate the hash1 of this package.
"""
return util.calc_hash1(self.filename)
-
+
+ @property
+ def type(self):
+ if self.format >= 2:
+ type = self.lexer.package.get_ver("type")
+ elif self.format == 1:
+ type = self._type
+ else:
+ type = self.metadata.get("type")
+
+ assert type, self
+ return type
+
@property
def name(self):
if self.format >= 1:
class SourcePackage(FilePackage):
- pass
+ _type = "source"
+
+ @property
+ def arch(self):
+ return "src"
+
+ @property
+ def supported_arches(self):
+ if self.format >= 2:
+ arches = self.lexer.package.get_var("arch", "all")
+ elif self.format == 1:
+ # Format 1 did not support "supported_arches", so we assume "all".
+ arches = "all"
+ else:
+ arches = self.metadata.get("PKG_SUPPORTED_ARCHES", "all")
+
+ assert arches, self
+ return arches
class BinaryPackage(FilePackage):
+ _type = "binary"
+
def get_scriptlet(self, type):
a = self.open_archive()
@property
def arch(self):
+ return "src"
+
+ @property
+ def supported_arches(self):
"""
- This is only used to create the name of the source package.
+ These are the supported arches. Which means, packages of these
+ architectures can be built out of this source package.
"""
- return "src"
+ return self.lexer.get_var("sup_arches", "all")
@property
def packages(self):
info.update({
"pakfire_version" : PAKFIRE_VERSION,
"uuid" : uuid.uuid4(),
+ "type" : "binary",
})
# Include distribution information.
# Generic package information including Pakfire information.
info.update({
"pakfire_version" : PAKFIRE_VERSION,
+ "type" : "source",
})
# Include distribution information.
"build_id" : uuid.uuid4(),
})
+ # Arches equals supported arches.
+ info["arch"] = self.pkg.supported_arches
+
# Set UUID
# XXX replace this by the payload hash
info.update({