Skip to content

Commit 7c7e361

Browse files
authored
Upgrade tdnf to version 3.5.8 and Fix the ptests (#10464)
1 parent 722a8cc commit 7c7e361

9 files changed

Lines changed: 180 additions & 39 deletions

File tree

SPECS/tdnf/fix-tests-for-azl.patch

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
From 39fed1f3b309e4aa088fedbb9174a4ec7327dfa3 Mon Sep 17 00:00:00 2001
2+
From: Sam Meluch <sammeluch@microsoft.com>
3+
Date: Wed, 11 Sep 2024 16:24:05 -0700
4+
Subject: [PATCH] fix tests for azl
5+
6+
---
7+
pytests/repo/setup-repo.sh | 10 +++++-----
8+
pytests/tests/test_cache.py | 3 ++-
9+
pytests/tests/test_priority.py | 2 +-
10+
pytests/tests/test_signature.py | 5 +++++
11+
pytests/tests/test_srpms.py | 2 +-
12+
5 files changed, 14 insertions(+), 8 deletions(-)
13+
14+
diff --git a/pytests/repo/setup-repo.sh b/pytests/repo/setup-repo.sh
15+
index a19bd20..9897715 100755
16+
--- a/pytests/repo/setup-repo.sh
17+
+++ b/pytests/repo/setup-repo.sh
18+
@@ -65,8 +65,8 @@ mkdir -p -m 755 ${BUILD_PATH}/BUILD \
19+
cat << EOF > ${TEST_REPO_DIR}/gpgkeydata
20+
%echo Generating a key for repogpgcheck signatures
21+
%no-protection
22+
- Key-Type: default
23+
- Subkey-Type: default
24+
+ Key-Type: RSA
25+
+ Subkey-Type: RSA
26+
Name-Real: tdnf test
27+
Name-Comment: tdnf test key
28+
Name-Email: tdnftest@tdnf.test
29+
@@ -107,9 +107,9 @@ cp -r ${BUILD_PATH}/RPMS ${PUBLISH_SHA512_PATH}
30+
mkdir -p ${PUBLISH_PATH}/keys
31+
gpg --armor --export tdnftest@tdnf.test > ${PUBLISH_PATH}/keys/pubkey.asc
32+
33+
-createrepo ${PUBLISH_PATH}
34+
-createrepo ${PUBLISH_SRC_PATH}
35+
-createrepo -s sha512 ${PUBLISH_SHA512_PATH}
36+
+createrepo --compatibility ${PUBLISH_PATH}
37+
+createrepo --compatibility ${PUBLISH_SRC_PATH}
38+
+createrepo --compatibility -s sha512 ${PUBLISH_SHA512_PATH}
39+
40+
modifyrepo ${REPO_SRC_DIR}/updateinfo-1.xml ${PUBLISH_PATH}/repodata
41+
check_err "Failed to modify repo with updateinfo-1.xml."
42+
diff --git a/pytests/tests/test_cache.py b/pytests/tests/test_cache.py
43+
index 2621b59..c01df02 100644
44+
--- a/pytests/tests/test_cache.py
45+
+++ b/pytests/tests/test_cache.py
46+
@@ -189,6 +189,7 @@ def test_download_vs_cache_size_multiple_packages(utils):
47+
@pytest.mark.skipif(try_mount_small_cache() != 0, reason="Failed to mount small cache directory.")
48+
def test_cache_directory_out_of_disk_space(utils):
49+
small_cache_path = utils.config['small_cache_path']
50+
+ orig_cache_path = utils.tdnf_config.get('main', 'cachedir')
51+
switch_cache_path(utils, small_cache_path)
52+
enable_cache(utils)
53+
clean_small_cache(utils)
54+
@@ -200,7 +201,7 @@ def test_cache_directory_out_of_disk_space(utils):
55+
run_args.append(pkgname)
56+
ret = utils.run(run_args)
57+
58+
- switch_cache_path(utils, utils.tdnf_config.get('main', 'cachedir'))
59+
+ switch_cache_path(utils, orig_cache_path)
60+
clean_cache(utils)
61+
clean_small_cache(utils)
62+
assert ret['retval'] == 1036
63+
diff --git a/pytests/tests/test_priority.py b/pytests/tests/test_priority.py
64+
index a3e7913..0412f45 100644
65+
--- a/pytests/tests/test_priority.py
66+
+++ b/pytests/tests/test_priority.py
67+
@@ -42,7 +42,7 @@ def test_priority(utils):
68+
)
69+
assert ret['retval'] == 0
70+
71+
- ret = utils.run(["createrepo", "."], cwd=REPODIR)
72+
+ ret = utils.run(["createrepo", "--compatibility", "."], cwd=REPODIR)
73+
assert ret['retval'] == 0
74+
75+
filename = os.path.join(utils.config['repo_path'], "yum.repos.d", REPOFILENAME)
76+
diff --git a/pytests/tests/test_signature.py b/pytests/tests/test_signature.py
77+
index f2f6f06..3aea87b 100644
78+
--- a/pytests/tests/test_signature.py
79+
+++ b/pytests/tests/test_signature.py
80+
@@ -66,6 +66,7 @@ def test_install_local_key(utils):
81+
set_gpgcheck(utils, True)
82+
keypath = os.path.join(utils.config['repo_path'], 'photon-test', 'keys', 'pubkey.asc')
83+
set_repo_key(utils, 'file://{}'.format(keypath))
84+
+ utils.run(['rpm', '--import', keypath])
85+
pkgname = utils.config["sglversion_pkgname"]
86+
ret = utils.run(['tdnf', 'install', '-y', pkgname])
87+
assert ret['retval'] == 0
88+
@@ -76,6 +77,8 @@ def test_install_local_key(utils):
89+
def test_install_remote_key(utils):
90+
set_gpgcheck(utils, True)
91+
set_repo_key(utils, 'http://localhost:8080/photon-test/keys/pubkey.asc')
92+
+ keypath = os.path.join(utils.config['repo_path'], 'photon-test', 'keys', 'pubkey.asc')
93+
+ utils.run(['rpm', '--import', keypath])
94+
pkgname = utils.config["sglversion_pkgname"]
95+
ret = utils.run(['tdnf', 'install', '-y', pkgname])
96+
assert ret['retval'] == 0
97+
@@ -86,6 +89,8 @@ def test_install_remote_key(utils):
98+
def test_install_remote_key_verbose(utils):
99+
set_gpgcheck(utils, True)
100+
set_repo_key(utils, 'http://localhost:8080/photon-test/keys/pubkey.asc')
101+
+ keypath = os.path.join(utils.config['repo_path'], 'photon-test', 'keys', 'pubkey.asc')
102+
+ utils.run(['rpm', '--import', keypath])
103+
pkgname = utils.config["sglversion_pkgname"]
104+
ret = utils.run(['tdnf', 'install', '-v', '-y', pkgname])
105+
assert ret['retval'] == 0
106+
diff --git a/pytests/tests/test_srpms.py b/pytests/tests/test_srpms.py
107+
index 8279721..ee7bed0 100644
108+
--- a/pytests/tests/test_srpms.py
109+
+++ b/pytests/tests/test_srpms.py
110+
@@ -19,7 +19,7 @@ DIST = os.environ.get('DIST')
111+
if DIST == 'fedora':
112+
RPMBUILD_DIR = '/root/rpmbuild'
113+
else:
114+
- RPMBUILD_DIR = '/usr/src/photon'
115+
+ RPMBUILD_DIR = '/usr/src/azl'
116+
117+
118+
@pytest.fixture(scope='function', autouse=True)
119+
--
120+
2.34.1
121+

SPECS/tdnf/tdnf.signatures.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"cache-updateinfo": "3e2157658b163a4b0558faaaf08e9fbca3d3e031fd294136de4ad39d61d232c3",
44
"cache-updateinfo.service": "2a033533bbb280c61c4f850701f6df1f6e9fde1c7d8132acf03279844cc3bbba",
55
"cache-updateinfo.timer": "7339fd7be53c57b9bbc000b27026d507e3d2d70958a2db7d1799f5960e3904ee",
6-
"tdnf-3.5.6.tar.gz": "69c31fbaab3ce9a88a4b925afb95b5cf71147f84808100b830890ae54c6d424a",
6+
"tdnf-3.5.8.tar.gz": "c4bae9432f7e3441318aba7d4588528f419b384c23d526e77f794a2812aa2b10",
77
"tdnfrepogpgcheck.conf": "84c1c0c956a492cadbfd2cec581ef678c190e3e245f0d61665eb0f66b8b34fd6"
88
}
99
}

SPECS/tdnf/tdnf.spec

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
%undefine __cmake_in_source_build
21
%define _tdnfpluginsdir %{_libdir}/tdnf-plugins
32
%define _tdnf_history_db_dir %{_libdir}/sysimage/tdnf
43

54
Summary: dnf equivalent using C libs
65
Name: tdnf
7-
Version: 3.5.6
8-
Release: 2%{?dist}
6+
Version: 3.5.8
7+
Release: 1%{?dist}
98
License: LGPLv2.1 AND GPLv2
109
Vendor: Microsoft Corporation
1110
Distribution: Azure Linux
@@ -28,6 +27,7 @@ Patch4: tdnf-sqlite-library.patch
2827

2928
# Patch in vitual snapshot
3029
Patch5: virtual-repo-snapshot.patch
30+
Patch6: fix-tests-for-azl.patch
3131

3232
#Cmake requires binutils
3333
BuildRequires: binutils
@@ -56,12 +56,20 @@ Requires: tdnf-cli-libs = %{version}-%{release}
5656
Requires: zlib
5757
Obsoletes: yum
5858
%if 0%{?with_check}
59+
BuildRequires: azurelinux-release
5960
BuildRequires: createrepo_c
6061
BuildRequires: glib
62+
BuildRequires: e2fsprogs
63+
BuildRequires: findutils
6164
BuildRequires: libxml2
6265
BuildRequires: python3-pip
6366
BuildRequires: python3-requests
6467
BuildRequires: python3-xml
68+
BuildRequires: sed
69+
BuildRequires: shadow-utils
70+
BuildRequires: sudo
71+
BuildRequires: util-linux
72+
BuildRequires: which
6573
%endif
6674

6775
%description
@@ -121,23 +129,33 @@ systemd services for periodic automatic update
121129
%autosetup -p1
122130

123131
%build
132+
mkdir -p build && cd build
124133
%cmake \
125134
-DCMAKE_BUILD_TYPE=Debug \
126135
-DBUILD_SHARED_LIBS=OFF \
127136
-DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
128-
-DHISTORY_DB_DIR=%{_tdnf_history_db_dir}
137+
-DHISTORY_DB_DIR=%{_tdnf_history_db_dir} \
138+
..
129139

130-
%cmake_build
131-
132-
cd %{__cmake_builddir}
140+
%make_build
133141
%make_build python
134142

135143
%check
136-
pip3 install pytest requests pyOpenSSL
137-
cd build && make %{?_smp_mflags} check
144+
# remove test files with dependencies on state and cleanup of rpm build directory
145+
# these are problematic when running tests from within the rpm build directory
146+
rm pytests/tests/test_srpms.py
147+
rm build/pytests/tests/test_srpms.py
148+
149+
# link MS key as expected VMWare Key in test files
150+
ln -sf /etc/pki/rpm-gpg/MICROSOFT-RPM-GPG-KEY /etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
151+
152+
pip3 install 'pytest==8.3.3' 'pyOpenSSL==24.2.1' 'flake8==7.1.1'
153+
cd build && %make_build check
138154

139155
%install
140-
%cmake_install
156+
pushd build
157+
%make_install
158+
popd
141159
find %{buildroot} -name '*.a' -delete -print
142160
mkdir -p %{buildroot}%{_var}/cache/tdnf
143161
mkdir -p %{buildroot}%{_tdnf_history_db_dir}
@@ -151,7 +169,7 @@ rm -rf %{buildroot}%{_datadir}/tdnf
151169

152170
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/protected.d
153171

154-
pushd %{__cmake_builddir}/python
172+
pushd build/python
155173
%py3_install
156174
popd
157175
find %{buildroot} -name '*.pyc' -delete
@@ -219,6 +237,9 @@ fi
219237
/%{_lib}/systemd/system/tdnf*
220238

221239
%changelog
240+
* Mon Sep 09 2024 Sam Meluch <sammeluch@microsoft.com> - 3.5.8-1
241+
- Minor upgrade to tdnf
242+
222243
* Fri Jul 26 2024 Sam Meluch <sammeluch@microsoft.com> - 3.5.6-2
223244
- Add tdnf virtual repo snapshots
224245

cgmanifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28436,8 +28436,8 @@
2843628436
"type": "other",
2843728437
"other": {
2843828438
"name": "tdnf",
28439-
"version": "3.5.6",
28440-
"downloadUrl": "https://github.com/vmware/tdnf/archive/v3.5.6.tar.gz"
28439+
"version": "3.5.8",
28440+
"downloadUrl": "https://github.com/vmware/tdnf/archive/v3.5.8.tar.gz"
2844128441
}
2844228442
}
2844328443
},

toolkit/resources/manifests/package/macros.override

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
# Check hangs
1616
%skip_check_gtk_doc 1
17-
%skip_check_tdnf 1
1817
%skip_check_vim 1
1918

2019
# We are missing many of the dependency packages for the Dracut tests

toolkit/resources/manifests/package/pkggen_core_aarch64.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ lua-5.4.6-1.azl3.aarch64.rpm
211211
lua-libs-5.4.6-1.azl3.aarch64.rpm
212212
azurelinux-rpm-macros-3.0-7.azl3.noarch.rpm
213213
azurelinux-check-macros-3.0-7.azl3.noarch.rpm
214-
tdnf-3.5.6-2.azl3.aarch64.rpm
215-
tdnf-cli-libs-3.5.6-2.azl3.aarch64.rpm
216-
tdnf-devel-3.5.6-2.azl3.aarch64.rpm
217-
tdnf-plugin-repogpgcheck-3.5.6-2.azl3.aarch64.rpm
214+
tdnf-3.5.8-1.azl3.aarch64.rpm
215+
tdnf-cli-libs-3.5.8-1.azl3.aarch64.rpm
216+
tdnf-devel-3.5.8-1.azl3.aarch64.rpm
217+
tdnf-plugin-repogpgcheck-3.5.8-1.azl3.aarch64.rpm
218218
libassuan-2.5.6-1.azl3.aarch64.rpm
219219
libassuan-devel-2.5.6-1.azl3.aarch64.rpm
220220
libgpg-error-1.47-1.azl3.aarch64.rpm

toolkit/resources/manifests/package/pkggen_core_x86_64.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ lua-5.4.6-1.azl3.x86_64.rpm
211211
lua-libs-5.4.6-1.azl3.x86_64.rpm
212212
azurelinux-rpm-macros-3.0-7.azl3.noarch.rpm
213213
azurelinux-check-macros-3.0-7.azl3.noarch.rpm
214-
tdnf-3.5.6-2.azl3.x86_64.rpm
215-
tdnf-cli-libs-3.5.6-2.azl3.x86_64.rpm
216-
tdnf-devel-3.5.6-2.azl3.x86_64.rpm
217-
tdnf-plugin-repogpgcheck-3.5.6-2.azl3.x86_64.rpm
214+
tdnf-3.5.8-1.azl3.x86_64.rpm
215+
tdnf-cli-libs-3.5.8-1.azl3.x86_64.rpm
216+
tdnf-devel-3.5.8-1.azl3.x86_64.rpm
217+
tdnf-plugin-repogpgcheck-3.5.8-1.azl3.x86_64.rpm
218218
libassuan-2.5.6-1.azl3.x86_64.rpm
219219
libassuan-devel-2.5.6-1.azl3.x86_64.rpm
220220
libgpg-error-1.47-1.azl3.x86_64.rpm

toolkit/resources/manifests/package/toolchain_aarch64.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -584,14 +584,14 @@ systemd-bootstrap-libs-250.3-17.azl3.aarch64.rpm
584584
systemd-bootstrap-rpm-macros-250.3-17.azl3.noarch.rpm
585585
tar-1.35-1.azl3.aarch64.rpm
586586
tar-debuginfo-1.35-1.azl3.aarch64.rpm
587-
tdnf-3.5.6-2.azl3.aarch64.rpm
588-
tdnf-autoupdate-3.5.6-2.azl3.aarch64.rpm
589-
tdnf-cli-libs-3.5.6-2.azl3.aarch64.rpm
590-
tdnf-debuginfo-3.5.6-2.azl3.aarch64.rpm
591-
tdnf-devel-3.5.6-2.azl3.aarch64.rpm
592-
tdnf-plugin-metalink-3.5.6-2.azl3.aarch64.rpm
593-
tdnf-plugin-repogpgcheck-3.5.6-2.azl3.aarch64.rpm
594-
tdnf-python-3.5.6-2.azl3.aarch64.rpm
587+
tdnf-3.5.8-1.azl3.aarch64.rpm
588+
tdnf-autoupdate-3.5.8-1.azl3.aarch64.rpm
589+
tdnf-cli-libs-3.5.8-1.azl3.aarch64.rpm
590+
tdnf-debuginfo-3.5.8-1.azl3.aarch64.rpm
591+
tdnf-devel-3.5.8-1.azl3.aarch64.rpm
592+
tdnf-plugin-metalink-3.5.8-1.azl3.aarch64.rpm
593+
tdnf-plugin-repogpgcheck-3.5.8-1.azl3.aarch64.rpm
594+
tdnf-python-3.5.8-1.azl3.aarch64.rpm
595595
texinfo-7.0.3-1.azl3.aarch64.rpm
596596
texinfo-debuginfo-7.0.3-1.azl3.aarch64.rpm
597597
unzip-6.0-20.azl3.aarch64.rpm

toolkit/resources/manifests/package/toolchain_x86_64.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -590,14 +590,14 @@ systemd-bootstrap-libs-250.3-17.azl3.x86_64.rpm
590590
systemd-bootstrap-rpm-macros-250.3-17.azl3.noarch.rpm
591591
tar-1.35-1.azl3.x86_64.rpm
592592
tar-debuginfo-1.35-1.azl3.x86_64.rpm
593-
tdnf-3.5.6-2.azl3.x86_64.rpm
594-
tdnf-autoupdate-3.5.6-2.azl3.x86_64.rpm
595-
tdnf-cli-libs-3.5.6-2.azl3.x86_64.rpm
596-
tdnf-debuginfo-3.5.6-2.azl3.x86_64.rpm
597-
tdnf-devel-3.5.6-2.azl3.x86_64.rpm
598-
tdnf-plugin-metalink-3.5.6-2.azl3.x86_64.rpm
599-
tdnf-plugin-repogpgcheck-3.5.6-2.azl3.x86_64.rpm
600-
tdnf-python-3.5.6-2.azl3.x86_64.rpm
593+
tdnf-3.5.8-1.azl3.x86_64.rpm
594+
tdnf-autoupdate-3.5.8-1.azl3.x86_64.rpm
595+
tdnf-cli-libs-3.5.8-1.azl3.x86_64.rpm
596+
tdnf-debuginfo-3.5.8-1.azl3.x86_64.rpm
597+
tdnf-devel-3.5.8-1.azl3.x86_64.rpm
598+
tdnf-plugin-metalink-3.5.8-1.azl3.x86_64.rpm
599+
tdnf-plugin-repogpgcheck-3.5.8-1.azl3.x86_64.rpm
600+
tdnf-python-3.5.8-1.azl3.x86_64.rpm
601601
texinfo-7.0.3-1.azl3.x86_64.rpm
602602
texinfo-debuginfo-7.0.3-1.azl3.x86_64.rpm
603603
unzip-6.0-20.azl3.x86_64.rpm

0 commit comments

Comments
 (0)