Skip to content

Commit

Permalink
Switch to staged distros
Browse files Browse the repository at this point in the history
- reprepro-import.sh imports to ${DISTRO}-build
- reprepro-stage.sh moves packages from build to production stage
  • Loading branch information
rhaschke committed Mar 21, 2024
1 parent 7591a71 commit 09e95d5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/interactive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion reprepro-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
18 changes: 18 additions & 0 deletions reprepro-stage.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 09e95d5

Please sign in to comment.