Skip to content

Commit

Permalink
test-getuto.sh: create simple test script
Browse files Browse the repository at this point in the history
* Fetches simple binpkg
* Runs getuto in a temporary directory
* Verifies the binpkg against the new keyring

Signed-off-by: Sam James <sam@gentoo.org>
  • Loading branch information
thesamesam authored and akhuettel committed Aug 19, 2023
1 parent bf56300 commit 6a3c73e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
libc-1-r1-1.gpkg.tar:
wget https://mirror.bytemark.co.uk/gentoo/releases/amd64/binpackages/17.1/x86-64/virtual/libc/libc-1-r1-1.gpkg.tar -O libc-1-r1-1.gpkg.tar

check: getuto test-getuto.sh libc-1-r1-1.gpkg.tar
./test-getuto.sh
27 changes: 27 additions & 0 deletions test-getuto.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -x -e

whoami() {
# Bypass getuto's check for root as we're going to run in a fake tempdir.
echo root
}

export -f whoami
# Keep the real root around before we override its value so we can grab a copy of
# gentoo-release.asc.
export REAL_ROOT="${ROOT%/}"
export ROOT="$(mktemp -d)"

mkdir -p "${ROOT}"/usr/share/openpgp-keys
ln -s "${REAL_ROOT}"/usr/share/openpgp-keys/gentoo-release.asc "${ROOT}"/usr/share/openpgp-keys/gentoo-release.asc

# Generate a keyring using getuto.
./getuto

# Make sure the newly-generated keyring works.
export GNUPGHOME="${ROOT%/}"/etc/portage/gnupg
mkdir -p "${ROOT}"/tmp/binpkg
tar xvf libc-1-r1-1.gpkg.tar -C "${ROOT}"/tmp/binpkg
for file in image.tar.bz2 metadata.tar.bz2 ; do
gpg --verify "${ROOT}"/tmp/binpkg/libc-1-r1-1/${file}.sig
done

0 comments on commit 6a3c73e

Please sign in to comment.