diff --git a/.packit/rpmlint.spec b/.packit/rpmlint.spec index ff529e4f1..2ef2ab6c1 100644 --- a/.packit/rpmlint.spec +++ b/.packit/rpmlint.spec @@ -1,7 +1,7 @@ %{!?python3: %global python3 %{__python3}} Name: rpmlint -Version: 2.4.0 +Version: 2.5.0 Release: 0%{?dist} Summary: Tool for checking common errors in RPM packages diff --git a/pyproject.toml b/pyproject.toml index b3bce9e82..8fbd3b0fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "rpmlint" -version = "2.4.0" +version = "2.5.0" description = "Check for common errors in RPM packages" license = {text = "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)"} authors = [ @@ -75,7 +75,7 @@ include-package-data = true [tool.setuptools.package-data] rpmlint = ["configdefaults.toml"] -"rpmlint.descriptions" = ["*.toml"] +"rpmlint.descriptions" = ["*.toml"] [tool.ruff] diff --git a/rpmlint/__isocodes__.py b/rpmlint/__isocodes__.py index 6f6406866..111bd5c8f 100644 --- a/rpmlint/__isocodes__.py +++ b/rpmlint/__isocodes__.py @@ -7996,6 +7996,15 @@ 'AW', 'AX', 'AZ', + 'Adlm', + 'Afak', + 'Aghb', + 'Ahom', + 'Arab', + 'Aran', + 'Armi', + 'Armn', + 'Avst', 'BA', 'BB', 'BD', @@ -8017,6 +8026,18 @@ 'BW', 'BY', 'BZ', + 'Bali', + 'Bamu', + 'Bass', + 'Batk', + 'Beng', + 'Bhks', + 'Blis', + 'Bopo', + 'Brah', + 'Brai', + 'Bugi', + 'Buhd', 'CA', 'CC', 'CD', @@ -8036,12 +8057,25 @@ 'CX', 'CY', 'CZ', + 'Cakm', + 'Cans', + 'Cari', + 'Cham', + 'Cher', + 'Cirt', + 'Copt', + 'Cprt', + 'Cyrl', + 'Cyrs', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', + 'Deva', + 'Dsrt', + 'Dupl', 'EC', 'EE', 'EG', @@ -8049,6 +8083,11 @@ 'ER', 'ES', 'ET', + 'Egyd', + 'Egyh', + 'Egyp', + 'Elba', + 'Ethi', 'FI', 'FJ', 'FK', @@ -8074,12 +8113,33 @@ 'GU', 'GW', 'GY', + 'Geok', + 'Geor', + 'Glag', + 'Goth', + 'Gran', + 'Grek', + 'Gujr', + 'Guru', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', + 'Hanb', + 'Hang', + 'Hani', + 'Hano', + 'Hans', + 'Hant', + 'Hatr', + 'Hebr', + 'Hira', + 'Hluw', + 'Hmng', + 'Hrkt', + 'Hung', 'ID', 'IE', 'IL', @@ -8090,10 +8150,16 @@ 'IR', 'IS', 'IT', + 'Inds', + 'Ital', 'JE', 'JM', 'JO', 'JP', + 'Jamo', + 'Java', + 'Jpan', + 'Jurc', 'KE', 'KG', 'KH', @@ -8105,6 +8171,17 @@ 'KW', 'KY', 'KZ', + 'Kali', + 'Kana', + 'Khar', + 'Khmr', + 'Khoj', + 'Kitl', + 'Kits', + 'Knda', + 'Kore', + 'Kpel', + 'Kthi', 'LA', 'LB', 'LC', @@ -8116,6 +8193,20 @@ 'LU', 'LV', 'LY', + 'Lana', + 'Laoo', + 'Latf', + 'Latg', + 'Latn', + 'Leke', + 'Lepc', + 'Limb', + 'Lina', + 'Linb', + 'Lisu', + 'Loma', + 'Lyci', + 'Lydi', 'MA', 'MC', 'MD', @@ -8139,6 +8230,22 @@ 'MX', 'MY', 'MZ', + 'Mahj', + 'Mand', + 'Mani', + 'Marc', + 'Maya', + 'Mend', + 'Merc', + 'Mero', + 'Mlym', + 'Modi', + 'Mong', + 'Moon', + 'Mroo', + 'Mtei', + 'Mult', + 'Mymr', 'NA', 'NC', 'NE', @@ -8151,7 +8258,19 @@ 'NR', 'NU', 'NZ', + 'Narb', + 'Nbat', + 'Newa', + 'Nkgb', + 'Nkoo', + 'Nshu', 'OM', + 'Ogam', + 'Olck', + 'Orkh', + 'Orya', + 'Osge', + 'Osma', 'PA', 'PE', 'PF', @@ -8166,12 +8285,28 @@ 'PT', 'PW', 'PY', + 'Palm', + 'Pauc', + 'Perm', + 'Phag', + 'Phli', + 'Phlp', + 'Phlv', + 'Phnx', + 'Piqd', + 'Plrd', + 'Prti', 'QA', + 'Qaaa', + 'Qabx', 'RE', 'RO', 'RS', 'RU', 'RW', + 'Rjng', + 'Roro', + 'Runr', 'SA', 'SB', 'SC', @@ -8193,6 +8328,23 @@ 'SX', 'SY', 'SZ', + 'Samr', + 'Sara', + 'Sarb', + 'Saur', + 'Sgnw', + 'Shaw', + 'Shrd', + 'Sidd', + 'Sind', + 'Sinh', + 'Sora', + 'Sund', + 'Sylo', + 'Syrc', + 'Syre', + 'Syrj', + 'Syrn', 'TC', 'TD', 'TF', @@ -8209,12 +8361,28 @@ 'TV', 'TW', 'TZ', + 'Tagb', + 'Takr', + 'Tale', + 'Talu', + 'Taml', + 'Tang', + 'Tavt', + 'Telu', + 'Teng', + 'Tfng', + 'Tglg', + 'Thaa', + 'Thai', + 'Tibt', + 'Tirh', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', + 'Ugar', 'VA', 'VC', 'VE', @@ -8222,10 +8390,24 @@ 'VI', 'VN', 'VU', + 'Vaii', + 'Visp', 'WF', 'WS', + 'Wara', + 'Wole', + 'Xpeo', + 'Xsux', 'YE', 'YT', + 'Yiii', 'ZA', 'ZM', - 'ZW'} + 'ZW', + 'Zinh', + 'Zmth', + 'Zsye', + 'Zsym', + 'Zxxx', + 'Zyyy', + 'Zzzz'} diff --git a/rpmlint/checks/FilesCheck.py b/rpmlint/checks/FilesCheck.py index 3c357e912..dec75615f 100644 --- a/rpmlint/checks/FilesCheck.py +++ b/rpmlint/checks/FilesCheck.py @@ -862,6 +862,35 @@ def _check_file_link_relative(self, pkg, fname, pkgfile): 'symlink-contains-up-and-down-segments', fname, link) + def _check_file_link_bindir_shebang(self, pkg, fname, pkgfile): + basedir = Path(fname).parent + linkto = str((basedir / Path(pkgfile.linkto)).resolve()) + # Link to a file not in the package, so ignore + if linkto not in pkg.files: + return + + realbin = pkg.files[linkto] + # Link to something in bindir is okay + if bin_regex.search(realbin.name): + return + if not stat.S_ISREG(realbin.mode): + return + + file_chunk, file_istext = self.peek(realbin.path, pkg) + file_interpreter, _file_interpreter_args = script_interpreter(file_chunk) + # Not a script with shebang, so ignore + if not file_interpreter: + return + + # If the shebang interpreter is a dependency, it's okay + deps = [x[0] for x in pkg.requires] + if file_interpreter in deps: + return + + self.output.add_info('W', pkg, 'symlink-to-binary-with-shebang', fname, + f'is a link to a script ({realbin.name}) but missing' + f' requires for {file_interpreter}') + def _check_file_link(self, pkg, fname, pkgfile): if not stat.S_ISLNK(pkgfile.mode): return @@ -871,6 +900,7 @@ def _check_file_link(self, pkg, fname, pkgfile): self._check_file_link_bindir_exes(pkg, fname) self._check_file_link_absolute(pkg, fname, pkgfile) self._check_file_link_relative(pkg, fname, pkgfile) + self._check_file_link_bindir_shebang(pkg, fname, pkgfile) def _check_file_dir(self, pkg, fname, pkgfile): if not stat.S_ISDIR(pkgfile.mode): diff --git a/rpmlint/checks/SpecCheck.py b/rpmlint/checks/SpecCheck.py index 1f9956d69..c8fcc5722 100644 --- a/rpmlint/checks/SpecCheck.py +++ b/rpmlint/checks/SpecCheck.py @@ -18,7 +18,7 @@ def re_tag_compile(tag): patch_regex = re_tag_compile(r'Patch(\d*)') -applied_patch_regex = re.compile(r'^%patch(\d*)') +applied_patch_regex = re.compile(r'^%patch\s*(\d*)') applied_patch_p_regex = re.compile(r'\s-P\s*(\d+)\b') applied_patch_pipe_regex = re.compile(r'\s%\{PATCH(\d+)\}\s*\|\s*(%\{?__)?patch\b') applied_patch_i_regex = re.compile(r'(?:%\{?__)?patch\}?.*?\s+(?:<|-i)\s+%\{PATCH(\d+)\}') diff --git a/rpmlint/descriptions/DuplicatesCheck.toml b/rpmlint/descriptions/DuplicatesCheck.toml index 7fedb8559..aea8dd10e 100644 --- a/rpmlint/descriptions/DuplicatesCheck.toml +++ b/rpmlint/descriptions/DuplicatesCheck.toml @@ -1,3 +1,7 @@ +files-duplicate=""" +Your package contains duplicated files that are not hard- or symlinks. +You should use the %fdupes macro to link the files to one. +""" files-duplicated-waste=""" Your package contains duplicated files that are not hard- or symlinks. You should use the %fdupes macro to link the files to one. diff --git a/rpmlint/descriptions/FilesCheck.toml b/rpmlint/descriptions/FilesCheck.toml index 7598c35d5..30a59a3e6 100644 --- a/rpmlint/descriptions/FilesCheck.toml +++ b/rpmlint/descriptions/FilesCheck.toml @@ -403,3 +403,9 @@ manual-page-in-subfolder=""" Manual page should not be placed in a subfolder of a manual section directory. """ + +symlink-to-binary-with-shebang=""" +A file in /usr/bin is a link to a script in a different place with a shebang. +rpm won't be able to inject the needed interpreter as dependency, so it should +be done manually. +""" diff --git a/rpmlint/descriptions/I18NCheck.toml b/rpmlint/descriptions/I18NCheck.toml index c62a8aa12..1437b6cbd 100644 --- a/rpmlint/descriptions/I18NCheck.toml +++ b/rpmlint/descriptions/I18NCheck.toml @@ -2,3 +2,15 @@ If /foo/bar is not tagged %lang(XX) whereas /foo is, the package won't be installable if XX is not in %_install_langs. """ + +"invalid-lc-messages-dir"=""" +The package contains a languages file for a language code that's not recognized +by rpmlint, in a path like /usr/share/locale/LANGCODE/LC_MESSAGES/FILE.mo. +please report a bug if the LANGCODE is correct. +""" + +"invalid-locale-man-dir"=""" +The package contains a man page file for a language code that's not recognized +by rpmlint, in a path like /usr/share/man/LANGCODE/man1/FILE.1.gz. +please report a bug if the LANGCODE is correct. +""" diff --git a/rpmlint/lint.py b/rpmlint/lint.py index 0af4dbba7..ac47c18e8 100644 --- a/rpmlint/lint.py +++ b/rpmlint/lint.py @@ -322,8 +322,15 @@ def print_explanation(self, messages, config): """ for message in messages: explanation = self.output.get_description(message, config) + if not explanation: + # check if it's a WarnOnFunction warning configuration + forbidden_functions = config.configuration['WarnOnFunction'] + if message in forbidden_functions: + explanation = forbidden_functions[message].get('description') + if not explanation: explanation = 'Unknown message, please report a bug if the description should be present.\n\n' + print(f'{message}:\n{explanation}') def load_checks(self): diff --git a/rpmlint/pkg.py b/rpmlint/pkg.py index ff8f7e965..8e70158c6 100644 --- a/rpmlint/pkg.py +++ b/rpmlint/pkg.py @@ -450,6 +450,22 @@ def _gather_dep_info(self): return (_requires, _prereq, _provides, _conflicts, _obsoletes, _recommends, _suggests, _enhances, _supplements) + def scriptprog(self, which): + """ + Get the specified script interpreter as a string. + Depending on rpm-python version, the string may or may not include + interpreter arguments, if any. + """ + if which is None: + return '' + prog = self[which] + if prog is None: + prog = '' + elif isinstance(prog, (list, tuple)): + # http://rpm.org/ticket/847#comment:2 + prog = ''.join(prog) + return prog + def __enter__(self): return self @@ -705,22 +721,6 @@ def check_versioned_dep(self, name, version): return True return False - def scriptprog(self, which): - """ - Get the specified script interpreter as a string. - Depending on rpm-python version, the string may or may not include - interpreter arguments, if any. - """ - if which is None: - return '' - prog = self[which] - if prog is None: - prog = '' - elif isinstance(prog, (list, tuple)): - # http://rpm.org/ticket/847#comment:2 - prog = ''.join(prog) - return prog - def get_installed_pkgs(name): """Get list of installed package objects by name.""" @@ -797,6 +797,7 @@ def __init__(self, name, is_source=False): self.header[getattr(rpm, f'RPMTAG_{tagname}NAME')] = [] self.header[getattr(rpm, f'RPMTAG_{tagname}FLAGS')] = [] self.header[getattr(rpm, f'RPMTAG_{tagname}VERSION')] = [] + self.header[rpm.RPMTAG_FILENAMES] = [] def add_file(self, path, name): pkgfile = PkgFile(name) @@ -817,7 +818,11 @@ def _mock_file(self, path, attrs): elif 'content' in attrs: content = attrs['content'] - self.add_file_with_content(path, content, metadata=metadata) + if 'linkto' in attrs: + self.add_symlink_to(path, attrs['linkto']) + else: + self.add_file_with_content(path, content, metadata=metadata) + self.header[rpm.RPMTAG_FILENAMES].append(path) if 'content-path' in attrs: content.close() @@ -853,6 +858,8 @@ def add_file_with_content(self, name, content, metadata=None, **flags): pkg_file = PkgFile(name) pkg_file.path = path pkg_file.mode = stat.S_IFREG | 0o0644 + pkg_file.user = 'root' + pkg_file.group = 'root' self.files[name] = pkg_file # create files in filesystem @@ -916,6 +923,8 @@ def add_symlink_to(self, name, target): pkg_file = PkgFile(name) pkg_file.mode = stat.S_IFLNK pkg_file.linkto = target + pkg_file.user = 'root' + pkg_file.group = 'root' self.files[name] = pkg_file def add_ghost(self, name): @@ -944,3 +953,7 @@ def md5_checksum(self, file_name): def cleanup(self): if self.dirname: self.__tmpdir.cleanup() + + # access the tags like an array + def __getitem__(self, key): + return self.header.get(key, None) diff --git a/test/spec/intltool.spec b/test/spec/intltool.spec new file mode 100644 index 000000000..593d73cb7 --- /dev/null +++ b/test/spec/intltool.spec @@ -0,0 +1,442 @@ +Name: intltool +Summary: Utility for internationalizing various kinds of data files +Version: 0.51.0 +Release: 24%{?dist} +License: GPL-2.0-or-later WITH Autoconf-exception-generic +#VCS: bzr:https://code.edge.launchpad.net/~intltool/intltool/trunk +Source: https://edge.launchpad.net/intltool/trunk/%{version}/+download/intltool-%{version}.tar.gz +URL: https://launchpad.net/intltool +BuildArch: noarch +Requires: patch +# for /usr/share/aclocal +Requires: automake +Requires: gettext-devel +Requires: perl(Getopt::Long) +Requires: perl(XML::Parser) +BuildRequires: perl-generators +BuildRequires: perl(Getopt::Long) +BuildRequires: perl(XML::Parser) +BuildRequires: gettext +BuildRequires: make +# http://bugzilla.gnome.org/show_bug.cgi?id=568845 +# Dropping this patch per the last comment on that thread: +# Martin Pitt: As the reporter of the bug I close this, as the new API du jour is gsettings, +# which has a sensible gettext integration. +#Patch0: schemas-merge.patch +# Fix intltool-update to work with perl 5.26. Patch taken from +# Debian's intltool_0.51.0-4.debian.tar.xz +Patch1: intltool-perl5.26-regex-fixes.patch +# https://bugs.launchpad.net/intltool/+bug/1505260 +# https://bugzilla.redhat.com/show_bug.cgi?id=1249051 +Patch2: intltool-merge-Create-cache-file-atomically.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1318674 +Patch3: intltool_distcheck-fix.patch + +%description +This tool automatically extracts translatable strings from oaf, glade, +bonobo ui, nautilus theme, .desktop, and other data files and puts +them in the po files. + +%prep +%setup -q +%patch 1 -p1 +%patch 2 -p1 +%patch 3 -p1 + +%build +%configure + +%make_build + +%install +%make_install + +%check +if ! make check; then + find . -type f -name 'test-suite.log' | while read trs; do + echo "BEGIN " ${trs}; cat ${trs} 1>&2; + done + echo "Exiting abnormally due to make check failure above" 1>&2 + exit 1 +fi + +%files +%doc AUTHORS README +%license COPYING +%{_bindir}/intltool* +%{_datadir}/intltool +%{_datadir}/aclocal/intltool.m4 +%{_mandir}/man8/intltool*.8* + +%changelog +* Thu Sep 21 2023 Jens Petersen - 0.51.0-24 +- SPDX migration of license tag + +* Thu Jul 20 2023 Fedora Release Engineering - 0.51.0-23 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Thu Jan 19 2023 Fedora Release Engineering - 0.51.0-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jul 21 2022 Fedora Release Engineering - 0.51.0-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jan 20 2022 Fedora Release Engineering - 0.51.0-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Jul 22 2021 Fedora Release Engineering - 0.51.0-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jan 26 2021 Fedora Release Engineering - 0.51.0-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 0.51.0-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jan 29 2020 Fedora Release Engineering - 0.51.0-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Jul 25 2019 Fedora Release Engineering - 0.51.0-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Feb 01 2019 Fedora Release Engineering - 0.51.0-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 0.51.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Jun 29 2018 Jitka Plesnikova - 0.51.0-12 +- Perl 5.28 rebuild + +* Wed Feb 07 2018 Fedora Release Engineering - 0.51.0-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Aug 08 2017 Kalev Lember - 0.51.0-10 +- Fix intltool-update to work with perl 5.26 (#1462217) + +* Wed Jul 26 2017 Fedora Release Engineering - 0.51.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 0.51.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Jul 29 2016 Wolfgang Ulbrich - 0.51.0-7 +- fix usage of distcheck for some packages rhbz (#1318674) + +* Tue Feb 16 2016 Yaakov Selkowitz - 0.51.0-6 +- Depend on perl(Getopt::Long) (#1307638) + +* Thu Feb 04 2016 Fedora Release Engineering - 0.51.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Mon Oct 12 2015 Colin Walters - 0.51.0-4 +- Add patch to hopefully close race condition in systemd builds +- Related to https://bugzilla.redhat.com/show_bug.cgi?id=1249051 +- And the test suite is failing but the logs are hidden under + test-suite.log, so copy some code I had in dbus.spec to cat them. + +* Mon Jul 13 2015 Ralf Corsépius - 0.51.0-3 +- Add intltool-0.51.0-perl-5.22.patch (Address RHBZ#1233444) +- Remove unnecessary %%debug_package. + +* Wed Jun 17 2015 Fedora Release Engineering - 0.51.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Mar 09 2015 David King - 0.51.0-1 +- Update to 0.51.0 +- Use license macro for COPYING +- Preserve timestamps during install +- Use parallel make flags +- Update man page glob in files section + +* Sat Jun 07 2014 Fedora Release Engineering - 0.50.2-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sat Aug 03 2013 Fedora Release Engineering - 0.50.2-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Wed Jul 24 2013 Petr Pisar - 0.50.2-6 +- Perl 5.18 rebuild + +* Fri Feb 8 2013 Matthias Clasen - 0.50.2-5 +- Update url (#908562) + +* Sun Oct 21 2012 Matthias Clasen - 0.50.2-3 +- Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 0.50.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Apr 17 2012 Kalev Lember - 0.50.2-2 +- Clean up previous change and fix Requires/BuildRequires (#225902) + +* Fri Apr 06 2012 Jon Ciesla - 0.50.2-1 +- Latest stable release. +- Merge review BZ 225902 fixes: +- Removed Obsoletes/Provides for xml-i18n-tools. +- Swapped gettext/gettext-devel Requires, BuildRequires. +- Added %%check section. + +* Fri Jan 13 2012 Fedora Release Engineering - 0.50.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Dec 20 2011 Alon Levy +- Update to 0.50.0 +- Drop patch carried for bz#568845 (schemas-merge) per last comment + in that bug. + +* Wed Feb 09 2011 Fedora Release Engineering - 0.41.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sun Mar 28 2010 Matthias Clasen - 0.41.1-1 +- Update to 0.41.1 + +* Wed Aug 12 2009 Matthias Clasen - 0.41.0-1 +- Update to 0.41.0 + +* Mon Aug 10 2009 Ville Skyttä - 0.40.6-4 +- Convert specfile to UTF-8. + +* Fri Jul 24 2009 Fedora Release Engineering - 0.40.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Apr 27 2009 Matthias Clasen - 0.40.6-2 +- Don't merge translations back into GConf schemas + +* Mon Mar 16 2009 Matthias Clasen - 0.40.6-1 +- Update to 0.40.6 + +* Tue Feb 24 2009 Fedora Release Engineering - 0.40.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Feb 12 2009 Matthias Clasen - 0.40.5-2 +- turn noarch + +* Sun Oct 19 2008 Matthias Clasen - 0.40.5-1 +- Update to 0.40.5 + +* Sun Sep 21 2008 Matthias Clasen - 0.40.4-1 +- Update to 0.40.4 + +* Wed Aug 6 2008 Matthias Clasen - 0.40.3-3 +- Require gettext-devel + +* Thu Jul 31 2008 Tom "spot" Callaway - 0.40.3-2 +- fix license tag + +* Fri Jul 25 2008 Matthias Clasen - 0.40.3-1 +- Update to 0.40.3 + +* Mon Jul 21 2008 Matthias Clasen - 0.40.1-1 +- Update to 0.40.1 + +* Tue Jun 3 2008 Matthias Clasen - 0.40.0-1 +- Update to 0.40.0 + +* Mon Feb 25 2008 Matthias Clasen - 0.37.1-1 +- Update to 0.37.1 + +* Tue Feb 19 2008 Fedora Release Engineering - 0.37.0-3 +- Autorebuild for GCC 4.3 + +* Tue Jan 15 2008 Matthias Clasen - 0.37.0-2 +- Require gettext + +* Mon Dec 17 2007 Matthias Clasen - 0.37.0-1 +- Update to 0.37.0 + +* Thu Dec 13 2007 Matthias Clasen - 0.36.3-1 +- Update to 0.36.3 + +* Sun Sep 16 2007 Matthias Clasen - 0.36.2-1 +- Update to 0.36.2 + +* Mon Aug 13 2007 Matthias Clasen - 0.36.1-1 +- Update to 0.36.1 + +* Fri Aug 3 2007 Matthias Clasen - 0.36.0-1 +- Update to 0.36.0 +- Update license field +- Drop patch rejected, obsolete and upstreamed patches +- Some spec file cleanups +- Require automake + +* Tue Jul 31 2007 David Zeuthen - 0.35.5-5 +- Add support for PolicyKit .policy files (b.g.o #462312) + +* Sat Jul 28 2007 Matthias Clasen - 0.35.5-4 +- Don't produce useless debuginfo (#249969) + +* Wed Mar 21 2007 Ray Strode - 0.35.5-3 +- don't store a translation if it is equal to the original + string + +* Mon Mar 19 2007 Bill Nottingham - 0.35.5-2 +- add upstream changeset 674 (GNOME bz#413461 - fix intltool-extract path) + +* Sat Feb 24 2007 Matthias Clasen - 0.35.5-1 +- Update to 0.35.5 + +* Wed Jan 10 2007 Matthias Clasen - 0.35.4-1 +- Update to 0.35.4 + +* Thu Dec 21 2006 Matthias Clasen - 0.35.2-1 +- Update to 0.35.2 + +* Tue Aug 1 2006 Matthias Clasen - 0.35.0-2 +- Add a missing BuildRequires: gettext + +* Wed Jul 12 2006 Jesse Keating - 0.35.0-1.1 +- rebuild + +* Tue May 16 2006 Matthias Clasen 0.35.0-1 +- Update to 0.35.1 + +* Tue May 9 2006 Matthias Clasen 0.34.90.cvs20060509-1 +- Update to a cvs snapshot to allow building gnome 2.15 + +* Fri Feb 10 2006 Jesse Keating - 0.34.2-1.1 +- bump again for double-long bug on ppc(64) + +* Mon Feb 6 2006 Matthias Clasen 0.34.2-1 +- Update to 0.34.2 + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Thu Aug 4 2005 Matthias Clasen - 0.34.1-1 +- New upstream version + +* Wed Mar 2 2005 Matthias Clasen - 0.33-2 +- Rebuild with gcc4 + +* Wed Jan 26 2005 Matthias Clasen - 0.33-1 +- Upgrade to 0.33 + +* Thu Jan 13 2005 Jeremy Katz - 0.31.2-3 +- fix intltool local mode (upstream 163981) + +* Wed Nov 3 2004 - 0.31.2-1 +- add BuildRequires on perl-XML-Parser, #132622 + +* Thu Sep 23 2004 Jonathan Blandford 0.31.2-1 +- bump version + +* Tue Aug 3 2004 Owen Taylor - 0.31.1-1 +- Upgrade to 0.31.1 + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Fri Mar 12 2004 Alex Larsson 0.30-1 +- update to 0.30 + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Mon Jan 19 2004 Jonathan Blandford 0.29-1 +- new version + +* Mon Aug 25 2003 Alexander Larsson 0.27.2-1 +- update + +* Mon Aug 11 2003 Havoc Pennington 0.27-1 +- 0.27 + +* Wed Jul 30 2003 Havoc Pennington 0.26-1 +- rebuild + +* Wed Jul 9 2003 Havoc Pennington 0.26-1 +- 0.26 + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Mon Jan 6 2003 Havoc Pennington +- 0.25 + +* Fri Nov 8 2002 Havoc Pennington +- 0.23 + +* Fri Jun 21 2002 Tim Powers +- automated rebuild + +* Sun Jun 09 2002 Havoc Pennington +- rebuild in different environment + +* Sun Jun 9 2002 Havoc Pennington +- 0.22 +- remove perl patch, perl is fixed + +* Thu Jun 6 2002 Nalin Dahyabhai +- tweak the perl5 check to not bomb with perl 5.8 + +* Thu May 23 2002 Tim Powers +- automated rebuild + +* Thu Apr 25 2002 Havoc Pennington +- rebuild in different environment + +* Thu Apr 4 2002 Jeremy Katz +- update to 0.18 + +* Thu Mar 14 2002 Jeremy Katz +- update to 0.17 + +* Thu Feb 21 2002 Jeremy Katz +- rebuild in new environment + +* Tue Feb 12 2002 Havoc Pennington +- 0.15 +- remove dbm patch, dbm no longer used upstream +- shorten summary line, #56739 + +* Wed Jan 30 2002 Owen Taylor +- Version 0.14 +- Try again on DBM fix +- Patch to use AnyDBM_File rather than NDBM_File for caching +- Version 0.14 + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Wed Jan 2 2002 Havoc Pennington +- 0.12.90 cvs snap + +* Mon Nov 26 2001 Havoc Pennington +- 0.12 tarball + +* Sun Oct 28 2001 Havoc Pennington +- new cvs snap, no longer noarch + +* Fri Oct 5 2001 Havoc Pennington +- intltool specfile, based on xml-i18n-tools (but fixed up) +- obsolete/provide xml-i18n-tools + +* Tue Aug 14 2001 Alexander Larsson 0.9-2 +- Require patch + +* Wed Aug 8 2001 Jonathan Blandford +- Fix bug #45699 and #50634 by upgrading version. + +* Mon Jul 16 2001 Trond Eivind Glomsrød +- s/Copyright/License/ +- Shorter summary +- Remove empty post/postun scripts +- Don't define name and ver on the top and use this in the headers later + +* Tue Jul 10 2001 Tim Powers +- cleaned up files list so that there aren't non-standard dirs and so + that it owns the xml-i18n-tools dir + +* Tue Apr 17 2001 Jonathan Blandford +- Cleaned up spec file a little for Red Hat. + +* Thu Mar 01 2001 Maciej Stachowiak +- removed devel subpackage + +* Tue Jan 04 2000 Robin * Slomkowski +- created this thing diff --git a/test/test_files.py b/test/test_files.py index 052abeb9d..de0f1fce6 100644 --- a/test/test_files.py +++ b/test/test_files.py @@ -1,3 +1,5 @@ +import stat + import pytest from rpmlint.checks.FilesCheck import FilesCheck from rpmlint.checks.FilesCheck import pyc_magic_from_chunk, pyc_mtime_from_chunk @@ -5,7 +7,7 @@ from rpmlint.checks.FilesCheck import script_interpreter as se from rpmlint.filter import Filter -from Testing import CONFIG, get_tested_package, get_tested_path +from Testing import CONFIG, get_tested_mock_package, get_tested_package, get_tested_path @pytest.fixture(scope='function', autouse=True) @@ -13,7 +15,19 @@ def filescheck(): CONFIG.info = True output = Filter(CONFIG) test = FilesCheck(CONFIG, output) - return output, test + yield output, test + + +@pytest.fixture +def output(filescheck): + output, _test = filescheck + yield output + + +@pytest.fixture +def test(filescheck): + _output, test = filescheck + yield test def test_pep3147(): @@ -244,3 +258,45 @@ def test_manual_pages(tmp_path, package, filescheck): assert 'W: manpage-not-compressed bz2 /usr/share/man/man1/test.1.zst' in out assert 'E: bad-manual-page-folder /usr/share/man/man0p/foo.3.gz expected folder: man3' in out assert 'bad-manual-page-folder /usr/share/man/man3/some.3pm.gz' not in out + + +@pytest.mark.parametrize('package', [ + get_tested_mock_package( + files={ + '/usr/share/package/bin.py': { + 'content': '#!/usr/bin/python3\nprint("python required")', + 'metadata': {'mode': 0o755 | stat.S_IFREG}, + }, + '/usr/bin/testlink': { + 'linkto': '../share/package/bin.py', + }, + }, + header={}, + ), +]) +def test_shebang(package, output, test): + test.check(package) + out = output.print_results(output.results) + assert 'W: symlink-to-binary-with-shebang /usr/bin/testlink' in out + + +@pytest.mark.parametrize('package', [ + get_tested_mock_package( + files={ + '/usr/share/package/bin.py': { + 'content': '#!/usr/bin/python3\nprint("python required")', + 'metadata': {'mode': 0o755 | stat.S_IFREG}, + }, + '/usr/bin/testlink': { + 'linkto': '../share/package/bin.py', + }, + }, + header={ + 'requires': ['/usr/bin/python3'], + }, + ), +]) +def test_shebang_ok(package, output, test): + test.check(package) + out = output.print_results(output.results) + assert 'W: symlink-to-binary-with-shebang /usr/bin/testlink' not in out diff --git a/test/test_i18n.py b/test/test_i18n.py new file mode 100644 index 000000000..016cf9faf --- /dev/null +++ b/test/test_i18n.py @@ -0,0 +1,49 @@ +import pytest +from rpmlint.checks.I18NCheck import I18NCheck +from rpmlint.filter import Filter + +from Testing import CONFIG, get_tested_mock_package + + +@pytest.fixture(scope='function', autouse=True) +def i18ncheck(): + CONFIG.info = True + output = Filter(CONFIG) + test = I18NCheck(CONFIG, output) + yield output, test + + +@pytest.fixture +def output(i18ncheck): + output, _test = i18ncheck + yield output + + +@pytest.fixture +def test(i18ncheck): + _output, test = i18ncheck + yield test + + +@pytest.mark.parametrize('package', [ + get_tested_mock_package(files=['/usr/share/locale/xx_ES/LC_MESSAGES/goodvibes.mo']), + get_tested_mock_package(files=['/usr/share/locale/es_XX/LC_MESSAGES/goodvibes.mo']), + get_tested_mock_package(files=['/usr/share/locale/xx/LC_MESSAGES/goodvibes.mo']), +]) +def test_i18n_invalid_lang(package, output, test): + test.check(package) + out = output.print_results(output.results) + assert 'E: invalid-lc-messages-dir' in out + + +@pytest.mark.parametrize('package', [ + get_tested_mock_package(files=['/usr/share/locale/zh/LC_MESSAGES/goodvibes.mo']), + get_tested_mock_package(files=['/usr/share/locale/zh_Hant/LC_MESSAGES/goodvibes.mo']), + get_tested_mock_package(files=['/usr/share/locale/es_ES/LC_MESSAGES/goodvibes.mo']), + get_tested_mock_package(files=['/usr/share/locale/zh_TW/LC_MESSAGES/goodvibes.mo']), + get_tested_mock_package(files=['/usr/share/locale/pt_BR/LC_MESSAGES/goodvibes.mo']), +]) +def test_i18n_valid_lang(package, output, test): + test.check(package) + out = output.print_results(output.results) + assert 'E: invalid-lc-messages-dir' not in out diff --git a/test/test_lint.py b/test/test_lint.py index 1fe5dc24d..391e81c33 100644 --- a/test/test_lint.py +++ b/test/test_lint.py @@ -132,6 +132,27 @@ def test_explain_known(capsys): assert not err +@pytest.mark.parametrize('configs', [ + # Message defined in configs/Fedora/warn-on-functions.toml + (Path('configs/Fedora/warn-on-functions.toml'), False), + (Path('configs/Fedora/scoring.toml'), True), +]) +def test_explain_known_warn_on_function(capsys, configs): + extraconfig, unknown = configs + message = ['crypto-policy-non-compliance-openssl'] + additional_options = { + 'explain': message, + 'config': [extraconfig], + } + options = {**options_preset, **additional_options} + linter = Lint(options) + linter.run() + out, err = capsys.readouterr() + + assert ('Unknown message' in out) == unknown + assert not err + + def test_explain_with_unknown(capsys): message = ['infopage-not-compressed', 'blablablabla'] additional_options = { diff --git a/test/test_speccheck.py b/test/test_speccheck.py index 9b708b112..ba9ef98da 100644 --- a/test/test_speccheck.py +++ b/test/test_speccheck.py @@ -40,6 +40,7 @@ def test_check_include(tmp_path, speccheck): 'spec/SpecCheck2', 'spec/SpecCheck3', 'spec/SpecCheckPatch', + 'spec/intltool', ]) def test_patch_not_applied(package, speccheck): output, test = speccheck diff --git a/tools/generate-isocodes.py b/tools/generate-isocodes.py index 4d84bd764..3ccc9aea3 100755 --- a/tools/generate-isocodes.py +++ b/tools/generate-isocodes.py @@ -14,6 +14,7 @@ iso_3166_1_url = os.environ.get('ISO_3166_1_URL', 'https://salsa.debian.org/iso-codes-team/iso-codes/raw/main/data/iso_3166-1.json') iso_639_3_url = os.environ.get('ISO_639_3_URL', 'https://salsa.debian.org/iso-codes-team/iso-codes/raw/main/data/iso_639-3.json') iso_639_2_url = os.environ.get('ISO_639_2_URL', 'https://salsa.debian.org/iso-codes-team/iso-codes/raw/main/data/iso_639-2.json') +iso_15924_url = os.environ.get('ISO_15924_URL', 'https://salsa.debian.org/iso-codes-team/iso-codes/raw/main/data/iso_15924.json') langs = set() countries = set() @@ -36,6 +37,11 @@ entry_code = entry.get('alpha_2') or entry['alpha_3'] if entry_code not in langs: langs.add(entry_code) +# ISO 15924, Codes for the representation of names of scripts +with urlopen(iso_15924_url) as f: + data = json.load(codecs.getreader('utf-8')(f)) + for entry in data['15924']: + countries.add(entry['alpha_4']) print(f'# Generated with {sys.argv[0]}') print('')