From 594f8c79e22cd089e8fe0056eff34aef54615cd6e9d3522793e84622e3aa324f Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Tue, 2 Jul 2024 11:49:40 +0000 Subject: [PATCH 1/6] - Support also creating systemd-repart bundles OBS-URL: https://build.opensuse.org/package/show/devel:microos:aeon/containment-tik-img-to-rpm?expand=0&rev=27 --- .gitattributes | 23 +++++++++ .gitignore | 1 + containment-tik-img-to-rpm | 80 ++++++++++++++++++++++++++++++ containment-tik-img-to-rpm.changes | 25 ++++++++++ containment-tik-img-to-rpm.spec | 54 ++++++++++++++++++++ image.spec.in | 53 ++++++++++++++++++++ 6 files changed, 236 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 containment-tik-img-to-rpm create mode 100644 containment-tik-img-to-rpm.changes create mode 100644 containment-tik-img-to-rpm.spec create mode 100644 image.spec.in diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/containment-tik-img-to-rpm b/containment-tik-img-to-rpm new file mode 100644 index 0000000..c3c426a --- /dev/null +++ b/containment-tik-img-to-rpm @@ -0,0 +1,80 @@ +#!/bin/sh -eu +BUILD_DISTURL= + +# To get BUILD_DISTURL +test -f /.buildenv && . /.buildenv + +top_dir="/usr/src/packages" +img_dir="${top_dir}/KIWI" +build_dir="/usr/lib/build" +spec_in="${build_dir}/image.spec.in" +arch="$(uname -m)" + +log() { + echo "[tik-img-to-rpm] $@" +} + +log "Check for tik-osimage-*.raw.xz in KIWI output directory" +if ! ls ${img_dir}/tik-osimage-*.raw.xz; then + log "No tik-osimage found" && exit 0 +fi + +log "tik-osimage-* found: Creating RPM from any tik-osimage-*.raw.xz images" + +for f in ${img_dir}/*.raw.xz; do + base_f=$(echo ${f} | awk -F '.raw.xz' '{print $1}' | awk -F "${img_dir}/" '{print $2}') + image=${base_f}.raw.xz + json_f=${img_dir}/${base_f}.cdx.json + log "[${base_f}] Parsing ${json_f} to populate variables for RPM .spec" + pkg_version=$(jq '.components[] | select(.name | endswith("-release")) | .version' ${json_f} | tr -d '"' | cut -f 1 -d '-') + pkg_release=$(jq '.components[] | select(.name | endswith("-release")) | .version' ${json_f} | tr -d '"' | cut -f 2 -d '-') + pkg_name=$(echo ${base_f} | awk -F ".${arch}" '{print $1}') + os_name=$(echo ${pkg_name} | awk -F 'tik-osimage-' '{print $2}') + + cd ${build_dir} + sed -e "s@__PKG_NAME__@${pkg_name}@g" \ + -e "s@__VERSION__@${pkg_version}@g" \ + -e "s@__RELEASE__@${pkg_release}@g" \ + -e "s@__SOURCE0__@${image}@g" \ + -e "s@__OS_NAME__@${os_name}@g" \ + < ${spec_in} \ + > ${build_dir}/image.spec + + cp /.build-changelog ${build_dir}/image.changes + ${build_dir}/changelog2spec --target rpm --file ${build_dir}/image.changes >> ${build_dir}/image.spec + + # Local builds have the file already in place, that's not true on IBS + if [ ! -f ${top_dir}/SOURCES/${image} ]; then + ln ${f} ${top_dir}/SOURCES + fi + + # Make sure /usr/src/packages/* dirs exist + if [ ! -f ${top_dir}/BUILD ]; then + log "Create BUILD dir" + mkdir -p ${top_dir}/BUILD + fi + + if [ ! -f ${top_dir}/SRPMS ]; then + log "Create SRPMS dir" + mkdir -p ${top_dir}/SRPMS + fi + + if [ ! -f ${top_dir}/RPMS/${arch} ]; then + log "Create ARCH RPMS dir" + mkdir -p ${top_dir}/RPMS/${arch} + fi + + log "Starting build" + + if [ -z "$BUILD_DISTURL" ]; then + rpmbuild --target ${arch} -ba ${build_dir}/image.spec + else + rpmbuild --target ${arch} -ba --define "disturl $BUILD_DISTURL" ${build_dir}/image.spec + fi + + # required for the BS to find the rpm, because it is + # a "non-standard result file for KIWI" + mkdir -p ${top_dir}/OTHER + mv ${top_dir}/RPMS/${arch}/${pkg_name}-${pkg_version}-${pkg_release}.${arch}.rpm ${top_dir}/OTHER/ + mv ${top_dir}/SRPMS/${pkg_name}-${pkg_version}-${pkg_release}.src.rpm ${top_dir}/OTHER/ +done diff --git a/containment-tik-img-to-rpm.changes b/containment-tik-img-to-rpm.changes new file mode 100644 index 0000000..b818b49 --- /dev/null +++ b/containment-tik-img-to-rpm.changes @@ -0,0 +1,25 @@ +------------------------------------------------------------------- +Tue Jul 2 11:49:14 UTC 2024 - Richard Brown + +- Support also creating systemd-repart bundles + +------------------------------------------------------------------- +Thu Jun 20 15:13:08 UTC 2024 - Richard Brown + +- Adjust for new obs-build changelog location + +------------------------------------------------------------------- +Tue May 14 09:49:57 UTC 2024 - Richard Brown + +- Handle changelog properly, to work with reproducible builds + in Factory + +------------------------------------------------------------------- +Fri May 10 18:19:04 UTC 2024 - Richard Brown + +- Conflict with containment-rpm + +------------------------------------------------------------------- +Fri May 10 10:20:40 UTC 2024 - Richard Brown + +- Initial package diff --git a/containment-tik-img-to-rpm.spec b/containment-tik-img-to-rpm.spec new file mode 100644 index 0000000..0d43dcc --- /dev/null +++ b/containment-tik-img-to-rpm.spec @@ -0,0 +1,54 @@ +# +# spec file for package containment-tik-img-to-rpm +# +# Copyright (c) 2024 SUSE LLC +# +# 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 https://bugs.opensuse.org/ +# + + +Name: containment-tik-img-to-rpm +Version: 1.0 +Release: 0 +Summary: OBS Post check for containing tik-osimage-* images in RPM +License: MIT +Source: containment-tik-img-to-rpm +Source1: image.spec.in +BuildRequires: filesystem +BuildArch: noarch +BuildRoot: %{_tmppath}/%{name}-%{version}-build +Requires: build +Requires: coreutils +Requires: gawk +Requires: jq +Requires: perl-DateTime-Format-DateParse +Conflicts: containment-rpm + +%description +OBS Post check for containing tik-osimage-* images in RPM + +%prep + +%build + +%install +mkdir -p %{buildroot}/usr/lib/build/post-build-checks/ +install -m 755 %{SOURCE0} %{buildroot}/usr/lib/build/post-build-checks/ +install -m 644 %{SOURCE1} %{buildroot}/usr/lib/build/ + +%files +%defattr(-,root,root) +%dir %{_prefix}/lib/build/post-build-checks +%{_prefix}/lib/build/post-build-checks/containment-tik-img-to-rpm +%{_prefix}/lib/build/image.spec.in + +%changelog diff --git a/image.spec.in b/image.spec.in new file mode 100644 index 0000000..4a3f1fc --- /dev/null +++ b/image.spec.in @@ -0,0 +1,53 @@ +# needsrootforbuild + +Url: http://www.aeondeskop.org/ +Name: __PKG_NAME__ +Summary: Package with __OS_NAME__ tik OS image +Version: __VERSION__ +Release: __RELEASE__ +Group: System/Management +License: GPL-2.0+ +Source0: __SOURCE0__ +Requires: tik +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +This package contains the __OS_NAME__ image for tik. + +%package repart-bundle +BuildRequires: udev +BuildRequires: xz +BuildRequires: systemd-repart-branding-Aeon +BuildRequires: coreutils + +%description repart-bundle +This package containers the __OS_NAME__ systemd-repart bundle for tik + +%prep + +%build +xz -d %{SOURCE0} +systemd-repart --split=1 %(basename ${SOURCE0} xz) + +%install +install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img +install -p -D -m 644 %{SOURCE0} $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}.raw.xz + +install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version} +install -p -D -m 644 %(basename ${SOURCE0} .raw.xz).root-%{_arch}.raw $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}/ +install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}/repart.d +install -p -D -m 644 %{_prefix}/lib/repart.d/* $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}/repart.d + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) +%{_prefix}/lib/tik/img/%{name}.%{version}.raw.xz + +%files repart-bundle +%defattr(-, root, root) +%{_prefix}/lib/tik/img/%{name}.%{version} + + +%changelog From b07001f6137351acfe4841961fea88636d590835d82a2993aa395d49b6760261 Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Tue, 2 Jul 2024 12:03:51 +0000 Subject: [PATCH 2/6] OBS-URL: https://build.opensuse.org/package/show/devel:microos:aeon/containment-tik-img-to-rpm?expand=0&rev=28 --- image.spec.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/image.spec.in b/image.spec.in index 4a3f1fc..81aeb5b 100644 --- a/image.spec.in +++ b/image.spec.in @@ -15,6 +15,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build This package contains the __OS_NAME__ image for tik. %package repart-bundle +Summary: Package with __OS_NAME__ tik systemd-repart bundle +Requires: tik BuildRequires: udev BuildRequires: xz BuildRequires: systemd-repart-branding-Aeon From 125bc2cfbe454f7380b8a3c16cacaf1b20fb3aba5fde4488829348978d200860 Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Tue, 2 Jul 2024 12:27:48 +0000 Subject: [PATCH 3/6] OBS-URL: https://build.opensuse.org/package/show/devel:microos:aeon/containment-tik-img-to-rpm?expand=0&rev=29 --- containment-tik-img-to-rpm.spec | 1 + image.spec.in | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/containment-tik-img-to-rpm.spec b/containment-tik-img-to-rpm.spec index 0d43dcc..bc30757 100644 --- a/containment-tik-img-to-rpm.spec +++ b/containment-tik-img-to-rpm.spec @@ -31,6 +31,7 @@ Requires: coreutils Requires: gawk Requires: jq Requires: perl-DateTime-Format-DateParse +Requires: udev Conflicts: containment-rpm %description diff --git a/image.spec.in b/image.spec.in index 81aeb5b..99ba3ee 100644 --- a/image.spec.in +++ b/image.spec.in @@ -17,9 +17,8 @@ This package contains the __OS_NAME__ image for tik. %package repart-bundle Summary: Package with __OS_NAME__ tik systemd-repart bundle Requires: tik -BuildRequires: udev +BuildRequires: udev BuildRequires: xz -BuildRequires: systemd-repart-branding-Aeon BuildRequires: coreutils %description repart-bundle @@ -38,7 +37,6 @@ install -p -D -m 644 %{SOURCE0} $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{ install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version} install -p -D -m 644 %(basename ${SOURCE0} .raw.xz).root-%{_arch}.raw $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}/ install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}/repart.d -install -p -D -m 644 %{_prefix}/lib/repart.d/* $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}/repart.d %clean rm -rf $RPM_BUILD_ROOT From 7ada4d4d402ddedec76b0bf35ab98f973edc74ceef89b3a3e6bc6949219fa14d Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Tue, 2 Jul 2024 14:03:12 +0000 Subject: [PATCH 4/6] - Package uncompressed images, to be used with systemd-repart OBS-URL: https://build.opensuse.org/package/show/devel:microos:aeon/containment-tik-img-to-rpm?expand=0&rev=30 --- containment-tik-img-to-rpm.changes | 4 ++-- containment-tik-img-to-rpm.spec | 1 - image.spec.in | 26 +++----------------------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/containment-tik-img-to-rpm.changes b/containment-tik-img-to-rpm.changes index b818b49..b26315e 100644 --- a/containment-tik-img-to-rpm.changes +++ b/containment-tik-img-to-rpm.changes @@ -1,7 +1,7 @@ ------------------------------------------------------------------- -Tue Jul 2 11:49:14 UTC 2024 - Richard Brown +Tue Jul 2 14:02:02 UTC 2024 - Richard Brown -- Support also creating systemd-repart bundles +- Package uncompressed images, to be used with systemd-repart ------------------------------------------------------------------- Thu Jun 20 15:13:08 UTC 2024 - Richard Brown diff --git a/containment-tik-img-to-rpm.spec b/containment-tik-img-to-rpm.spec index bc30757..0d43dcc 100644 --- a/containment-tik-img-to-rpm.spec +++ b/containment-tik-img-to-rpm.spec @@ -31,7 +31,6 @@ Requires: coreutils Requires: gawk Requires: jq Requires: perl-DateTime-Format-DateParse -Requires: udev Conflicts: containment-rpm %description diff --git a/image.spec.in b/image.spec.in index 99ba3ee..0f00599 100644 --- a/image.spec.in +++ b/image.spec.in @@ -14,40 +14,20 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %description This package contains the __OS_NAME__ image for tik. -%package repart-bundle -Summary: Package with __OS_NAME__ tik systemd-repart bundle -Requires: tik -BuildRequires: udev -BuildRequires: xz -BuildRequires: coreutils - -%description repart-bundle -This package containers the __OS_NAME__ systemd-repart bundle for tik - %prep %build -xz -d %{SOURCE0} -systemd-repart --split=1 %(basename ${SOURCE0} xz) +xz -k -d %{SOURCE0} %install install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img -install -p -D -m 644 %{SOURCE0} $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}.raw.xz - -install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version} -install -p -D -m 644 %(basename ${SOURCE0} .raw.xz).root-%{_arch}.raw $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}/ -install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}/repart.d +install -p -D -m 644 %(basename %{SOURCE0} .xz) $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}.raw %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-, root, root) -%{_prefix}/lib/tik/img/%{name}.%{version}.raw.xz - -%files repart-bundle -%defattr(-, root, root) -%{_prefix}/lib/tik/img/%{name}.%{version} - +%{_prefix}/lib/tik/img/%{name}.%{version}.raw %changelog From 950dc0dfa6c0f48bac4ebf7263ad2d96027b501d93eddd27931fad45aa34d9cc Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Tue, 2 Jul 2024 14:33:35 +0000 Subject: [PATCH 5/6] OBS-URL: https://build.opensuse.org/package/show/devel:microos:aeon/containment-tik-img-to-rpm?expand=0&rev=31 --- image.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/image.spec.in b/image.spec.in index 0f00599..4d6b1fc 100644 --- a/image.spec.in +++ b/image.spec.in @@ -15,13 +15,13 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build This package contains the __OS_NAME__ image for tik. %prep +xz -k -d %{SOURCE0} %build -xz -k -d %{SOURCE0} %install install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img -install -p -D -m 644 %(basename %{SOURCE0} .xz) $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}.raw +install -p -D -m 644 %{_sourcedir}%(basename %{SOURCE0} .xz) $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}.raw %clean rm -rf $RPM_BUILD_ROOT From b1339000bd7d15c510779962f2b6584bc99fd394be73bbf9ae114eb32d15de03 Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Tue, 2 Jul 2024 14:47:45 +0000 Subject: [PATCH 6/6] OBS-URL: https://build.opensuse.org/package/show/devel:microos:aeon/containment-tik-img-to-rpm?expand=0&rev=32 --- image.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image.spec.in b/image.spec.in index 4d6b1fc..4d90a5b 100644 --- a/image.spec.in +++ b/image.spec.in @@ -21,7 +21,7 @@ xz -k -d %{SOURCE0} %install install -d -m 644 $RPM_BUILD_ROOT%{_prefix}/lib/tik/img -install -p -D -m 644 %{_sourcedir}%(basename %{SOURCE0} .xz) $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}.raw +install -p -D -m 644 %{_sourcedir}/%(basename %{SOURCE0} .xz) $RPM_BUILD_ROOT%{_prefix}/lib/tik/img/%{name}.%{version}.raw %clean rm -rf $RPM_BUILD_ROOT