[elbe-devel] [PATCH v2] elbepack: add uri to Origin

Eduard Krein eduard.krein at linutronix.de
Tue Jun 25 16:26:34 CEST 2024


Add unified resource identifier to Origin class for packages.
Also display package uris inside source.xml.

Signed-off-by: Eduard Krein <eduard.krein at linutronix.de>
---
 elbepack/aptpkgutils.py    | 4 +++-
 elbepack/elbexml.py        | 1 +
 elbepack/schema/dbsfed.xsd | 7 +++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
index 4120c918..098be7d0 100644
--- a/elbepack/aptpkgutils.py
+++ b/elbepack/aptpkgutils.py
@@ -43,6 +43,7 @@ class Origin:
     codename: str
     site: str
     component: str
+    uri: str
 
 
 def _apt_pkg_hashes(pkg):
@@ -101,7 +102,8 @@ def pkgstate(pkg):
 def pkgorigin(pkg):
     if pkg.installed:
         o = pkg.installed.origins[0]
-        origin = Origin(origin=o.origin, codename=o.codename, site=o.site, component=o.component)
+        origin = Origin(origin=o.origin, codename=o.codename,
+                        site=o.site, component=o.component, uri=pkg.installed.uri)
     else:
         origin = None
 
diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index 092400e3..e13593de 100644
--- a/elbepack/elbexml.py
+++ b/elbepack/elbexml.py
@@ -399,6 +399,7 @@ class ElbeXML:
 
         pak.et.set('release-origin', aptpkg.origin.origin)
         pak.et.set('release-codename', aptpkg.origin.codename)
+        pak.et.set('uri', aptpkg.origin.uri)
 
         if aptpkg.is_auto_installed:
             pak.et.set('auto', 'true')
diff --git a/elbepack/schema/dbsfed.xsd b/elbepack/schema/dbsfed.xsd
index f9b919c6..4a223c7c 100644
--- a/elbepack/schema/dbsfed.xsd
+++ b/elbepack/schema/dbsfed.xsd
@@ -2949,6 +2949,13 @@ SPDX-FileCopyrightText: Linutronix GmbH
             </documentation>
           </annotation>
         </attribute>
+        <attribute name="uri" type="string" use="optional">
+          <annotation>
+            <documentation>
+              uniform resource identifier of the debian package
+            </documentation>
+          </annotation>
+        </attribute>
         <attribute name="pin" type="string" use="optional">
           <annotation>
             <documentation>
-- 
2.39.2



More information about the elbe-devel mailing list