diff --git a/tests/no-new-dependency/requires.txt b/tests/no-new-dependency/requires.txt new file mode 100644 index 0000000..c036bd5 --- /dev/null +++ b/tests/no-new-dependency/requires.txt @@ -0,0 +1,11 @@ +coreutils +dwz +rpm +zip +/usr/bin/bash +/usr/bin/file +/usr/bin/find +/usr/bin/grep +/usr/bin/sed +/usr/bin/sh +/usr/bin/xargs diff --git a/tests/no-new-dependency/runtest.sh b/tests/no-new-dependency/runtest.sh new file mode 100755 index 0000000..cb92a9c --- /dev/null +++ b/tests/no-new-dependency/runtest.sh @@ -0,0 +1,11 @@ +#!/bin/bash -ex + +# we diff most of the dependencies against our list in requires.txt +# generally, a new dependency is bad, for exceptional cases, we can add it to the list together with the change +# we intentionally grep out: +# -srpm-macros and -rpm-macros +# rpmlib(...) +# conditional dependencies (they contain if) +# at the end, we strip the versions with cut +diff -u <(cat $(dirname $0)/requires.txt | sort | uniq) \ + <(rpm -q --requires redhat-rpm-config | grep -Ev -- '-s?rpm-macros(\s|$)|^rpmlib\(|\sif\s' | cut -d' ' -f1 | sort | uniq) diff --git a/tests/tests.yml b/tests/tests.yml index 1b6632e..ad49de7 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -31,6 +31,9 @@ - gcc - gcc-c++ - annobin-annocheck + # no-new-dependency + - diffutils + - grep repositories: - repo: https://src.fedoraproject.org/tests/clang.git dest: clang @@ -40,3 +43,4 @@ run: "dnf -y build-dep {{ tenv_workdir }}/redhat-rpm-config.spec && rpmbuild --define '_sourcedir {{ tenv_workdir }}' -ba {{ tenv_workdir }}/redhat-rpm-config.spec" - clang/fedora-flags - gcc-fedora-flags + - no-new-dependency