Sync from SUSE:ALP:Source:Standard:1.0 SL-Micro-6.0-versioned-1726752130 revision b3eb27db2bc4d3aa2a5e211bbce3b1e9

This commit is contained in:
Adrian Schröter 2025-01-09 12:29:07 +01:00
commit 94c33933ba
10 changed files with 48306 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

33
README.md Normal file
View File

@ -0,0 +1,33 @@
#
# snapshot repository emulator
#
This is generating a package with the goal to enforce defined
versions of a package based on a given updateinfo.xml file.
Goals:
* Do not enforce the installation of a package
* But when installed, it must be a certain version
This is currently implemented via conflicts due to unknown
reasons.
Shouldn't these be conditional requires instead?
eg.:
Requires: abcd-1.2.3 if abcd
?
###################
##### WARNING #####
###################
Do *NOT* use this package for any image or container. You
won't be able to build it or only for a very short time frame.
###################
##### WARNING #####
###################

View File

@ -0,0 +1,7 @@
-------------------------------------------------------------------
Tue Oct 8 09:37:51 UTC 2024 - Adrian Schröter <adrian@suse.de>
- initial demo package jsc#SMO-333
- python code is from Jiri, just added argument handling and
made it executable for python3

View File

@ -0,0 +1,80 @@
#
# spec file for package meta-package
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# The package name needs to include the version to avoid automatic updates
%define snapshot_version 1726752130
Name: SL-Micro-6.0-versioned-%snapshot_version
Version: %snapshot_version
Release: 0
Summary: Repository snapshot enforcement
License: GPLv2
Source1: generate_requires.py
Source2: README.md
Source3: aarch64.updateinfo.xml
Source4: s390x.updateinfo.xml
Source5: x86_64.updateinfo.xml
# old, not used
Source100: generate_conflicts.py
# just for source rpm check
Source101: update.sh
BuildRequires: python311
# generate_requires.py updateinfo.xml [not_newer_than_in_unixtime]
%ifarch aarch64
%( python3.11 %{S:1} %{S:3} )
%endif
%ifarch s390x
%( python3.11 %{S:1} %{S:4} )
%endif
%ifarch x86_64
%( python3.11 %{S:1} %{S:5} )
%endif
%description
#
# snapshot repository emulator
#
This is generating a package with the goal to enforce defined
versions of a package based on a given updateinfo.xml file.
Goals:
* Do not enforce the installation of a package
* But when installed, it must be a certain version
* Additional packages are still possible
###################
##### WARNING #####
###################
Do *NOT* use this package for any image or container. You
won't be able to build it or only for a very short time frame.
###################
##### WARNING #####
###################
%prep
%setup -c -T
cp %{SOURCE2} .
%install
%files
%doc README.md
%changelog

16008
aarch64.updateinfo.xml Normal file

File diff suppressed because it is too large Load Diff

71
generate_conflicts.py Normal file
View File

@ -0,0 +1,71 @@
import sys
import xml.etree.ElementTree as ET
if len(sys.argv) < 2:
print("ERRIR: Require at least the updateinfo.xml file name")
sys.exit(1)
filename = sys.argv[1]
timestamp = None
if len(sys.argv) > 2:
timestamp = sys.argv[2]
tree = ET.parse(filename)
root = tree.getroot()
package_versions = {}
package_versions_skip = []
for update in root:
patch_id = update.find("id").text
issued_date = int(update.find('issued').attrib['date'])
pkglist = update.find("pkglist").find("collection")
# updates which are newer than the time stamp should be blocked (conflict of the released version)
# if there were more patches with it, it applies to all of them
if timestamp is None or issued_date > timestamp:
for package in pkglist:
name = package.attrib['name']
version = package.attrib['version']
release = package.attrib['release']
package_versions_skip.append({
"name" : name,
"version" : version,
"release" : release,
})
continue
for package in pkglist:
name = package.attrib['name']
version = package.attrib['version']
release = package.attrib['release']
# if there is a newer patch already known, ignore the old one
if name in package_versions:
if issued_date < package_versions[name]["issued"]:
print("Older patch, skipping ", name, file=sys.stderr)
continue
package_versions[name] = {
"version" : version,
"release" : release,
"issued" : issued_date
}
# list of conflict statements for the .spec-file
conflicts = []
for package in package_versions.keys():
older = "Conflicts: {0} < {1}-{2}".format(package, package_versions[package]["version"], package_versions[package]["release"])
newer = "Conflicts: {0} > {1}-{2}".format(package, package_versions[package]["version"], package_versions[package]["release"])
conflicts.append(older)
conflicts.append(newer)
for package in package_versions_skip:
# if specific version is enforced, no need to additionally conflict newer releases
if package["name"] in package_versions:
continue
conflict = "Conflicts: {0} = {1}-{2}".format(package["name"], package["version"], package["release"])
conflicts.append(conflict)
conflicts = list(dict.fromkeys(conflicts))
conflicts.sort()
for conflict in conflicts:
print(conflict)

55
generate_requires.py Normal file
View File

@ -0,0 +1,55 @@
import sys
import xml.etree.ElementTree as ET
if len(sys.argv) < 2:
print("ERRIR: Require at least the updateinfo.xml file name")
sys.exit(1)
filename = sys.argv[1]
timestamp = None
if len(sys.argv) > 2:
timestamp = sys.argv[2]
tree = ET.parse(filename)
root = tree.getroot()
package_versions = {}
package_versions_skip = []
for update in root:
patch_id = update.find("id").text
issued_date = int(update.find('issued').attrib['date'])
pkglist = update.find("pkglist").find("collection")
# updates which are newer than the time stamp should be blocked (conflict of the released version)
# if there were more patches with it, it applies to all of them
if not timestamp is None and issued_date > timestamp:
continue
for package in pkglist:
name = package.attrib['name']
version = package.attrib['version']
release = package.attrib['release']
# if there is a newer patch already known, ignore the old one
if name in package_versions:
if issued_date < package_versions[name]["issued"]:
print("Older patch, skipping ", name, file=sys.stderr)
continue
package_versions[name] = {
"version" : version,
"release" : release,
"issued" : issued_date
}
# list of require statements for the .spec-file
lines = []
for package in package_versions.keys():
requires = "Requires: ({0} = {1}-{2} if {0})".format(package, package_versions[package]["version"], package_versions[package]["release"])
lines.append(requires)
lines = list(dict.fromkeys(lines))
lines.sort()
for line in lines:
print(line)

15849
s390x.updateinfo.xml Normal file

File diff suppressed because it is too large Load Diff

12
update.sh Normal file
View File

@ -0,0 +1,12 @@
base_url="https://download.suse.de/ibs/SUSE/Products/SL-Micro/6.0"
for arch in x86_64 aarch64 s390x; do
updateinfo=`curl -L -s -o - $base_url/$arch/product/repodata/repomd.xml | sed -n 's,.* href="repodata/\(.*-updateinfo.xml.zst\)".*,\1,p'`
curl -L -s -o - $base_url/$arch/product/repodata/$updateinfo | zstdcat - > $arch.updateinfo.xml
done
version=`sed -n 's,.*issued date="\([^"]*\)".*,\1,p' x86_64.updateinfo.xml | sort | tail -n 1`
sed -i "s,^%define snapshot_version.*,%define snapshot_version $version," *.spec

16168
x86_64.updateinfo.xml Normal file

File diff suppressed because it is too large Load Diff