Sync from SUSE:SLFO:Main baseiso-containment revision bb746cbb8691f4cd67a3c7f744b51661

This commit is contained in:
Adrian Schröter 2025-01-31 10:09:43 +01:00
commit f6dac11767
5 changed files with 183 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

View File

@ -0,0 +1,19 @@
-------------------------------------------------------------------
Thu Jan 30 10:15:16 UTC 2025 - Adrian Schröter <adrian@suse.de>
- 0.2.1
* process only agama-installer iso's for now to avoid problems
with other image builds.
-------------------------------------------------------------------
Wed Jan 29 13:11:41 UTC 2025 - Adrian Schröter <adrian@suse.de>
- 0.2
* add provides baseiso($NAME) to avoid the need to maintain this
in build config
-------------------------------------------------------------------
Fri Jan 24 12:38:49 UTC 2025 - Adrian Schröter <adrian@suse.de>
- initial package 0.1

43
baseiso-containment.spec Normal file
View File

@ -0,0 +1,43 @@
#
# spec file for package baseiso-containment
#
# Copyright (c) 2025 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: baseiso-containment
Version: 0.2.1
Release: 0
Summary: Wraps Agama build for product composer
License: MIT
Group: System/Management
Source1: baseiso.spec.in
Source2: baseiso_post_run
BuildRequires: filesystem
BuildArch: noarch
%description
Wraps Agama build as base image for product composer
%install
mkdir -p %{buildroot}%{_prefix}/lib/build/post_build.d
install -m 644 %{S:1} %{buildroot}%{_prefix}/lib/build/
install -m 755 %{S:2} %{buildroot}%{_prefix}/lib/build/post_build.d/
%files
%dir %{_prefix}/lib/build/post_build.d
%{_prefix}/lib/build/post_build.d/*_post_run
%{_prefix}/lib/build/baseiso.spec.in
%changelog

24
baseiso.spec.in Normal file
View File

@ -0,0 +1,24 @@
# needsrootforbuild
Url: http://www.suse.com/
Name: baseiso-__NAME__
Summary: Product Composer Base Images
Version: __VERSION__
Release: __RELEASE__
Group: System/Management
License: SUSE-EULA
Provides: baseiso(__NAME__)
%define install_dir %_libexecdir/base-isos
%description
Images to be used by product composer as a base. It is designed
for Agama Installer in first place.
%install
mkdir -p %buildroot%{install_dir}
cp -a /usr/src/packages/KIWI/* %buildroot%install_dir
%files
%install_dir

74
baseiso_post_run Normal file
View File

@ -0,0 +1,74 @@
#!/bin/bash
: ${TOPDIR:=/usr/src/packages}
set -e
set -u
BUILD_DIR=/usr/lib/build
BUILD_DISTURL=
# To get BUILD_DISTURL
test -f /.buildenv && . /.buildenv
IMAGE_DIR=/usr/src/packages/KIWI
[ -d $IMAGE_DIR ] || exit 0
cd $IMAGE_DIR
# Setting default for SPEC_IN
SPEC_IN=$BUILD_DIR/baseiso.spec.in
# Overwrite default for SPEC_IN if _image.spec.in
# exists in sources dir
if [ -f $TOPDIR/SOURCES/baseiso.spec.in ];then
SPEC_IN=$TOPDIR/SOURCES/baseiso.spec.in
fi
echo "Using $SPEC_IN as spec file template"
ARCH="$(uname -m)"
# We filter here currently only for agama-installer until we
# have a clean way to specify it in kiwi build descriptions.
# Alternative is that kiwi bundler get the containment
# functionality. Needs to be discussed.
iso_file=`ls -1 /usr/src/packages/KIWI/agama-installer*.iso 2>/dev/null`
# nothing to do for us
[ -z "$iso_file" ] && exit 0
iso_file="${iso_file##*/}"
iso_name=${iso_file%.$ARCH*}
iso_version=${iso_file#*$ARCH-}
iso_version=${iso_version%.iso}
iso_build=${iso_version##*-Build}
iso_version=${iso_version%-Build*}
iso_flavor=${iso_version#*-}
iso_version=${iso_version%-*}
IMAGE=$iso_name
shopt -s nullglob
shopt -s extglob
echo "Attempting to wrap $IMAGE in a containment rpm ..."
sed -e "s@__NAME__@$iso_name@g" \
-e "s@__VERSION__@$iso_version@g" \
-e "s@__RELEASE__@$iso_build@g" \
< $SPEC_IN \
> $BUILD_DIR/image.spec
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 $TOPDIR/OTHER
mv $TOPDIR/RPMS/$ARCH/baseiso-$iso_name-$iso_version-$iso_build.$ARCH.rpm $TOPDIR/OTHER/
mv $TOPDIR/SRPMS/baseiso-$iso_name-$iso_version-$iso_build.src.rpm $TOPDIR/OTHER/