- Fix SOURCEURL for multibuild DISTURLs
- Add test suite (test.sh, sles-release-15.4-150400.32.2.x86_64.rpm) - Set SOURCEURL also in chroot builds OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-kiwi_metainfo_helper?expand=0&rev=26
This commit is contained in:
parent
0c9465faa1
commit
0250501b3c
2
README
2
README
@ -7,7 +7,7 @@ build-specific metainfo.
|
|||||||
|
|
||||||
| Placeholder | Value | Example |
|
| Placeholder | Value | Example |
|
||||||
|--------------------------------------|----------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------|
|
|--------------------------------------|----------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------|
|
||||||
| %DISTURL% | The OBS dist url | obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09obs-opensuse-tumbleweed-image |
|
| %DISTURL% | The OBS dist url | obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09-opensuse-tumbleweed-image |
|
||||||
| %SOURCEURL% | Source url for container recipe (OBS) | https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=0f40c57dd619e1dff9e512949b6bca09 |
|
| %SOURCEURL% | Source url for container recipe (OBS) | https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=0f40c57dd619e1dff9e512949b6bca09 |
|
||||||
| %SOURCEURL% | Source url for container recipe (IBS) | https://sources.suse.com/SUSE:SLE-15:Update:CR/sles15-image/2951b67133dd6384cacb28203174e030/ |
|
| %SOURCEURL% | Source url for container recipe (IBS) | https://sources.suse.com/SUSE:SLE-15:Update:CR/sles15-image/2951b67133dd6384cacb28203174e030/ |
|
||||||
| %RELEASE% | The OBS release number (<cicnt\>.<bldcnt\>) | 4.2 |
|
| %RELEASE% | The OBS release number (<cicnt\>.<bldcnt\>) | 4.2 |
|
||||||
|
@ -21,16 +21,6 @@ if [ -e "${BUILD_DATA}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
files=("${RECIPEFILE}")
|
files=("${RECIPEFILE}")
|
||||||
# generate %SOURCEURL% based on DISTURL with a special case for build.suse.de
|
|
||||||
prj=$(echo ${DISTURL} | cut -d/ -f4)
|
|
||||||
localpath=$(echo ${DISTURL} | cut -d/ -f6-)
|
|
||||||
rev=$(echo ${localpath} | cut -d- -f1)
|
|
||||||
packagename=$(echo ${localpath} | cut -d- -f2-)
|
|
||||||
if [[ "${DISTURL}" == obs://build.suse.de/* ]]; then
|
|
||||||
SOURCEURL="https://sources.suse.com/${prj}/${packagename}/${rev}/"
|
|
||||||
else
|
|
||||||
SOURCEURL="https://$(echo ${DISTURL} | cut -d/ -f3)/package/show/${prj}/${packagename}?rev=${rev}"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "Warning: No build data found - chroot build?"
|
echo "Warning: No build data found - chroot build?"
|
||||||
DISTURL="local"
|
DISTURL="local"
|
||||||
@ -44,6 +34,17 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# generate %SOURCEURL% based on DISTURL with a special case for build.suse.de
|
||||||
|
prj=$(echo ${DISTURL} | cut -d/ -f4)
|
||||||
|
localpath=$(echo ${DISTURL} | cut -d/ -f6-)
|
||||||
|
rev=$(echo ${localpath} | cut -d- -f1)
|
||||||
|
packagename=$(echo ${localpath} | cut -d- -f2- | cut -d: -f1)
|
||||||
|
if [[ "${DISTURL}" == obs://build.suse.de/* ]]; then
|
||||||
|
SOURCEURL="https://sources.suse.com/${prj}/${packagename}/${rev}/"
|
||||||
|
else
|
||||||
|
SOURCEURL="https://$(echo ${DISTURL} | cut -d/ -f3)/package/show/${prj}/${packagename}?rev=${rev}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Print all rpm files which contain os-release
|
# Print all rpm files which contain os-release
|
||||||
find_release_rpms() {
|
find_release_rpms() {
|
||||||
find ./repos -name \*-release\*.rpm | while read rpm; do
|
find ./repos -name \*-release\*.rpm | while read rpm; do
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jan 17 09:57:02 UTC 2022 - Fabian Vogt <fvogt@suse.com>
|
||||||
|
|
||||||
|
- Add test suite (test.sh, sles-release-15.4-150400.32.2.x86_64.rpm)
|
||||||
|
- Fix SOURCEURL for multibuild DISTURLs
|
||||||
|
- Set SOURCEURL also in chroot builds
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Jan 13 09:32:09 UTC 2022 - Frederic Crozat <fcrozat@suse.com>
|
Thu Jan 13 09:32:09 UTC 2022 - Frederic Crozat <fcrozat@suse.com>
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@ URL: https://build.opensuse.org
|
|||||||
Source0: kiwi_metainfo_helper.service
|
Source0: kiwi_metainfo_helper.service
|
||||||
Source1: kiwi_metainfo_helper
|
Source1: kiwi_metainfo_helper
|
||||||
Source2: README
|
Source2: README
|
||||||
|
# For %%check
|
||||||
|
Source3: test.sh
|
||||||
|
Source4: sles-release-15.4-150400.32.2.x86_64.rpm
|
||||||
|
BuildRequires: diffutils
|
||||||
Requires: /usr/bin/find
|
Requires: /usr/bin/find
|
||||||
Requires: /usr/bin/grep
|
Requires: /usr/bin/grep
|
||||||
Requires: /usr/bin/sed
|
Requires: /usr/bin/sed
|
||||||
@ -42,10 +46,12 @@ cp %{SOURCE2} .
|
|||||||
%build
|
%build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
mkdir -p %{buildroot}%{_prefix}/lib/obs/service/
|
||||||
|
install -m 0644 %{SOURCE0} %{buildroot}%{_prefix}/lib/obs/service/
|
||||||
|
install -m 0755 %{SOURCE1} %{buildroot}%{_prefix}/lib/obs/service/
|
||||||
|
|
||||||
mkdir -p %{buildroot}%{_prefix}/lib/obs/service
|
%check
|
||||||
install -m 0644 %{SOURCE0} %{buildroot}%{_prefix}/lib/obs/service
|
sh %{SOURCE3}
|
||||||
install -m 0755 %{SOURCE1} %{buildroot}%{_prefix}/lib/obs/service
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc README
|
%doc README
|
||||||
|
BIN
sles-release-15.4-150400.32.2.x86_64.rpm
(Stored with Git LFS)
Normal file
BIN
sles-release-15.4-150400.32.2.x86_64.rpm
(Stored with Git LFS)
Normal file
Binary file not shown.
97
test.sh
Normal file
97
test.sh
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
tmpdir=$(mktemp -d)
|
||||||
|
trap 'rm -rf ${tmpdir}' EXIT
|
||||||
|
|
||||||
|
sourcedir="$(realpath "$(dirname $0)")"
|
||||||
|
script="${sourcedir}/kiwi_metainfo_helper"
|
||||||
|
|
||||||
|
cd $tmpdir
|
||||||
|
|
||||||
|
# Setup environment
|
||||||
|
|
||||||
|
mkdir -p ${tmpdir}/repos/
|
||||||
|
cp "${sourcedir}/sles-release-15.4-150400.32.2.x86_64.rpm" ${tmpdir}/repos/
|
||||||
|
|
||||||
|
# Mock "date"
|
||||||
|
export PATH=${tmpdir}:$PATH
|
||||||
|
cat >${tmpdir}/date <<'EOF'
|
||||||
|
#!/bin/sh
|
||||||
|
exec /usr/bin/date -d "2018-10-30T09:19:02.074934628Z" "$@"
|
||||||
|
EOF
|
||||||
|
chmod a+x ${tmpdir}/date
|
||||||
|
|
||||||
|
cat >.data <<EOF
|
||||||
|
DISTURL="obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09-opensuse-tumbleweed-image:docker"
|
||||||
|
RELEASE=4.2
|
||||||
|
RECIPEFILE=_service:foobar:Dockerfile
|
||||||
|
EOF
|
||||||
|
export BUILD_DIST=.dist
|
||||||
|
|
||||||
|
cat >Dockerfile <<EOF
|
||||||
|
DISTURL=%DISTURL%
|
||||||
|
SOURCEURL=%SOURCEURL%
|
||||||
|
RELEASE=%RELEASE%
|
||||||
|
BUILDTIME=%BUILDTIME%
|
||||||
|
OS_VERSION_ID=%OS_VERSION_ID%
|
||||||
|
OS_VERSION_ID_SP=%OS_VERSION_ID_SP%
|
||||||
|
OS_PRETTY_NAME=%OS_PRETTY_NAME%
|
||||||
|
OS_VENDOR=%OS_VENDOR%
|
||||||
|
OS_PRETTY_NAME_DASHED=%OS_PRETTY_NAME_DASHED%
|
||||||
|
OS_PRETTY_NAME_BEFORE_PAREN=%OS_PRETTY_NAME_BEFORE_PAREN%
|
||||||
|
OS_PRETTY_NAME_BEFORE_PAREN_DASHED=%OS_PRETTY_NAME_BEFORE_PAREN_DASHED%
|
||||||
|
EOF
|
||||||
|
|
||||||
|
bash "${script}"
|
||||||
|
|
||||||
|
diff -u Dockerfile - <<EOF
|
||||||
|
DISTURL=obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09-opensuse-tumbleweed-image:docker
|
||||||
|
SOURCEURL=https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=0f40c57dd619e1dff9e512949b6bca09
|
||||||
|
RELEASE=4.2
|
||||||
|
BUILDTIME=2018-10-30T09:19:02.074934628Z
|
||||||
|
OS_VERSION_ID=15.4
|
||||||
|
OS_VERSION_ID_SP=15.4
|
||||||
|
OS_PRETTY_NAME=SUSE Linux Enterprise Server 15 SP4
|
||||||
|
OS_VENDOR=SUSE
|
||||||
|
OS_PRETTY_NAME_DASHED=SUSE-Linux-Enterprise-Server-15-SP4
|
||||||
|
OS_PRETTY_NAME_BEFORE_PAREN=SUSE Linux Enterprise Server 15 SP4
|
||||||
|
OS_PRETTY_NAME_BEFORE_PAREN_DASHED=SUSE-Linux-Enterprise-Server-15-SP4
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Now with a build.suse.de DISTURL
|
||||||
|
cat >.data <<EOF
|
||||||
|
DISTURL="obs://build.suse.de/SUSE:SLE-15-SP3:Update:CR/images/5f0a221b7877396cbf977205e64690d2-sles15-image"
|
||||||
|
RELEASE=4.2
|
||||||
|
RECIPEFILE=_service:foobar:Dockerfile
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat >Dockerfile <<EOF
|
||||||
|
DISTURL=%DISTURL%
|
||||||
|
SOURCEURL=%SOURCEURL%
|
||||||
|
EOF
|
||||||
|
|
||||||
|
bash "${script}"
|
||||||
|
|
||||||
|
diff -u Dockerfile - <<EOF
|
||||||
|
DISTURL=obs://build.suse.de/SUSE:SLE-15-SP3:Update:CR/images/5f0a221b7877396cbf977205e64690d2-sles15-image
|
||||||
|
SOURCEURL=https://sources.suse.com/SUSE:SLE-15-SP3:Update:CR/sles15-image/5f0a221b7877396cbf977205e64690d2/
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Now test without build data (osc chroot build) and that without %OS_*% it doesn't need a release RPM
|
||||||
|
rm -r ./.data ./repos/
|
||||||
|
|
||||||
|
cat >Dockerfile <<EOF
|
||||||
|
DISTURL=%DISTURL%
|
||||||
|
SOURCEURL=%SOURCEURL%
|
||||||
|
RELEASE=%RELEASE%
|
||||||
|
BUILDTIME=%BUILDTIME%
|
||||||
|
EOF
|
||||||
|
|
||||||
|
bash "${script}"
|
||||||
|
|
||||||
|
diff -u Dockerfile - <<EOF
|
||||||
|
DISTURL=local
|
||||||
|
SOURCEURL=https://local/package/show/local/local?rev=local
|
||||||
|
RELEASE=0
|
||||||
|
BUILDTIME=2018-10-30T09:19:02.074934628Z
|
||||||
|
EOF
|
Loading…
Reference in New Issue
Block a user