Skip to content

Commit

Permalink
Speed up reprepro import and stage manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Mar 21, 2024
1 parent d18e952 commit ae9a29c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
21 changes: 10 additions & 11 deletions reprepro-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
8 changes: 3 additions & 5 deletions reprepro-stage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit ae9a29c

Please sign in to comment.