Skip to content

Commit

Permalink
Use latest Fedora image and use RSA key type and curve for gpg key
Browse files Browse the repository at this point in the history
No need to use %_topdir in specs, it is implicitly done

setup-repo.sh: No need to pass `-r' to rpmbuild command, it was a wrong
usage for our usecase

Signed-off-by: Shreenidhi Shedi <[email protected]>
  • Loading branch information
sshedi committed Dec 7, 2024
1 parent dd3d0f8 commit 9698481
Show file tree
Hide file tree
Showing 22 changed files with 68 additions and 70 deletions.
2 changes: 1 addition & 1 deletion ci/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fedora:34
FROM fedora:latest

COPY ci/prep.sh /prep.sh
RUN chmod +x /prep.sh
Expand Down
1 change: 1 addition & 0 deletions ci/prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ common_pkgs=(
python3-pyOpenSSL
python3-pytest
python3-requests
python3-setuptools
python3-urllib3
rpm-build
sed
Expand Down
44 changes: 21 additions & 23 deletions pytests/repo/setup-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@
#

if [ $# -ne 2 ]; then
echo "Usage: $0 <repo_path> <specs_dir>"
echo "Usage: $0 <repo_path> <specs_dir>" >&2
exit 1
fi

function fix_dir_perms()
{
function fix_dir_perms() {
chmod 755 ${TEST_REPO_DIR}
find ${TEST_REPO_DIR} -type d -exec chmod 0755 {} \;
find ${TEST_REPO_DIR} -type f -exec chmod 0644 {} \;
}

## used to check return code for each command.
function check_err {
rc=$?
function check_err() {
local rc=$?
if [ $rc -ne 0 ]; then
echo $1
echo "$1" >&2
exit $rc
fi
}
Expand All @@ -37,7 +36,7 @@ fi

REPO_SRC_DIR=$2
if [ ! -d ${REPO_SRC_DIR} ]; then
echo "specs dir does not exist"
echo "ERROR: specs dir does not exist" >&2
exit 1
fi

Expand All @@ -58,21 +57,21 @@ mkdir -p -m 755 ${BUILD_PATH}/BUILD \
${TEST_REPO_DIR}/yum.repos.d \
${PUBLISH_PATH} \
${PUBLISH_SRC_PATH} \
${PUBLISH_SHA512_PATH} \
${PUBLISH_SHA512_PATH} \
${GNUPGHOME}

#gpgkey data for unattended key generation
cat << EOF > ${TEST_REPO_DIR}/gpgkeydata
%echo Generating a key for repogpgcheck signatures
%no-protection
Key-Type: default
Subkey-Type: default
Name-Real: tdnf test
Name-Comment: tdnf test key
Name-Email: [email protected]
Expire-Date: 0
%commit
%echo done
%echo Generating a key for repogpgcheck signatures
%no-protection
Key-Type: RSA
Subkey-Type: RSA
Name-Real: tdnf test
Name-Comment: tdnf test key
Name-Email: [email protected]
Expire-Date: 0
%commit
%echo done
EOF

#generate a key non interactively. this is used in testing
Expand All @@ -90,12 +89,11 @@ for d in conflicts enhances obsoletes provides recommends requires suggests supp
sed s/@@dep@@/$d/ < ${REPO_SRC_DIR}/tdnf-repoquery-deps.spec.in > ${BUILD_PATH}/SOURCES/tdnf-repoquery-$d.spec
done

echo building packages
echo "Building packages"
for spec in ${REPO_SRC_DIR}/*.spec ${BUILD_PATH}/SOURCES/*.spec ; do
echo "building ${spec}"
rpmbuild --define "_topdir ${BUILD_PATH}" \
-r ${BUILD_PATH} -ba ${spec} 2>&1
check_err "failed to build ${spec}"
echo "Building ${spec}"
rpmbuild -D "_topdir ${BUILD_PATH}" -ba ${spec} 2>&1
check_err "ERROR: failed to build ${spec}"
done
rpmsign --addsign ${BUILD_PATH}/RPMS/*/*.rpm
check_err "Failed to sign built packages."
Expand Down
9 changes: 1 addition & 8 deletions pytests/repo/tdnf-bad-pre.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,12 @@ Part of tdnf test spec. Test bad install scripts.
%build

%install
mkdir -p %_topdir/%buildroot/usr/bin
cat << EOF >> %_topdir/%buildroot/usr/bin/bad-pre.sh
#!/bin/sh
# dummy script. Return false because we are bad.
/bin/false
EOF

%pre
# fail intentionally
/bin/false
%{_bindir}/false

%files
/usr/bin/bad-pre.sh

%changelog
* Fri Apr 2 2021 Oliver Kurth <[email protected]> 1.0.0-1
Expand Down
5 changes: 3 additions & 2 deletions pytests/repo/tdnf-conflict-file0.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ Part of tdnf test spec. Two packages containing one identical file.
%build

%install
mkdir -p %_topdir/%buildroot/usr/lib/conflict
mkdir -p %{buildroot}/usr/lib/conflict
# for a file conflict, cntents of the files need to differ
echo file0 > %_topdir/%buildroot/usr/lib/conflict/conflicting-file
echo file0 > %{buildroot}/usr/lib/conflict/conflicting-file

%files
/usr/lib/conflict/conflicting-file

Expand Down
5 changes: 3 additions & 2 deletions pytests/repo/tdnf-conflict-file1.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ Part of tdnf test spec. Two packages containing one identical file.
%build

%install
mkdir -p %_topdir/%buildroot/usr/lib/conflict
echo file > %_topdir/%buildroot/usr/lib/conflict/conflicting-file
mkdir -p %{buildroot}/usr/lib/conflict
echo file > %{buildroot}/usr/lib/conflict/conflicting-file

%files
/usr/lib/conflict/conflicting-file

Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-missing-dep.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test
%build

%install
mkdir -p %_topdir/%buildroot/lib/systemd/system/
cat << EOF >> %_topdir/%buildroot/lib/systemd/system/%name.service
mkdir -p %{buildroot}/lib/systemd/system/
cat << EOF >> %{buildroot}/lib/systemd/system/%name.service
[Unit]
Description=%name.service for whatprovides test.
Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-multi1.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test

# files should not conflict
%install
mkdir -p %_topdir/%buildroot/usr/share/multiinstall
touch %_topdir/%buildroot/usr/share/multiinstall-%{release}
mkdir -p %{buildroot}/usr/share/multiinstall
touch %{buildroot}/usr/share/multiinstall-%{release}

%files
/usr/share/multiinstall-%{release}
Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-multi2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test

# files should not conflict
%install
mkdir -p %_topdir/%buildroot/usr/share/multiinstall
touch %_topdir/%buildroot/usr/share/multiinstall-%{release}
mkdir -p %{buildroot}/usr/share/multiinstall
touch %{buildroot}/usr/share/multiinstall-%{release}

%files
/usr/share/multiinstall-%{release}
Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-multi3.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test

# files should not conflict
%install
mkdir -p %_topdir/%buildroot/usr/share/multiinstall
touch %_topdir/%buildroot/usr/share/multiinstall-%{release}
mkdir -p %{buildroot}/usr/share/multiinstall
touch %{buildroot}/usr/share/multiinstall-%{release}

%files
/usr/share/multiinstall-%{release}
Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-multi4.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test

# files should not conflict
%install
mkdir -p %_topdir/%buildroot/usr/share/multiinstall
touch %_topdir/%buildroot/usr/share/multiinstall-%{release}
mkdir -p %{buildroot}/usr/share/multiinstall
touch %{buildroot}/usr/share/multiinstall-%{release}

%files
/usr/share/multiinstall-%{release}
Expand Down
5 changes: 3 additions & 2 deletions pytests/repo/tdnf-repoquery-base.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ depend on this in some way.
%build

%install
mkdir -p %_topdir/%buildroot/usr/lib/repoquery
touch %_topdir/%buildroot/usr/lib/repoquery/%name
mkdir -p %{buildroot}/usr/lib/repoquery
touch %{buildroot}/usr/lib/repoquery/%name

%files
/usr/lib/repoquery/%name

Expand Down
5 changes: 3 additions & 2 deletions pytests/repo/tdnf-repoquery-changelog.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ depend on this in some way.
%build

%install
mkdir -p %_topdir/%buildroot/usr/lib/repoquery
touch %_topdir/%buildroot/usr/lib/repoquery/%name
mkdir -p %{buildroot}/usr/lib/repoquery
touch %{buildroot}/usr/lib/repoquery/%name

%files
/usr/lib/repoquery/%name

Expand Down
5 changes: 3 additions & 2 deletions pytests/repo/tdnf-repoquery-deps.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ depend on tdnf-repoquery-base (or provide, ...)
%build

%install
mkdir -p %_topdir/%buildroot/usr/lib/repoquery
touch %_topdir/%buildroot/usr/lib/repoquery/%name
mkdir -p %{buildroot}/usr/lib/repoquery
touch %{buildroot}/usr/lib/repoquery/%name

%files
/usr/lib/repoquery/%name

Expand Down
5 changes: 3 additions & 2 deletions pytests/repo/tdnf-repoquery-queryformat.spec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ depend on this in some way.
%build

%install
mkdir -p %_topdir/%buildroot/usr/lib/repoquery
touch %_topdir/%buildroot/usr/lib/repoquery/%name
mkdir -p %{buildroot}/usr/lib/repoquery
touch %{buildroot}/usr/lib/repoquery/%name

%files
/usr/lib/repoquery/%name

Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-test-cleanreq-leaf1.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test
%build

%install
mkdir -p %_topdir/%buildroot/lib/cleanreq/
touch %_topdir/%buildroot/lib/cleanreq/%name
mkdir -p %{buildroot}/lib/cleanreq/
touch %{buildroot}/lib/cleanreq/%name

%files
/lib/cleanreq/%name
Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-test-cleanreq-leaf2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test
%build

%install
mkdir -p %_topdir/%buildroot/lib/cleanreq/
touch %_topdir/%buildroot/lib/cleanreq/%name
mkdir -p %{buildroot}/lib/cleanreq/
touch %{buildroot}/lib/cleanreq/%name

%files
/lib/cleanreq/%name
Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-test-cleanreq-required.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test
%build

%install
mkdir -p %_topdir/%buildroot/lib/cleanreq/
touch %_topdir/%buildroot/lib/cleanreq/required
mkdir -p %{buildroot}/lib/cleanreq/
touch %{buildroot}/lib/cleanreq/required

%files
/lib/cleanreq/required
Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-test-noarch.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test
%build

%install
mkdir -p %_topdir/%buildroot/lib/systemd/system/
cat << EOF >> %_topdir/%buildroot/lib/systemd/system/%{name}.service
mkdir -p %{buildroot}/lib/systemd/system/
cat << EOF >> %{buildroot}/lib/systemd/system/%{name}.service
[Unit]
Description=%{name} for arch related tests
Expand Down
4 changes: 2 additions & 2 deletions pytests/repo/tdnf-test-one.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Part of tdnf test spec. Basic install/remove/upgrade test
%build

%install
mkdir -p %_topdir/%buildroot/lib/systemd/system/
cat << EOF >> %_topdir/%buildroot/lib/systemd/system/tdnf-test-one.service
mkdir -p %{buildroot}/lib/systemd/system/
cat << EOF >> %{buildroot}/lib/systemd/system/tdnf-test-one.service
[Unit]
Description=tdnf-test-one.service for whatprovides test.
Expand Down
6 changes: 3 additions & 3 deletions pytests/repo/tdnf-test-toolarge.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ out of disk space error.
%build

%install
mkdir -p %_topdir/%buildroot/lib/toolarge/
touch %_topdir/%buildroot/lib/toolarge/largedata.txt
dd if=/dev/urandom of=%_topdir/%buildroot/lib/toolarge/largedata.txt bs=1M count=1
mkdir -p %{buildroot}/lib/toolarge/
touch %{buildroot}/lib/toolarge/largedata.txt
dd if=/dev/urandom of=%{buildroot}/lib/toolarge/largedata.txt bs=1M count=1

%files
/lib/toolarge/largedata.txt
Expand Down
6 changes: 3 additions & 3 deletions pytests/repo/tdnf-verbose-scripts.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Part of tdnf test spec. Basic install/remove/upgrade test
%build

%install
mkdir -p %_topdir/%buildroot/lib/systemd/system/
echo %_topdir/%buildroot/lib/systemd/system/%{name}.service
cat << EOF >> %_topdir/%buildroot/lib/systemd/system/%{name}.service
mkdir -p %{buildroot}/lib/systemd/system/
echo %{buildroot}/lib/systemd/system/%{name}.service
cat << EOF >> %{buildroot}/lib/systemd/system/%{name}.service
[Unit]
Description=%{name}.service for rpm script test.
Expand Down

0 comments on commit 9698481

Please sign in to comment.