]> git.ipfire.org Git - pakfire.git/commitdiff
Merge branch 'master' of ssh://git.ipfire.org/pub/git/oddments/pakfire
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 8 Oct 2011 12:23:00 +0000 (14:23 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 8 Oct 2011 12:23:00 +0000 (14:23 +0200)
python/pakfire/constants.py
python/pakfire/packages/base.py
python/pakfire/packages/file.py
python/pakfire/packages/make.py
python/pakfire/packages/packager.py

index af34ee6af365bd5730db8e54973ab83c219cbd67..69d1960c8bc27725972b27e416096954c56ccf8a 100644 (file)
@@ -57,9 +57,9 @@ METADATA_DOWNLOAD_PATH  = "repodata"
 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"
 
@@ -122,6 +122,7 @@ package
 %(description)s
        end
 
+       type        = %(type)s
        size        = %(inst_size)d
 end
 
index 0bb4f21561cd18961ae6dc3fd82eb86b54efd65d..96046392c5cab748000c99919c26bb1f88db3e45 100644 (file)
@@ -92,7 +92,16 @@ class Package(object):
 
                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),
                ]
index 43f40738e7cbc93176a4c6f6760a09c6d03a0b8e..925513617656c6b8993b846299d86f119c3bc020 100644 (file)
@@ -454,7 +454,19 @@ class FilePackage(Package):
                        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:
@@ -685,10 +697,29 @@ class FilePackage(Package):
 
 
 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()
 
index f873191a9e753e0dd3e000f4a18e60e25b9596db..b23e82854cf91f3ea548033ed19486c3dc48fd1f 100644 (file)
@@ -183,10 +183,15 @@ class Makefile(MakefileBase):
 
        @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):
index 7ff97773b292096bf86d58520966fa65a327d9aa..9a4b658aafd8ccb87000334e5861b9e5c465128f 100644 (file)
@@ -200,6 +200,7 @@ class BinaryPackager(Packager):
                info.update({
                        "pakfire_version" : PAKFIRE_VERSION,
                        "uuid"            : uuid.uuid4(),
+                       "type"            : "binary",
                })
 
                # Include distribution information.
@@ -552,6 +553,7 @@ class SourcePackager(Packager):
                # Generic package information including Pakfire information.
                info.update({
                        "pakfire_version" : PAKFIRE_VERSION,
+                       "type"            : "source",
                })
 
                # Include distribution information.
@@ -580,6 +582,9 @@ class SourcePackager(Packager):
                        "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({