mirror of
https://github.com/goreleaser/nfpm
synced 2026-11-01 15:50:14 +01:00
* fix: Add optional dependencies to Arch packages Serialize recommends and suggests as Arch optdepend metadata so optional dependencies are retained in generated packages. See #1123 * test: assert optdepend in the archlinux acceptance stage Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018mQoXuBtWLvs8N7nSYWNKz * refactor: use slices.Concat and assert every optdepend value Address the review nits: avoid writing into the Recommends backing array, and assert the full list of optdepend values instead of substrings, since extractPkginfoFields keeps only the last value of a repeated key. Signed-off-by: amirahrari <ahrariamir@proton.me> --------- Signed-off-by: amirahrari <ahrariamir@proton.me> Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> Co-authored-by: amir <mirammir21@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cb68ab4e-96d3-4658-a1c0-c2c33e8c52a0
138 lines
3.9 KiB
Docker
138 lines
3.9 KiB
Docker
FROM archlinux AS test_base
|
|
ARG package
|
|
RUN echo "${package}"
|
|
COPY ${package} /tmp/foo.pkg.tar.zst
|
|
|
|
|
|
# ---- minimal test ----
|
|
FROM test_base AS min
|
|
RUN pacman --noconfirm -U /tmp/foo.pkg.tar.zst
|
|
|
|
|
|
# ---- symlink test ----
|
|
FROM min AS symlink
|
|
RUN ls -l /path/to/symlink | grep "/path/to/symlink -> /etc/foo/whatever.conf"
|
|
|
|
|
|
# ---- simple test ----
|
|
FROM min AS simple
|
|
RUN test -e /usr/bin/fake
|
|
RUN test -f /etc/foo/whatever.conf
|
|
RUN echo wat >> /etc/foo/whatever.conf
|
|
RUN pacman --noconfirm -R foo
|
|
RUN test -f /etc/foo/whatever.conf.pacsave
|
|
RUN test ! -f /usr/bin/fake
|
|
|
|
|
|
# ---- no-glob test ----
|
|
FROM min AS no-glob
|
|
RUN test -d /usr/share/whatever/
|
|
RUN test -f /usr/share/whatever/file1
|
|
RUN test -f /usr/share/whatever/file2
|
|
RUN test -d /usr/share/whatever/folder2
|
|
RUN test -f /usr/share/whatever/folder2/file1
|
|
RUN test -f /usr/share/whatever/folder2/file2
|
|
|
|
|
|
# ---- complex test ----
|
|
FROM min AS complex
|
|
RUN pacman -Qi foo | grep "Depends On\\s*: bash"
|
|
RUN pacman -Qi foo | grep "Replaces\\s*: foo"
|
|
RUN pacman -Qi foo | grep "Provides\\s*: fake"
|
|
RUN pacman -Qi foo | grep "Optional Deps\\s*: fish"
|
|
RUN test -e /usr/bin/fake
|
|
RUN test -f /etc/foo/whatever.conf
|
|
RUN test -d /usr/share/whatever/
|
|
RUN test -d /usr/share/whatever/folder
|
|
RUN test -f /usr/share/whatever/folder/file1
|
|
RUN test -f /usr/share/whatever/folder/file2
|
|
RUN test -d /usr/share/whatever/folder/folder2
|
|
RUN test -f /usr/share/whatever/folder/folder2/file1
|
|
RUN test -f /usr/share/whatever/folder/folder2/file2
|
|
RUN test -d /var/log/whatever
|
|
RUN test -d /usr/share/foo
|
|
RUN test -d /usr/foo/bar/something
|
|
RUN test -d /etc/something
|
|
RUN test -f /etc/something/a
|
|
RUN test -f /etc/something/b
|
|
RUN test -d /etc/something/c
|
|
RUN test -f /etc/something/c/d
|
|
RUN test $(stat -c %a /usr/bin/fake2) -eq 4755
|
|
RUN test -f /tmp/preinstall-proof
|
|
RUN test -f /tmp/postinstall-proof
|
|
RUN test ! -f /tmp/preremove-proof
|
|
RUN test ! -f /tmp/postremove-proof
|
|
RUN echo wat >> /etc/foo/whatever.conf
|
|
RUN pacman --noconfirm -R foo
|
|
RUN test -f /etc/foo/whatever.conf.pacsave
|
|
RUN test ! -f /usr/bin/fake
|
|
RUN test ! -f /usr/bin/fake2
|
|
RUN test -f /tmp/preremove-proof
|
|
RUN test -f /tmp/postremove-proof
|
|
RUN test ! -d /var/log/whatever
|
|
RUN test ! -d /usr/share/foo
|
|
RUN test ! -d /usr/foo/bar/something
|
|
|
|
|
|
# ---- signed test ----
|
|
FROM min AS signed
|
|
RUN echo "Arch Linux has no signature support"
|
|
|
|
|
|
# ---- overrides test ----
|
|
FROM min AS overrides
|
|
RUN test -e /usr/bin/fake
|
|
RUN test -f /etc/foo/whatever.conf
|
|
RUN test ! -f /tmp/preinstall-proof
|
|
RUN test -f /tmp/postinstall-proof
|
|
RUN test ! -f /tmp/preremove-proof
|
|
RUN test ! -f /tmp/postremove-proof
|
|
RUN echo wat >> /etc/foo/whatever.conf
|
|
RUN pacman --noconfirm -R foo
|
|
RUN test -f /etc/foo/whatever.conf.pacsave
|
|
RUN test ! -f /usr/bin/fake
|
|
RUN test -f /tmp/preremove-proof
|
|
RUN test ! -f /tmp/postremove-proof
|
|
|
|
|
|
# ---- meta test ----
|
|
FROM test_base AS meta
|
|
RUN pacman -Sy && pacman --noconfirm -U /tmp/foo.pkg.tar.zst
|
|
RUN command -v zsh
|
|
|
|
|
|
# ---- env-var-version test ----
|
|
FROM min AS env-var-version
|
|
ENV EXPECTVER="foo 1.0.0-1"
|
|
RUN export FOUND_VER="$(pacman -Q foo)" && \
|
|
echo "Expected: '${EXPECTVER}' :: Found: '${FOUND_VER}'" && \
|
|
test "${FOUND_VER}" = "${EXPECTVER}"
|
|
|
|
|
|
# ---- changelog test ----
|
|
FROM min AS withchangelog
|
|
RUN echo "Arch Linux has no changelog support"
|
|
|
|
|
|
# ---- upgrade test ----
|
|
FROM test_base AS upgrade
|
|
ARG oldpackage
|
|
RUN echo "${oldpackage}"
|
|
COPY ${oldpackage} /tmp/old_foo.pkg.tar.zst
|
|
RUN pacman --noconfirm -U /tmp/old_foo.pkg.tar.zst
|
|
RUN test -f /tmp/preinstall-proof
|
|
RUN cat /tmp/preinstall-proof | grep "Install"
|
|
RUN test -f /tmp/postinstall-proof
|
|
RUN cat /tmp/postinstall-proof | grep "Install"
|
|
RUN test ! -f /tmp/preupgrade-proof
|
|
RUN test ! -f /tmp/postupgrade-proof
|
|
RUN echo modified > /etc/regular.conf
|
|
RUN echo modified > /etc/noreplace.conf
|
|
RUN pacman --noconfirm -U /tmp/foo.pkg.tar.zst
|
|
RUN test -f /tmp/preupgrade-proof
|
|
RUN test -f /tmp/postupgrade-proof
|
|
RUN test -f /etc/regular.conf
|
|
RUN test -f /etc/regular.conf.pacnew
|
|
RUN test -f /etc/noreplace.conf
|
|
RUN test -f /etc/noreplace.conf.pacnew
|