From ae9a29c15fee28cacc8d86546941b9ce9f4dfbf5 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Thu, 21 Mar 2024 17:09:37 +0100 Subject: [PATCH] Speed up reprepro import and stage manipulation --- reprepro-import.sh | 21 ++++++++++----------- reprepro-stage.sh | 8 +++----- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/reprepro-import.sh b/reprepro-import.sh index de71ad8d..84269463 100755 --- a/reprepro-import.sh +++ b/reprepro-import.sh @@ -5,8 +5,6 @@ if [ -r ~/.reprepro.env ]; then . ~/.reprepro.env fi -LOG="$(mktemp /tmp/reprepro-import-XXXXXX)" - # Sanity checks [ ! -d "$INCOMING_DIR" ] && echo "Invalid incoming directory" && exit 1 [ -z "$DISTRO" ] && echo "Distribution undefined" && exit 1 @@ -21,31 +19,32 @@ if [ -n "$GH_TOKEN" ]; then gh --repo "$REPO" run download --name debs --dir "$INCOMING_DIR" fi +function filter { + grep -vE "Exporting indices...|Deleting files no longer referenced..." +} + # Import sources for f in "$INCOMING_DIR"/*.dsc; do - reprepro includedsc "$DISTRO" "$f"; + echo "$f" + reprepro includedsc "$DISTRO" "$f" | filter done # Import packages -for f in "$DISTRO" "$INCOMING_DIR"/*.deb; do - reprepro includedeb "$DISTRO" "$f" && echo "$f" >> "$LOG" -done +reprepro includedeb "$DISTRO" "$INCOMING_DIR"/*.deb | filter # Cleanup files (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" -reprepro -C main-dbg includedeb "$DISTRO" "$INCOMING_DIR"/*.deb +reprepro -C main-dbg includedeb "$DISTRO" "$INCOMING_DIR"/*.deb | filter (cd "$INCOMING_DIR" || exit 1; rm ./*.deb) +reprepro export "$DISTRO" + # Merge local.yaml into ros-one.yaml cat "$INCOMING_DIR/local.yaml" >> "ros-one.yaml" "$(dirname "${BASH_SOURCE[0]}")/src/scripts/yaml_remove_duplicates.py" ros-one.yaml # Remove remaining files (cd "$INCOMING_DIR" || exit 1; rm ./Packages ./Release ./README.md.in ./local.yaml) - -echo "Imported: " -cat "$LOG" -rm "$LOG" diff --git a/reprepro-stage.sh b/reprepro-stage.sh index e8ce5205..b0a2535f 100755 --- a/reprepro-stage.sh +++ b/reprepro-stage.sh @@ -11,8 +11,6 @@ fi [ -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 +pkgs=$(reprepro list "$DISTRO-build" | cut -s -d " " -f 2) +reprepro copy "$DISTRO" "$DISTRO-build" "$pkgs" +reprepro remove "$DISTRO-build" "$pkgs"