From 09e95d5c2d82055c481430c0760a307788dc9aec Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Thu, 21 Mar 2024 09:38:43 +0100 Subject: [PATCH] Switch to staged distros - reprepro-import.sh imports to ${DISTRO}-build - reprepro-stage.sh moves packages from build to production stage --- .github/workflows/interactive.yaml | 2 +- reprepro-import.sh | 5 ++++- reprepro-stage.sh | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 reprepro-stage.sh diff --git a/.github/workflows/interactive.yaml b/.github/workflows/interactive.yaml index 4b72f51e..3f403cbd 100644 --- a/.github/workflows/interactive.yaml +++ b/.github/workflows/interactive.yaml @@ -83,7 +83,7 @@ jobs: sudo mkdir -p /etc/ros/rosdep/sources.list.d echo "yaml https://ros.packages.techfak.net/ros-one.yaml ${{ inputs.DEB_DISTRO || vars.DEB_DISTRO || '' }}" | sudo tee /etc/ros/rosdep/sources.list.d/1-ros-one.list EXTRA_DEB_SOURCES: "${{ inputs.CONTINUE_BUILD && \ - format('deb [signed-by=/etc/apt/keyrings/ros-one-keyring.gpg] https://ros.packages.techfak.net {0} main', \ + format('deb [signed-by=/etc/apt/keyrings/ros-one-keyring.gpg] https://ros.packages.techfak.net {0}-build main', \ inputs.DEB_DISTRO || vars.DEB_DISTRO) || '' }}" COLCON_PKG_SELECTION: ${{ inputs.COLCON_PKG_SELECTION || vars.COLCON_PKG_SELECTION || '' }} # proceed from existing debs artifact if run_attempt > 1 diff --git a/reprepro-import.sh b/reprepro-import.sh index f286c656..de71ad8d 100755 --- a/reprepro-import.sh +++ b/reprepro-import.sh @@ -12,6 +12,9 @@ LOG="$(mktemp /tmp/reprepro-import-XXXXXX)" [ -z "$DISTRO" ] && echo "Distribution undefined" && exit 1 [ -z "$REPO" ] && echo "github repo undefined" && exit 1 +# Operate on the -build distro +DISTRO="${DISTRO}-build" + # Fetch last debs artifact from github if [ -n "$GH_TOKEN" ]; then echo "$GH_TOKEN" | gh auth login --with-token @@ -29,7 +32,7 @@ for f in "$DISTRO" "$INCOMING_DIR"/*.deb; do done # Cleanup files -(cd "$INCOMING_DIR" || exit 1; rm ./*.log ./*.deb ./*.dsc ./*.tar.gz ./*.changes ./*.buildinfo) +(cd "$INCOMING_DIR" || exit 1; rm ./*.log ./*.deb ./*.dsc ./*.tar.gz ./*.tar.xz ./*.changes ./*.buildinfo) # Rename, Import, and Cleanup ddeb files mmv "$INCOMING_DIR/*.ddeb" "$INCOMING_DIR/#1.deb" diff --git a/reprepro-stage.sh b/reprepro-stage.sh new file mode 100755 index 00000000..e8ce5205 --- /dev/null +++ b/reprepro-stage.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [ -r ~/.reprepro.env ]; then + # shellcheck disable=SC1090 + . ~/.reprepro.env +fi + +# Sanity checks +[ ! -d "$INCOMING_DIR" ] && echo "Invalid incoming directory" && exit 1 +[ -z "$DISTRO" ] && echo "Distribution undefined" && exit 1 +[ -z "$REPO" ] && echo "github repo undefined" && exit 1 + +# Move packages from build to production stage +for pkg in $(reprepro list "$DISTRO-build" | cut -s -d " " -f 2); do + echo "$pkg" + reprepro copy "$DISTRO" "$DISTRO-build" "$pkg" + reprepro remove "$DISTRO-build" "$pkg" +done