run-upstream-build/fetch.sh

51 lines
1.2 KiB
Bash
Raw Normal View History

2024-08-07 21:50:24 +02:00
#! /bin/bash
set -e
. ./pika-build-config.sh
2024-08-07 22:07:17 +02:00
VERSION="$PIKA_PACKAGE_VERSION"
echo "$PIKA_BUILD_ARCH" > pika-build-arch
2024-08-07 21:50:24 +02:00
if [[ $PIKA_BUILD_ARCH == "amd64-v3" ]]
then
export PIKA_BIN_ARCH="amd64"
fi
if [[ $PIKA_BUILD_ARCH == "i386" ]]
then
export PIKA_BIN_ARCH="i386"
fi
2024-08-07 22:21:13 +02:00
apt-get update -y
2024-08-07 21:50:24 +02:00
mkdir -p ./output
#
2024-08-07 22:30:52 +02:00
BIN_PACKAGE_NAME_LIST=$(apt showsrc "$PIKA_PACKAGE_NAME" | grep -E "^Binary:" | cut -d":" -f2- | sed 's/\,/\n/g' | sed 's/\ /\n/g' | sed '/^$/d' | sort -u)
2024-08-07 22:09:15 +02:00
for bin_pkg in $BIN_PACKAGE_NAME_LIST
2024-08-07 21:50:24 +02:00
do
BIN_VERSION=$(apt show $bin_pkg:$PIKA_BIN_ARCH 2>&1 | grep Version: | head -n1 | cut -f2- -d":" | cut -f2- -d":" | tr -d ' ')
TARGET_VERSION=$(echo $BIN_VERSION | sed 's/\+b.*//')
2024-08-07 22:23:34 +02:00
if apt download -y $bin_pkg:$PIKA_BIN_ARCH
2024-08-07 21:50:24 +02:00
then
2024-08-07 22:23:34 +02:00
if [[ $BIN_VERSION == $TARGET_VERSION ]]
then
2024-08-07 22:32:29 +02:00
mv -vf ./*.deb ./output/
2024-08-07 22:23:34 +02:00
else
for i in ./*.deb
do
mkdir $i-tmp
dpkg-deb -R $i $i-tmp
sed -i "s#$BIN_VERSION#$TARGET_VERSION#g" $i-tmp/DEBIAN/control
2024-08-07 22:44:37 +02:00
dpkg-deb -b $i-tmp $i-fixed_$PIKA_BIN_ARCH.deb
mv -vf ./*-fixed_$PIKA_BIN_ARCH.deb ./output/
2024-08-07 22:41:44 +02:00
rm -rf ./*.deb
2024-08-07 22:23:34 +02:00
done
fi
2024-08-07 21:50:24 +02:00
else
2024-08-07 22:23:34 +02:00
echo "Maybe Error: $bin_pkg doesn't exist in $PIKA_BIN_ARCH"
2024-08-07 21:50:24 +02:00
fi
done