From c5102db3edebae33af03020044d43b415ce5bc4b Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Wed, 7 Aug 2024 20:40:56 +0300 Subject: [PATCH] pbuilder structure --- .github/workflows/i386-native.yml | 40 --------------- main.sh | 80 ++++-------------------------- native.sh | 82 +++++++++++++++++++++++++++++++ main_pbuilder.sh => pbuilder.sh | 12 ++++- 4 files changed, 101 insertions(+), 113 deletions(-) delete mode 100644 .github/workflows/i386-native.yml create mode 100755 native.sh rename main_pbuilder.sh => pbuilder.sh (61%) diff --git a/.github/workflows/i386-native.yml b/.github/workflows/i386-native.yml deleted file mode 100644 index c53cd799f..000000000 --- a/.github/workflows/i386-native.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: PikaOS Upstream Package Build & Release (i386) - -on: - push: - branches: - - main - paths: - - 'pika-build-config/i386-native.sh' - -jobs: - build: - runs-on: upstream-package - container: - image: ghcr.io/pikaos-linux/pika-base-debian-container:i386 - volumes: - - /proc:/proc - options: --privileged -it - - steps: - - uses: actions/checkout@v3 - - - name: Install SSH key - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_KEY }} - name: id_rsa - known_hosts: ${{ secrets.KNOWN_HOSTS }} - if_key_exists: replace - - - name: Update APT Cache - run: apt-get update -y - - - name: Set Build Config - run: cp -vf ./pika-build-config/i386setup.sh ./pika-build-config.sh - - - name: Build Package - run: ./main.sh - - - name: Release Package - run: ./release.sh diff --git a/main.sh b/main.sh index 9a8c32f5c..535c65105 100755 --- a/main.sh +++ b/main.sh @@ -2,81 +2,19 @@ set -e -. ./pika-build-config.sh -VERSION="$PIKA_PACKAGE_VERSION" - -echo "$PIKA_BUILD_ARCH" > pika-build-arch - -# Get source code -if [[ "$PIKA_PACKAGE_NAME" == *-dmo ]]; +### TEMP UNTIL BUILDER IS ADAPTED +if [[ "$PIKA_BUILD_ARCH" == "i386" ]] then - apt-get source "$PIKA_PACKAGE_NAME" -y + export PIKA_BUILD_USE_PBUILDER=1 else - apt-get source "$PIKA_PACKAGE_NAME=$VERSION" -y + export PIKA_BUILD_USE_PBUILDER=1 fi +### -if [ "$PIKA_REBUILD" = true ] +if [[ "$PIKA_BUILD_USE_PBUILDER" == "1" ]] then - VERSION="$VERSION+$PIKA_REBUILD_VERSION" + ./pbuilder.sh +else + ./native.sh fi - -# Get build deps -#LOGNAME=root dh_make --createorig -y -l -p src-pkg-name_"$VERSION" || echo "dh-make: Ignoring Last Error" - -# Enter build dir -cd $(find ./ -maxdepth 1 -name "$PIKA_PACKAGE_NAME*" -type d | head -1) - -# DO PATCHING -if git clone --depth=1 https://git.pika-os.com/upstream-patches/"$PIKA_PACKAGE_NAME".git ../patches -then - if [ -f ../patches/series ] - then - if cat ./debian/source/format | grep 'quilt' - then - cp -rvf ../patches/patches ./debian/ - cat ../patches/series >> ./debian/patches/series - else - for i in $(cat ../patches/series) - do - echo "Applying Patch: $i" - patch -Np1 -i ../patches/patches/$i || bash -c "echo "Applying Patch $i Failed!" && exit 2" - done - fi - fi - if [ -f ../patches/native-series ] - then - for i in $(cat ../patches/native-series) - do - echo "Applying Patch: $i" - patch -Np1 -i ../patches/patches/$i || bash -c "echo "Applying Patch $i Failed!" && exit 2" - done - fi -fi - -# Reversion changelog -if [ "$PIKA_REBUILD" = true ] -then - CHANGELOG_DATE=$(date '+%a, %d %b %Y %H:%M:%S %z') - CHANGELOG_APPEND="$PIKA_PACKAGE_NAME ($VERSION) pika; urgency=medium\n\n * PikaOS 4 Rebuild.\n\n -- Ward Nakchbandi $CHANGELOG_DATE\n" - sed -i "1s/^/$CHANGELOG_APPEND\n/" debian/changelog - if [ -f debian/control ] - then - sed -i "s#source:Version#binary:Version#g" debian/control - fi - if [ -f debian/control.in ] - then - sed -i "s#source:Version#binary:Version#g" debian/control.in - fi -fi - -# Get build deps -apt-get build-dep ./ -y - -# Build Binary Packages -dpkg-buildpackage --no-sign - -# Move the debs to output -cd ../ -mkdir -p ./output -mv ./*.deb ./output/ diff --git a/native.sh b/native.sh new file mode 100755 index 000000000..9a8c32f5c --- /dev/null +++ b/native.sh @@ -0,0 +1,82 @@ +#! /bin/bash + +set -e + +. ./pika-build-config.sh + +VERSION="$PIKA_PACKAGE_VERSION" + +echo "$PIKA_BUILD_ARCH" > pika-build-arch + +# Get source code +if [[ "$PIKA_PACKAGE_NAME" == *-dmo ]]; +then + apt-get source "$PIKA_PACKAGE_NAME" -y +else + apt-get source "$PIKA_PACKAGE_NAME=$VERSION" -y +fi + +if [ "$PIKA_REBUILD" = true ] +then + VERSION="$VERSION+$PIKA_REBUILD_VERSION" +fi + +# Get build deps +#LOGNAME=root dh_make --createorig -y -l -p src-pkg-name_"$VERSION" || echo "dh-make: Ignoring Last Error" + +# Enter build dir +cd $(find ./ -maxdepth 1 -name "$PIKA_PACKAGE_NAME*" -type d | head -1) + +# DO PATCHING +if git clone --depth=1 https://git.pika-os.com/upstream-patches/"$PIKA_PACKAGE_NAME".git ../patches +then + if [ -f ../patches/series ] + then + if cat ./debian/source/format | grep 'quilt' + then + cp -rvf ../patches/patches ./debian/ + cat ../patches/series >> ./debian/patches/series + else + for i in $(cat ../patches/series) + do + echo "Applying Patch: $i" + patch -Np1 -i ../patches/patches/$i || bash -c "echo "Applying Patch $i Failed!" && exit 2" + done + fi + fi + if [ -f ../patches/native-series ] + then + for i in $(cat ../patches/native-series) + do + echo "Applying Patch: $i" + patch -Np1 -i ../patches/patches/$i || bash -c "echo "Applying Patch $i Failed!" && exit 2" + done + fi +fi + +# Reversion changelog +if [ "$PIKA_REBUILD" = true ] +then + CHANGELOG_DATE=$(date '+%a, %d %b %Y %H:%M:%S %z') + CHANGELOG_APPEND="$PIKA_PACKAGE_NAME ($VERSION) pika; urgency=medium\n\n * PikaOS 4 Rebuild.\n\n -- Ward Nakchbandi $CHANGELOG_DATE\n" + sed -i "1s/^/$CHANGELOG_APPEND\n/" debian/changelog + if [ -f debian/control ] + then + sed -i "s#source:Version#binary:Version#g" debian/control + fi + if [ -f debian/control.in ] + then + sed -i "s#source:Version#binary:Version#g" debian/control.in + fi +fi + +# Get build deps +apt-get build-dep ./ -y + +# Build Binary Packages +dpkg-buildpackage --no-sign + +# Move the debs to output +cd ../ +mkdir -p ./output +mv ./*.deb ./output/ diff --git a/main_pbuilder.sh b/pbuilder.sh similarity index 61% rename from main_pbuilder.sh rename to pbuilder.sh index c7d7124b6..1cfb775eb 100755 --- a/main_pbuilder.sh +++ b/pbuilder.sh @@ -19,9 +19,17 @@ else apt-get source "$PIKA_PACKAGE_NAME=$VERSION" -y fi -pika-pbuilder-i386-init +### TODO: Native patching +### TODO: Quilt patching +### TODO: NMU REBUILD -ARCH=i386 cowbuilder --architecture i386 --buildresult . --logfile buildlog.log "$@" --build ./*.dsc +if [[ "$PIKA_BUILD_ARCH" == "i386" ]] + pika-pbuilder-i386-init + pika-pbuilder-i386-build --build ./*.dsc +else + pika-pbuilder-amd64-init + pika-pbuilder-amd64-build --build ./*.dsc +fi # Move the debs to output mkdir -p ./output