[elbe-devel] [PATCH] schema: forbid simultaneous package pinning by archive and version

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Mar 18 12:33:00 CET 2024


Pinning to both version and release at the same time does not work with
apt as it can only apply on pin record.

A specification like
`<pkg pin="codename" version="2022.12*">swupdate</pkg>`
would result in two distinct pins:

```
Package: swupdate
Pin: release n=codename
Pin-Priority: 991

Package: swupdate
Pin: version 2022.12*
Pin-Priority: 1001
```

As `xsd:unique` only works on an element and not on a type it has to be
copied to both usages of the `rfs:pkg` type.
XSD 1.1 would support `xsd:assert` but libxml2 only supports XSD 1.0.

Reported-by: Franz Heger <franz.heger at kuka.com>
Link: https://github.com/Linutronix/elbe/pull/401#issuecomment-1983594632
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/schema/dbsfed.xsd | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/elbepack/schema/dbsfed.xsd b/elbepack/schema/dbsfed.xsd
index f20103f46c4d..c42e3770602c 100644
--- a/elbepack/schema/dbsfed.xsd
+++ b/elbepack/schema/dbsfed.xsd
@@ -2979,6 +2979,15 @@ SPDX-FileCopyrightText: Linutronix GmbH
             the given mirrors into the target rootfilesystem.
           </documentation>
         </annotation>
+        <unique name="pkg-list-mutual-exclusive-pkg-pin-or-version">
+          <annotation>
+            <documentation>
+              Only one of pin= or version= can be specified at the same time.
+            </documentation>
+          </annotation>
+          <selector xpath="."/>
+          <field xpath="@pin | @version"/>
+        </unique>
       </element>
     </sequence>
     <attributeGroup ref="xml:specialAttrs"/>
@@ -3015,6 +3024,15 @@ SPDX-FileCopyrightText: Linutronix GmbH
             Reference to a binary debian package which is supposed to be installed.
           </documentation>
         </annotation>
+        <unique name="fullpkg-list-mutual-exclusive-pkg-pin-or-version">
+          <annotation>
+            <documentation>
+              Only one of pin= or version= can be specified at the same time.
+            </documentation>
+          </annotation>
+          <selector xpath="."/>
+          <field xpath="@pin | @version"/>
+        </unique>
       </element>
     </sequence>
     <attributeGroup ref="xml:specialAttrs"/>

---
base-commit: ef9eeca734b372faba47b88df94950d5b465751d
change-id: 20240318-schema-exclusive-pin-822d3fb3087f

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list