Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 24 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Setup | Checkout rpm-sequoia
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup | Dependencies
run: sudo apt update && sudo apt install codespell
- name: Codespell
Expand All @@ -22,12 +22,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout rpm-sequoia
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup | Build Cache rpm-sequoia
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand Down Expand Up @@ -55,12 +55,12 @@ jobs:
needs: ["Compile"]
steps:
- name: Setup | Checkout rpm-sequoia
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup | Build Cache rpm-sequoia
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand All @@ -85,12 +85,12 @@ jobs:
needs: ["Compile"]
steps:
- name: Setup | Checkout rpm-sequoia
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup | Build Cache rpm-sequoia
uses: actions/cache@v3
- name: Setup | Build Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand All @@ -107,23 +107,16 @@ jobs:
run: cargo build

- name: Setup | rpm Dependencies
run: sudo apt install automake autoconf autopoint gettext libtool tar zlib1g-dev libpopt-dev libsqlite3-dev liblua5.4-dev fakechroot libarchive-dev libmagic-dev
run: |
sudo apt install podman

- name: Setup | Checkout rpm
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: rpm-software-management/rpm.git
ref: rpm-4.18.x
ref: master
fetch-depth: 1
path: rpm-pristine

- name: Setup | Build Cache rpm
uses: actions/cache@v3
with:
path: |
rpm/
rpm-build/
key: ${{ runner.os }}-rpm-${{ hashFiles('rpm-pristine/.git/HEAD', 'rpm-pristine/.git/refs/heads/master') }}
path: rpm

- name: Test | rpm
run: |
Expand All @@ -141,36 +134,22 @@ jobs:
exit 1
fi

echo "::group::configure"

# If rpm doesn't exist, then we don't have a cache of an
# rpm build.
if ! test -e rpm
then
cp -a rpm-pristine rpm

cd rpm
autoreconf -is
cd ..

mkdir -p rpm-build
cd rpm-build
../rpm/configure --prefix=/ --with-crypto=sequoia
else
cd rpm-build
fi
echo "::endgroup::"

echo "::group::make"
make
echo "::endgroup::"

echo "::group::make check"
cd rpm
RPM_ROOT=$(pwd)
cd tests
if ! make check TESTSUITEFLAGS="-k OpenPGP -k signature -k rpmkeys -k digest"
# based on ./mktree.oci build
podman build --target full -t rpm-tests -f Dockerfile ..
# install rpm-sequoia in the test image
podman build -t rpm-tests-sequoia -f ../../tests/Dockerfile ../../
# run the tests by overriding librpm-sequoia in the container.
if ! podman run --privileged -it --rm --read-only --tmpfs /tmp -v $RPM_ROOT:/srv:z \
--workdir /srv -e ROOTLESS=1 rpm-tests-sequoia \
rpmtests -k OpenPGP -k signature -k rpmkeys -k digest;
then
echo "::endgroup::"

cd ..
for log in rpmtests.dir/*/rpmtests.log
do
echo "::group::$log"
Expand Down
40 changes: 14 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ by default.
[rustc]: https://packages.fedoraproject.org/pkgs/rust/rust/
[nettle-devel]: https://packages.fedoraproject.org/pkgs/nettle/nettle-devel

Here's how to build rpm-sequoia and a version of rpm that uses it:
Here's how to build rpm-sequoia and a version of rpm that uses it (before 4.18):

```
$ sudo dnf install cargo rustc clang pkg-config nettle-devel
Expand Down Expand Up @@ -111,34 +111,22 @@ We also set two environment variables when calling `cargo build`:
and defaults to `${prefix}/lib`.


To run just one or two tests, do something like the following:

Note: when building or running the test suite, it is essential to make
sure `PKG_CONFIG_PATH` and `LD_LIBRARY_PATH` are set appropriately (as
in the above transcript).
The current rpm is using containers to run testsuite.
To run just one or two tests, the simplest solution is to build
a container with rpm testsuite, copy rpm-sequoia on top of that
(for example in another container layer), run ldconfig and then
run the tests:

```
$ cd /tmp/rpm/rpm/b/tests
$ export PKG_CONFIG_PATH=/tmp/rpm/rpm-sequoia/target/release
$ export LD_LIBRARY_PATH=/tmp/rpm/rpm-sequoia/target/release
$ make populate_testing
$ T="266 273"; for t in $T; do if ! ../../tests/rpmtests $t; then cat rpmtests.dir/$t/rpmtests.log; fi; done
$ cd /tmp/rpm/rpm/tests
$ podman build --target full -t rpm-tests -f Dockerfile
Comment thread
nwalfield marked this conversation as resolved.
$ podman build -t rpm-tests-sequoia -f ../../tests/Dockerfile ../../
Comment thread
nwalfield marked this conversation as resolved.
$ podman run --privileged -it --rm --read-only --tmpfs /tmp -v /tmp/rpm/rpm/:/srv:z --workdir /srv -e ROOTLESS=1 rpm-tests-sequoia rpmtests -k "openpgp v6 keys and signatures"
Comment thread
nwalfield marked this conversation as resolved.
```

To get tracing output, set RPM_TRACE to 1:

To get tracing output, set `RPM_TRACE` to 1. This needs to be passed
using `--setenv` optionto the specific command in the testsuite, for
example:
```
$ cd /tmp/rpm/rpm/b/tests
$ export PKG_CONFIG_PATH=/tmp/rpm/rpm-sequoia/target/release
$ export LD_LIBRARY_PATH=/tmp/rpm/rpm-sequoia/target/release
$ make populate_testing
$ export RPM_TRACE=1
$ ../../tests/rpmtests 273
$ cat rpmtests.dir/273/rpmtests.log
...
+pgpDigParamsFree: -> success
+rpmFreeCrypto: entered
+rpmFreeCrypto: -> success
273. rpmsigdig.at:495: 273. rpmsign --addsign (rpmsigdig.at:495): FAILED (rpmsigdig.at:503)
...
runroot --setenv RPM_TRACE 1 rpmkeys ...
Comment thread
nwalfield marked this conversation as resolved.
```
7 changes: 7 additions & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM rpm-tests as src
MAINTAINER jakuje@gmail.com

WORKDIR /srv/rpm
COPY /target/debug/librpm_sequoia.so /usr/local/lib64/
COPY /target/debug/librpm_sequoia.so.1 /usr/local/lib64/
RUN ldconfig