|
72 | 72 | Vcs-Git-Ref: refs/heads/testing |
73 | 73 | """) |
74 | 74 |
|
| 75 | +basic_changes_ppa = deb822.Changes(""" |
| 76 | +Format: 1.8 |
| 77 | +Date: Thu, 19 Mar 2026 19:53:17 -0700 |
| 78 | +Source: hello |
| 79 | +Built-For-Profiles: derivative.ubuntu noudeb |
| 80 | +Architecture: source |
| 81 | +Version: 2.10-5ubuntu1~ppa1 |
| 82 | +Distribution: resolute |
| 83 | +Urgency: medium |
| 84 | +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
| 85 | +Changed-By: John Doe <john.doe@example.com> |
| 86 | +Changes: |
| 87 | + hello (2.10-5ubuntu1~ppa1) resolute; urgency=medium |
| 88 | + . |
| 89 | + * Testing |
| 90 | +Checksums-Sha1: |
| 91 | + 93d36eb50575b7520ef1c83b9bb710e47b173485 1090 hello_2.10-5ubuntu1~ppa1.dsc |
| 92 | + f7bebf6f9c62a2295e889f66e05ce9bfaed9ace3 725946 hello_2.10.orig.tar.gz |
| 93 | + 68e569d38607b4a6c49855157a7e088e7cbd29b5 13280 hello_2.10-5ubuntu1~ppa1.debian.tar.xz |
| 94 | + 710b6fda80d0db1662bb1be900e16d36778e4e0c 6488 hello_2.10-5ubuntu1~ppa1_source.buildinfo |
| 95 | +Checksums-Sha256: |
| 96 | + b13071d9b7f4e7d5940cec73b21efe640894d135d8b959dac6bc77fff878728b 1090 hello_2.10-5ubuntu1~ppa1.dsc |
| 97 | + 31e066137a962676e89f69d1b65382de95a7ef7d914b8cb956f41ea72e0f516b 725946 hello_2.10.orig.tar.gz |
| 98 | + 8b1e3f6da54c3fc390e49cb5ee2e8079793496b0488465822754abbc91f0af27 13280 hello_2.10-5ubuntu1~ppa1.debian.tar.xz |
| 99 | + ef2fd9b53c0058c85c0b6c35752e6df068f4fa2267622a93ef922275a045ad0e 6488 hello_2.10-5ubuntu1~ppa1_source.buildinfo |
| 100 | +Files: |
| 101 | + 3f9815521e1d422171f47ae52122bf81 1090 devel optional hello_2.10-5ubuntu1~ppa1.dsc |
| 102 | + 6cd0ffea3884a4e79330338dcc2987d6 725946 devel optional hello_2.10.orig.tar.gz |
| 103 | + bf2ddaa879860206e8d7f93a08e148a5 13280 devel optional hello_2.10-5ubuntu1~ppa1.debian.tar.xz |
| 104 | + e7210718902f4ef005852d3b484e4eeb 6488 devel optional hello_2.10-5ubuntu1~ppa1_source.buildinfo |
| 105 | +Original-Maintainer: Santiago Vila <sanvila@debian.org> |
| 106 | +""") |
| 107 | + |
75 | 108 | basic_changes_sru = deb822.Changes(""" |
76 | 109 | Format: 1.8 |
77 | 110 | Date: Wed, 11 Mar 2026 16:01:41 -0400 |
|
103 | 136 | Original-Maintainer: Santiago Vila <sanvila@debian.org> |
104 | 137 | """) |
105 | 138 |
|
| 139 | +archive_upload_profile = { |
| 140 | + "name": "ubuntu", |
| 141 | + "allow_dcut": False, |
| 142 | + "allow_unsigned_uploads": False, |
| 143 | + "allowed_distributions": "(?!UNRELEASED)", |
| 144 | + "default_host_main": "ssh-ubuntu", |
| 145 | + "full_upload_log": False, |
| 146 | + "hash": "md5", |
| 147 | + "interface": "cli", |
| 148 | + "login": "anonymous", |
| 149 | + "meta": "ubuntu", |
| 150 | + "method": "ftp", |
| 151 | + "passive_ftp": True, |
| 152 | + "post_upload_command": "", |
| 153 | + "pre_upload_command": "", |
| 154 | + "run_lintian": False, |
| 155 | + "scp_compress": False, |
| 156 | + "allowed-distribution": {}, |
| 157 | + "codenames": "ubuntu", |
| 158 | + "hooks": [ |
| 159 | + "badauthor", |
| 160 | + "updatemaintainer", |
| 161 | + "ppaforppaonly", |
| 162 | + "badcontent", |
| 163 | + "nobug", |
| 164 | + "sure", |
| 165 | + "gitubuntu", |
| 166 | + "placeholderbug", |
| 167 | + "checksum", |
| 168 | + "suite-mismatch", |
| 169 | + "releasemismatch", |
| 170 | + "supported-distribution", |
| 171 | + "required-fields", |
| 172 | + "check-debs", |
| 173 | + "gpg", |
| 174 | + ], |
| 175 | + "run_dinstall": False, |
| 176 | + "check_version": False, |
| 177 | + "progress_indicator": "2", |
| 178 | + "fqdn": "upload.ubuntu.com", |
| 179 | + "incoming": "/ubuntu", |
| 180 | + "supported-distribution": { |
| 181 | + "allowed": ["release", "proposed", "backports", "security"], |
| 182 | + "known": ["release", "proposed", "updates", "backports", "security"], |
| 183 | + }, |
| 184 | + "check-debs": {"enforce": "source", "skip": False}, |
| 185 | + "required-fields": { |
| 186 | + "skip": False, |
| 187 | + "fields": ["Launchpad-Bugs-Fixed"], |
| 188 | + "suites": ["any-stable"], |
| 189 | + }, |
| 190 | + "valid_commands": [], |
| 191 | +} |
| 192 | + |
| 193 | +ppa_upload_profile = { |
| 194 | + "name": "ppa", |
| 195 | + "allow_dcut": False, |
| 196 | + "allow_unsigned_uploads": False, |
| 197 | + "allowed_distributions": "(?!UNRELEASED)", |
| 198 | + "default_host_main": "ssh-ubuntu", |
| 199 | + "full_upload_log": False, |
| 200 | + "hash": "md5", |
| 201 | + "interface": "cli", |
| 202 | + "login": "anonymous", |
| 203 | + "meta": "ubuntu", |
| 204 | + "method": "ftp", |
| 205 | + "passive_ftp": True, |
| 206 | + "post_upload_command": "", |
| 207 | + "pre_upload_command": "", |
| 208 | + "run_lintian": False, |
| 209 | + "scp_compress": False, |
| 210 | + "allowed-distribution": {}, |
| 211 | + "codenames": "ubuntu", |
| 212 | + "hooks": [ |
| 213 | + "check-debs", |
| 214 | + "nobug", |
| 215 | + "badcontent", |
| 216 | + "checksum", |
| 217 | + "required-fields", |
| 218 | + "ppaforppaonly", |
| 219 | + "suite-mismatch", |
| 220 | + "badauthor", |
| 221 | + "placeholderbug", |
| 222 | + "gpg", |
| 223 | + "releasemismatch", |
| 224 | + ], |
| 225 | + "run_dinstall": False, |
| 226 | + "check_version": False, |
| 227 | + "progress_indicator": "2", |
| 228 | + "fqdn": "ppa.launchpad.net", |
| 229 | + "incoming": "~johndoe/testing", |
| 230 | + "required-fields": {"skip": True}, |
| 231 | + "supported-distribution": { |
| 232 | + "allowed": ["release"], |
| 233 | + "known": ["release", "proposed", "updates", "backports", "security"], |
| 234 | + }, |
| 235 | + "check-debs": {"enforce": "source", "skip": False}, |
| 236 | + "valid_commands": [], |
| 237 | + "ppa": "johndoe/testing", |
| 238 | +} |
| 239 | + |
106 | 240 |
|
107 | 241 | def test_check_missing_ubuntu_maintainer(): |
108 | 242 | ubuntu_lint.check_missing_ubuntu_maintainer( |
@@ -221,6 +355,26 @@ def test_check_distribution_invalid(): |
221 | 355 | ) |
222 | 356 |
|
223 | 357 |
|
| 358 | +def test_check_ppa_version_string(): |
| 359 | + ubuntu_lint.check_ppa_version_string( |
| 360 | + context=ubuntu_lint.Context(changes=basic_changes_ubuntu_delta, profile=archive_upload_profile) |
| 361 | + ) |
| 362 | + |
| 363 | + with pytest.raises(ubuntu_lint.LintFailure): |
| 364 | + ubuntu_lint.check_ppa_version_string( |
| 365 | + context=ubuntu_lint.Context(changes=basic_changes_ubuntu_delta, profile=ppa_upload_profile) |
| 366 | + ) |
| 367 | + |
| 368 | + ubuntu_lint.check_ppa_version_string( |
| 369 | + context=ubuntu_lint.Context(changes=basic_changes_ppa, profile=ppa_upload_profile) |
| 370 | + ) |
| 371 | + |
| 372 | + with pytest.raises(ubuntu_lint.LintFailure): |
| 373 | + ubuntu_lint.check_ppa_version_string( |
| 374 | + context=ubuntu_lint.Context(changes=basic_changes_ppa, profile=archive_upload_profile) |
| 375 | + ) |
| 376 | + |
| 377 | + |
224 | 378 | def test_check_sru_version_string_breaks_upgrades(requests_mock): |
225 | 379 | package = basic_changes_sru.get("Source") |
226 | 380 |
|
|
0 commit comments