[elbe-devel] [PATCH v2 4/4] elbepack: add package architecture to source.xml

Thomas Weißschuh thomas.weissschuh at linutronix.de
Fri Jun 28 13:52:20 CEST 2024


It is necessary for multiarch support and SBOM generation.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/aptpkgutils.py    | 7 +++++++
 elbepack/elbexml.py        | 2 ++
 elbepack/schema/dbsfed.xsd | 7 +++++++
 3 files changed, 16 insertions(+)

diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
index ac14789f04a6..d4d99a2a913c 100644
--- a/elbepack/aptpkgutils.py
+++ b/elbepack/aptpkgutils.py
@@ -215,6 +215,7 @@ class PackageBase:
                  installed_version, candidate_version,
                  installed_hashes, candidate_hashes,
                  installed_prio, candidate_prio,
+                 installed_arch, candidate_arch,
                  state, is_auto_installed, origin):
 
         self.name = name
@@ -224,6 +225,8 @@ class PackageBase:
         self.candidate_hashes = candidate_hashes
         self.installed_prio = installed_prio
         self.candidate_prio = candidate_prio
+        self.installed_arch = installed_arch
+        self.candidate_arch = candidate_arch
         self.state = state
         self.is_auto_installed = is_auto_installed
         self.origin = origin
@@ -250,6 +253,8 @@ class APTPackage(PackageBase):
         chashes = pkg.candidate and _apt_pkg_hashes(pkg.candidate)
         iprio = pkg.installed and pkg.installed.priority
         cprio = pkg.candidate and pkg.candidate.priority
+        iarch = pkg.installed and pkg.installed.architecture
+        carch = pkg.candidate and pkg.candidate.architecture
 
         self.state = pkgstate(pkg)
         self.is_auto_installed = pkg.is_auto_installed
@@ -264,6 +269,7 @@ class APTPackage(PackageBase):
                              iver, cver,
                              ihashes, chashes,
                              iprio, cprio,
+                             iarch, carch,
                              pkgstate(pkg), pkg.is_auto_installed,
                              origin)
 
@@ -280,5 +286,6 @@ class XMLPackage(PackageBase):
                              node.et.get('version'), None,
                              hashes, None,
                              node.et.get('prio'), None,
+                             node.et.get('arch'), None,
                              INSTALLED, node.et.get('auto') == 'true',
                              None)
diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index 21cda18ea7ee..ac68cdea861b 100644
--- a/elbepack/elbexml.py
+++ b/elbepack/elbexml.py
@@ -388,10 +388,12 @@ class ElbeXML:
         if aptpkg.installed_version is not None:
             pak.et.set('version', aptpkg.installed_version)
             pak.et.set('prio', aptpkg.installed_prio)
+            pak.et.set('arch', aptpkg.installed_arch)
             hashes = aptpkg.installed_hashes
         else:
             pak.et.set('version', aptpkg.candidate_version)
             pak.et.set('prio', aptpkg.candidate_prio)
+            pak.et.set('arch', aptpkg.candidate_arch)
             hashes = aptpkg.candidate_hashes
 
         for k, v in hashes.items():
diff --git a/elbepack/schema/dbsfed.xsd b/elbepack/schema/dbsfed.xsd
index 4a223c7cf701..8efe3f54de3e 100644
--- a/elbepack/schema/dbsfed.xsd
+++ b/elbepack/schema/dbsfed.xsd
@@ -3014,6 +3014,13 @@ SPDX-FileCopyrightText: Linutronix GmbH
             </documentation>
           </annotation>
         </attribute>
+        <attribute name="arch" type="string" use="optional">
+          <annotation>
+            <documentation>
+              architecture of the package in the original repository.
+            </documentation>
+          </annotation>
+        </attribute>
         <attribute name="on_src_cd" type="string" use="optional">
           <annotation>
             <documentation>

-- 
2.45.2



More information about the elbe-devel mailing list