From f0d276f8c43b270d859bef22abe25a8322adcf36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Wed, 30 Oct 2024 14:12:42 +0100 Subject: [PATCH] Add package sources for suse-migration-rpm The suse-migration-rpm package contains an OBS hook script which turns the migration live ISO image into a package named according to the name of the image name attribute. In our case: SLES15-Migration. The sources of this package was not maintained in any git repository but are tightly coupled to the live image build which resides here. Thus and to complete the source gap we have for the DMS this commit adds the sources for the meta package here --- image/package/suse-migration-rpm.changes | 57 +++++++++++++++++ image/package/suse-migration-rpm.spec | 50 +++++++++++++++ .../package/suse-migration-rpm/image.spec.in | 41 ++++++++++++ .../package/suse-migration-rpm/kiwi_post_run | 64 +++++++++++++++++++ 4 files changed, 212 insertions(+) create mode 100644 image/package/suse-migration-rpm.changes create mode 100644 image/package/suse-migration-rpm.spec create mode 100644 image/package/suse-migration-rpm/image.spec.in create mode 100644 image/package/suse-migration-rpm/kiwi_post_run diff --git a/image/package/suse-migration-rpm.changes b/image/package/suse-migration-rpm.changes new file mode 100644 index 0000000..a87cc66 --- /dev/null +++ b/image/package/suse-migration-rpm.changes @@ -0,0 +1,57 @@ +------------------------------------------------------------------- +Thu Nov 14 10:11:04 UTC 2019 - Marcus Schaefer + +- Reference commit for SUSE maintenance + + This submission creates a reference to bsc#1155192 + +------------------------------------------------------------------- +Mon Nov 11 14:29:56 UTC 2019 - Marcus Schaefer + +- Add product version requirement to spec file + For further details see: https://github.com/SUSE/suse-migration-services/pull/143 + +------------------------------------------------------------------- +Tue Aug 20 12:01:26 UTC 2019 - Jesús Bermúdez Velázquez + +- Reference commit for SUSE maintenance + Fix BYOS upgrade from 12SP4-SAP to 15 (BSC#1142108) + +------------------------------------------------------------------- +Wed Aug 14 11:47:24 UTC 2019 - Jesús Bermúdez Velázquez + +- This submission creates a reference to bsc#1142108 + +------------------------------------------------------------------- +Wed Jul 17 09:46:13 UTC 2019 - ms@suse.com + +- Install run_migration from suse-migration-services package + that is now a build requirement. For details see: + https://github.com/SUSE/suse-migration-services/issues/108 + +------------------------------------------------------------------- +Thu May 2 13:24:04 UTC 2019 - ms@suse.com + +- Reference commit for SUSE maintenance + + This submission creates a reference to fate#327175 and bsc#1133919 + +------------------------------------------------------------------- +Mon Mar 4 12:53:44 UTC 2019 - ms@suse.com + +- Install SLES15-Migration live image to /usr/share/migration-image + See https://github.com/SUSE/suse-migration-services/issues/54 + for details + +------------------------------------------------------------------- +Fri Jan 25 10:08:59 UTC 2019 - ms@suse.com + +- Install SLES15-Migration live image to /boot + +------------------------------------------------------------------- +Wed Nov 14 15:32:25 UTC 2018 - ms@suse.com + +- Post Processing package for SLES15-Migration live image. + This package provides metadata used at the end of an + appliance build to package the image results into a + package diff --git a/image/package/suse-migration-rpm.spec b/image/package/suse-migration-rpm.spec new file mode 100644 index 0000000..a4b89cb --- /dev/null +++ b/image/package/suse-migration-rpm.spec @@ -0,0 +1,50 @@ +# +# spec file for package suse-migration-rpm +# +# Copyright (c) 2018 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/ +# + + +Name: suse-migration-rpm +Version: 1.0.1 +Release: 0 +Summary: Migration enablement package +License: GPL-3.0-or-later +Group: System/Management +Url: https://github.com/SUSE/suse-migration-services +Source: %{name}.tar.gz +BuildRequires: filesystem +Requires: suse-migration-services +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +OBS kiwi_post_run hook to wrap the kiwi-produced Migration live +ISO image in an rpm package. + +%prep +%setup -q -n %{name} + +%build + +%install +mkdir -p %{buildroot}/usr/lib/build/ +install -m 644 image.spec.in %{buildroot}/usr/lib/build/ +install -m 755 kiwi_post_run %{buildroot}/usr/lib/build/ + +%files +%defattr(-,root,root) +/usr/lib/build/kiwi_post_run +/usr/lib/build/image.spec.in + +%changelog diff --git a/image/package/suse-migration-rpm/image.spec.in b/image/package/suse-migration-rpm/image.spec.in new file mode 100644 index 0000000..132dda9 --- /dev/null +++ b/image/package/suse-migration-rpm/image.spec.in @@ -0,0 +1,41 @@ +# needsrootforbuild + +%global MinSLEVersion 12.3 + +Url: http://www.suse.com/ +Name: __NAME__ +Summary: Migration Live System +Version: __VERSION__ +Release: __RELEASE__ +Group: System/Management +License: SUSE-EULA +Source0: __SOURCE__ +Requires: product(SLES) >= %{MinSLEVersion} +Requires: suse-migration-pre-checks +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +This package contains the Migration Live System. + +%prep + +%build + +%install +install -d -m 755 $RPM_BUILD_ROOT/usr/share/migration-image +install -d -m 755 $RPM_BUILD_ROOT/%{_sbindir} +cp %{SOURCE0} $RPM_BUILD_ROOT/usr/share/migration-image +cp %{_sbindir}/run_migration $RPM_BUILD_ROOT/%{_sbindir} + +%post +/usr/bin/suse-migration-pre-checks + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) +/usr/share/migration-image +%{_sbindir}/run_migration + +%changelog diff --git a/image/package/suse-migration-rpm/kiwi_post_run b/image/package/suse-migration-rpm/kiwi_post_run new file mode 100644 index 0000000..779c405 --- /dev/null +++ b/image/package/suse-migration-rpm/kiwi_post_run @@ -0,0 +1,64 @@ +#!/bin/bash + +set -e +set -u + +: ${TOPDIR:=/usr/src/packages} + +IMAGE_DIR=$TOPDIR/KIWI +BUILD_DIR=/usr/lib/build + +cd $IMAGE_DIR + +ARCH=$(rpm --eval '%{_arch}') +IMAGE=$(echo *.iso) +NAME=$(echo $IMAGE | cut -f1 -d.) +VERSION=$(echo $IMAGE | cut -f3 -d-) +RELEASE=$(echo $IMAGE | cut -f4 -d- | sed -e "s@Build@@" | cut -f1 -d.) + +if [ -z "$IMAGE" ]; then + echo "Couldn't find anything in $IMAGE_DIR matching *.iso" + echo "Will skip containment rpm wrapping steps." + exit 0 +fi + +echo "Attempting to wrap $IMAGE in a containment rpm ..." + +echo "name $NAME" +echo "version $VERSION" +echo "release $RELEASE" + +sed -e "s/__NAME__/$NAME/g" \ + -e "s/__VERSION__/$VERSION/g" \ + -e "s/__RELEASE__/$RELEASE/g" \ + -e "s/__SOURCE__/$IMAGE/g" \ + < $BUILD_DIR/image.spec.in \ + > $BUILD_DIR/image.spec + +# Local builds have the file already in place, that's not true on IBS +if [ ! -f $TOPDIR/SOURCES/$IMAGE ]; then + ln $IMAGE $TOPDIR/SOURCES +fi + +# Make sure /usr/src/packages/* dirs exist +if [ ! -f $TOPDIR/BUILD ]; then + echo "Create BUILD dir" + mkdir -p $TOPDIR/BUILD +fi + +if [ ! -f $TOPDIR/SRPMS ]; then + echo "Create SRPMS dir" + mkdir -p $TOPDIR/SRPMS +fi + +if [ ! -f $TOPDIR/RPMS/$ARCH ]; then + echo "Create SRPMS dir" + mkdir -p $TOPDIR/RPMS/$ARCH +fi + +rpmbuild -ba $BUILD_DIR/image.spec + +# 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/$NAME-$VERSION-$RELEASE.$ARCH.rpm $TOPDIR/OTHER/