├── .dockerignore ├── .editorconfig ├── .github └── workflows │ ├── codeql.yml │ └── main.yml ├── .gitignore ├── .packit.yaml ├── .packit └── rpmlint.spec ├── .pre-commit-hooks.yaml ├── .vscode ├── launch.json └── settings.json ├── COPYING ├── MANIFEST.in ├── Makefile ├── README.md ├── configs ├── Fedora │ ├── fedora.toml │ ├── licenses.toml │ ├── scoring.toml │ ├── users-groups.toml │ └── warn-on-functions.toml └── openSUSE │ ├── dbus-services.toml │ ├── licenses.toml │ ├── opensuse.toml │ ├── pam-modules.toml │ ├── pie-executables.toml │ ├── scoring.toml │ └── users-groups.toml ├── diff.py ├── lint.py ├── pyproject.toml ├── pytest.ini ├── rpmlint.svg ├── rpmlint ├── __init__.py ├── __isocodes__.py ├── arparser.py ├── checks │ ├── AbstractCheck.py │ ├── AlternativesCheck.py │ ├── AppDataCheck.py │ ├── BashismsCheck.py │ ├── BinariesCheck.py │ ├── BuildRootAndDateCheck.py │ ├── ConfigFilesCheck.py │ ├── DBusPolicyCheck.py │ ├── DocCheck.py │ ├── DuplicatesCheck.py │ ├── ErlangCheck.py │ ├── FHSCheck.py │ ├── FilesCheck.py │ ├── I18NCheck.py │ ├── IconSizesCheck.py │ ├── InitScriptCheck.py │ ├── LSBCheck.py │ ├── LibraryDependencyCheck.py │ ├── LogrotateCheck.py │ ├── MenuCheck.py │ ├── MenuXDGCheck.py │ ├── MixedOwnershipCheck.py │ ├── PAMModulesCheck.py │ ├── PkgConfigCheck.py │ ├── PostCheck.py │ ├── PythonCheck.py │ ├── SharedLibraryPolicyCheck.py │ ├── SignatureCheck.py │ ├── SourceCheck.py │ ├── SpecCheck.py │ ├── SysVInitOnSystemdCheck.py │ ├── TagsCheck.py │ ├── TmpFilesCheck.py │ ├── XinetdDepCheck.py │ ├── ZipCheck.py │ └── ZyppSyntaxCheck.py ├── cli.py ├── color.py ├── config.py ├── configdefaults.toml ├── descriptions │ ├── AlternativesCheck.toml │ ├── AppDataCheck.toml │ ├── BashismsCheck.toml │ ├── BinariesCheck.toml │ ├── BuildDateCheck.toml │ ├── BuildRootCheck.toml │ ├── CheckForXinetd.toml │ ├── ConfigFilesCheck.toml │ ├── DBusPolicyCheck.toml │ ├── DocCheck.toml │ ├── DuplicatesCheck.toml │ ├── ErlangCheck.toml │ ├── FilesCheck.toml │ ├── I18NCheck.toml │ ├── IconSizesCheck.toml │ ├── InitScriptCheck.toml │ ├── LSBCheck.toml │ ├── LibraryDependencyCheck.toml │ ├── LogrotateCheck.toml │ ├── MenuCheck.toml │ ├── MenuXDGCheck.toml │ ├── MixedOwnershipCheck.toml │ ├── PAMModulesCheck.toml │ ├── PkgConfigCheck.toml │ ├── PythonCheck.toml │ ├── SharedLibraryPolicyCheck.toml │ ├── SignatureCheck.toml │ ├── SourceCheck.toml │ ├── SpecCheck.toml │ ├── SysVInitOnSystemdCheck.toml │ ├── TagsCheck.toml │ ├── TmpFilesCheck.toml │ ├── ZipCheck.toml │ └── ZyppSyntaxCheck.toml ├── filter.py ├── helpers.py ├── lddparser.py ├── lint.py ├── objdumpparser.py ├── pkg.py ├── pkgfile.py ├── readelfparser.py ├── rpmdiff.py ├── spellcheck.py ├── stringsparser.py └── version.py ├── setup.cfg ├── setup.py ├── test ├── README.md ├── Testing.py ├── binary │ ├── SpecCheck4-0.0.1-0.x86_64.rpm │ ├── alternatives-borked-1.0-0.x86_64.rpm │ ├── alternatives-ok-1.0-0.x86_64.rpm │ ├── asm-1.5.3-0.noarch.rpm │ ├── bad-crc-uncompressed-1.0-9.1.x86_64.rpm │ ├── bcc-lua-0.10.0-86.12.x86_64.rpm │ ├── binary-in-etc-1.0-0.x86_64.rpm │ ├── crypto-policy-1.0-0.x86_64.rpm │ ├── dev-dependency-0-3.1.x86_64.rpm │ ├── ghc-0-0.x86_64.rpm │ ├── glibc-0-0.x86_64.rpm │ ├── hello-2.0-1.x86_64-signed.rpm │ ├── invalid-dependency-0-0.x86_64.rpm │ ├── invalid-la-file-1.0-0.x86_64.rpm │ ├── invalid-license-0-1.1.x86_64.rpm │ ├── invalid-version-0pre-3.1.x86_64.rpm │ ├── libalternatives-borked-1.0-0.x86_64.rpm │ ├── libalternatives-ok-1.0-0.x86_64.rpm │ ├── libnoexec-0-0.x86_64.rpm │ ├── libtest-1.0-0.x86_64.rpm │ ├── libtest1-1.5-0.x86_64.rpm │ ├── libtest2-1.5-0.x86_64.rpm │ ├── libtest3-3.5-0.x86_64.rpm │ ├── libtest4-4.0-0.x86_64.rpm │ ├── libtool-wrapper-0-0.x86_64.rpm │ ├── lto-text-1.0-0.x86_64.rpm │ ├── mc-4.8.15-10.3.1.x86_64.rpm │ ├── mc-4.8.21-2.1.x86_64.rpm │ ├── misc-no-warnings-0-1.x86_64.rpm │ ├── misc-warnings-0pre-3.1.x86_64.rpm │ ├── multiple_errors-1.0-0.x86_64.rpm │ ├── ngircd-22-2.fc22.x86_64.rpm │ ├── no-binary-1.0-0.x86_64.rpm │ ├── no-signature-1.0-0.noarch.rpm │ ├── no-url-tag-0alpha-5.1.x86_64.rpm │ ├── noarch-noarch.rpm │ ├── non-fhs-0-0.x86_64.rpm │ ├── non-position-independent-exec-1.0-0.x86_64.rpm │ ├── non-standard-group-0-2.1.x86_64.rpm │ ├── not-standard-release-extension-0-1.1.x86_64.rpm │ ├── only-non-binary-in-usr-lib-1.0-0.x86_64.rpm │ ├── only-non-binary-in-usr-lib_exception-1.0-0.x86_64.rpm │ ├── python311-pytest-xprocess-0.23.0-2.4.noarch.rpm │ ├── python39-evtx-0.7.4-29.1.noarch.rpm │ ├── random-devel-0-2.1.x86_64.rpm │ ├── random-exp-0-0.x86_64.rpm │ ├── requires-on-release-0-1.1.x86_64.rpm │ ├── ruby2.5-rubygem-rubyzip-testsuite-1.2.1-0.x86_64.rpm │ ├── ruby2.6-rubygem-fast_gettext-2.0.1-1.1.x86_64.rpm │ ├── self-0-0.x86_64.rpm │ ├── spellingerrors-default-0-0.noarch.rpm │ ├── spellingerrors-lang-0-0.noarch.rpm │ ├── spellingerrors-lang2-0-0.noarch.rpm │ ├── spellingerrors-lang3-0-0.noarch.rpm │ ├── summary-on-multiple-lines-1.0-0.x86_64.rpm │ ├── summary-warning-0-1.1.x86_64.rpm │ ├── tempfiled-0-0.x86_64.rpm │ ├── texlive-codepage-doc-2018.151.svn21126-38.1.noarch.rpm │ ├── unexpanded-macro-exp-0-4.1.x86_64.rpm │ ├── unknown-key-1.0-0.noarch.rpm │ ├── xrootd-devel-5.5.4-1.fc37.x86_64.rpm │ └── xtables-addons-kmp-default-2.14_k4.12.14_lp151.16-lp151.3.10.x86_64.rpm ├── configs │ ├── broken.config │ ├── descriptions.config │ ├── test.config │ ├── test.override.config │ ├── test2.config │ ├── testfilters.config │ ├── testing-rpmlintrc │ ├── testing2-rpmlintrc │ ├── testing3-rpmlintrc │ ├── testlists1.config │ └── testlists2.config ├── dump_stats.py ├── files │ ├── README1.gz │ ├── README2.bz2 │ ├── README3.xz │ ├── aarch64.o │ ├── broken-xml.metainfo.xml │ ├── broken.appdata.xml │ ├── correct-fsf.txt │ ├── ebpf.o │ ├── incorrect-fsf.txt │ ├── ipython-requires.txt │ ├── logrotate │ │ ├── logrotate.conf │ │ └── logrotate2.conf │ ├── m-no-CInf.beam │ ├── m.beam │ ├── netmask │ │ ├── errors.c │ │ ├── errors.h │ │ ├── main.c │ │ ├── netmask.c │ │ └── netmask.h │ ├── python-flit-metadata.txt │ ├── python-jupyter-events-metadata.txt │ ├── python-jupyter_server_fileid-metadata.txt │ ├── python-scikit_build-metadata.txt │ ├── python3-power │ │ ├── __init__.cpython-33.pyc │ │ ├── __init__.cpython-33.pyo │ │ ├── __init__.py │ │ ├── common.cpython-33.pyc │ │ ├── common.cpython-33.pyo │ │ └── common.py │ ├── reiserfs │ │ ├── io.h │ │ ├── libreiserfscore.a │ │ ├── libreiserfscore.la │ │ ├── misc.h │ │ ├── reiserfs_err.h │ │ ├── reiserfs_fs.h │ │ ├── reiserfs_lib.h │ │ ├── reiserfscore.pc │ │ └── swab.h │ ├── rpmlint-test-good.desktop │ ├── rpmlint-test.desktop │ ├── shlib2 │ │ ├── libfoo-2.so │ │ ├── libfoo-2.so.foo │ │ ├── libfoo.so │ │ └── libfoo.so.1 │ ├── shlib_policy │ │ ├── libhello.so │ │ ├── libhello2.so │ │ └── libtest.so.1.5.0 │ ├── systemd │ │ ├── org.freedesktop.NetworkManager.conf │ │ └── org.freedesktop.NetworkManager2.conf │ ├── terminator.appdata.xml │ └── x86_64.o ├── ldd │ ├── appletviewer │ ├── libtirpc.so.3.0.0 │ ├── opt-dependency │ └── usr-dependency ├── mockdata │ ├── mock_FHS.py │ ├── mock_LSB.py │ ├── mock_appdata.py │ ├── mock_bashisms.py │ ├── mock_build_date.py │ ├── mock_build_root.py │ ├── mock_config_files.py │ ├── mock_dbus_policy.py │ ├── mock_doc.py │ ├── mock_duplicates.py │ ├── mock_erlang.py │ ├── mock_files.py │ ├── mock_i18n.py │ ├── mock_icon_sizes.py │ ├── mock_logrotate.py │ ├── mock_menuxdg.py │ ├── mock_mixed_ownership.py │ ├── mock_pam_modules.py │ ├── mock_pkgconfig.py │ ├── mock_python.py │ ├── mock_shlib_policy.py │ ├── mock_sysvinitonsystemd.py │ ├── mock_tags.py │ ├── mock_tmp_files.py │ ├── mock_xinetd.py │ └── mock_zypp_syntax.py ├── pyc │ ├── .gitignore │ ├── __future__.cpython-36.pyc │ └── __future__.cpython-37.pyc ├── readelf │ ├── archive-with-debuginfo.a │ ├── call-mktemp │ ├── call-setgroups │ ├── empty-archive.a │ ├── executable-stack │ ├── function-sections.a │ ├── hostname │ ├── invalid-soname.so │ ├── libbsd-ctor.a │ ├── libclang_rt.asan-preinit-x86_64.a │ ├── libgame.so │ ├── libkleeRuntimeFreeStanding.bca │ ├── libutil-2.29.so │ ├── lto-object.o │ ├── main.a │ ├── nested-function │ ├── no-soname.so │ ├── non-pic-shared-m32.so │ ├── only-data.a │ ├── rpath-lib.so │ ├── small_archive.a │ ├── stripped-archive.a │ └── stripped-lto.a ├── rpmlintrc │ ├── multiple │ │ ├── sample-rpmlintrc │ │ ├── sample.rpmlintrc │ │ └── sample.spec │ └── single │ │ ├── sample.rpmlintrc │ │ └── sample.spec ├── source │ ├── CheckInclude-1-1.src.rpm │ ├── invalid-spec-name-0-0.src.rpm │ ├── no-spec-file-0-0.src.rpm │ ├── non-utf8-1.0-1.el5.centos.src.rpm │ ├── not-compressed-multi-spec-1.0-0.src.rpm │ ├── valid-exception-begin-grouping-1.0-1.src.rpm │ ├── valid-exception-in-grouping-1.0-1.src.rpm │ └── wrongsrc-0-0.src.rpm ├── spec │ ├── %autopatch-not-in-prep.spec │ ├── %autosetup-not-in-prep.spec │ ├── %ifarch-applied-patch.spec │ ├── MacroInComment.spec │ ├── SpecCheck.spec │ ├── SpecCheck2.spec │ ├── SpecCheck3.spec │ ├── SpecCheck4.spec │ ├── SpecCheckPatch.spec │ ├── SpecCheckTemp.spec │ ├── bogus-date.spec │ ├── buildarch-instead-of-exclusivearch-tag.spec │ ├── buildprereq-use.spec │ ├── comparison-operator-in-deptoken.spec │ ├── configure-without-libdir-spec.spec │ ├── deprecated-grep.spec │ ├── depscript-without-disabling-depgen.spec │ ├── forbidden-controlchar-found.spec │ ├── ghc.spec │ ├── gimp.spec │ ├── hardcoded-library-path.spec │ ├── hardcoded-packager-tag.spec │ ├── hardcoded-path-in-buildroot-tag.spec │ ├── hardcoded-prefix-tag.spec │ ├── intltool.spec │ ├── lib-package-without-%mklibname.spec │ ├── libcanberra.spec │ ├── libdir-macro-in-noarch-package.spec │ ├── libspelling.spec │ ├── macro-in-changelog-autochangelog.spec │ ├── macro-in-changelog.spec │ ├── macro-in-comment.spec │ ├── make-check-outside-check-section.spec │ ├── mixed-use-of-spaces-and-tabs.spec │ ├── more-than-one-%changelog.spec │ ├── no-%%%s-section.spec │ ├── no-buildroot-tag.spec │ ├── non-break-space.spec │ ├── non-standard-group.spec │ ├── non-utf8-spec-file.spec │ ├── null-char-first.spec │ ├── null-char-last.spec │ ├── obsolete-tag.spec │ ├── patch-fuzz-is-changed.spec │ ├── patch-not-applied.spec │ ├── prereq_use.spec │ ├── python-module-def.spec │ ├── python-setup-install.spec │ ├── python-setup-python_install.spec │ ├── python-setup-test.spec │ ├── python-sitearch-glob.spec │ ├── python-sitelib-glob.spec │ ├── python-sitelib.spec │ ├── rpm-buildroot-usage-shell-var.spec │ ├── rpm-buildroot-usage.spec │ ├── setup-not-in-prep.spec │ ├── setup-not-quiet.spec │ ├── shared-bindir-glob-in-files.spec │ ├── shared-datadir-glob-in-files.spec │ ├── shared-docdir-glob-in-files.spec │ ├── shared-includedir-glob-in-files.spec │ ├── shared-mandir-glob-in-files.spec │ ├── unversioned-explicit-obsoletes.spec │ ├── unversioned-explicit-version.spec │ ├── use-of-RPM-SOURCE-DIR.spec │ └── yast2-installation.spec ├── test_FHS.py ├── test_LSB.py ├── test_alternatives.py ├── test_appdata.py ├── test_bashisms.py ├── test_binaries.py ├── test_build_date.py ├── test_build_root.py ├── test_cli.py ├── test_config.py ├── test_config_files.py ├── test_dbus_policy.py ├── test_diff.py ├── test_doc.py ├── test_duplicates.py ├── test_erlang.py ├── test_files.py ├── test_filter.py ├── test_helpers.py ├── test_i18n.py ├── test_icon_sizes.py ├── test_ldd_parser.py ├── test_lib_dependency.py ├── test_lint.py ├── test_logrotate.py ├── test_menuxdg.py ├── test_mixed_ownership.py ├── test_objdump_parser.py ├── test_pam_modules.py ├── test_pkg.py ├── test_pkgconfig.py ├── test_python.py ├── test_readelf_parser.py ├── test_shlib_policy.py ├── test_signature.py ├── test_sources.py ├── test_speccheck.py ├── test_spellchecking.py ├── test_sysvinitonsystemd.py ├── test_tags.py ├── test_tmp_files.py ├── test_xinetd.py ├── test_zip.py └── test_zypp_syntax.py └── tools ├── generate-fedora-users-groups.py ├── generate-isocodes.py └── generate-suse-licenses.py /.dockerignore: -------------------------------------------------------------------------------- 1 | **/__pycache__ 2 | **/*.pyo 3 | **/*.pyc 4 | !test/pyc/*.pyc 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | indent_style = space 3 | indent_size = 4 4 | tab_width = 8 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | max_line_length = 79 10 | 11 | [Makefile] 12 | indent_style = tab 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ "main", "opensuse" ] 6 | pull_request: 7 | branches: [ "main", "opensuse" ] 8 | 9 | jobs: 10 | analyze: 11 | name: Analyze 12 | runs-on: ubuntu-latest 13 | permissions: 14 | actions: read 15 | contents: read 16 | security-events: write 17 | 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | language: [ python ] 22 | 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v3 26 | 27 | - name: Initialize CodeQL 28 | uses: github/codeql-action/init@v2 29 | with: 30 | languages: ${{ matrix.language }} 31 | queries: +security-and-quality 32 | 33 | - name: Autobuild 34 | uses: github/codeql-action/autobuild@v2 35 | 36 | - name: Perform CodeQL Analysis 37 | uses: github/codeql-action/analyze@v2 38 | with: 39 | category: "/language:${{ matrix.language }}" 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Distribution / packaging 2 | .eggs 3 | *.egg-info 4 | build/ 5 | dist/ 6 | 7 | # Byte-compiled / optimized 8 | __pycache__/ 9 | *.py[cod] 10 | 11 | # Environments 12 | .env 13 | .venv 14 | env/ 15 | venv/ 16 | 17 | # Unit test / coverage reports 18 | .pytest_cache 19 | .tox/ 20 | .coverage 21 | .coverage.* 22 | .cache 23 | 24 | # IDEs 25 | .idea 26 | 27 | # Patches and files 28 | *.orig 29 | *.rej 30 | .*.swp 31 | 32 | # Others 33 | *.flog 34 | *.xz 35 | /__version__.py 36 | /.packit/*.tar.gz 37 | -------------------------------------------------------------------------------- /.packit.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # docs: https://packit.dev/docs/configuration/ 3 | upstream_package_name: rpmlint 4 | specfile_path: .packit/rpmlint.spec 5 | 6 | actions: 7 | get-current-version: "rpmspec -q --srpm --qf '%{VERSION}' .packit/rpmlint.spec" 8 | 9 | jobs: 10 | - job: copr_build 11 | metadata: 12 | targets: 13 | - fedora-rawhide-x86_64 14 | - fedora-rawhide-aarch64 15 | - mageia-cauldron-x86_64 16 | - mageia-cauldron-aarch64 17 | # opensuse images are failing because dnf-plugins-core package is not working 18 | #- opensuse-tumbleweed-x86_64 19 | #- opensuse-tumbleweed-aarch64 20 | trigger: pull_request 21 | - job: copr_build 22 | trigger: commit 23 | metadata: 24 | targets: 25 | - fedora-rawhide-x86_64 26 | - fedora-rawhide-aarch64 27 | - mageia-cauldron-x86_64 28 | - mageia-cauldron-aarch64 29 | # opensuse images are failing because dnf-plugins-core package is not working 30 | #- opensuse-tumbleweed-x86_64 31 | #- opensuse-tumbleweed-aarch64 32 | branch: main 33 | project: rpm-software-management-rpmlint-mainline 34 | list_on_homepage: True 35 | preserve_project: True 36 | - job: copr_build 37 | trigger: commit 38 | metadata: 39 | targets: 40 | # opensuse images are failing because dnf-plugins-core package is not working 41 | #- opensuse-tumbleweed-x86_64 42 | #- opensuse-tumbleweed-aarch64 43 | branch: opensuse 44 | project: rpm-software-management-rpmlint-opensuse 45 | list_on_homepage: True 46 | preserve_project: True 47 | -------------------------------------------------------------------------------- /.pre-commit-hooks.yaml: -------------------------------------------------------------------------------- 1 | - id: rpmlint 2 | name: Check RPM package errors 3 | description: rpmlint is a tool for checking common errors in RPM packages. 4 | entry: rpmlint 5 | language: python 6 | files: \.rpm 7 | types: [file] 8 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Debug", 6 | "type": "python", 7 | "request": "launch", 8 | "program": "lint.py", 9 | "console": "integratedTerminal", 10 | "args": ["./test/binary/*.rpm"] 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.testing.pytestArgs": [ 3 | "test" 4 | ], 5 | "python.testing.unittestEnabled": false, 6 | "python.testing.pytestEnabled": true, 7 | } 8 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include Makefile 2 | include COPYING 3 | include README.md 4 | include conftest.py 5 | recursive-include configs *.toml 6 | recursive-include rpmlint *.toml 7 | recursive-include test * 8 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: rpmlint/__isocodes__.py 2 | 3 | clean: 4 | rm -f rpmlint/__isocodes__.py 5 | 6 | rpmlint/__isocodes__.py: 7 | tools/generate-isocodes.py > $@ 8 | -------------------------------------------------------------------------------- /configs/Fedora/scoring.toml: -------------------------------------------------------------------------------- 1 | [Scoring] 2 | # This can set how bad each error is. 3 | # But we set BadnessThreshold to -1 so anything above 0 4 | # is actually fatal. 5 | # You can check configs/openSUSE/scoring.toml for more fine graded scoring. 6 | no-group-tag = 1 7 | -------------------------------------------------------------------------------- /configs/Fedora/warn-on-functions.toml: -------------------------------------------------------------------------------- 1 | # Additional warnings on specific function calls 2 | [WarnOnFunction] 3 | 4 | [WarnOnFunction.crypto-policy-non-compliance-openssl] 5 | f_name = "SSL_CTX_set_cipher_list" 6 | good_param = "PROFILE=SYSTEM" 7 | description = """This application package calls a function to explicitly set crypto ciphers 8 | for SSL/TLS. That may cause the application not to use the system-wide set 9 | cryptographic policy and should be modified in accordance to: 10 | https://fedoraproject.org/wiki/Packaging:CryptoPolicies""" 11 | 12 | [WarnOnFunction.crypto-policy-non-compliance-gnutls-1] 13 | f_name = "gnutls_priority_set_direct" 14 | description = """This application package calls a function to explicitly set crypto ciphers 15 | for SSL/TLS. That may cause the application not to use the system-wide set 16 | cryptographic policy and should be modified in accordance to: 17 | https://fedoraproject.org/wiki/Packaging:CryptoPolicies""" 18 | 19 | [WarnOnFunction.crypto-policy-non-compliance-gnutls-2] 20 | f_name = "gnutls_priority_init" 21 | good_param = "SYSTEM" 22 | description = """This application package calls a function to explicitly set crypto ciphers 23 | for SSL/TLS. That may cause the application not to use the system-wide set 24 | cryptographic policy and should be modified in accordance to: 25 | https://fedoraproject.org/wiki/Packaging:CryptoPolicies""" 26 | -------------------------------------------------------------------------------- /configs/openSUSE/scoring.toml: -------------------------------------------------------------------------------- 1 | [Scoring] 2 | arch-dependent-file-in-usr-share = 590 3 | arch-independent-package-contains-binary-or-object = 499 4 | binary-in-etc = 900 5 | devel-file-in-non-devel-package = 50 6 | dir-or-file-in-var-lock = 10000 7 | dir-or-file-in-var-run = 10000 8 | env-script-interpreter = 9 9 | executable-docs = 900 10 | file-contains-buildroot = 10000 11 | files-duplicated-waste = 100 12 | hardlink-across-config-files = 10000 13 | hardlink-across-partition = 10000 14 | info-dir-file = 10000 15 | invalid-license = 100000 16 | invalid-pkgconfig-file = 10000 17 | libtool-wrapper-in-package = 10000 18 | lto-bytecode = 10000 19 | lto-no-text-in-archive = 10000 20 | makefile-junk = 109 21 | no-pkg-config-provides = 300 22 | non-ghost-in-run = 10000 23 | non-position-independent-executable = 10000 24 | percent-in-conflicts = 10000 25 | percent-in-dependency = 10000 26 | percent-in-obsoletes = 10000 27 | percent-in-provides = 10000 28 | shlib-policy-name-error = 10000 29 | spurious-executable-perm = 50 30 | summary-ended-with-dot = 20 31 | summary-not-capitalized = 20 32 | summary-too-long = 200 33 | pam-unauthorized-module = 10000 34 | wrong-script-interpreter = 490 35 | obsolete-insserv-requirement = 10000 36 | deprecated-init-script = 10000 37 | deprecated-boot-script = 10000 38 | executable-stack = 10000 39 | binary-or-shlib-defines-rpath = 10000 40 | patchable-function-entry-in-archive = 10000 41 | patch-macro-old-format = 10000 42 | -------------------------------------------------------------------------------- /diff.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | from rpmlint.cli import diff 4 | 5 | diff() 6 | -------------------------------------------------------------------------------- /lint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | from rpmlint.cli import lint 4 | 5 | lint() 6 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = 3 | -vv 4 | --cov=rpmlint 5 | -n auto 6 | -p no:legacypath 7 | pythonpath= . 8 | testpaths= test 9 | -------------------------------------------------------------------------------- /rpmlint/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/rpmlint/__init__.py -------------------------------------------------------------------------------- /rpmlint/arparser.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | from rpmlint.helpers import ENGLISH_ENVIRONMENT 4 | 5 | 6 | class ArParser: 7 | """ 8 | Class contains all information obtained by ar command. 9 | """ 10 | 11 | def __init__(self, pkgfile_path): 12 | self.pkgfile_path = pkgfile_path 13 | self.objects = [] 14 | self.parsing_failed_reason = None 15 | self.parse() 16 | 17 | def parse(self): 18 | r = subprocess.run(['ar', 't', self.pkgfile_path], encoding='utf8', 19 | capture_output=True, env=ENGLISH_ENVIRONMENT) 20 | if r.returncode != 0: 21 | self.parsing_failed_reason = r.stderr 22 | return 23 | 24 | self.objects = r.stdout.splitlines() 25 | -------------------------------------------------------------------------------- /rpmlint/checks/AppDataCheck.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | from xml.etree import ElementTree 3 | 4 | from rpmlint.checks.AbstractCheck import AbstractFilesCheck 5 | from rpmlint.helpers import ENGLISH_ENVIRONMENT 6 | 7 | 8 | class AppDataCheck(AbstractFilesCheck): 9 | """ 10 | check appdata files for format violations 11 | https://www.freedesktop.org/software/appstream/docs/ 12 | """ 13 | # default command, split here so we can mock it later 14 | cmd = 'appstream-util validate-relax --nonet ' 15 | 16 | def __init__(self, config, output): 17 | super().__init__(config, output, r'/usr/share/appdata/.*\.(appdata|metainfo).xml$') 18 | 19 | def check_file(self, pkg, filename): 20 | root = pkg.dir_name() 21 | f = root + filename 22 | cmd = self.cmd + f 23 | 24 | validation_failed = False 25 | try: 26 | r = subprocess.run(cmd.split(), env=ENGLISH_ENVIRONMENT, 27 | stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 28 | if r.returncode != 0: 29 | validation_failed = True 30 | except FileNotFoundError: 31 | # appstream-util is not installed 32 | # validate the xml format only 33 | try: 34 | ElementTree.parse(f) 35 | except ElementTree.ParseError: 36 | validation_failed = True 37 | if validation_failed: 38 | self.output.add_info('E', pkg, 'invalid-appdata-file', filename) 39 | -------------------------------------------------------------------------------- /rpmlint/checks/BuildRootAndDateCheck.py: -------------------------------------------------------------------------------- 1 | import re 2 | import stat 3 | import time 4 | 5 | import rpm 6 | from rpmlint.checks.AbstractCheck import AbstractFilesCheck 7 | 8 | 9 | class BuildRootAndDateCheck(AbstractFilesCheck): 10 | """ 11 | Check that the file doesn't contain the current date or time. 12 | And check the file does not contain build root reference. 13 | 14 | If so, it causes the package to rebuild when it's not needed. 15 | """ 16 | def __init__(self, config, output): 17 | super().__init__(config, output, r'.*') 18 | self.looksliketime = re.compile('(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])') 19 | self.istoday = re.compile(time.strftime('%b %e %Y')) 20 | self.prepare_regex(rpm.expandMacro('%{?buildroot}') or '/.{1,40}/BUILDROOT/') 21 | 22 | def prepare_regex(self, buildroot): 23 | for m in ('name', 'version', 'release', 'NAME', 'VERSION', 'RELEASE'): 24 | buildroot = buildroot.replace('%%{%s}' % (m), r'[\w\!-\.]{1,20}') 25 | self.lookslikebuildroot = re.compile(buildroot) 26 | 27 | def check_file(self, pkg, filename): 28 | if filename.startswith('/usr/lib/debug') or pkg.is_source or \ 29 | not stat.S_ISREG(pkg.files[filename].mode): 30 | return 31 | 32 | data = pkg.read_with_mmap(filename) 33 | if self.istoday.search(data): 34 | if self.looksliketime.search(data): 35 | self.output.add_info('E', pkg, 'file-contains-date-and-time', filename) 36 | else: 37 | self.output.add_info('E', pkg, 'file-contains-current-date', filename) 38 | if self.lookslikebuildroot.search(data): 39 | self.output.add_info('E', pkg, 'file-contains-buildroot', filename) 40 | -------------------------------------------------------------------------------- /rpmlint/checks/ConfigFilesCheck.py: -------------------------------------------------------------------------------- 1 | from rpmlint.checks.AbstractCheck import AbstractCheck 2 | 3 | 4 | class ConfigFilesCheck(AbstractCheck): 5 | """ 6 | Check that configuration files are in a proper location and marked as 7 | 'noreplace'. 8 | """ 9 | def check_binary(self, pkg): 10 | for filename in pkg.config_files: 11 | self._check_non_confdir_files(pkg, filename) 12 | self._check_noreplace_files(pkg, filename) 13 | 14 | def _check_non_confdir_files(self, pkg, fn): 15 | """ 16 | Check if the configuration file is in /etc or /var directory. 17 | 18 | Print a warning if it's not. 19 | """ 20 | if not fn.startswith('/etc/') and not fn.startswith('/var/'): 21 | self.output.add_info('W', pkg, 22 | 'non-etc-or-var-file-marked-as-conffile', fn) 23 | 24 | def _check_noreplace_files(self, pkg, fn): 25 | """ 26 | Check if the configuration file has 'noreplace' flag. 27 | 28 | Print a warning if there is no 'noreplace' tag. 29 | """ 30 | if fn not in pkg.noreplace_files: 31 | self.output.add_info('W', pkg, 32 | 'conffile-without-noreplace-flag', fn) 33 | -------------------------------------------------------------------------------- /rpmlint/checks/ErlangCheck.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from pybeam import BeamFile 4 | from rpm import expandMacro 5 | from rpmlint.checks.AbstractCheck import AbstractFilesCheck 6 | from rpmlint.helpers import byte_to_string 7 | 8 | 9 | class ErlangCheck(AbstractFilesCheck): 10 | def __init__(self, config, output): 11 | super().__init__(config, output, r'.*?\.beam$') 12 | build_dir = expandMacro('%_builddir') 13 | self.source_re = re.compile(build_dir) 14 | 15 | def check_file(self, pkg, filename): 16 | try: 17 | beam = BeamFile(pkg.files[filename].path) 18 | 19 | if beam.compileinfo is None: 20 | self.output.add_info('W', pkg, 'beam-compile-info-missed', filename) 21 | return 22 | 23 | compile_state = byte_to_string(beam.compileinfo['source']) 24 | if 'debug_info' not in beam.compileinfo['options']: 25 | self.output.add_info('E', pkg, 'beam-compiled-without-debuginfo', filename) 26 | 27 | # This can't be an error as builddir can be user specific and vary between users 28 | # it could be error in OBS where all the builds are done by user abuild, not in 29 | # general. 30 | if not self.source_re.match(compile_state): 31 | self.output.add_info('W', pkg, 'beam-was-not-recompiled', filename, compile_state) 32 | except Exception: 33 | self.output.add_info('E', pkg, 'pybeam-failed', filename) 34 | -------------------------------------------------------------------------------- /rpmlint/checks/IconSizesCheck.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from rpmlint.checks.AbstractCheck import AbstractCheck 4 | 5 | 6 | class IconSizesCheck(AbstractCheck): 7 | file_size_regex = re.compile(r'/icons/[^/]+/(?P\d+)x(?P\d+)/') 8 | info_size_regex = re.compile(r'(?P\d+) x (?P\d+)') 9 | 10 | def check(self, pkg): 11 | if pkg.is_source: 12 | return 13 | 14 | for fname, pkgfile in pkg.files.items(): 15 | if '/animations/' in fname: 16 | continue 17 | 18 | res = self.file_size_regex.search(fname) 19 | res2 = self.info_size_regex.search(pkgfile.magic) 20 | if res and res2: 21 | sizes = (res.group('x'), res.group('y')) 22 | actualsizes = (res2.group('x'), res2.group('y')) 23 | if abs(int(sizes[0]) - int(actualsizes[0])) > 2 or \ 24 | abs(int(sizes[1]) - int(actualsizes[1])) > 2: 25 | self.output.add_info('E', pkg, 'wrong-icon-size', fname, 26 | 'expected:', 'x'.join(sizes), 'actual:', 'x'.join(actualsizes)) 27 | -------------------------------------------------------------------------------- /rpmlint/checks/LSBCheck.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | import rpm 4 | from rpmlint.checks.AbstractCheck import AbstractCheck 5 | 6 | 7 | class LSBCheck(AbstractCheck): 8 | """ 9 | Validate that package name, version and release number are LSB compliant. 10 | 11 | The rules are the intersection of compatible NVRs between RPM v3 and DPKG 12 | for supporting portability across RPM and Debian systems through tools 13 | like alien. 14 | 15 | Note: It uses values gained from rpm (RPMTAGs) not parsed from .rpm 16 | filename. 17 | """ 18 | name_regex = re.compile('^[a-z0-9.+-]+$') 19 | version_regex = re.compile('^[a-zA-Z0-9.+]+$') 20 | 21 | def check(self, pkg): 22 | self._check_lsb_name(pkg) 23 | self._check_lsb_version(pkg) 24 | self._check_lsb_release(pkg) 25 | 26 | def _check_lsb_name(self, pkg): 27 | """ 28 | Check if the package name is LSB compliant (only lowercase 29 | letters, numbers, '.', '+' or '-' characters). 30 | """ 31 | name = pkg.name 32 | if name and not self.name_regex.search(name): 33 | self.output.add_info('E', pkg, 'non-lsb-compliant-package-name', pkg.name) 34 | 35 | def _check_lsb_version(self, pkg): 36 | """ 37 | Check if the package version number is LSB compliant (only alphanumeric 38 | symbols, '.' or '+' characters). 39 | """ 40 | version = pkg[rpm.RPMTAG_VERSION] 41 | if version and not self.version_regex.search(version): 42 | self.output.add_info('E', pkg, 'non-lsb-compliant-version', pkg[rpm.RPMTAG_VERSION]) 43 | 44 | def _check_lsb_release(self, pkg): 45 | """ 46 | Check if the package release number is LSB compliant (only alphanumeric 47 | symbols, '.' or '+' characters). 48 | """ 49 | release = pkg[rpm.RPMTAG_RELEASE] 50 | if release and not self.version_regex.search(release): 51 | self.output.add_info('E', pkg, 'non-lsb-compliant-release', pkg[rpm.RPMTAG_RELEASE]) 52 | -------------------------------------------------------------------------------- /rpmlint/checks/MixedOwnershipCheck.py: -------------------------------------------------------------------------------- 1 | from rpmlint.checks.AbstractCheck import AbstractCheck 2 | 3 | 4 | class MixedOwnershipCheck(AbstractCheck): 5 | def check(self, pkg): 6 | """ 7 | Check for mixed permissions in the directory path. 8 | 9 | If folder is owned by i.e. nobody then the files there shouldn't 10 | be owned by other user either, as then nobody could replace the files 11 | and inject anything. 12 | """ 13 | if pkg.is_source: 14 | return 15 | 16 | for path, info in pkg.files.items(): 17 | parent = path.rpartition('/')[0] 18 | 19 | # In case parent folder is not part of this RPM we can't verify it 20 | if parent not in pkg.files: 21 | continue 22 | parent_owner = pkg.files[parent].user 23 | # root user is trusted 24 | if parent_owner in ('root', '0'): 25 | continue 26 | if info.user != parent_owner: 27 | message = f'Path "{path}" owned by "{info.user}" is stored in directory owned by "{parent_owner}"' 28 | self.output.add_info('E', pkg, 'file-parent-ownership-mismatch', message) 29 | -------------------------------------------------------------------------------- /rpmlint/checks/PAMModulesCheck.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from rpmlint.checks.AbstractCheck import AbstractCheck 4 | 5 | 6 | class PAMModulesCheck(AbstractCheck): 7 | pam_module_re = re.compile(r'^(?:/usr)?/lib(?:64)?/security/([^/]+\.so)$') 8 | 9 | def __init__(self, config, output): 10 | super().__init__(config, output) 11 | self.pam_authorized_modules = config.configuration['PAMAuthorizedModules'] 12 | 13 | def check(self, pkg): 14 | if pkg.is_source: 15 | return 16 | 17 | for f in pkg.files: 18 | if f in pkg.ghost_files: 19 | continue 20 | 21 | m = self.pam_module_re.match(f) 22 | if m: 23 | bn = m.groups()[0] 24 | if bn not in self.pam_authorized_modules: 25 | self.output.add_info('E', pkg, 'pam-unauthorized-module', bn) 26 | -------------------------------------------------------------------------------- /rpmlint/checks/XinetdDepCheck.py: -------------------------------------------------------------------------------- 1 | from rpmlint.checks.AbstractCheck import AbstractCheck 2 | 3 | 4 | class XinetdDepCheck(AbstractCheck): 5 | def check(self, pkg): 6 | if pkg.is_source: 7 | return 8 | 9 | for req in pkg.requires + pkg.prereq: 10 | if req[0] == 'xinetd': 11 | self.output.add_info('E', pkg, 'obsolete-xinetd-requirement') 12 | -------------------------------------------------------------------------------- /rpmlint/checks/ZyppSyntaxCheck.py: -------------------------------------------------------------------------------- 1 | from rpmlint.checks.AbstractCheck import AbstractCheck 2 | 3 | 4 | class ZyppSyntaxCheck(AbstractCheck): 5 | def check(self, pkg): 6 | # We care only about the names, versions are pointless here 7 | pkg_supplements = [x.name for x in pkg.supplements] 8 | pkg_enhances = [x.name for x in pkg.enhances] 9 | pkg_recommends = [x.name for x in pkg.recommends] 10 | pkg_suggests = [x.name for x in pkg.suggests] 11 | pkg_requires = [x.name for x in pkg.requires] 12 | pkg_conflicts = [x.name for x in pkg.conflicts] 13 | keywords = pkg_supplements + pkg_enhances + pkg_recommends + pkg_suggests + pkg_requires + pkg_conflicts 14 | for keyword in keywords: 15 | if keyword.startswith('packageand('): 16 | self.output.add_info('E', pkg, 'suse-zypp-packageand', keyword) 17 | if keyword.startswith('otherproviders('): 18 | self.output.add_info('E', pkg, 'suse-zypp-otherproviders', keyword) 19 | -------------------------------------------------------------------------------- /rpmlint/color.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | if hasattr(sys.stdout, 'isatty') and sys.stdout.isatty(): 4 | class Color: 5 | """ 6 | Colors used when doing printouts with rpmlint 7 | """ 8 | Bold = '\x1b[1m' 9 | Red = '\x1b[31m' 10 | Yellow = '\x1b[33m' 11 | Reset = '\x1b[0m' 12 | else: 13 | class Color: 14 | """ 15 | Colors used when doing printouts with rpmlint 16 | """ 17 | Bold = '' 18 | Red = '' 19 | Yellow = '' 20 | Reset = '' 21 | -------------------------------------------------------------------------------- /rpmlint/descriptions/AppDataCheck.toml: -------------------------------------------------------------------------------- 1 | invalid-appdata-file = """ 2 | Appdata file is not valid. Check the validity with appstream-util. 3 | """ 4 | -------------------------------------------------------------------------------- /rpmlint/descriptions/BashismsCheck.toml: -------------------------------------------------------------------------------- 1 | bin-sh-syntax-error=""" 2 | A /bin/sh shell script contains a POSIX shell syntax error. 3 | This might indicate a potential bash-specific feature being used, 4 | try dash -n for more detailed error message.""" 5 | potential-bashisms=""" 6 | checkbashisms reported potential bashisms in a /bin/sh shell 7 | script, you might want to manually check this script for bashisms.""" 8 | -------------------------------------------------------------------------------- /rpmlint/descriptions/BuildDateCheck.toml: -------------------------------------------------------------------------------- 1 | file-contains-current-date=""" 2 | Your file contains the current date, this may cause the package 3 | to rebuild in excess. 4 | """ 5 | file-contains-date-and-time=""" 6 | Your file uses __DATE__ and __TIME__ which causes the package to 7 | rebuild when not needed. 8 | """ 9 | -------------------------------------------------------------------------------- /rpmlint/descriptions/BuildRootCheck.toml: -------------------------------------------------------------------------------- 1 | file-contains-buildroot=""" 2 | Your file contains traces of %{buildroot}.""" 3 | -------------------------------------------------------------------------------- /rpmlint/descriptions/CheckForXinetd.toml: -------------------------------------------------------------------------------- 1 | obsolete-xinetd-requirement=""" 2 | Xinetd is obsolete by systemd socket activated services. 3 | Please stop using xinetd and switch to socket activation 4 | from systemd. 5 | """ 6 | -------------------------------------------------------------------------------- /rpmlint/descriptions/ConfigFilesCheck.toml: -------------------------------------------------------------------------------- 1 | non-etc-or-var-file-marked-as-conffile=""" 2 | A file not in /etc or /var is marked as being a configuration file (%config). 3 | Please put your configuration files in /etc or /var. 4 | """ 5 | conffile-without-noreplace-flag=""" 6 | A configuration file is stored in your package without the noreplace flag. 7 | This flag tells RPM not to overwrite or replace a configuration file to protect 8 | local modifications. 9 | A way to resolve this is to put the following in your SPEC file: 10 | %config(noreplace) /etc/your_config_file_here 11 | """ 12 | -------------------------------------------------------------------------------- /rpmlint/descriptions/DBusPolicyCheck.toml: -------------------------------------------------------------------------------- 1 | dbus-policy-allow-without-destination=""" 2 | 'allow' directives must always specify a 'send_destination'.""" 3 | dbus-policy-allow-receive=""" 4 | allow receive_* is normally not needed as that is the default.""" 5 | dbus-policy-deny-without-destination=""" 6 | 'deny' directives must always specify a 'send_destination' 7 | otherwise messages to other services could be blocked.""" 8 | dbus-policy-missing-allow=""" 9 | Every dbus config normally needs a line of the form 10 | 11 | or similar. If that is missing the service 12 | will not work with a dbus that uses deny as default policy""" 13 | dbus-parsing-exception=""" 14 | A python exception was raised which prevents further analysis 15 | of the DBus rule file.""" 16 | -------------------------------------------------------------------------------- /rpmlint/descriptions/DocCheck.toml: -------------------------------------------------------------------------------- 1 | executable-docs=""" 2 | Documentation should not be executable. 3 | """ 4 | doc-file-dependency=""" 5 | A file marked as %doc creates a possible additional dependency in the package. 6 | This is not wanted and may be caused by example scripts with executable bits 7 | set included in the package's documentation. 8 | """ 9 | install-file-in-docs=""" 10 | A file whose name suggests that it contains installation instructions is 11 | included in the package. Such instructions are often not relevant for already 12 | installed packages. 13 | """ 14 | package-with-huge-docs=""" 15 | More than half the size of your package is documentation. 16 | Consider splitting it into a -doc subpackage. 17 | """ 18 | -------------------------------------------------------------------------------- /rpmlint/descriptions/DuplicatesCheck.toml: -------------------------------------------------------------------------------- 1 | files-duplicate=""" 2 | Your package contains duplicated files that are not hard- or symlinks. 3 | You should use the %fdupes macro to link the files to one. 4 | """ 5 | files-duplicated-waste=""" 6 | Your package contains duplicated files that are not hard- or symlinks. 7 | You should use the %fdupes macro to link the files to one. 8 | """ 9 | hardlink-across-partition=""" 10 | Your package contains two files that are apparently hardlinked and 11 | that are likely on different partitions. Installation of such an RPM will fail 12 | due to RPM being unable to unpack the hardlink. Do not hardlink across 13 | the first two levels of a path, e.g. between /var/ftp and /var/www or 14 | /etc and /usr. 15 | """ 16 | hardlink-across-config-files=""" 17 | Your package contains two config files that are apparently hardlinked. 18 | Hardlinking a config file is probably not what you want. Please double 19 | check and report false positives. 20 | """ 21 | -------------------------------------------------------------------------------- /rpmlint/descriptions/ErlangCheck.toml: -------------------------------------------------------------------------------- 1 | beam-compile-info-missed=""" 2 | Your beam file has missed compile info chunk. 3 | """ 4 | beam-compiled-without-debuginfo=""" 5 | Your beam file indicates that it doesn't contain debug_info. 6 | Please, make sure that you compile with +debug_info. 7 | """ 8 | beam-was-not-recompiled=""" 9 | It seems that your beam file was not compiled by you, but was 10 | just copied in binary form to destination. Please, make sure 11 | that you really compile it from the sources. 12 | """ 13 | pybeam-failed=""" 14 | Invocation of the Python pybeam library failed. 15 | """ 16 | -------------------------------------------------------------------------------- /rpmlint/descriptions/I18NCheck.toml: -------------------------------------------------------------------------------- 1 | "subfile-not-in-%lang"=""" 2 | If /foo/bar is not tagged %lang(XX) whereas /foo is, the package won't be 3 | installable if XX is not in %_install_langs. 4 | """ 5 | 6 | "invalid-lc-messages-dir"=""" 7 | The package contains a languages file for a language code that's not recognized 8 | by rpmlint, in a path like /usr/share/locale/LANGCODE/LC_MESSAGES/FILE.mo. 9 | please report a bug if the LANGCODE is correct. 10 | """ 11 | 12 | "invalid-locale-man-dir"=""" 13 | The package contains a man page file for a language code that's not recognized 14 | by rpmlint, in a path like /usr/share/man/LANGCODE/man1/FILE.1.gz. 15 | please report a bug if the LANGCODE is correct. 16 | """ 17 | -------------------------------------------------------------------------------- /rpmlint/descriptions/IconSizesCheck.toml: -------------------------------------------------------------------------------- 1 | wrong-icon-size=""" 2 | Your icon file is installed in a fixed-size directory, but has a 3 | largely incorrect size. Some desktop environments (e.g. GNOME) 4 | display them incorrectly.""" 5 | -------------------------------------------------------------------------------- /rpmlint/descriptions/LSBCheck.toml: -------------------------------------------------------------------------------- 1 | non-lsb-compliant-package-name=""" 2 | Your package name contains an illegal character that is not 3 | LSB-compliant. Use only lowercase letters, numbers, '.', '+' 4 | or '-' characters. 5 | """ 6 | non-lsb-compliant-version=""" 7 | Your version number contains an illegal character that is not 8 | LSB-compliant. Use only alphanumeric symbols, '.' or '+' 9 | characters. 10 | """ 11 | non-lsb-compliant-release=""" 12 | Your release number contains an illegal character that is not 13 | LSB-compliant. Use only alphanumeric symbols, '.' or '+' 14 | characters. 15 | """ 16 | -------------------------------------------------------------------------------- /rpmlint/descriptions/LibraryDependencyCheck.toml: -------------------------------------------------------------------------------- 1 | no-library-dependency-for=""" 2 | The package misses dependency on a library package that provides the shared library. 3 | """ 4 | 5 | no-library-dependency-on=""" 6 | The package misses dependency on a package which file it links to. 7 | """ 8 | -------------------------------------------------------------------------------- /rpmlint/descriptions/LogrotateCheck.toml: -------------------------------------------------------------------------------- 1 | logrotate-duplicate=""" 2 | There are dupliated logrotate entries with different settings for 3 | the specified file.""" 4 | logrotate-user-writable-log-dir=""" 5 | The log directory is writable by unprivileged users. Please fix 6 | the permissions so only root can write there or add the 'su' option 7 | to your logrotate config.""" 8 | logrotate-log-dir-not-packaged=""" 9 | Please add the specified directory to the file list to be able to 10 | check permissions.""" 11 | -------------------------------------------------------------------------------- /rpmlint/descriptions/MenuXDGCheck.toml: -------------------------------------------------------------------------------- 1 | invalid-desktopfile=""" 2 | The .desktop file is not valid, check with desktop-file-validate 3 | """ 4 | non-utf8-desktopfile=""" 5 | The .desktop file is not encoded in UTF-8. 6 | """ 7 | desktopfile-without-binary=""" 8 | The .desktop file is for a file not present in the package. You 9 | should check the requires or see if this is not a error. 10 | """ 11 | desktopfile-duplicate-section=""" 12 | The .desktop file contains the mentioned section name twice, which 13 | can trigger parsing ambiguities. Remove the duplicate. 14 | """ 15 | desktopfile-duplicate-option=""" 16 | The .desktop file contains the mentioned option key twice, 17 | which can trigger parsing ambiguities. Remove the duplicate. 18 | """ 19 | desktopfile-missing-header=""" 20 | The .desktop file should start with a section header. 21 | """ 22 | -------------------------------------------------------------------------------- /rpmlint/descriptions/MixedOwnershipCheck.toml: -------------------------------------------------------------------------------- 1 | file-parent-ownership-mismatch=""" 2 | A file or directory is stored in a directory owned by another unprivileged user. 3 | This is a security issue since the owner of the parent directory can replace this 4 | file/directory with a different one. 5 | """ 6 | -------------------------------------------------------------------------------- /rpmlint/descriptions/PAMModulesCheck.toml: -------------------------------------------------------------------------------- 1 | pam-unauthorized-module=""" 2 | The package installs a PAM module. If the package 3 | is intended for inclusion the PAM module name must 4 | be included in the white list. 5 | """ 6 | -------------------------------------------------------------------------------- /rpmlint/descriptions/PkgConfigCheck.toml: -------------------------------------------------------------------------------- 1 | invalid-pkgconfig-file=""" 2 | Your .pc file appears to be invalid. Possible causes are: 3 | - it contains traces of $RPM_BUILD_ROOT or $RPM_BUILD_DIR. 4 | - it contains unreplaced macros (@have_foo@) 5 | - it references invalid paths (e.g. /home or /tmp) 6 | """ 7 | pkgconfig-invalid-libs-dir=""" 8 | Your .pc file contains -L/usr/lib or -L/lib and is 9 | built on a lib64 target, or contains references to -L/usr/lib64 or 10 | -L/lib64 and is built for a lib target. 11 | """ 12 | double-slash-in-pkgconfig-path=""" 13 | This pkg-config file contains a path with a double slash ('//') in it. This 14 | will break debugedit when stripping debug symbols during package building if 15 | these paths have been passed to gcc, and fail with the following error: 16 | canonicalization unexpectedly shrank by one character. 17 | """ 18 | pkgconfig-exception=""" 19 | An exception during parsing of .pc file has occurred. 20 | """ 21 | -------------------------------------------------------------------------------- /rpmlint/descriptions/PythonCheck.toml: -------------------------------------------------------------------------------- 1 | python-doc-in-package=""" 2 | doc/ or docs/ directory in Python package directory. Documentation should go into %{docdir}, not %{python_sitelib}/""" 3 | python-egg-info-distutils-style=""" 4 | The Python package's egg-info is a distutils style file. 5 | Please update to dist-info standardized core metadata. 6 | """ 7 | python-tests-in-site-packages=""" 8 | test/ or tests/ directory in %{python_sitelib}. This should never happen since 9 | this is a global name space not owned by any particular package. 10 | """ 11 | python-doc-in-site-packages=""" 12 | doc/ or docs directory installed to %{python_sitelib}. This should never happen 13 | since this is a global name space not owned by any particular package. 14 | """ 15 | python-src-in-site-packages=""" 16 | src/ directory installed to %{python_sitelib}. This should never happen 17 | since this is a global name space not owned by any particular package. 18 | """ 19 | 20 | python-missing-require=""" 21 | The python package declare some requirement that's not detected in the 22 | rpm package. Please, verify that all dependencies are added as 23 | Requires. 24 | """ 25 | 26 | python-leftover-require=""" 27 | Some python module Requires can't be found in the python package 28 | requirements declaration. Please verify that all dependencies are 29 | really needed. 30 | """ 31 | 32 | python-pyc-multiple-versions=""" 33 | There are .pyc files in the rpm that are from the different Python 34 | interperters. Please, verify that all files are needed for this package. 35 | """ 36 | 37 | python-sphinx-doctrees-leftover=""" 38 | Cache Sphinx build folder found in the package ".doctrees". Please, make sure 39 | to do not include any build files in the final package. 40 | """ 41 | -------------------------------------------------------------------------------- /rpmlint/descriptions/SharedLibraryPolicyCheck.toml: -------------------------------------------------------------------------------- 1 | shlib-policy-excessive-dependency=""" 2 | Your package starts with 'lib' as part of its name, but also contains binaries 3 | that have more dependencies than those that already required by the libraries. 4 | Those binaries should probably not be part of the library package, but split into 5 | a seperate one to reduce the additional dependencies for other users of this library. 6 | """ 7 | shlib-policy-missing-lib=""" 8 | Your package name looks its based on soname, but does not provide any libraries. 9 | """ 10 | shlib-fixed-dependency=""" 11 | Your shared library package requires a fixed version of another package. The 12 | intention of the Shared Library Policy is to allow parallel installation of 13 | multiple versions of the same shared library, hard dependencies likely make that 14 | impossible. Please remove this dependency and instead move it to the runtime uses 15 | of your library. 16 | """ 17 | shlib-unversioned-lib=""" 18 | Your package matches the Shared Library Policy Naming Scheme but contains an 19 | unversioned library. Therefore it is very unlikely that your package can be installed 20 | in parallel to another version of this library package. Consider moving unversioned 21 | parts into another package. 22 | """ 23 | -------------------------------------------------------------------------------- /rpmlint/descriptions/SignatureCheck.toml: -------------------------------------------------------------------------------- 1 | no-signature=""" 2 | You have to include your pgp or gpg signature in your package. 3 | """ 4 | unknown-key=""" 5 | The package was signed, but with an unknown key. See the rpm --import option 6 | for more information. 7 | """ 8 | invalid-signature=""" 9 | The package was signed, but the signature is corrupted. 10 | """ 11 | -------------------------------------------------------------------------------- /rpmlint/descriptions/SourceCheck.toml: -------------------------------------------------------------------------------- 1 | multiple-specfiles=""" 2 | Your package contains multiple spec files. To build a correct package, you need 3 | to have only one spec file containing all your RPM information. 4 | """ 5 | strange-permission=""" 6 | A file that you listed to include in your package has strange 7 | permissions. Usually, a file should have 0644 permissions. 8 | """ 9 | inconsistent-file-extension=""" 10 | The file name extension indicates a different compression format than 11 | what is actually used (as checked by file(1)). 12 | """ 13 | -------------------------------------------------------------------------------- /rpmlint/descriptions/SysVInitOnSystemdCheck.toml: -------------------------------------------------------------------------------- 1 | obsolete-insserv-requirement=""" 2 | In systemd based distributions insserv is obsolete. 3 | Please remove dependencies on insserv.""" 4 | deprecated-init-script=""" 5 | SysV init scripts are deprecated. Please migrate to 6 | systemd service files.""" 7 | deprecated-boot-script=""" 8 | SysV boot scripts are deprecated. Please migrate to 9 | systemd service files.""" 10 | systemd-shadowed-initscript=""" 11 | The package contains both an init script and a systemd service 12 | file for the same activity.""" 13 | -------------------------------------------------------------------------------- /rpmlint/descriptions/TmpFilesCheck.toml: -------------------------------------------------------------------------------- 1 | pre-with-tmpfile-creation=""" 2 | %pre section contains %tmpfiles_create macro that should be in the 3 | %post section instead. 4 | """ 5 | post-without-tmpfile-creation=""" 6 | Please use the %tmpfiles_create macro in %post for each of your 7 | tmpfiles.d files if you expect this file or directory to be 8 | available after package installation (and before reboot). 9 | """ 10 | tmpfile-not-regular-file=""" 11 | Files in tmpfiles.d need to be regular files. 12 | """ 13 | tmpfile-not-in-filelist=""" 14 | Please add the specified file to your %files section as %ghost so 15 | users can easily query who created the file, it gets uninstalled on 16 | package removal and finally other rpmlint checks see it. 17 | """ 18 | -------------------------------------------------------------------------------- /rpmlint/descriptions/ZipCheck.toml: -------------------------------------------------------------------------------- 1 | bad-crc-in-zip = """ 2 | The reported file in the zip fails the CRC check. 3 | Usually this is a sign of a corrupt zip file. 4 | """ 5 | uncompressed-zip = """ 6 | The zip file is not compressed. 7 | """ 8 | class-path-in-manifest = """ 9 | The META-INF/MANIFEST.MF file in the jar contains a hardcoded Class-Path. 10 | These entries do not work with older Java versions and even if they do work, 11 | they are inflexible and usually cause nasty surprises. 12 | """ 13 | jar-not-indexed = """ 14 | The jar file is not indexed, i.e. it does not contain the META-INF/INDEX.LIST 15 | file. Indexed jars speed up the class searching process of classloaders 16 | in some situations. 17 | """ 18 | -------------------------------------------------------------------------------- /rpmlint/descriptions/ZyppSyntaxCheck.toml: -------------------------------------------------------------------------------- 1 | suse-zypp-packageand=""" 2 | The 'packageand(package1:package2)' syntax is obsolete, please use boolean 3 | dependencies like: 4 | 'Supplements: (package1 and package2)' 5 | """ 6 | suse-zypp-otherproviders=""" 7 | The 'otherproviders(symbol)' syntax is obsolete, it is not needed and you 8 | can use the 'symbol' directly: 9 | 'Conflicts: symbol' 10 | """ 11 | 12 | -------------------------------------------------------------------------------- /rpmlint/helpers.py: -------------------------------------------------------------------------------- 1 | # File containing various helper functions used across rpmlint 2 | 3 | from contextlib import contextmanager 4 | import os 5 | from shutil import get_terminal_size 6 | import sys 7 | 8 | from rpmlint.color import Color 9 | 10 | 11 | ENGLISH_ENVIRONMENT = dict(os.environ, LC_ALL='en_US.UTF-8', LANGUAGE='en_US') 12 | 13 | 14 | def string_center(message, filler=' '): 15 | """ 16 | Create string centered of the terminal 17 | """ 18 | cols, rows = get_terminal_size() 19 | return (f' {message} ').center(cols, filler) 20 | 21 | 22 | def print_centered(message, filler=' '): 23 | """ 24 | Print message in the center of a terminal 25 | """ 26 | print(string_center(message, filler)) 27 | 28 | 29 | def print_warning(message): 30 | """ 31 | Print warning message to stderr. 32 | """ 33 | print(f'{Color.Red}{message}{Color.Reset}', file=sys.stderr) 34 | 35 | 36 | def byte_to_string(item): 37 | """ 38 | Convert byte items to strings 39 | """ 40 | # empty stuff or already existing string stays 41 | if item is None or isinstance(item, str): 42 | return item 43 | 44 | # if we have a list/tuple we have to recurse 45 | if isinstance(item, (list, tuple)): 46 | return [byte_to_string(i) for i in item] 47 | 48 | # everything else shall be decoded and fails replaced 49 | return item.decode(encoding='UTF-8', errors='replace') 50 | 51 | 52 | def readlines(path): 53 | with open(path, 'rb') as fobj: 54 | for line in fobj: 55 | yield byte_to_string(line) 56 | 57 | 58 | @contextmanager 59 | def pushd(new_dir): 60 | """ 61 | Mimics Unix pushd/popd 62 | """ 63 | cwd = os.getcwd() 64 | os.chdir(new_dir) 65 | try: 66 | yield 67 | finally: 68 | os.chdir(cwd) 69 | -------------------------------------------------------------------------------- /rpmlint/pkgfile.py: -------------------------------------------------------------------------------- 1 | import rpm 2 | 3 | 4 | class PkgFile: 5 | __slots__ = ['name', 'path', 'flags', 'mode', 'user', 'group', 'linkto', 6 | 'size', 'md5', 'mtime', 'rdev', 'inode', 'requires', 'provides', 7 | 'lang', 'magic', 'filecaps'] 8 | 9 | def __init__(self, name): 10 | self.name = name 11 | # Real path to the file (taking extract dir into account) 12 | self.path = name 13 | self.flags = 0 14 | self.mode = 0 15 | self.user = None 16 | self.group = None 17 | self.linkto = '' 18 | self.size = None 19 | self.md5 = None 20 | self.mtime = 0 21 | self.rdev = '' 22 | self.inode = 0 23 | self.requires = [] 24 | self.provides = [] 25 | self.lang = '' 26 | self.magic = '' 27 | self.filecaps = None 28 | 29 | @property 30 | def is_config(self): 31 | return self.flags & rpm.RPMFILE_CONFIG 32 | 33 | @property 34 | def is_doc(self): 35 | return self.flags & rpm.RPMFILE_DOC 36 | 37 | @property 38 | def is_noreplace(self): 39 | return self.flags & rpm.RPMFILE_NOREPLACE 40 | 41 | @property 42 | def is_ghost(self): 43 | return self.flags & rpm.RPMFILE_GHOST 44 | 45 | @property 46 | def is_missingok(self): 47 | return self.flags & rpm.RPMFILE_MISSINGOK 48 | -------------------------------------------------------------------------------- /rpmlint/stringsparser.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | from rpmlint.helpers import ENGLISH_ENVIRONMENT 4 | 5 | 6 | class StringsParser: 7 | """ 8 | Class contains all information obtained by strings command. 9 | """ 10 | 11 | def __init__(self, pkgfile_path): 12 | self.pkgfile_path = pkgfile_path 13 | self.strings = [] 14 | self.parsing_failed_reason = None 15 | self.parse() 16 | 17 | def parse(self): 18 | r = subprocess.run(['strings', self.pkgfile_path], encoding='utf8', 19 | capture_output=True, env=ENGLISH_ENVIRONMENT) 20 | if r.returncode != 0: 21 | self.parsing_failed_reason = r.stderr 22 | return 23 | 24 | self.strings = r.stdout.splitlines() 25 | -------------------------------------------------------------------------------- /rpmlint/version.py: -------------------------------------------------------------------------------- 1 | try: 2 | from importlib.metadata import version, PackageNotFoundError 3 | except ImportError: 4 | from importlib_metadata import version, PackageNotFoundError 5 | 6 | try: 7 | __version__ = version('rpmlint') 8 | except PackageNotFoundError: 9 | __version__ = '0.0.0' 10 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [aliases] 2 | test=pytest 3 | 4 | [flake8] 5 | ignore = E122,E501,W504 6 | import-order-style = google 7 | application-import-names = Testing 8 | exclude = test/files/* 9 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | 4 | setup() 5 | -------------------------------------------------------------------------------- /test/binary/SpecCheck4-0.0.1-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/SpecCheck4-0.0.1-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/alternatives-borked-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/alternatives-borked-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/alternatives-ok-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/alternatives-ok-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/asm-1.5.3-0.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/asm-1.5.3-0.noarch.rpm -------------------------------------------------------------------------------- /test/binary/bad-crc-uncompressed-1.0-9.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/bad-crc-uncompressed-1.0-9.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/bcc-lua-0.10.0-86.12.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/bcc-lua-0.10.0-86.12.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/binary-in-etc-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/binary-in-etc-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/crypto-policy-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/crypto-policy-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/dev-dependency-0-3.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/dev-dependency-0-3.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/ghc-0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/ghc-0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/glibc-0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/glibc-0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/hello-2.0-1.x86_64-signed.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/hello-2.0-1.x86_64-signed.rpm -------------------------------------------------------------------------------- /test/binary/invalid-dependency-0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/invalid-dependency-0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/invalid-la-file-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/invalid-la-file-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/invalid-license-0-1.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/invalid-license-0-1.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/invalid-version-0pre-3.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/invalid-version-0pre-3.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/libalternatives-borked-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/libalternatives-borked-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/libalternatives-ok-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/libalternatives-ok-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/libnoexec-0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/libnoexec-0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/libtest-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/libtest-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/libtest1-1.5-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/libtest1-1.5-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/libtest2-1.5-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/libtest2-1.5-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/libtest3-3.5-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/libtest3-3.5-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/libtest4-4.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/libtest4-4.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/libtool-wrapper-0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/libtool-wrapper-0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/lto-text-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/lto-text-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/mc-4.8.15-10.3.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/mc-4.8.15-10.3.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/mc-4.8.21-2.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/mc-4.8.21-2.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/misc-no-warnings-0-1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/misc-no-warnings-0-1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/misc-warnings-0pre-3.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/misc-warnings-0pre-3.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/multiple_errors-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/multiple_errors-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/ngircd-22-2.fc22.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/ngircd-22-2.fc22.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/no-binary-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/no-binary-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/no-signature-1.0-0.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/no-signature-1.0-0.noarch.rpm -------------------------------------------------------------------------------- /test/binary/no-url-tag-0alpha-5.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/no-url-tag-0alpha-5.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/noarch-noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/noarch-noarch.rpm -------------------------------------------------------------------------------- /test/binary/non-fhs-0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/non-fhs-0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/non-position-independent-exec-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/non-position-independent-exec-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/non-standard-group-0-2.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/non-standard-group-0-2.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/not-standard-release-extension-0-1.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/not-standard-release-extension-0-1.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/only-non-binary-in-usr-lib-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/only-non-binary-in-usr-lib-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/only-non-binary-in-usr-lib_exception-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/only-non-binary-in-usr-lib_exception-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/python311-pytest-xprocess-0.23.0-2.4.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/python311-pytest-xprocess-0.23.0-2.4.noarch.rpm -------------------------------------------------------------------------------- /test/binary/python39-evtx-0.7.4-29.1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/python39-evtx-0.7.4-29.1.noarch.rpm -------------------------------------------------------------------------------- /test/binary/random-devel-0-2.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/random-devel-0-2.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/random-exp-0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/random-exp-0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/requires-on-release-0-1.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/requires-on-release-0-1.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/ruby2.5-rubygem-rubyzip-testsuite-1.2.1-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/ruby2.5-rubygem-rubyzip-testsuite-1.2.1-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/ruby2.6-rubygem-fast_gettext-2.0.1-1.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/ruby2.6-rubygem-fast_gettext-2.0.1-1.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/self-0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/self-0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/spellingerrors-default-0-0.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/spellingerrors-default-0-0.noarch.rpm -------------------------------------------------------------------------------- /test/binary/spellingerrors-lang-0-0.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/spellingerrors-lang-0-0.noarch.rpm -------------------------------------------------------------------------------- /test/binary/spellingerrors-lang2-0-0.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/spellingerrors-lang2-0-0.noarch.rpm -------------------------------------------------------------------------------- /test/binary/spellingerrors-lang3-0-0.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/spellingerrors-lang3-0-0.noarch.rpm -------------------------------------------------------------------------------- /test/binary/summary-on-multiple-lines-1.0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/summary-on-multiple-lines-1.0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/summary-warning-0-1.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/summary-warning-0-1.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/tempfiled-0-0.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/tempfiled-0-0.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/texlive-codepage-doc-2018.151.svn21126-38.1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/texlive-codepage-doc-2018.151.svn21126-38.1.noarch.rpm -------------------------------------------------------------------------------- /test/binary/unexpanded-macro-exp-0-4.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/unexpanded-macro-exp-0-4.1.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/unknown-key-1.0-0.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/unknown-key-1.0-0.noarch.rpm -------------------------------------------------------------------------------- /test/binary/xrootd-devel-5.5.4-1.fc37.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/xrootd-devel-5.5.4-1.fc37.x86_64.rpm -------------------------------------------------------------------------------- /test/binary/xtables-addons-kmp-default-2.14_k4.12.14_lp151.16-lp151.3.10.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/binary/xtables-addons-kmp-default-2.14_k4.12.14_lp151.16-lp151.3.10.x86_64.rpm -------------------------------------------------------------------------------- /test/configs/broken.config: -------------------------------------------------------------------------------- 1 | Distribution = [ "Fedora Project" 2 | Vendor = Fedora Project 3 | -------------------------------------------------------------------------------- /test/configs/descriptions.config: -------------------------------------------------------------------------------- 1 | [Descriptions] 2 | no-binary = """ 3 | A new text for no-binary error. 4 | """ 5 | 6 | no-soname = """ 7 | A new text for no-soname error. 8 | """ 9 | 10 | non-standard-dir-in-usr = """ 11 | A new text for non-standard-dir-in-usr error. 12 | """ 13 | 14 | non-standard-dir-in-var = """ 15 | A new text for non-standard-dir-in-var error. 16 | """ 17 | -------------------------------------------------------------------------------- /test/configs/test.config: -------------------------------------------------------------------------------- 1 | Distribution = "Fedora Project" 2 | Vendor = "Fedora Project" 3 | 4 | MandatoryOptflags = ['-fno-PIE', '-g', '-Ofast'] 5 | ForbiddenOptflags = ['-frounding-math'] 6 | 7 | [WarnOnFunction.crypto-policy-non-compliance-openssl] 8 | f_name = "SSL_CTX_set_cipher_list" 9 | description = '''This application package calls a function to explicitly set crypto ciphers 10 | for SSL/TLS. That may cause the application not to use the system-wide set 11 | cryptographic policy and should be modified in accordance to: 12 | https://fedoraproject.org/wiki/Packaging:CryptoPolicies''' 13 | [WarnOnFunction.crypto-policy-non-compliance-gnutls-1] 14 | f_name = "gnutls_priority_set_direct" 15 | description = '''This application package calls a function to explicitly set crypto ciphers 16 | for SSL/TLS. That may cause the application not to use the system-wide set 17 | cryptographic policy and should be modified in accordance to: 18 | https://fedoraproject.org/wiki/Packaging:CryptoPolicies''' 19 | [WarnOnFunction.crypto-policy-non-compliance-gnutls-2] 20 | f_name = "gnutls_priority_init" 21 | good_param = "SYSLOG" 22 | description = '''This application package calls a function to explicitly set crypto ciphers 23 | for SSL/TLS. That may cause the application not to use the system-wide set 24 | cryptographic policy and should be modified in accordance to: 25 | https://fedoraproject.org/wiki/Packaging:CryptoPolicies''' 26 | -------------------------------------------------------------------------------- /test/configs/test.override.config: -------------------------------------------------------------------------------- 1 | ValidGroups = [ 2 | 'Only/One', 3 | ] 4 | -------------------------------------------------------------------------------- /test/configs/test2.config: -------------------------------------------------------------------------------- 1 | Vendor = "SUSE" 2 | ExtraMenuNeeds = [ 3 | 'windows', 4 | ] 5 | 6 | [WarnOnFunction.crypto-policy-non-compliance-openssl] 7 | f_name = "REPLACED" 8 | good_param = "ADDED" 9 | 10 | [WarnOnFunction.crypto-policy-3] 11 | f_name = "new_blobie" 12 | -------------------------------------------------------------------------------- /test/configs/testfilters.config: -------------------------------------------------------------------------------- 1 | Filters = [ 2 | '.*invalid-buildhost.*', 3 | '.*executable-in-library-package.*', 4 | '.*non-versioned-file-in-library-package.*', 5 | '.*shlib-policy-name-error.*', 6 | # this is just a comment to be ignored by the parsing 7 | '.*hardcoded-path-in-buildroot-tag.*', 8 | '.*no-buildroot-tag.*', 9 | '.*cross-directory-hard-link.*', 10 | 'no-regex', 11 | ' no-regex-with-leading-space', 12 | 'ngircd.*: E: bad-error', 13 | '^ngircd.*: E: test-color-error details of the error$', 14 | 'fatal-error' 15 | ] 16 | 17 | BlockedFilters = [ 18 | 'fatal-error' 19 | ] 20 | 21 | [Scoring] 22 | test-color-error = 12345 23 | -------------------------------------------------------------------------------- /test/configs/testing2-rpmlintrc: -------------------------------------------------------------------------------- 1 | addFilter('I am not used') 2 | addFilter('He is not used') 3 | # addFilter('She is not used') 4 | addFilter('no-%build-section') 5 | -------------------------------------------------------------------------------- /test/configs/testing3-rpmlintrc: -------------------------------------------------------------------------------- 1 | # Backward compatibility should match spaces within paren 2 | addFilter('no-spaces-in-paren') 3 | addFilter( 'has-spaces-in-paren' ) 4 | addFilter( 'multiple-spaces-in-paren' ) 5 | addFilter("doublequotes-instead-of-singlequotes") -------------------------------------------------------------------------------- /test/configs/testlists1.config: -------------------------------------------------------------------------------- 1 | Filters = [ 2 | '.*invalid-buildhost.*', 3 | ] 4 | ValidGroups = [ 5 | 'bullshitgroup', 6 | 'group2/wrong', 7 | ] 8 | -------------------------------------------------------------------------------- /test/configs/testlists2.config: -------------------------------------------------------------------------------- 1 | Filters = [ 2 | '.*cross-directory-hard-link.*', 3 | ] 4 | ValidGroups = [ 5 | 'System/Libraries', 6 | ] 7 | -------------------------------------------------------------------------------- /test/dump_stats.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | if __name__ == '__main__': 4 | import sys 5 | import pstats 6 | 7 | p = pstats.Stats(sys.argv[1]) 8 | N = 60 9 | p.sort_stats('cumulative').print_stats(N) 10 | print('========================================================') 11 | p.sort_stats('tottime').print_stats(N) 12 | print('========================================================') 13 | p.sort_stats('ncalls').print_stats(N) 14 | -------------------------------------------------------------------------------- /test/files/README1.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/README1.gz -------------------------------------------------------------------------------- /test/files/README2.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/README2.bz2 -------------------------------------------------------------------------------- /test/files/README3.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/README3.xz -------------------------------------------------------------------------------- /test/files/aarch64.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/aarch64.o -------------------------------------------------------------------------------- /test/files/ebpf.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/ebpf.o -------------------------------------------------------------------------------- /test/files/ipython-requires.txt: -------------------------------------------------------------------------------- 1 | backcall 2 | decorator 3 | jedi>=0.16 4 | matplotlib-inline 5 | pickleshare 6 | prompt_toolkit!=3.0.37,<3.1.0,>=3.0.30 7 | pygments>=2.4.0 8 | stack_data 9 | traitlets>=5 10 | 11 | [:python_version < "3.10"] 12 | typing_extensions 13 | leftover>=3.0 14 | 15 | [:python_version > "3.11"] 16 | req312 17 | no-leftover 18 | 19 | [:sys_platform != "win32"] 20 | pexpect>4.3 21 | -------------------------------------------------------------------------------- /test/files/logrotate/logrotate.conf: -------------------------------------------------------------------------------- 1 | /var/log/myapp/*.log { 2 | su appuser appuser 3 | weekly 4 | rotate 4 5 | compress 6 | 7 | delaycompress 8 | missingok 9 | create 644 appuser appuser 10 | } 11 | 12 | /var/log/myapp/*.log { 13 | su appuser2 appuser2 14 | } 15 | -------------------------------------------------------------------------------- /test/files/logrotate/logrotate2.conf: -------------------------------------------------------------------------------- 1 | /var/log/myapp/*.log { 2 | su appuser2 appuser2 3 | } 4 | 5 | /tmp/foo/my.log { 6 | # comment 7 | su appuser2 appuser2 8 | } 9 | 10 | /tmp/foo2/my.log { 11 | su appuser2 appuser2 12 | } 13 | -------------------------------------------------------------------------------- /test/files/m-no-CInf.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/m-no-CInf.beam -------------------------------------------------------------------------------- /test/files/m.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/m.beam -------------------------------------------------------------------------------- /test/files/netmask/errors.h: -------------------------------------------------------------------------------- 1 | /* errors.h -- error message handlers. 2 | Copyright (C) 1998 Robert Stone 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 17 | 18 | #ifndef _HAVE_ERRORS_H 19 | #define _HAVE_ERRORS_H 20 | 21 | /* call initerrors before using these other functions 22 | * 23 | * these functions seem pretty straightforward to me, the messaging 24 | * functions take sprintf formatted strings and have a limit of 25 | * 1024 byte long error messages. 26 | * progname should be set to argv[0] 27 | * if progname is NULL, it is unchanged 28 | * type == 0 for stderr 29 | * type == 1 for syslog 30 | * otherwise type is unchanged 31 | * stat == 0 to skip status reporting 32 | * stat == 1 to print status messages 33 | * otherwise stat is unchanged 34 | * defaults: progname = NULL, type = 0, stat = 0 */ 35 | int initerrors(char *progname, int type, int stat); 36 | 37 | int status(const char *fmt, ...); 38 | /* print a status message */ 39 | 40 | int warn(const char *fmt, ...); 41 | /* print a warning message */ 42 | 43 | int panic(const char *fmt, ...); 44 | /* print an error and exit */ 45 | #endif 46 | -------------------------------------------------------------------------------- /test/files/netmask/netmask.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | typedef struct nm *NM; 6 | 7 | NM nm_new_v4(struct in_addr *); 8 | 9 | NM nm_new_v6(struct in6_addr *); 10 | 11 | NM nm_new_ai(struct addrinfo *); 12 | 13 | #define NM_USE_DNS 1 14 | 15 | NM nm_new_str(const char *, int flags); 16 | 17 | NM nm_merge(NM, NM); 18 | 19 | typedef union { 20 | struct in6_addr s6; 21 | struct in_addr s; 22 | } nm_addr; 23 | 24 | void nm_walk(NM, void (*)(int domain, nm_addr *neta, nm_addr *mask)); 25 | 26 | -------------------------------------------------------------------------------- /test/files/python3-power/__init__.cpython-33.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/python3-power/__init__.cpython-33.pyc -------------------------------------------------------------------------------- /test/files/python3-power/__init__.cpython-33.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/python3-power/__init__.cpython-33.pyo -------------------------------------------------------------------------------- /test/files/python3-power/__init__.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """ 3 | Provides crossplatform checking of current power source, battery warning level and battery time remaining estimate. 4 | Allows you to add observer for power notifications if platform supports it. 5 | 6 | Usage: 7 | from power import PowerManagement, PowerManagementObserver # Automatically imports platform-specific implementation 8 | 9 | class Observer(PowerManagementObserver): 10 | def on_power_sources_change(self, power_management): 11 | print "Power sources did change." 12 | 13 | def on_time_remaining_change(self, power_management): 14 | print "Time remaining did change." 15 | 16 | # class Observer(object): 17 | # ... 18 | # PowerManagementObserver.register(Observer) 19 | """ 20 | __author__ = 'kulakov.ilya@gmail.com' 21 | __version__ = '1.1' 22 | 23 | from sys import platform 24 | from power.common import * 25 | 26 | 27 | try: 28 | if platform.startswith('darwin'): 29 | from power.darwin import PowerManagement 30 | elif platform.startswith('win32'): 31 | from power.win32 import PowerManagement 32 | elif platform.startswith('linux'): 33 | from power.linux import PowerManagement 34 | else: 35 | raise RuntimeError("{platform} is not supported.".format(platform=platform)) 36 | except RuntimeError as e: 37 | import warnings 38 | warnings.warn("Unable to load PowerManagement for {platform}. No-op PowerManagement class is used: {error}".format(error=str(e), platform=platform)) 39 | from power.common import PowerManagementNoop as PowerManagement 40 | -------------------------------------------------------------------------------- /test/files/python3-power/common.cpython-33.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/python3-power/common.cpython-33.pyc -------------------------------------------------------------------------------- /test/files/python3-power/common.cpython-33.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/python3-power/common.cpython-33.pyo -------------------------------------------------------------------------------- /test/files/reiserfs/libreiserfscore.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/reiserfs/libreiserfscore.a -------------------------------------------------------------------------------- /test/files/reiserfs/libreiserfscore.la: -------------------------------------------------------------------------------- 1 | # libreiserfscore.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libreiserfscore.so.0' 9 | 10 | # Names of this library. 11 | library_names='libreiserfscore.so.0.0.0 libreiserfscore.so.0 libreiserfscore.so' 12 | 13 | # The name of the static archive. 14 | old_library='libreiserfscore.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lcom_err -luuid' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libreiserfscore. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/lib64' 42 | -------------------------------------------------------------------------------- /test/files/reiserfs/reiserfs_err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * reiserfs_err.h: 3 | * This file is automatically generated; please do not edit it. 4 | */ 5 | 6 | #include 7 | 8 | #define REISERFS_ET_BREAD_FAILED (50094765501195648L) 9 | #define REISERFS_ET_BAD_MAGIC (50094765501195647L) 10 | #define REISERFS_ET_BAD_SUPER (50094765501195646L) 11 | #define REISERFS_ET_SMALL_PARTITION (50094765501195645L) 12 | #define REISERFS_ET_NOT_ENOUGH_BLOCKS (50094765501195644L) 13 | #define REISERFS_ET_TOO_SMALL (50094765501195643L) 14 | #define REISERFS_ET_GETBLK_FAILED (50094765501195642L) 15 | extern const struct error_table et_reiserfs_error_table; 16 | extern void initialize_reiserfs_error_table(void); 17 | 18 | /* For compatibility with Heimdal */ 19 | extern void initialize_reiserfs_error_table_r(struct et_list **list); 20 | 21 | #define ERROR_TABLE_BASE_reiserfs (50094765501195648L) 22 | 23 | /* for compatibility with older versions... */ 24 | #define init_reiserfs_err_tbl initialize_reiserfs_error_table 25 | #define reiserfs_err_base ERROR_TABLE_BASE_reiserfs 26 | -------------------------------------------------------------------------------- /test/files/reiserfs/reiserfscore.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr 2 | exec_prefix=/ 3 | libdir=/usr/lib64 4 | includedir=/usr/include 5 | 6 | Name: reiserfscore 7 | Description: ReiserFS Core Library 8 | Version: 3.6.27 9 | Cflags: -I${includedir}/reiserfs -I${includedir} 10 | Libs: -L${libdir} -lreiserfscore 11 | -------------------------------------------------------------------------------- /test/files/rpmlint-test-good.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=rpmlint-test 3 | Name[de]=rpmlint-test umlaut äöü 4 | Name[x-test]=xxrpmlint-testxx 5 | MimeType=application/x-rpm; 6 | Exec=rpmlint-test file.file 7 | Icon=chameleon_v_balíku 8 | Type=Application 9 | InitialPreference=5 10 | NoDisplay=false 11 | GenericName=rpmlint testcase 12 | GenericName[x-test]=xxrpmlint testcasexx 13 | Categories=System;PackageManager; 14 | Keywords=software;package; 15 | Keywords[x-test]=xxsoftwarexx;xxpackagexx; 16 | -------------------------------------------------------------------------------- /test/files/rpmlint-test.desktop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/rpmlint-test.desktop -------------------------------------------------------------------------------- /test/files/shlib2/libfoo-2.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/shlib2/libfoo-2.so -------------------------------------------------------------------------------- /test/files/shlib2/libfoo-2.so.foo: -------------------------------------------------------------------------------- 1 | foobar 2 | -------------------------------------------------------------------------------- /test/files/shlib2/libfoo.so: -------------------------------------------------------------------------------- 1 | libfoo.so.1 -------------------------------------------------------------------------------- /test/files/shlib2/libfoo.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/shlib2/libfoo.so.1 -------------------------------------------------------------------------------- /test/files/shlib_policy/libhello.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/shlib_policy/libhello.so -------------------------------------------------------------------------------- /test/files/shlib_policy/libhello2.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/shlib_policy/libhello2.so -------------------------------------------------------------------------------- /test/files/shlib_policy/libtest.so.1.5.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/shlib_policy/libtest.so.1.5.0 -------------------------------------------------------------------------------- /test/files/systemd/org.freedesktop.NetworkManager2.conf: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 1024 8 | 2048 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/files/x86_64.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/files/x86_64.o -------------------------------------------------------------------------------- /test/ldd/appletviewer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/ldd/appletviewer -------------------------------------------------------------------------------- /test/ldd/libtirpc.so.3.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/ldd/libtirpc.so.3.0.0 -------------------------------------------------------------------------------- /test/ldd/opt-dependency: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/ldd/opt-dependency -------------------------------------------------------------------------------- /test/ldd/usr-dependency: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/ldd/usr-dependency -------------------------------------------------------------------------------- /test/mockdata/mock_FHS.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | NoFHSPackage = get_tested_mock_package( 5 | lazyload=True, 6 | files=['/usr/dummy', '/var/dummy', '/var/local'], 7 | ) 8 | -------------------------------------------------------------------------------- /test/mockdata/mock_LSB.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | NonLSBCompliancePackage = get_tested_mock_package( 5 | lazyload=True, 6 | name='fPing@1', 7 | files={ 8 | '/usr/sbin/fping', 9 | '/usr/share/doc/packages/fPing', 10 | '/usr/share/doc/packages/fPing/CHANGELOG.md', 11 | '/usr/share/licenses/fPing', 12 | '/usr/share/licenses/fPing/COPYING', 13 | '/usr/share/man/man8/fping.8.gz', 14 | }, 15 | header={ 16 | 'name': 'fPing@1', 17 | 'version': '1.0_beta', 18 | 'release': '1.0-beta' 19 | }, 20 | ) 21 | -------------------------------------------------------------------------------- /test/mockdata/mock_appdata.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | AppDataPackage = get_tested_mock_package( 5 | lazyload=True, 6 | files={ 7 | '/usr/share/appdata/broken.appdata.xml': { 8 | 'content-path': 'files/broken.appdata.xml', 9 | 'create_dirs': True, 10 | }, 11 | '/usr/share/appdata/broken-xml.metainfo.xml': { 12 | 'content-path': 'files/broken-xml.metainfo.xml', 13 | 'create_dirs': True, 14 | }, 15 | } 16 | ) 17 | -------------------------------------------------------------------------------- /test/mockdata/mock_bashisms.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | SCRIPT1 = """#!/bin/sh 5 | xz $tmp/1 &> /dev/null 6 | """ 7 | 8 | SCRIPT2 = """#!/bin/sh 9 | do 10 | """ 11 | 12 | 13 | BashismsPackage = get_tested_mock_package( 14 | files={ 15 | '/bin/script1': {'content': SCRIPT1}, 16 | '/bin/script2': {'content': SCRIPT2}, 17 | }, 18 | ) 19 | -------------------------------------------------------------------------------- /test/mockdata/mock_build_date.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | BuildDatePackage = get_tested_mock_package( 5 | lazyload=True, 6 | files={ 7 | '/bin/with-date': {'content': 'Jan 1 2019'}, 8 | '/bin/with-datetime': {'content': 'Jan 1 2019 12:15:11'}, 9 | }, 10 | ) 11 | -------------------------------------------------------------------------------- /test/mockdata/mock_build_root.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | BuildrootPackage = get_tested_mock_package( 5 | lazyload=True, 6 | files={ 7 | '/bin/trace': {'content': '/home/marxin/rpmbuild/BUILDROOT/buildroot-0-0.x86_64'}, 8 | }, 9 | ) 10 | -------------------------------------------------------------------------------- /test/mockdata/mock_config_files.py: -------------------------------------------------------------------------------- 1 | from rpm import RPMFILE_CONFIG, RPMFILE_NOREPLACE 2 | 3 | from Testing import get_tested_mock_package 4 | 5 | 6 | ConfigFilesBrokenPackage = get_tested_mock_package( 7 | lazyload=True, 8 | files={ 9 | '/etc/conffile1': {'metadata': {'flags': RPMFILE_CONFIG}}, 10 | '/var/conffile2': {'metadata': {'flags': RPMFILE_CONFIG}}, 11 | '/usr/share/conffile3': {'metadata': {'flags': RPMFILE_CONFIG}}, 12 | } 13 | ) 14 | 15 | 16 | ConfigFilesOkPackage = get_tested_mock_package( 17 | lazyload=True, 18 | files={ 19 | '/etc/conffile1': {'metadata': {'flags': RPMFILE_CONFIG & RPMFILE_NOREPLACE}}, 20 | '/var/conffile2': {'metadata': {'flags': RPMFILE_CONFIG & RPMFILE_NOREPLACE}}, 21 | } 22 | ) 23 | -------------------------------------------------------------------------------- /test/mockdata/mock_dbus_policy.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | DbusRulePackage = get_tested_mock_package( 5 | lazyload=True, 6 | files={ 7 | '/etc/dbus-1/system.d/noxml.conf': {}, 8 | '/etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf': { 9 | 'content-path': 'files/systemd/org.freedesktop.NetworkManager.conf', 10 | }, 11 | '/etc/dbus-1/system.d/org.freedesktop.NetworkManager2.conf': { 12 | 'content-path': 'files/systemd/org.freedesktop.NetworkManager2.conf', 13 | }, 14 | }, 15 | ) 16 | -------------------------------------------------------------------------------- /test/mockdata/mock_duplicates.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | HardlinksAndDuplicatesPresent = get_tested_mock_package( 5 | lazyload=True, 6 | files={ 7 | '/etc/bar': {'content': 'large enough file', 'metadata': {'mode': 33188}}, 8 | '/etc/bar2': {'content': 'large enough file', 'metadata': {'mode': 33188}}, 9 | '/etc/bar3': {'content': 'large enough file', 'metadata': {'mode': 33188}}, 10 | '/etc/foo': {'content': 'Foo file', 'metadata': {'mode': 33188, 'inode': 10}}, 11 | '/etc/foo2': {'content': 'Foo 2 file', 'metadata': {'mode': 33188, 'flags': 1, 'inode': 5}}, 12 | '/etc/small': {'content': ' \n', 'metadata': {'mode': 33188}}, 13 | '/etc/small2': {'content': ' \n', 'metadata': {'mode': 33188}}, 14 | '/etc/strace1.txt': {'content': 'this is a very large file', 'metadata': {'mode': 33188, 'size': 270509}}, 15 | '/etc/strace2.txt': {'content': 'this is a very large file', 'metadata': {'mode': 33188, 'size': 270509}}, 16 | '/var/foo': {'content': 'Foo file', 'metadata': {'mode': 33188, 'inode': 10}}, 17 | '/var/foo2': {'content': 'Foo 2 file', 'metadata': {'mode': 33188, 'flags': 1, 'inode': 5}} 18 | } 19 | ) 20 | 21 | NoHardLinksAndDuplicatesPresent = HardlinksAndDuplicatesPresent.clone( 22 | files={ 23 | '/usr/share/bad-crc.zip': {'content': 'this is a zip file', 'metadata': {'mode': 33188, 'flags': 1}}, 24 | '/usr/share/uncompressed.zip': {'content': 'this is an another zip file', 'metadata': {'mode': 33188, 'flags': 1}}, 25 | }, 26 | ) 27 | -------------------------------------------------------------------------------- /test/mockdata/mock_erlang.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | ErlangPackage = get_tested_mock_package( 4 | lazyload=True, 5 | files={ 6 | '/usr/lib/erlang/m-no-CInf.beam': { 7 | 'content-path': 'files/m-no-CInf.beam', 8 | 'create_dirs': True, 9 | }, 10 | '/usr/lib/erlang/m.beam': { 11 | 'content-path': 'files/m.beam', 12 | 'create_dirs': True, 13 | }, 14 | }, 15 | header={ 16 | 'requires': [ 17 | 'rpmlib(CompressedFileNames) <= 3.0.4-1', 18 | 'rpmlib(FileDigests) <= 4.6.0-1', 19 | 'rpmlib(PayloadFilesHavePrefix) <= 4.0-1', 20 | 'rpmlib(PayloadIsZstd) <= 5.4.18-1', 21 | ], 22 | }, 23 | ) 24 | -------------------------------------------------------------------------------- /test/mockdata/mock_i18n.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | I18NPackage = get_tested_mock_package( 5 | lazyload=True, 6 | files=[ 7 | '/usr/share/locale/zh/LC_MESSAGES/goodvibes.mo', 8 | '/usr/share/locale/zh_Hant/LC_MESSAGES/goodvibes.mo', 9 | '/usr/share/locale/es_ES/LC_MESSAGES/goodvibes.mo', 10 | '/usr/share/locale/zh_TW/LC_MESSAGES/goodvibes.mo', 11 | '/usr/share/locale/pt_BR/LC_MESSAGES/goodvibes.mo', 12 | ], 13 | ) 14 | 15 | 16 | InvalidI18NPackage = get_tested_mock_package( 17 | lazyload=True, 18 | files=[ 19 | '/usr/share/locale/xx_ES/LC_MESSAGES/goodvibes.mo', 20 | '/usr/share/locale/es_XX/LC_MESSAGES/goodvibes.mo', 21 | '/usr/share/locale/xx/LC_MESSAGES/goodvibes.mo', 22 | ], 23 | ) 24 | -------------------------------------------------------------------------------- /test/mockdata/mock_icon_sizes.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | WrongIconSizePackage = get_tested_mock_package( 5 | files={ 6 | '/usr/share/tasque/icons/hicolor/16x16/status/tasque-note.png': { 7 | 'metadata': {'magic': '22 x 22'} 8 | } 9 | } 10 | ) 11 | -------------------------------------------------------------------------------- /test/mockdata/mock_logrotate.py: -------------------------------------------------------------------------------- 1 | import stat 2 | 3 | from Testing import get_tested_mock_package 4 | 5 | 6 | LogrotatePackage = get_tested_mock_package( 7 | lazyload=True, 8 | files={ 9 | '/tmp/foo': { 10 | 'create_dirs': True, 11 | 'is_dir': True, 12 | 'metadata': { 13 | 'mode': stat.S_IFDIR | 0o755, 14 | 'user': 'marxin', 15 | 'group': 'users', 16 | }, 17 | }, 18 | '/tmp/foo2': { 19 | 'create_dirs': True, 20 | 'is_dir': True, 21 | 'metadata': { 22 | 'mode': stat.S_IFREG | stat.S_ISUID | 0o777, 23 | 'user': 'root', 24 | 'group': 'users2', 25 | }, 26 | }, 27 | '/tmp/foo/my.log': { 28 | 'metadata': { 29 | 'mode': 0o644 | stat.S_IFREG, 30 | 'user': 'root', 31 | 'group': 'users2', 32 | }, 33 | }, 34 | '/tmp/foo2/my.log': { 35 | 'metadata': { 36 | 'mode': stat.S_IFREG | stat.S_ISUID | 0o777, 37 | 'user': 'root', 38 | 'group': 'users2', 39 | }, 40 | }, 41 | '/etc/logrotate.d/logrotate.conf': { 42 | 'create_dirs': True, 43 | 'content-path': 'files/logrotate/logrotate.conf', 44 | }, 45 | '/etc/logrotate.d/logrotate2.conf': { 46 | 'create_dirs': True, 47 | 'content-path': 'files/logrotate/logrotate2.conf', 48 | }, 49 | } 50 | ) 51 | -------------------------------------------------------------------------------- /test/mockdata/mock_menuxdg.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | BROKEN = """ 5 | [DEFAULT] 6 | something = true 7 | [else 8 | """ 9 | 10 | BADBIN = """ 11 | [Desktop Entry] 12 | Name=rpmlint-test 13 | Exec=rpmlint-test file.file 14 | Icon=chameleon_v_balíku 15 | Type=Application 16 | GenericName=rpmlint testcase 17 | Categories=Game;Amusement; 18 | """ 19 | 20 | 21 | BADDUP = """ 22 | [Desktop Entry] 23 | [Desktop Entry] 24 | Name=rpmlint-test 25 | Name=name duplicate 26 | Exec=rpmlint-test file.file 27 | Icon=chameleon_v_balíku 28 | Type=Application 29 | GenericName=rpmlint testcase 30 | Categories=Game;Amusement; 31 | """ 32 | 33 | 34 | BADSEC = """ 35 | Name=rpmlint-test 36 | [Bad Section] 37 | Name[x-test]=xxrpmlint-testxx 38 | Exec=rpmlint-test file.file 39 | Icon=rpmlint-test 40 | Type=Application 41 | GenericName=rpmlint testcase 42 | """ 43 | 44 | 45 | MenuXDGInvalidPackage = get_tested_mock_package( 46 | lazyload=True, 47 | files={'/usr/share/applications/somefile.desktop': {'content': BROKEN}}, 48 | ) 49 | 50 | 51 | MenuXDGBadBinPackage = get_tested_mock_package( 52 | lazyload=True, 53 | files={'/usr/share/applications/rpmlint-test.desktop': {'content': BADBIN}}, 54 | ) 55 | 56 | 57 | MenuXDGBadDupPackage = get_tested_mock_package( 58 | lazyload=True, 59 | files={'/usr/share/applications/rpmlint-test.desktop': {'content': BADDUP}}, 60 | ) 61 | 62 | 63 | MenuXDGBadSecPackage = get_tested_mock_package( 64 | lazyload=True, 65 | files={'/usr/share/applications/rpmlint-test.desktop': {'content': BADSEC}}, 66 | ) 67 | 68 | 69 | MenuXDGBadUTF8Package = get_tested_mock_package( 70 | lazyload=True, 71 | files={ 72 | '/usr/share/applications/rpmlint-test.desktop': { 73 | 'content-path': 'files/rpmlint-test.desktop', 74 | 'create_dirs': True, 75 | }, 76 | }, 77 | ) 78 | 79 | MenuXDGPackage = get_tested_mock_package( 80 | lazyload=True, 81 | files={ 82 | '/usr/bin/rpmlint-test': {}, 83 | '/usr/share/applications/rpmlint-test.desktop': { 84 | 'content-path': 'files/rpmlint-test-good.desktop', 85 | 'create_dirs': True, 86 | }, 87 | }, 88 | ) 89 | -------------------------------------------------------------------------------- /test/mockdata/mock_mixed_ownership.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | MixedOwnershipPackage = get_tested_mock_package( 5 | lazyload=True, 6 | files={ 7 | '/usr/bin/noproblem': {}, 8 | '/var/lib/badfolder': { 9 | 'metadata': {'user': 'nobody'}, 10 | 'is_dir': True 11 | }, 12 | '/var/lib/badfolder/broken1': { 13 | 'metadata': {'user': 'root'} 14 | }, 15 | '/var/lib/badfolder/correctperms': { 16 | 'metadata': {'user': 'root'}, 17 | 'is_dir': True, 18 | }, 19 | '/var/lib/badfolder/correctperms/broken2': {}, 20 | }, 21 | ) 22 | -------------------------------------------------------------------------------- /test/mockdata/mock_pam_modules.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | PAMModulePackage = get_tested_mock_package( 5 | lazyload=True, 6 | files=['/usr/lib64/security/pam-module.so'], 7 | ) 8 | -------------------------------------------------------------------------------- /test/mockdata/mock_shlib_policy.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | Libtest1Package = get_tested_mock_package( 5 | lazyload=True, 6 | name='libtest1', 7 | files={ 8 | '/usr/lib64/libtest.so.1.5.0': { 9 | # SONAME: libtest.so.1x 10 | 'content-path': 'files/shlib_policy/libtest.so.1.5.0', 11 | } 12 | }, 13 | header={ 14 | 'requires': [ 15 | '/sbin/ldconfig', 16 | 'libc.so.6()(64bit)', 17 | 'libc.so.6(GLIBC_2.2.5)(64bit)', 18 | ] 19 | } 20 | ) 21 | 22 | 23 | LibslpMissingSuffixPackage = get_tested_mock_package( 24 | lazyload=True, 25 | name='libslp-missing-suffix', 26 | files={ 27 | '/usr/lib64/hello': {'is_dir': True}, 28 | '/usr/lib64/hello/libhello2.so': {'content-path': 'files/shlib_policy/libhello2.so'}, 29 | '/usr/lib64/libhello.so': {'content-path': 'files/shlib_policy/libhello.so'}, 30 | '/usr/lib64/libhello2.so': {'content-path': 'files/shlib_policy/libhello2.so'} 31 | }, 32 | header={ 33 | 'requires': [ 34 | 'libc.so.6()(64bit)', 35 | 'libc.so.6(GLIBC_2.2.5)(64bit)', 36 | # Excessive dependency 37 | 'libsparta.so.2', 38 | ] 39 | } 40 | ) 41 | 42 | 43 | Libslp1234Package = get_tested_mock_package( 44 | lazyload=True, 45 | name='libslp1234', 46 | files={ 47 | '/usr/lib64/hello': {'is_dir': True}, 48 | '/usr/lib64/hello/libhello2.so': {'content-path': 'files/shlib_policy/libhello2.so'}, 49 | '/usr/lib64/libhello.so': {'content-path': 'files/shlib_policy/libhello.so'}, 50 | '/usr/lib64/libhello2.so': {'content-path': 'files/shlib_policy/libhello2.so'} 51 | }, 52 | header={ 53 | 'requires': [ 54 | 'libc.so.6()(64bit)', 55 | 'libc.so.6(GLIBC_2.2.5)(64bit)', 56 | # Fixed shlib dependency 57 | 'libsparta.so.2 = 1.23', 58 | ] 59 | } 60 | ) 61 | -------------------------------------------------------------------------------- /test/mockdata/mock_sysvinitonsystemd.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | BAR_INITRD = """ 5 | #! /bin/bash 6 | 7 | ### BEGIN INIT INFO 8 | # Provides: foo 9 | # Required-Start: $local_fs $network 10 | # Required-Stop: $local_fs 11 | # Default-Start: 2 3 4 5 12 | # Default-Stop: 0 1 6 13 | # Short-Description: foo service 14 | # Description: Run Foo service 15 | ### END INIT INFO 16 | 17 | # Carry out specific functions when asked to by the system 18 | case "$1" in 19 | start) 20 | echo "Starting Foo..." 21 | sudo -u foo-user bash -c 'cd /path/to/scripts/ && ./start-foo.sh' 22 | ;; 23 | stop) 24 | echo "Stopping Foo..." 25 | sudo -u foo-user bash -c 'cd /path/to/scripts/ && ./stop-foo.sh' 26 | sleep 2 27 | ;; 28 | *) 29 | echo "Usage: /etc/init.d/foo {start|stop}" 30 | exit 1 31 | ;; 32 | esac 33 | 34 | exit 0 35 | """ 36 | 37 | 38 | InitPackage = get_tested_mock_package( 39 | lazyload=True, 40 | files={ 41 | '/etc/init.d/boot.script': {'content': ''}, 42 | '/etc/init.d/weekly.script': {'content': ''}, 43 | }, 44 | header={'requires': ['insserv']}, 45 | ) 46 | 47 | 48 | RcLinksPackage = get_tested_mock_package( 49 | lazyload=True, 50 | files={ 51 | '/etc/init.d/bar': {'content': BAR_INITRD}, 52 | '/usr/lib/systemd/system/bar.service': {}, 53 | '/usr/lib/systemd/system/foo.service': {}, 54 | }, 55 | header={'requires': ['insserv']}, 56 | ) 57 | -------------------------------------------------------------------------------- /test/mockdata/mock_tmp_files.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | KRB5_CONF = """ 5 | d /var/lib/kerberos 0755 root root - 6 | d /var/lib/kerberos/krb5 0755 root root - 7 | d /var/lib/kerberos/krb5/user 0755 root root - 8 | d /var/lib/kerberos/krb5kdc 0755 root root - 9 | C /var/lib/kerberos/krb5kdc/kdc.conf 0600 root root - /usr/share/kerberos/krb5kdc/kdc.conf 10 | C /var/lib/kerberos/krb5kdc/kadm5.acl 0600 root root - /usr/share/kerberos/krb5kdc/kadm5.acl 11 | C /var/lib/kerberos/krb5kdc/kadm5.dict 0600 root root - /usr/share/kerberos/krb5kdc/kadm5.dict 12 | """ 13 | 14 | 15 | SYSTEMD_TMPFILES_CONF = """ 16 | # create a directory with permissions 0770 owned by user foo and group bar 17 | d /run/my_new_directory 0770 foo bar 18 | """ 19 | 20 | 21 | PREIN = """ 22 | [ -z "${TRANSACTIONAL_UPDATE}" -a -x /usr/bin/systemd-tmpfiles ] && 23 | /usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/systemd-tmpfiles.conf || : 24 | """ 25 | 26 | POSTIN = """ 27 | [ -z "${TRANSACTIONAL_UPDATE}" -a -x /usr/bin/systemd-tmpfiles ] && 28 | /usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/systemd-tmpfiles_correct.conf || : 29 | """ 30 | 31 | 32 | TempfiledPackage = get_tested_mock_package( 33 | lazyload=True, 34 | files={ 35 | '/usr/lib/tmpfiles.d/krb5.conf': {'content': KRB5_CONF}, 36 | '/usr/lib/tmpfiles.d/symlink.conf': {'linkto': '/usr/lib/tmpfiles.d/krb5.conf'} 37 | }, 38 | header={}, 39 | ) 40 | 41 | 42 | SystemdTempfilesPackage = get_tested_mock_package( 43 | lazyload=True, 44 | files={ 45 | '/usr/lib/tmpfiles.d/systemd-tmpfiles.conf': {'content': SYSTEMD_TMPFILES_CONF}, 46 | }, 47 | header={'PREIN': PREIN}, 48 | ) 49 | 50 | 51 | SystemdTempfilesOkPackage = get_tested_mock_package( 52 | lazyload=True, 53 | files={ 54 | '/run/my_new_directory': {}, 55 | '/usr/lib/tmpfiles.d/systemd-tmpfiles_correct.conf': {'content': SYSTEMD_TMPFILES_CONF}, 56 | }, 57 | header={'POSTIN': POSTIN}, 58 | ) 59 | -------------------------------------------------------------------------------- /test/mockdata/mock_xinetd.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | RequireXinetd = get_tested_mock_package( 5 | lazyload=True, 6 | header={ 7 | 'requires': [ 8 | 'xinetd', 9 | ], 10 | }, 11 | ) 12 | -------------------------------------------------------------------------------- /test/mockdata/mock_zypp_syntax.py: -------------------------------------------------------------------------------- 1 | from Testing import get_tested_mock_package 2 | 3 | 4 | SyntaxPackageandPackage = get_tested_mock_package( 5 | lazyload=True, 6 | header={ 7 | 'requires': [], 8 | 'supplements': ['packageand(c:d)'], 9 | 'recommends': ['packageand(a:b)'], 10 | 'suggests': ['(a and b)'], 11 | 'conflicts': [ 12 | 'bee', 13 | 'otherproviders(yast2_theme)', 14 | ], 15 | }, 16 | ) 17 | 18 | 19 | SyntaxAndPackage = get_tested_mock_package( 20 | lazyload=True, 21 | header={ 22 | 'requires': [], 23 | 'supplements': ['(c and d)'], 24 | 'recommends': ['b'], 25 | 'suggests': ['(a and b)'], 26 | 'conflicts': [ 27 | 'bee', 28 | ], 29 | }, 30 | ) 31 | -------------------------------------------------------------------------------- /test/pyc/.gitignore: -------------------------------------------------------------------------------- 1 | !*.pyc 2 | -------------------------------------------------------------------------------- /test/pyc/__future__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/pyc/__future__.cpython-36.pyc -------------------------------------------------------------------------------- /test/pyc/__future__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/pyc/__future__.cpython-37.pyc -------------------------------------------------------------------------------- /test/readelf/archive-with-debuginfo.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/archive-with-debuginfo.a -------------------------------------------------------------------------------- /test/readelf/call-mktemp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/call-mktemp -------------------------------------------------------------------------------- /test/readelf/call-setgroups: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/call-setgroups -------------------------------------------------------------------------------- /test/readelf/empty-archive.a: -------------------------------------------------------------------------------- 1 | ! 2 | -------------------------------------------------------------------------------- /test/readelf/executable-stack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/executable-stack -------------------------------------------------------------------------------- /test/readelf/function-sections.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/function-sections.a -------------------------------------------------------------------------------- /test/readelf/hostname: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/hostname -------------------------------------------------------------------------------- /test/readelf/invalid-soname.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/invalid-soname.so -------------------------------------------------------------------------------- /test/readelf/libbsd-ctor.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/libbsd-ctor.a -------------------------------------------------------------------------------- /test/readelf/libclang_rt.asan-preinit-x86_64.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/libclang_rt.asan-preinit-x86_64.a -------------------------------------------------------------------------------- /test/readelf/libgame.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/libgame.so -------------------------------------------------------------------------------- /test/readelf/libkleeRuntimeFreeStanding.bca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/libkleeRuntimeFreeStanding.bca -------------------------------------------------------------------------------- /test/readelf/libutil-2.29.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/libutil-2.29.so -------------------------------------------------------------------------------- /test/readelf/lto-object.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/lto-object.o -------------------------------------------------------------------------------- /test/readelf/main.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/main.a -------------------------------------------------------------------------------- /test/readelf/nested-function: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/nested-function -------------------------------------------------------------------------------- /test/readelf/no-soname.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/no-soname.so -------------------------------------------------------------------------------- /test/readelf/non-pic-shared-m32.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/non-pic-shared-m32.so -------------------------------------------------------------------------------- /test/readelf/only-data.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/only-data.a -------------------------------------------------------------------------------- /test/readelf/rpath-lib.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/rpath-lib.so -------------------------------------------------------------------------------- /test/readelf/small_archive.a: -------------------------------------------------------------------------------- 1 | ! 2 | limerick/ 0 0 0 644 191 ` 3 | There was a young man from Japan 4 | Whose limericks never would scan. 5 | When asked why that was, 6 | He replied "It's because 7 | I always try to cram as many words into the last line as I possibly can." 8 | 9 | -------------------------------------------------------------------------------- /test/readelf/stripped-archive.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/stripped-archive.a -------------------------------------------------------------------------------- /test/readelf/stripped-lto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/readelf/stripped-lto.a -------------------------------------------------------------------------------- /test/rpmlintrc/multiple/sample-rpmlintrc: -------------------------------------------------------------------------------- 1 | addFilter("W: files-attr-not-set") 2 | -------------------------------------------------------------------------------- /test/rpmlintrc/multiple/sample.rpmlintrc: -------------------------------------------------------------------------------- 1 | setBadness('suse-dbus-unauthorized-service', 0) 2 | -------------------------------------------------------------------------------- /test/rpmlintrc/multiple/sample.spec: -------------------------------------------------------------------------------- 1 | Name: sample 2 | Version: 0 3 | Release: 0 4 | License: GPL-2.0-only 5 | Summary: Whatever 6 | 7 | %description 8 | Whatever. 9 | -------------------------------------------------------------------------------- /test/rpmlintrc/single/sample.rpmlintrc: -------------------------------------------------------------------------------- 1 | setBadness('suse-dbus-unauthorized-service', 0) 2 | -------------------------------------------------------------------------------- /test/rpmlintrc/single/sample.spec: -------------------------------------------------------------------------------- 1 | Name: sample 2 | Version: 0 3 | Release: 0 4 | License: GPL-2.0-only 5 | Summary: Whatever 6 | 7 | %description 8 | Whatever. 9 | -------------------------------------------------------------------------------- /test/source/CheckInclude-1-1.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/source/CheckInclude-1-1.src.rpm -------------------------------------------------------------------------------- /test/source/invalid-spec-name-0-0.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/source/invalid-spec-name-0-0.src.rpm -------------------------------------------------------------------------------- /test/source/no-spec-file-0-0.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/source/no-spec-file-0-0.src.rpm -------------------------------------------------------------------------------- /test/source/non-utf8-1.0-1.el5.centos.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/source/non-utf8-1.0-1.el5.centos.src.rpm -------------------------------------------------------------------------------- /test/source/not-compressed-multi-spec-1.0-0.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/source/not-compressed-multi-spec-1.0-0.src.rpm -------------------------------------------------------------------------------- /test/source/valid-exception-begin-grouping-1.0-1.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/source/valid-exception-begin-grouping-1.0-1.src.rpm -------------------------------------------------------------------------------- /test/source/valid-exception-in-grouping-1.0-1.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/source/valid-exception-in-grouping-1.0-1.src.rpm -------------------------------------------------------------------------------- /test/source/wrongsrc-0-0.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/source/wrongsrc-0-0.src.rpm -------------------------------------------------------------------------------- /test/spec/%autopatch-not-in-prep.spec: -------------------------------------------------------------------------------- 1 | Name: %autopatch-not-in-prep 2 | Version: 0 3 | Release: 0 4 | Summary: autopatch not inside prep warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | Requires: Somethingwithsinglespace >=1.0 10 | Conflicts: Someotherthinwithsinglespace<= 1.0 11 | Obsoletes: %{name} <= %{version} 12 | Provides: %{name} = %{version} 13 | 14 | %description 15 | autopatch macro must be inside %prep. 16 | 17 | %autopatch 18 | 19 | %prep 20 | 21 | %build 22 | 23 | %install 24 | 25 | %files 26 | %{_libdir}/foo 27 | 28 | %changelog 29 | -------------------------------------------------------------------------------- /test/spec/%autosetup-not-in-prep.spec: -------------------------------------------------------------------------------- 1 | # This is comment to check macro-in-comment not found. 2 | Name: autosetup-not-in-prep 3 | Version: 0 4 | Release: 0 5 | Summary: autosetup-not-in-prep warning. 6 | License: GPL-2.0-only 7 | Group: Undefined 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | Requires: Somethingwithdoublespace = 1.0 11 | Conflicts: Some thing with double space == 2.0 12 | Provides: /Something 13 | 14 | %description 15 | The specfile contains %autosetup outside the %prep. 16 | 17 | %autosetup 18 | 19 | %prep 20 | 21 | %build 22 | 23 | %install 24 | 25 | %files 26 | %{_libdir}/foo 27 | 28 | %changelog 29 | -------------------------------------------------------------------------------- /test/spec/%ifarch-applied-patch.spec: -------------------------------------------------------------------------------- 1 | Name: %ifarch-applied-patch 2 | Version: 0 3 | Release: 0 4 | Summary: %ifarch-applied-patch warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | Patch1: Patch1.patch 10 | Requires(post): foo 11 | 12 | %description 13 | A patch is applied inside an %ifarch block. Patches must be applied 14 | on all architectures and may contain necessary configure and/or code 15 | patch to be effective only on a given arch. 16 | 17 | %prep 18 | 19 | %build 20 | 21 | %install 22 | %ifarch 23 | %patch1 -P 1 24 | %endif 25 | 26 | %files 27 | %{_libdir}/foo 28 | 29 | %changelog 30 | -------------------------------------------------------------------------------- /test/spec/MacroInComment.spec: -------------------------------------------------------------------------------- 1 | Name: MacroInComment 2 | Version: 0 3 | Release: 0 4 | Summary: None here 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 11 | Provides: unversioned-provides, versioned-provides = 1.0 12 | Obsoletes: versioned-obsoletes < 2.0 13 | Obsoletes: unversioned-obsoletes 14 | Obsoletes: /usr/bin/unversioned-but-filename 15 | Provides: /sbin/another-unversioned-but-filename 16 | #!BuildIgnore: %{name} 17 | 18 | %description 19 | MacroInComment test. 20 | 21 | %package noarch-sub 22 | Summary: Noarch subpackage 23 | Group: Undefined 24 | BuildArch: noarch 25 | 26 | %description noarch-sub 27 | Noarch subpackage test. 28 | 29 | %prep 30 | %autosetup -p 1 31 | 32 | %build 33 | # %configure 34 | # %%% 35 | 36 | %install 37 | rm -rf $RPM_BUILD_ROOT 38 | 39 | %clean 40 | rm -rf $RPM_BUILD_ROOT 41 | 42 | %files 43 | %defattr(-,root,root,-) 44 | %{_libdir}/foo 45 | 46 | %files noarch-sub 47 | %defattr(-,root,root,-) 48 | 49 | %changelog 50 | -------------------------------------------------------------------------------- /test/spec/SpecCheck.spec: -------------------------------------------------------------------------------- 1 | Name: SpecCheck 2 | Version: 0 3 | Release: 0 4 | Summary: None here 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | Patch: Patch.patch 11 | Patch1: Patch1.patch 12 | Patch2: Patch2.patch 13 | Patch3: Patch3.patch 14 | Patch4: Patch4.patch 15 | Patch5: Patch5.patch 16 | Patch6: Patch6.patch 17 | Patch7: Patch7.patch 18 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 19 | Provides: unversioned-provides, versioned-provides = 1.0 20 | Obsoletes: versioned-obsoletes < 2.0 21 | Obsoletes: unversioned-obsoletes 22 | Obsoletes: /usr/bin/unversioned-but-filename 23 | Provides: /sbin/another-unversioned-but-filename 24 | 25 | %description 26 | SpecCheck test. 27 | 28 | %package noarch-sub 29 | Summary: Noarch subpackage 30 | Group: Undefined 31 | BuildArch: noarch 32 | 33 | %description noarch-sub 34 | Noarch subpackage test. 35 | 36 | %prep 37 | %setup 38 | %patch1 39 | %patch 40 | %patch -P 2 -P 4 41 | sed -e s/foo/bar/ %{PATCH5} | %{__patch} -p1 42 | %{__patch} -p2 < %{PATCH6} 43 | patch -i %{PATCH7} 44 | 45 | %build 46 | # %configure 47 | # %%% 48 | 49 | %install 50 | rm -rf $RPM_BUILD_ROOT 51 | 52 | %clean 53 | rm -rf $RPM_BUILD_ROOT 54 | 55 | %files 56 | %defattr(-,root,root,-) 57 | %{_libdir}/foo 58 | 59 | %files noarch-sub 60 | %defattr(-,root,root,-) 61 | 62 | %changelog 63 | -------------------------------------------------------------------------------- /test/spec/SpecCheck2.spec: -------------------------------------------------------------------------------- 1 | Name: SpecCheck2 2 | Version: 0 3 | Release: 0 4 | Summary: None here 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | Patch: Patch.patch 11 | Patch1: Patch1.patch 12 | Patch2: Patch2.patch 13 | Patch3: Patch3.patch 14 | Patch4: Patch4.patch 15 | Patch5: Patch5.patch 16 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 17 | BuildRequires: source-for-second-rpm 18 | BuildArch: noarch 19 | ExclusiveArch: i586 20 | Requires: Oneanotherthing>=1.0 21 | Conflicts: Onelastthing==2.0 22 | 23 | %description 24 | macro-in-%changelog-deptoken:- 25 | (Developer Note) 26 | Macro can cause a warning which you can escape by using %%buildroot or 27 | %+buildroot or %.buildroot or any othersign prefixed with % 28 | for example %(-, +, .) and so on. 29 | Make sure you exclude %_buildroot or usage of % followed by _ 30 | 31 | %prep 32 | %autosetup 33 | 34 | %build 35 | %configure 36 | ./configure --libdir=%{_libdir} 37 | make %{_libdir} 38 | 39 | %install 40 | rm -rf $RPM_BUILD_ROOT 41 | 42 | %check 43 | 44 | %clean 45 | rm -rf $RPM_BUILD_ROOT 46 | 47 | %files 48 | %defattr(-,root,root,-) 49 | %{_libdir}/foo 50 | 51 | %changelog 52 | -------------------------------------------------------------------------------- /test/spec/SpecCheck3.spec: -------------------------------------------------------------------------------- 1 | Name: SpecCheck3 2 | Version: 0 3 | Release: 0 4 | Summary: None here 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | Patch: Patch.patch 11 | Patch1: Patch1.patch 12 | Patch2: Patch2.patch 13 | Patch3: Patch3.patch 14 | Patch4: Patch4.patch 15 | Patch5: Patch5.patch 16 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 17 | 18 | %description 19 | SpecCheck test 2. 20 | 21 | 22 | %prep 23 | %autosetup -N 24 | %autopatch 25 | 26 | 27 | %build 28 | 29 | 30 | %install 31 | rm -rf $RPM_BUILD_ROOT 32 | 33 | 34 | %clean 35 | rm -rf $RPM_BUILD_ROOT 36 | 37 | 38 | %files 39 | %defattr(-,root,root,-) 40 | %{_libdir}/foo 41 | 42 | 43 | %changelog 44 | -------------------------------------------------------------------------------- /test/spec/SpecCheck4.spec: -------------------------------------------------------------------------------- 1 | Name: SpecCheck4 2 | Version: 0.0.1 3 | Release: 0 4 | Summary: None here 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | Requires: require 11 | Provides: provide 12 | Obsoletes: obsolete 13 | Conflicts: conflict 14 | 15 | %description 16 | 17 | %prep 18 | %setup -q 19 | 20 | %build 21 | %configure 22 | %make_build 23 | 24 | %install 25 | %make_install 26 | 27 | %post 28 | %postun 29 | 30 | %files 31 | %license COPYING 32 | %doc ChangeLog README 33 | 34 | %changelog 35 | * Wed Oct 23 14:15:39 UTC 2019 - Frank Schreiner 36 | - changelog entry ....  37 | -------------------------------------------------------------------------------- /test/spec/SpecCheckPatch.spec: -------------------------------------------------------------------------------- 1 | 2 | Name: SpecCheckPatch 3 | Version: 0 4 | Release: 0 5 | Summary: None here 6 | 7 | Group: Undefined 8 | License: GPLv2 9 | URL: http://rpmlint.zarb.org/#%{name} 10 | Source0: Source0.tar.gz 11 | Patch1: Patch1.patch 12 | Patch2: Patch2.patch 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | 15 | %description 16 | SpecCheck test 2. 17 | 18 | 19 | %prep 20 | %setup -q 21 | %patch -P 1 -p1 22 | %patch -P2 -p1 23 | 24 | %build 25 | 26 | 27 | %install 28 | rm -rf $RPM_BUILD_ROOT 29 | 30 | 31 | %clean 32 | rm -rf $RPM_BUILD_ROOT 33 | 34 | 35 | %files 36 | %defattr(-,root,root,-) 37 | %{_libdir}/foo 38 | 39 | 40 | %changelog 41 | -------------------------------------------------------------------------------- /test/spec/bogus-date.spec: -------------------------------------------------------------------------------- 1 | ### Based on macro-in-changelog.spec, I added the date information in changlog, as follows: 2 | Name: macro-in 3 | Version: 0 4 | Release: 0 5 | Summary: macro-in 6 | License: GPL-2.0-only 7 | Group: Undefined 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | 11 | %description 12 | Macros are expanded in %changelog too, which can in unfortunate cases lead 13 | to the package not building at all, or other subtle unexpected conditions that 14 | affect the build. Even when that doesn't happen, the expansion results in 15 | possibly 'rewriting history' on subsequent package revisions and generally 16 | odd entries eg. in source rpms, which is rarely wanted. Avoid use of macros 17 | in %changelog altogether, or use two '%'s to escape them, like '%%foo'. 18 | 19 | %prep 20 | 21 | %build 22 | 23 | %install 24 | 25 | %files 26 | %{_libdir}/foo 27 | 28 | %changelog 29 | * Wed Oct 22 14:15:39 UTC 2019 - Frank Schreiner 30 | - 31 | -------------------------------------------------------------------------------- /test/spec/buildarch-instead-of-exclusivearch-tag.spec: -------------------------------------------------------------------------------- 1 | Name: buildarch-instead-of-exclusivearch-tag 2 | Version: 0 3 | Release: 0 4 | Summary: buildarch-instead-of-exclusivearch-tag warning 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | BuildArch: x86_64 11 | BuildArchitectures: i586 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | 14 | %description 15 | Use ExclusiveArch instead of BuildArch (or BuildArchitectures) 16 | to restrict build on some specific architectures. 17 | Only use BuildArch with noarch 18 | 19 | %prep 20 | %autosetup 21 | 22 | %build 23 | 24 | %install 25 | 26 | %clean 27 | 28 | %files 29 | %defattr(-,root,root,-) 30 | %{_libdir}/foo 31 | 32 | %changelog 33 | -------------------------------------------------------------------------------- /test/spec/buildprereq-use.spec: -------------------------------------------------------------------------------- 1 | Name: buildprereq-use 2 | Version: 0 3 | Release: 0 4 | Summary: buildprereq-use warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | BuildPreReq: Something 10 | 11 | %description 12 | The use of BuildPreReq is deprecated, build dependencies are always required 13 | before a package can be built. Use plain BuildRequires instead. 14 | 15 | %prep 16 | %autosetup 17 | 18 | %build 19 | 20 | %install 21 | 22 | %files 23 | %{_libdir}/foo 24 | 25 | %changelog 26 | -------------------------------------------------------------------------------- /test/spec/comparison-operator-in-deptoken.spec: -------------------------------------------------------------------------------- 1 | Name: comparison-operator-in-deptoken 2 | Version: 0 3 | Release: 0 4 | Summary: comparison-operator-in-deptoken warning. 5 | 6 | License: GPL-2.0-only 7 | Group: Undefined 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | BuildRequires: something>2.0 11 | Requires: Something>1.0 12 | Conflicts: Something=2.0 13 | 14 | %description 15 | This dependency token contains a comparison operator (<, > or =). This is 16 | usually not intended and may be caused by missing whitespace between the 17 | token's name, the comparison operator and the version string. 18 | 19 | %prep 20 | %autosetup 21 | 22 | %build 23 | 24 | %install 25 | 26 | %files 27 | %{_libdir}/foo 28 | 29 | %changelog 30 | -------------------------------------------------------------------------------- /test/spec/configure-without-libdir-spec.spec: -------------------------------------------------------------------------------- 1 | Name: configure-without-libdir-spec 2 | Version: 0 3 | Release: 0 4 | Summary: configure-without-libdir-spec warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | A configure script is run without specifying the libdir. configure 12 | options must be augmented with something like --libdir=%{_libdir} whenever 13 | the script supports it. 14 | 15 | %prep 16 | %autosetup 17 | 18 | %build 19 | ./configure 20 | 21 | %install 22 | 23 | %files 24 | 25 | %changelog 26 | -------------------------------------------------------------------------------- /test/spec/deprecated-grep.spec: -------------------------------------------------------------------------------- 1 | Name: deprecated-grep 2 | Version: 0 3 | Release: 0 4 | Summary: deprecated-grep warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | Direct use of grep as egrep or fgrep is deprecated in GNU grep and 12 | historical in POSIX, use grep -E and grep -F instead. 13 | 14 | %prep 15 | egrep something 16 | 17 | %build 18 | 19 | %install 20 | 21 | %files 22 | %{_libdir}/foo 23 | 24 | %changelog 25 | -------------------------------------------------------------------------------- /test/spec/depscript-without-disabling-depgen.spec: -------------------------------------------------------------------------------- 1 | %define __find_provides 2 | 3 | Name: depscript-without-disabling-depgen 4 | Version: 0 5 | Summary: depscript-without-disabling-depgen warning 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | In some common rpm configurations/versions, defining __find_provides and/or 12 | __find_requires has no effect if rpm's internal dependency generator has not 13 | been disabled for the build. %define _use_internal_dependency_generator to 0 14 | to disable it in the specfile, or don't define __find_provides/requires. 15 | 16 | %prep 17 | %autosetup 18 | 19 | %build 20 | 21 | %install 22 | 23 | %files 24 | %{_libdir}/foo 25 | 26 | %changelog 27 | -------------------------------------------------------------------------------- /test/spec/forbidden-controlchar-found.spec: -------------------------------------------------------------------------------- 1 | Name: SpecCheck_forbidden-controlchar-found 2 | Version: 1.0 3 | Release: 0 4 | Summary: forbidden-controlchar-found warning 5 | License: MIT 6 | URL: https://www.example.com 7 | Source: Source.tar.gz 8 | Requires: something_needed > 1.0 9 | Provides: something_new 10 | Obsoletes: something_old 11 | Conflicts: something_bad 12 | BuildRequires: gcc 13 | 14 | %description 15 | This package contains tags which contain forbidden control characters. 16 | These are all ASCII characters with a decimal value below 32, except TAB(9), 17 | LF(10) and CR(13) 18 | 19 | %prep 20 | %setup -q 21 | 22 | %build 23 | %configure 24 | %make_build 25 | 26 | %install 27 | %make_install 28 | 29 | %post 30 | %postun 31 | 32 | %files 33 | %license COPYING 34 | %doc ChangeLog README 35 | 36 | %changelog 37 | - This is a changelog entry with forbidden control character 38 | 39 | -------------------------------------------------------------------------------- /test/spec/hardcoded-library-path.spec: -------------------------------------------------------------------------------- 1 | Name: hardcoded-library-path 2 | Version: 0 3 | Release: 0 4 | Summary: hardcoded-library-path error 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 11 | 12 | %description 13 | A library path is hardcoded to one of the following paths: /lib, 14 | /usr/lib. It should be replaced by something like /%{_lib} or %{_libdir}. 15 | 16 | %prep 17 | %autosetup 18 | 19 | %build 20 | /usr/lib/bash/dirname/ 21 | /usr/lib 22 | /lib 23 | 24 | %clean 25 | 26 | %files 27 | %defattr(-,root,root,-) 28 | %{_libdir}/foo 29 | 30 | %changelog 31 | -------------------------------------------------------------------------------- /test/spec/hardcoded-packager-tag.spec: -------------------------------------------------------------------------------- 1 | Name: hardcoded-packager-tag 2 | Version: 0 3 | Release: 0 4 | Summary: hardcoded-packager-tag warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | Packager: Someone 10 | 11 | %description 12 | The Packager tag is hardcoded in your spec file. It should be removed, so 13 | as to use rebuilder's own defaults. 14 | 15 | %prep 16 | 17 | %build 18 | 19 | %install 20 | 21 | %files 22 | %{_libdir}/foo 23 | 24 | %changelog 25 | -------------------------------------------------------------------------------- /test/spec/hardcoded-path-in-buildroot-tag.spec: -------------------------------------------------------------------------------- 1 | Name: hardcoded-path-in-buildroot-tag 2 | Version: 0 3 | Release: 0 4 | Summary: hardcoded-path-in-buildroot-tag warning. 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Buildroot: /usr/bin/bash 9 | Source0: Source0.tar.gz 10 | 11 | %description 12 | A path is hardcoded in your Buildroot tag. It should be replaced 13 | by something like %{_tmppath}/%{name}-%{version}-build. 14 | 15 | %prep 16 | %autosetup 17 | 18 | %build 19 | 20 | %install 21 | 22 | %files 23 | %{_libdir}/foo 24 | 25 | %changelog 26 | -------------------------------------------------------------------------------- /test/spec/hardcoded-prefix-tag.spec: -------------------------------------------------------------------------------- 1 | Name: hardcoded-prefix-tag 2 | Version: 0 3 | Release: 0 4 | Summary: hardcoded-prefix-tag warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | Prefix: /usr/bin/bash 10 | 11 | %description 12 | The Prefix tag is hardcoded in your spec file. It should be removed, so as 13 | to allow package relocation. 14 | 15 | %prep 16 | 17 | %build 18 | 19 | %install 20 | 21 | %files 22 | %{_libdir}/foo 23 | 24 | %changelog 25 | -------------------------------------------------------------------------------- /test/spec/lib-package-without-%mklibname.spec: -------------------------------------------------------------------------------- 1 | Name: SpecCheck34 2 | Version: 0 3 | Release: 0 4 | Summary: None here 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 11 | 12 | %description 13 | SpecCheck test 34. 14 | 15 | %package -n %{libname} 16 | 17 | %prep 18 | %autosetup 19 | 20 | %build 21 | 22 | 23 | %install 24 | rm -rf $RPM_BUILD_ROOT 25 | 26 | 27 | %clean 28 | rm -rf $RPM_BUILD_ROOT 29 | 30 | 31 | %files 32 | %defattr(-,root,root,-) 33 | %{_libdir}/foo 34 | 35 | 36 | %changelog 37 | -------------------------------------------------------------------------------- /test/spec/libdir-macro-in-noarch-package.spec: -------------------------------------------------------------------------------- 1 | Name: libdir-macro-in-noarch-package 2 | Version: 0 3 | Release: 0 4 | Summary: libdir-macro-in-noarch-packagew warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | BuildArch: noarch 10 | 11 | %description 12 | The %{_libdir} or %{_lib} macro was found in a noarch package in a section 13 | that gets included in binary packages. This is most likely an error because 14 | these macros are expanded on the build host and their values vary between 15 | architectures, probably resulting in a package that does not work properly 16 | on all architectures at runtime. Investigate whether the package is really 17 | architecture independent or if some other dir/macro should be instead. 18 | 19 | %prep 20 | 21 | %build 22 | 23 | %install 24 | 25 | %files 26 | %{_libdir}/foo 27 | 28 | %changelog 29 | -------------------------------------------------------------------------------- /test/spec/macro-in-changelog-autochangelog.spec: -------------------------------------------------------------------------------- 1 | Name: macro-in-%changelog 2 | Version: 0 3 | Release: 0 4 | Summary: macro-in-%changelog warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | Macros are expanded in %changelog too, which can in unfortunate cases lead 12 | to the package not building at all, or other subtle unexpected conditions that 13 | affect the build. Even when that doesn't happen, the expansion results in 14 | possibly 'rewriting history' on subsequent package revisions and generally 15 | odd entries eg. in source rpms, which is rarely wanted. Avoid use of macros 16 | in %changelog altogether, or use two '%'s to escape them, like '%%foo'. 17 | 18 | %prep 19 | 20 | %build 21 | 22 | %install 23 | 24 | %files 25 | %{_libdir}/foo 26 | 27 | %changelog 28 | %autochangelog 29 | -------------------------------------------------------------------------------- /test/spec/macro-in-changelog.spec: -------------------------------------------------------------------------------- 1 | Name: macro-in-%changelog 2 | Version: 0 3 | Release: 0 4 | Summary: macro-in-%changelog warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | Macros are expanded in %changelog too, which can in unfortunate cases lead 12 | to the package not building at all, or other subtle unexpected conditions that 13 | affect the build. Even when that doesn't happen, the expansion results in 14 | possibly 'rewriting history' on subsequent package revisions and generally 15 | odd entries eg. in source rpms, which is rarely wanted. Avoid use of macros 16 | in %changelog altogether, or use two '%'s to escape them, like '%%foo'. 17 | 18 | %prep 19 | 20 | %build 21 | 22 | %install 23 | 24 | %files 25 | %{_libdir}/foo 26 | 27 | %changelog 28 | You have a %buildroot macro 29 | -------------------------------------------------------------------------------- /test/spec/macro-in-comment.spec: -------------------------------------------------------------------------------- 1 | Name: macro-in-comment 2 | Version: 0 3 | Release: 0 4 | Summary: macro-in-comment-warning 5 | Patch0: patch0.patch 6 | License: GPL-2.0-only 7 | Group: 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | 11 | %description 12 | There is a unescaped macro after a shell style comment in the specfile. 13 | Macros are expanded everywhere, so check if it can cause a problem in this 14 | case and escape the macro with another leading % if appropriate. 15 | 16 | %prep 17 | %autopatch 18 | %autosetup 19 | 20 | %build 21 | # this is a comment %{version} 22 | 23 | %install 24 | 25 | %files 26 | %{_libdir}/foo 27 | 28 | %changelog 29 | -------------------------------------------------------------------------------- /test/spec/make-check-outside-check-section.spec: -------------------------------------------------------------------------------- 1 | Name: make-check-outside-check-section 2 | Version: 0 3 | Release: 0 4 | Summary: make-check-outside-check-section warning. 5 | Group: Undefined 6 | License: GPLv2 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | 9 | %description 10 | Make check or other automated regression test should be run in %check, as 11 | they can be disabled with a rpm macro for short circuiting purposes 12 | 13 | %prep 14 | 15 | make check 16 | 17 | %check 18 | 19 | %changelog 20 | -------------------------------------------------------------------------------- /test/spec/mixed-use-of-spaces-and-tabs.spec: -------------------------------------------------------------------------------- 1 | Name: mixed-use-of-spaces-and-tabs 2 | Version: 0 3 | Release: 0 4 | Summary: mixed-use-of-spaces-and-tabs warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | Patch0: Patch0.patch 10 | Requires: php 11 | 12 | %description 13 | The specfile mixes use of spaces and tabs for indentation, which is a 14 | cosmetic annoyance. 15 | 16 | %prep 17 | cd lib 18 | 19 | %autopatch 20 | %autosetup 21 | 22 | %build 23 | 24 | %install 25 | %ifarch 26 | # apply patch0 27 | %patch0 -p0 28 | %endif 29 | 30 | %files 31 | %{_libdir}/foo 32 | 33 | %changelog 34 | -------------------------------------------------------------------------------- /test/spec/more-than-one-%changelog.spec: -------------------------------------------------------------------------------- 1 | Name: more-than-one-%changelog-section 2 | Version: 0 3 | Release: 0 4 | Summary: more-than-one-%changelog-section 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | The spec file unnecessarily contains more than one %changelog section. 12 | 13 | %prep 14 | %autosetup 15 | 16 | %build 17 | 18 | %install 19 | 20 | %files 21 | %{_libdir}/foo 22 | 23 | %changelog 24 | something. 25 | %changelog 26 | one another thing. 27 | -------------------------------------------------------------------------------- /test/spec/no-%%%s-section.spec: -------------------------------------------------------------------------------- 1 | Name: no-%%%s-section 2 | Version: 0 3 | Release: 0 4 | Summary: no-%%%s-section warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | 8 | %description 9 | no-%prep-section:- 10 | The spec file does not contain a %prep section. Even if some packages don't 11 | directly need it, section markers may be overridden in rpm's configuration 12 | to provide additional 'under the hood' functionality. Add the section, even 13 | if empty. 14 | no-%build-section:- 15 | The spec file does not contain a %build section. Even if some packages 16 | don't directly need it, section markers may be overridden in rpm's 17 | configuration to provide additional 'under the hood' functionality, such as 18 | injection of automatic -debuginfo subpackages. Add the section, even if 19 | empty. 20 | no-%install-section:- 21 | The spec file does not contain an %install section. Even if some packages 22 | don't directly need it, section markers may be overridden in rpm's 23 | configuration to provide additional 'under the hood' functionality. Add the 24 | section, even if empty. 25 | no-%{clean}-section:- 26 | The spec file doesn't contain a %{clean} section to remove the files installed 27 | by the %install section 28 | 29 | %files 30 | %{_libdir}/foo 31 | 32 | %changelog 33 | -------------------------------------------------------------------------------- /test/spec/no-buildroot-tag.spec: -------------------------------------------------------------------------------- 1 | Name: no-buildroot-tag 2 | Version: 0 3 | Release: 0 4 | Summary: no-buildroot-tag warning 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | 9 | %description 10 | The BuildRoot tag isn't used in your spec. It must be used in order to 11 | allow building the package as non root on some systems. For some rpm versions 12 | (e.g. rpm.org >= 4.6) the BuildRoot tag is not necessary in specfiles and is 13 | ignored by rpmbuild; if your package is only going to be built with such rpm 14 | versions you can ignore this warning. 15 | 16 | %files 17 | %defattr(-,root,root,-) 18 | %{_libdir}/foo 19 | 20 | %changelog 21 | -------------------------------------------------------------------------------- /test/spec/non-break-space.spec: -------------------------------------------------------------------------------- 1 | Name: non-break-space 2 | Version: 0 3 | Release: 0 4 | Summary: non-break-space warning. 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | The spec file contains a non-break space, which looks like a regular space 12 | in some editors but can lead to obscure errors. It should be replaced by a 13 | regular space. 14 | 15 | %prep 16 | 17 | %build 18 | 19 | %install 20 | 21 | %files 22 | %{_libdir}/foo 23 | 24 | %changelog 25 | -------------------------------------------------------------------------------- /test/spec/non-standard-group.spec: -------------------------------------------------------------------------------- 1 | Name: non-standard-group 2 | Version: 1.0 3 | Release: 0 4 | Summary: non-standard-group warning 5 | License: MIT 6 | Group: Something 7 | URL: https://www.example.com 8 | Source: Source.tar.gz 9 | BuildRequires: gcc 10 | 11 | %description 12 | A test specfile with Group (Group: Something) that is not standard. The value of the Group tag in the package is not valid. 13 | 14 | %prep 15 | %setup -q 16 | 17 | %build 18 | %configure 19 | %make_build 20 | 21 | %install 22 | %make_install 23 | 24 | %post 25 | %postun 26 | 27 | %files 28 | %license COPYING 29 | %doc ChangeLog README 30 | 31 | %changelog 32 | -------------------------------------------------------------------------------- /test/spec/non-utf8-spec-file.spec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rpm-software-management/rpmlint/54b1d8c53930627ef850c3ac8062d2aa8ffeaf47/test/spec/non-utf8-spec-file.spec -------------------------------------------------------------------------------- /test/spec/null-char-first.spec: -------------------------------------------------------------------------------- 1 | 2 | Name: SpecCheck 3 | Version: 0 4 | Release: 0 5 | Summary: None here 6 | 7 | Group: Undefined 8 | License: GPLv2 9 | URL: http://rpmlint.zarb.org/#%{name} 10 | Source0: Source0.tar.gz 11 | Patch: Patch.patch 12 | Patch1: Patch1.patch 13 | Patch2: Patch2.patch 14 | Patch3: Patch3.patch 15 | Patch4: Patch4.patch 16 | Patch5: Patch5.patch 17 | Patch6: Patch6.patch 18 | Patch7: Patch7.patch 19 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 20 | Provides: unversioned-provides, versioned-provides = 1.0 21 | Obsoletes: versioned-obsoletes < 2.0 22 | Obsoletes: unversioned-obsoletes 23 | Obsoletes: /usr/bin/unversioned-but-filename 24 | Provides: /sbin/another-unversioned-but-filename 25 | 26 | %description 27 | SpecCheck test. 28 | 29 | %package noarch-sub 30 | Summary: Noarch subpackage 31 | Group: Undefined 32 | BuildArch: noarch 33 | 34 | %description noarch-sub 35 | Noarch subpackage test. 36 | 37 | %prep 38 | %setup 39 | %patch1 40 | %patch 41 | %patch -P 2 -P 4 42 | sed -e s/foo/bar/ %{PATCH5} | %{__patch} -p1 43 | %{__patch} -p2 < %{PATCH6} 44 | patch -i %{PATCH7} 45 | 46 | %build 47 | # %configure 48 | # %%% 49 | 50 | %install 51 | rm -rf $RPM_BUILD_ROOT 52 | 53 | %clean 54 | rm -rf $RPM_BUILD_ROOT 55 | 56 | %files 57 | %defattr(-,root,root,-) 58 | %{_libdir}/foo 59 | 60 | %files noarch-sub 61 | %defattr(-,root,root,-) 62 | 63 | %changelog 64 | -------------------------------------------------------------------------------- /test/spec/null-char-last.spec: -------------------------------------------------------------------------------- 1 | Name: SpecCheck 2 | Version: 0 3 | Release: 0 4 | Summary: None here 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | Patch: Patch.patch 11 | Patch1: Patch1.patch 12 | Patch2: Patch2.patch 13 | Patch3: Patch3.patch 14 | Patch4: Patch4.patch 15 | Patch5: Patch5.patch 16 | Patch6: Patch6.patch 17 | Patch7: Patch7.patch 18 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 19 | Provides: unversioned-provides, versioned-provides = 1.0 20 | Obsoletes: versioned-obsoletes < 2.0 21 | Obsoletes: unversioned-obsoletes 22 | Obsoletes: /usr/bin/unversioned-but-filename 23 | Provides: /sbin/another-unversioned-but-filename 24 | 25 | %description 26 | SpecCheck test. 27 | 28 | %package noarch-sub 29 | Summary: Noarch subpackage 30 | Group: Undefined 31 | BuildArch: noarch 32 | 33 | %description noarch-sub 34 | Noarch subpackage test. 35 | 36 | %prep 37 | %setup 38 | %patch1 39 | %patch 40 | %patch -P 2 -P 4 41 | sed -e s/foo/bar/ %{PATCH5} | %{__patch} -p1 42 | %{__patch} -p2 < %{PATCH6} 43 | patch -i %{PATCH7} 44 | 45 | %build 46 | # %configure 47 | # %%% 48 | 49 | %install 50 | rm -rf $RPM_BUILD_ROOT 51 | 52 | %clean 53 | rm -rf $RPM_BUILD_ROOT 54 | 55 | %files 56 | %defattr(-,root,root,-) 57 | %{_libdir}/foo 58 | 59 | %files noarch-sub 60 | %defattr(-,root,root,-) 61 | 62 | %changelog 63 | 64 | -------------------------------------------------------------------------------- /test/spec/obsolete-tag.spec: -------------------------------------------------------------------------------- 1 | Name: obsolete-tag 2 | Version: 0 3 | Release: 0 4 | Summary: obsolete-tag warning. 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | Serial: 2 10 | Copyright: Something 11 | 12 | %description 13 | The following tags are obsolete: Copyright and Serial. They must 14 | be replaced by License and Epoch respectively. 15 | 16 | %prep 17 | %autosetup 18 | 19 | %build 20 | 21 | %install 22 | 23 | %files 24 | %{_libdir}/foo 25 | 26 | %changelog 27 | -------------------------------------------------------------------------------- /test/spec/patch-fuzz-is-changed.spec: -------------------------------------------------------------------------------- 1 | %define _default_patch_fuzz 2 2 | Name: patch-fuzz-is-changed 3 | Version: 1.0 4 | Release: 0 5 | Summary: patch-fuzz-is-changed warning 6 | License: MIT 7 | URL: https://www.example.com 8 | Source: Source.tar.gz 9 | BuildRequires: gcc 10 | 11 | %description 12 | The internal patch fuzz value was changed, and could hide patchs issues, or 13 | could lead to applying a patch at the wrong location. Usually, this is often 14 | the sign that someone didn't check if a patch is still needed and do not want 15 | to rediff it. It is usually better to rediff the patch and try to send it 16 | 17 | %prep 18 | %setup -q 19 | 20 | %build 21 | %configure 22 | %make_build 23 | 24 | %install 25 | %make_install 26 | 27 | %post 28 | %postun 29 | 30 | %files 31 | %license COPYING 32 | %doc ChangeLog README 33 | 34 | %changelog 35 | -------------------------------------------------------------------------------- /test/spec/patch-not-applied.spec: -------------------------------------------------------------------------------- 1 | Name: patch-not-applied 2 | Version: 0 3 | Release: 0 4 | Summary: invalid-url warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | Patch0: Patch.patch 8 | Patch1: Patch1.patch 9 | 10 | %description 11 | A patch is included in your package but was not applied. 12 | 13 | %prep 14 | 15 | %build 16 | 17 | %install 18 | %patch -P 19 | 20 | %files 21 | %{_libdir}/foo 22 | 23 | %changelog 24 | -------------------------------------------------------------------------------- /test/spec/prereq_use.spec: -------------------------------------------------------------------------------- 1 | Name: prereq_use 2 | Version: 0 3 | Release: 0 4 | Summary: prereq_use warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | Patch0: Patch0.patch 10 | PreReq(pre): none 11 | PreReq(post): none_other 12 | 13 | %description 14 | The use of PreReq is deprecated. In the majority of cases, a plain Requires 15 | is enough and the right thing to do. Sometimes Requires(pre), Requires(post), 16 | Requires(preun) and/or Requires(postun) can also be used instead of PreReq. 17 | 18 | %prep 19 | cd lib 20 | 21 | %autopatch 22 | %autosetup 23 | 24 | %build 25 | 26 | %install 27 | %ifarch 28 | # apply patch0 29 | %patch0 -p0 30 | %endif 31 | 32 | %files 33 | %{_libdir}/foo 34 | 35 | %changelog 36 | -------------------------------------------------------------------------------- /test/spec/python-module-def.spec: -------------------------------------------------------------------------------- 1 | %{?!python_module:%define python_module() python-%{**} python3-%{**}} 2 | 3 | Name: python-module-def 4 | Version: 1.0 5 | Release: 0 6 | Summary: python-module-def warning 7 | License: MIT 8 | URL: https://www.example.com 9 | Source: Source.tar.gz 10 | BuildRequires: gcc 11 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 12 | 13 | %description 14 | A test specfile with python setup.py test that is deprecated. 15 | 16 | %prep 17 | %setup -q 18 | 19 | %build 20 | %configure 21 | %make_build 22 | 23 | %install 24 | %make_install 25 | 26 | %check 27 | %pytest 28 | 29 | %post 30 | %postun 31 | 32 | %files 33 | %license COPYING 34 | %doc ChangeLog README 35 | 36 | %changelog 37 | -------------------------------------------------------------------------------- /test/spec/python-setup-install.spec: -------------------------------------------------------------------------------- 1 | Name: python-setup-install 2 | Version: 1.0 3 | Release: 0 4 | Summary: python-setup-install warning 5 | License: MIT 6 | URL: https://www.example.com 7 | Source: Source.tar.gz 8 | BuildRequires: gcc 9 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 10 | 11 | %description 12 | A test specfile with python setup.py test that is deprecated. 13 | 14 | %prep 15 | %setup -q 16 | 17 | %build 18 | python3 setup.py build 19 | 20 | %install 21 | python3 setup.py install 22 | 23 | %check 24 | 25 | %files 26 | %license COPYING 27 | %doc ChangeLog README 28 | 29 | %changelog 30 | -------------------------------------------------------------------------------- /test/spec/python-setup-python_install.spec: -------------------------------------------------------------------------------- 1 | Name: python-setup-python_install 2 | Version: 1.0 3 | Release: 0 4 | Summary: python-setup-install warning 5 | License: MIT 6 | URL: https://www.example.com 7 | Source: Source.tar.gz 8 | BuildRequires: gcc 9 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 10 | 11 | %description 12 | A test specfile with python setup.py test that is deprecated. 13 | 14 | %prep 15 | %setup -q 16 | 17 | %build 18 | %python_build 19 | 20 | %install 21 | %python_install 22 | %python3_install 23 | %python312_install 24 | # old fedora version 25 | %py3_install 26 | 27 | %check 28 | 29 | %files 30 | %license COPYING 31 | %doc ChangeLog README 32 | 33 | %changelog 34 | -------------------------------------------------------------------------------- /test/spec/python-setup-test.spec: -------------------------------------------------------------------------------- 1 | Name: python-setup-test 2 | Version: 1.0 3 | Release: 0 4 | Summary: python-setup-test warning 5 | License: MIT 6 | URL: https://www.example.com 7 | Source: Source.tar.gz 8 | BuildRequires: gcc 9 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 10 | 11 | %description 12 | A test specfile with python setup.py test that is deprecated. 13 | 14 | %prep 15 | %setup -q 16 | 17 | %build 18 | %configure 19 | %make_build 20 | 21 | %install 22 | %make_install 23 | 24 | %check 25 | %python_exec setup.py test 26 | 27 | %post 28 | %postun 29 | 30 | %files 31 | %license COPYING 32 | %doc ChangeLog README 33 | 34 | %changelog 35 | -------------------------------------------------------------------------------- /test/spec/python-sitearch-glob.spec: -------------------------------------------------------------------------------- 1 | # 2 | # spec file for package python-sitearch-glob 3 | # 4 | # Copyright (c) specCURRENT_YEAR SUSE LINUX GmbH, Nuernberg, Germany. 5 | # 6 | # All modifications and additions to the file contributed by third parties 7 | # remain the property of their copyright owners, unless otherwise agreed 8 | # upon. The license for this file, and modifications and additions to the 9 | # file, is the same license as for the pristine package itself (unless the 10 | # license for the pristine package is not an Open Source License, in which 11 | # case the license is the MIT License). An "Open Source License" is a 12 | # license that conforms to the Open Source Definition (Version 1.9) 13 | # published by the Open Source Initiative. 14 | 15 | # Please submit bugfixes or comments via http://bugs.opensuse.org/ 16 | # 17 | 18 | 19 | Name: python-sitearch-glob 20 | Version: 0.1 21 | Release: 0 22 | Summary: Cool Python package 23 | License: GPL-2.0-or-later 24 | # FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines" 25 | Group: Development/Libraries/Python 26 | Url: http://rpmlint.zarb.org/#%{name} 27 | BuildRequires: python-rpm-macros 28 | %{python_subpackages} 29 | 30 | %description 31 | Cool Python Package 32 | 33 | %prep 34 | %autosetup -p1 35 | 36 | %build 37 | %python_build 38 | 39 | %install 40 | %python_install 41 | 42 | %files %{python_files} 43 | %{python_sitearch}/* 44 | 45 | %changelog 46 | -------------------------------------------------------------------------------- /test/spec/python-sitelib-glob.spec: -------------------------------------------------------------------------------- 1 | # 2 | # spec file for package python-sitelib-glob 3 | # 4 | # Copyright (c) specCURRENT_YEAR SUSE LINUX GmbH, Nuernberg, Germany. 5 | # 6 | # All modifications and additions to the file contributed by third parties 7 | # remain the property of their copyright owners, unless otherwise agreed 8 | # upon. The license for this file, and modifications and additions to the 9 | # file, is the same license as for the pristine package itself (unless the 10 | # license for the pristine package is not an Open Source License, in which 11 | # case the license is the MIT License). An "Open Source License" is a 12 | # license that conforms to the Open Source Definition (Version 1.9) 13 | # published by the Open Source Initiative. 14 | 15 | # Please submit bugfixes or comments via http://bugs.opensuse.org/ 16 | # 17 | 18 | 19 | Name: python-sitelib-glob 20 | Version: 0.1 21 | Release: 0 22 | Summary: Cool Python package 23 | License: GPL-2.0-or-later 24 | # FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines" 25 | Group: Development/Libraries/Python 26 | Url: http://rpmlint.zarb.org/#%{name} 27 | BuildRequires: python-rpm-macros 28 | %{python_subpackages} 29 | 30 | %description 31 | Cool Python Package 32 | 33 | %prep 34 | %autosetup -p1 35 | 36 | %build 37 | %python_build 38 | 39 | %install 40 | %python_install 41 | 42 | %files %{python_files} 43 | %{python_sitelib}/* 44 | 45 | %changelog 46 | 47 | -------------------------------------------------------------------------------- /test/spec/python-sitelib.spec: -------------------------------------------------------------------------------- 1 | # 2 | # spec file for package python-sitelib 3 | # 4 | # Copyright (c) specCURRENT_YEAR SUSE LINUX GmbH, Nuernberg, Germany. 5 | # 6 | # All modifications and additions to the file contributed by third parties 7 | # remain the property of their copyright owners, unless otherwise agreed 8 | # upon. The license for this file, and modifications and additions to the 9 | # file, is the same license as for the pristine package itself (unless the 10 | # license for the pristine package is not an Open Source License, in which 11 | # case the license is the MIT License). An "Open Source License" is a 12 | # license that conforms to the Open Source Definition (Version 1.9) 13 | # published by the Open Source Initiative. 14 | 15 | # Please submit bugfixes or comments via http://bugs.opensuse.org/ 16 | # 17 | 18 | 19 | Name: python-sitelib 20 | Version: 0.1 21 | Release: 0 22 | Summary: Cool Python package 23 | License: GPL-2.0-or-later 24 | # FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines" 25 | Group: Development/Libraries/Python 26 | Url: http://rpmlint.zarb.org/#%{name} 27 | BuildRequires: python-rpm-macros 28 | %{python_subpackages} 29 | 30 | %description 31 | Cool Python Package 32 | 33 | %prep 34 | %autosetup -p1 35 | 36 | %build 37 | %python_build 38 | 39 | %install 40 | %python_install 41 | 42 | %files %{python_files} 43 | %{python_sitelib}/sitelib 44 | %{python_sitelib}/sitelib/* 45 | %{python_sitelib}/sitelib-%{version}*-info 46 | 47 | %changelog 48 | 49 | -------------------------------------------------------------------------------- /test/spec/rpm-buildroot-usage-shell-var.spec: -------------------------------------------------------------------------------- 1 | Name: rpm-buildroot-usage-shell-var 2 | Version: 0 3 | Release: 0 4 | Summary: rpm-buildroot-usage warning (when referenced as shell variable). 5 | Group: Undefined 6 | License: GPLv2 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 10 | 11 | %description 12 | $RPM_BUILD_ROOT should not be touched during %build or %prep stage, as it 13 | may break short circuit builds. 14 | 15 | %prep 16 | # None of these actually refer to the build root 17 | \$RPM_BUILD_ROOT 18 | \\\$RPM_BUILD_ROOT 19 | # $RPM_BUILD_ROOT 20 | 21 | %build 22 | \\$RPM_BUILD_ROOT 23 | echo ${RPM_BUILD_ROOT} # comment 24 | 25 | %install 26 | 27 | %clean 28 | 29 | %files 30 | %defattr(-,root,root,-) 31 | %{_libdir}/foo 32 | 33 | %changelog 34 | -------------------------------------------------------------------------------- /test/spec/rpm-buildroot-usage.spec: -------------------------------------------------------------------------------- 1 | Name: rpm-buildroot-usage 2 | Version: 0 3 | Release: 0 4 | Summary: rpm-buildroot-usage warning. 5 | Group: Undefined 6 | License: GPLv2 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 10 | 11 | %description 12 | $RPM_BUILD_ROOT should not be touched during %build or %prep stage, as it 13 | may break short circuit builds. 14 | 15 | %prep 16 | %buildroot 17 | 18 | %install 19 | 20 | %clean 21 | 22 | %files 23 | %defattr(-,root,root,-) 24 | %{_libdir}/foo 25 | 26 | %changelog 27 | -------------------------------------------------------------------------------- /test/spec/setup-not-in-prep.spec: -------------------------------------------------------------------------------- 1 | Name: setup-not-in-prep 2 | Version: 0 3 | Release: 0 4 | Summary: setup-not-in-prep warning 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | The %setup macro should only be used within the %prep section because it may 12 | not expand to anything outside of it and can break the build in unpredictable. 13 | 14 | %setup 15 | 16 | %prep 17 | 18 | %build 19 | 20 | %files 21 | %{_libdir}/foo 22 | 23 | %changelog 24 | -------------------------------------------------------------------------------- /test/spec/setup-not-quiet.spec: -------------------------------------------------------------------------------- 1 | Name: setup-not-quiet 2 | Version: 0 3 | Release: 0 4 | Summary: setup-not-quiet warning. 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | Use the -q option to the %setup macro to avoid useless build output from 12 | unpacking the sources. 13 | 14 | %prep 15 | 16 | %setup 17 | 18 | %build 19 | 20 | %install 21 | 22 | %files 23 | %{_libdir}/foo 24 | 25 | %changelog 26 | -------------------------------------------------------------------------------- /test/spec/shared-bindir-glob-in-files.spec: -------------------------------------------------------------------------------- 1 | Name: shared-bindir-glob-in-files 2 | Version: 1.0 3 | Release: 1%{?dist} 4 | Summary: Dummy test package 5 | 6 | License: Public Domain 7 | URL: http://fedoraproject.org/ 8 | 9 | %description 10 | 11 | 12 | %prep 13 | 14 | 15 | %build 16 | 17 | 18 | %install 19 | 20 | 21 | %files 22 | %{_bindir}/* 23 | 24 | 25 | %changelog 26 | * Wed Apr 23 2025 Tim Landscheidt 27 | - 28 | -------------------------------------------------------------------------------- /test/spec/shared-datadir-glob-in-files.spec: -------------------------------------------------------------------------------- 1 | Name: shared-datadir-glob-in-files 2 | Version: 1.0 3 | Release: 1%{?dist} 4 | Summary: Dummy test package 5 | 6 | License: Public Domain 7 | URL: http://fedoraproject.org/ 8 | 9 | %description 10 | 11 | 12 | %prep 13 | 14 | 15 | %build 16 | 17 | 18 | %install 19 | 20 | 21 | %files 22 | %{_datadir}/* 23 | 24 | 25 | %changelog 26 | * Wed Apr 23 2025 Tim Landscheidt 27 | - 28 | -------------------------------------------------------------------------------- /test/spec/shared-docdir-glob-in-files.spec: -------------------------------------------------------------------------------- 1 | Name: shared-docdir-glob-in-files 2 | Version: 1.0 3 | Release: 1%{?dist} 4 | Summary: Dummy test package 5 | 6 | License: Public Domain 7 | URL: http://fedoraproject.org/ 8 | 9 | %description 10 | 11 | 12 | %prep 13 | 14 | 15 | %build 16 | 17 | 18 | %install 19 | 20 | 21 | %files 22 | %{_docdir}/* 23 | 24 | 25 | %changelog 26 | * Wed Apr 23 2025 Tim Landscheidt 27 | - 28 | -------------------------------------------------------------------------------- /test/spec/shared-includedir-glob-in-files.spec: -------------------------------------------------------------------------------- 1 | Name: shared-includedir-glob-in-files 2 | Version: 1.0 3 | Release: 1%{?dist} 4 | Summary: Dummy test package 5 | 6 | License: Public Domain 7 | URL: http://fedoraproject.org/ 8 | 9 | %description 10 | 11 | 12 | %prep 13 | 14 | 15 | %build 16 | 17 | 18 | %install 19 | 20 | 21 | %files 22 | %{_includedir}/* 23 | 24 | 25 | %changelog 26 | * Wed Apr 23 2025 Tim Landscheidt 27 | - 28 | -------------------------------------------------------------------------------- /test/spec/shared-mandir-glob-in-files.spec: -------------------------------------------------------------------------------- 1 | Name: shared-mandir-glob-in-files 2 | Version: 1.0 3 | Release: 1%{?dist} 4 | Summary: Dummy test package 5 | 6 | License: Public Domain 7 | URL: http://fedoraproject.org/ 8 | 9 | %description 10 | 11 | 12 | %prep 13 | 14 | 15 | %build 16 | 17 | 18 | %install 19 | 20 | 21 | %files 22 | %{_mandir}/* 23 | 24 | 25 | %changelog 26 | * Wed Apr 23 2025 Tim Landscheidt 27 | - 28 | -------------------------------------------------------------------------------- /test/spec/unversioned-explicit-obsoletes.spec: -------------------------------------------------------------------------------- 1 | Name: unversioned-explicit-obsoletes 2 | Version: 0 3 | Release: 0 4 | Summary: unversioned-explicit-obsoletes 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | Obsoletes: Something 10 | 11 | %description 12 | The specfile contains an unversioned Obsoletes: token, which will match all 13 | older, equal and newer versions of the obsoleted thing. This may cause update 14 | problems, restrict future package/provides naming, and may match something it 15 | was originally not inteded to match -- make the Obsoletes versioned if 16 | possible. 17 | 18 | %prep 19 | %autosetup 20 | 21 | %build 22 | 23 | %install 24 | 25 | %files 26 | %{_libdir}/foo 27 | 28 | %changelog 29 | -------------------------------------------------------------------------------- /test/spec/unversioned-explicit-version.spec: -------------------------------------------------------------------------------- 1 | Name: unversioned-explicit-provides 2 | Version: 0 3 | Release: 0 4 | Summary: unversioned-explicit-provides warning. 5 | 6 | Group: Undefined 7 | License: GPLv2 8 | URL: http://rpmlint.zarb.org/#%{name} 9 | Source0: Source0.tar.gz 10 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 11 | Provides: someones-something=%{version} 12 | 13 | %description 14 | The specfile contains an unversioned Provides: token, which will match all 15 | older, equal, and newer versions of the provided thing. This may cause 16 | update problems and will make versioned dependencies, obsoletions and conflicts 17 | on the provided thing useless -- make the Provides versioned if possible. 18 | 19 | %prep 20 | %autosetup 21 | 22 | %build 23 | 24 | %install 25 | rm -rf $RPM_BUILD_ROOT 26 | 27 | %clean 28 | rm -rf $RPM_BUILD_ROOT 29 | 30 | %files 31 | %defattr(-,root,root,-) 32 | %{_libdir}/foo 33 | 34 | %changelog 35 | -------------------------------------------------------------------------------- /test/spec/use-of-RPM-SOURCE-DIR.spec: -------------------------------------------------------------------------------- 1 | Name: use-of-RPM-SOURCE-DIR 2 | Version: 0 3 | Release: 0 4 | Summary: use-of-RPM-SOURCE-DIR error 5 | License: GPL-2.0-only 6 | Group: Undefined 7 | URL: http://rpmlint.zarb.org/#%{name} 8 | Source0: Source0.tar.gz 9 | 10 | %description 11 | You use $RPM_SOURCE_DIR or %{_sourcedir} in your spec file. If you have to 12 | use a directory for building, use %{buildroot} instead. 13 | 14 | %prep 15 | %autosetup 16 | 17 | %build 18 | 19 | %{_sourcedir} 20 | 21 | %install 22 | rm -rf $RPM_SOURCE_DIR 23 | 24 | %files 25 | %{_libdir}/foo 26 | 27 | %changelog 28 | -------------------------------------------------------------------------------- /test/test_FHS.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_FHS import NoFHSPackage 2 | import pytest 3 | from rpmlint.checks.FHSCheck import FHSCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def fhscheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = FHSCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [NoFHSPackage]) 18 | def test_FHS_compliance(package, fhscheck): 19 | """ 20 | Check that the directories are not FHS compliant. 21 | """ 22 | output, test = fhscheck 23 | test.check(package) 24 | out = output.print_results(output.results) 25 | 26 | # Check invalid /usr subdirectory 27 | assert 'non-standard-dir-in-usr' in out 28 | assert 'sbin' in out 29 | 30 | # Check invalid /var subdirectory 31 | assert 'non-standard-dir-in-var' in out 32 | assert 'lib' in out 33 | -------------------------------------------------------------------------------- /test/test_LSB.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_LSB import NonLSBCompliancePackage 2 | import pytest 3 | from rpmlint.checks.LSBCheck import LSBCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def lsbcheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = LSBCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [NonLSBCompliancePackage]) 18 | def test_LSB_compliance(package, lsbcheck): 19 | """ 20 | Check that the package name, version and release number are LSB compliant. 21 | """ 22 | output, test = lsbcheck 23 | test.check(package) 24 | out = output.print_results(output.results) 25 | 26 | # Check invalid package name 27 | assert 'non-lsb-compliant-package-name' in out 28 | assert 'package name contains an illegal character' in out 29 | 30 | # Check invalid package version 31 | assert 'non-lsb-compliant-version' in out 32 | assert 'version number contains an illegal character' in out 33 | 34 | # Check invalid package release 35 | assert 'non-lsb-compliant-release' in out 36 | assert 'release number contains an illegal character' in out 37 | -------------------------------------------------------------------------------- /test/test_appdata.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import patch 2 | 3 | from mockdata.mock_appdata import AppDataPackage 4 | import pytest 5 | from rpmlint.checks.AppDataCheck import AppDataCheck 6 | from rpmlint.filter import Filter 7 | 8 | from Testing import CONFIG, HAS_APPSTREAM_GLIB 9 | 10 | 11 | @pytest.fixture(scope='function', autouse=True) 12 | def appdatacheck(): 13 | CONFIG.info = True 14 | output = Filter(CONFIG) 15 | test = AppDataCheck(CONFIG, output) 16 | return output, test 17 | 18 | 19 | @pytest.mark.skipif(not HAS_APPSTREAM_GLIB, reason='Optional dependency appstream-glib not installed') 20 | @pytest.mark.parametrize('package', [AppDataPackage]) 21 | def test_appdata_fail(package, appdatacheck): 22 | output, test = appdatacheck 23 | test.check(package) 24 | out = output.print_results(output.results) 25 | # there are two borked packages 26 | assert len(output.results) == 2 27 | assert 'invalid-appdata-file' in out 28 | 29 | 30 | @pytest.mark.parametrize('package', [AppDataPackage]) 31 | @patch('rpmlint.checks.AppDataCheck.AppDataCheck.cmd', 'command-really-not-found') 32 | def test_appdata_fail_no_checker(package, appdatacheck): 33 | output, test = appdatacheck 34 | test.check(package) 35 | out = output.print_results(output.results) 36 | # there is just one borked file as the other is invalid content 37 | # but valid xml 38 | assert len(output.results) == 1 39 | assert 'invalid-appdata-file' in out 40 | -------------------------------------------------------------------------------- /test/test_bashisms.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_bashisms import BashismsPackage 2 | import pytest 3 | from rpmlint.checks.BashismsCheck import BashismsCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG, HAS_CHECKBASHISMS, HAS_DASH 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def bashismscheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = BashismsCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.skipif(not HAS_CHECKBASHISMS, reason='Optional dependency checkbashisms not installed') 18 | @pytest.mark.skipif(not HAS_DASH, reason='Optional dependency dash not installed') 19 | @pytest.mark.parametrize('package', [BashismsPackage]) 20 | def test_bashisms(package, bashismscheck): 21 | output, test = bashismscheck 22 | test.check(package) 23 | out = output.print_results(output.results) 24 | assert 'W: potential-bashisms /bin/script1' in out 25 | assert 'W: bin-sh-syntax-error /bin/script2' in out 26 | 27 | 28 | @pytest.mark.skipif(not HAS_CHECKBASHISMS, reason='Optional dependency checkbashisms not installed') 29 | @pytest.mark.skipif(not HAS_DASH, reason='Optional dependency dash not installed') 30 | @pytest.mark.parametrize('package', [BashismsPackage]) 31 | def test_bashisms_error(package, bashismscheck): 32 | output, test = bashismscheck 33 | package.dirname = 'I-do-not-exist-for-sure' 34 | 35 | with pytest.raises(FileNotFoundError): 36 | test.check(package) 37 | -------------------------------------------------------------------------------- /test/test_build_date.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from mockdata.mock_bashisms import BashismsPackage 4 | from mockdata.mock_build_date import BuildDatePackage 5 | import pytest 6 | from rpmlint.checks.BuildRootAndDateCheck import BuildRootAndDateCheck 7 | from rpmlint.filter import Filter 8 | 9 | from Testing import CONFIG 10 | 11 | 12 | @pytest.fixture(scope='function', autouse=True) 13 | def builddatecheck(): 14 | CONFIG.info = True 15 | output = Filter(CONFIG) 16 | test = BuildRootAndDateCheck(CONFIG, output) 17 | return output, test 18 | 19 | 20 | @pytest.mark.parametrize('package', [BuildDatePackage]) 21 | def test_build_date_time(package, builddatecheck): 22 | output, test = builddatecheck 23 | test.istoday = re.compile('Jan 1 2019') 24 | test.check(package) 25 | out = output.print_results(output.results) 26 | assert 'E: file-contains-date-and-time /bin/with-datetime' in out 27 | assert 'E: file-contains-current-date /bin/with-date' in out 28 | 29 | 30 | @pytest.mark.parametrize('package', [BashismsPackage]) 31 | def test_build_date_time_correct(package, builddatecheck): 32 | output, test = builddatecheck 33 | test.istoday = re.compile('Jan 1 2019') 34 | test.check(package) 35 | out = output.print_results(output.results) 36 | assert 'E: file-contains-date-and-time' not in out 37 | assert 'E: file-contains-current-date' not in out 38 | -------------------------------------------------------------------------------- /test/test_build_root.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_build_root import BuildrootPackage 2 | import pytest 3 | from rpmlint.checks.BuildRootAndDateCheck import BuildRootAndDateCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def buildrootcheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = BuildRootAndDateCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [BuildrootPackage]) 18 | def test_build_root(package, buildrootcheck): 19 | output, test = buildrootcheck 20 | test.prepare_regex('/home/marxin/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64') 21 | test.check(package) 22 | out = output.print_results(output.results) 23 | assert 'E: file-contains-buildroot /bin/trace' in out 24 | -------------------------------------------------------------------------------- /test/test_config_files.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_config_files import ( 2 | ConfigFilesBrokenPackage, 3 | ConfigFilesOkPackage, 4 | ) 5 | from mockdata.mock_logrotate import LogrotatePackage 6 | import pytest 7 | from rpmlint.checks.ConfigFilesCheck import ConfigFilesCheck 8 | from rpmlint.filter import Filter 9 | 10 | from Testing import CONFIG 11 | 12 | 13 | @pytest.fixture(scope='function', autouse=True) 14 | def configfilescheck(): 15 | CONFIG.info = True 16 | output = Filter(CONFIG) 17 | test = ConfigFilesCheck(CONFIG, output) 18 | return output, test 19 | 20 | 21 | @pytest.mark.parametrize('package', [ConfigFilesBrokenPackage]) 22 | def test_config_files1(package, configfilescheck): 23 | output, test = configfilescheck 24 | test.check(package) 25 | out = output.print_results(output.results) 26 | assert 'non-etc-or-var-file-marked-as-conffile /usr/share/conffile3' in out 27 | assert 'conffile-without-noreplace-flag /etc/conffile1' in out 28 | assert 'conffile-without-noreplace-flag /var/conffile2' in out 29 | assert 'conffile-without-noreplace-flag /usr/share/conffile3' in out 30 | 31 | 32 | @pytest.mark.parametrize('package', [LogrotatePackage, ConfigFilesOkPackage]) 33 | def test_config_files_correct1(package, configfilescheck): 34 | output, test = configfilescheck 35 | test.check(package) 36 | out = output.print_results(output.results) 37 | assert 'non-etc-or-var-file-marked-as-conffile' not in out 38 | assert 'conffile-without-noreplace-flag' not in out 39 | -------------------------------------------------------------------------------- /test/test_dbus_policy.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_dbus_policy import DbusRulePackage 2 | import pytest 3 | from rpmlint.checks.DBusPolicyCheck import DBusPolicyCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def dbuspolicycheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = DBusPolicyCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [DbusRulePackage]) 18 | def test_dbus_policy(package, dbuspolicycheck): 19 | output, test = dbuspolicycheck 20 | test.check(package) 21 | out = output.print_results(output.results) 22 | assert 'E: dbus-parsing-exception raised an exception: no element found: line 1, column 0 /etc/dbus-1/system.d/noxml.conf' in out 23 | assert 'E: dbus-policy-allow-without-destination ' in out 24 | assert 'W: dbus-policy-allow-receive ' in out 25 | assert 'E: dbus-policy-deny-without-destination ' in out 26 | assert 'E: dbus-policy-missing-allow /etc/dbus-1/system.d/org.freedesktop.NetworkManager2.conf' in out 27 | -------------------------------------------------------------------------------- /test/test_diff.py: -------------------------------------------------------------------------------- 1 | from rpmlint.rpmdiff import Rpmdiff 2 | 3 | from Testing import get_tested_path 4 | 5 | 6 | def test_distribution_tags(): 7 | oldpkg = get_tested_path('binary/mc-4.8.15-10.3.1.x86_64.rpm') 8 | newpkg = get_tested_path('binary/mc-4.8.21-2.1.x86_64.rpm') 9 | ignore = [] 10 | diff = Rpmdiff(oldpkg, newpkg, ignore) 11 | textdiff = diff.textdiff() 12 | # the count always reports one less 13 | assert 231 <= len(textdiff.splitlines()) <= 233 14 | 15 | ignore.append('T') 16 | ignore.append('5') 17 | ignore.append('S') 18 | diff = Rpmdiff(oldpkg, newpkg, ignore) 19 | textdiff = diff.textdiff() 20 | assert 36 <= len(textdiff.splitlines()) <= 38 21 | 22 | assert 'added /usr/share/mc/syntax/yaml.syntax' in textdiff 23 | 24 | 25 | def test_exclude(): 26 | oldpkg = get_tested_path('binary/mc-4.8.15-10.3.1.x86_64.rpm') 27 | newpkg = get_tested_path('binary/mc-4.8.21-2.1.x86_64.rpm') 28 | ignore = list('T5S') 29 | 30 | # print(Rpmdiff(oldpkg, newpkg, ignore=ignore).textdiff()) 31 | 32 | for exclude in [], ['/usr/share/mc/ski'], ['/share/mc/skins'], ['skins']: 33 | diff = Rpmdiff(oldpkg, newpkg, ignore, exclude) 34 | textdiff = diff.textdiff() 35 | assert '/usr/share/mc/skins/yadt256.ini' in textdiff 36 | 37 | for exclude in (['/usr/share/mc/skins'], ['/usr/share/*/skins'], 38 | ['/*/*/*/skins']): 39 | diff = Rpmdiff(oldpkg, newpkg, ignore, exclude) 40 | textdiff = diff.textdiff() 41 | assert '/usr/share/mc/skins/yadt256.ini' not in textdiff 42 | assert '/usr/share/mc/syntax/cuda.syntax' in textdiff 43 | 44 | for exclude in ['*.syntax'], ['syntax/cuda.syntax']: 45 | diff = Rpmdiff(oldpkg, newpkg, ignore, exclude) 46 | textdiff = diff.textdiff() 47 | assert '/usr/share/mc/skins/yadt256.ini' in textdiff 48 | assert '/usr/share/mc/syntax/cuda.syntax' not in textdiff 49 | -------------------------------------------------------------------------------- /test/test_doc.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_doc import ( 2 | DocFileDependencyPackage, 3 | InstallFileInDocPackage, 4 | MyDocPackage, 5 | ) 6 | import pytest 7 | from rpmlint.checks.DocCheck import DocCheck 8 | from rpmlint.filter import Filter 9 | 10 | from Testing import CONFIG 11 | 12 | 13 | @pytest.fixture(scope='function', autouse=True) 14 | def doccheck(): 15 | CONFIG.info = True 16 | output = Filter(CONFIG) 17 | test = DocCheck(CONFIG, output) 18 | return output, test 19 | 20 | 21 | @pytest.mark.parametrize('package', [MyDocPackage]) 22 | def test_doccheck(package, doccheck): 23 | output, test = doccheck 24 | test.check(package) 25 | out = output.print_results(output.results) 26 | assert 'E: executable-docs /usr/share/doc/packages/mydoc/doc.html' in out 27 | assert 'E: executable-docs /usr/share/doc/packages/mydoc/README' in out 28 | assert 'W: package-with-huge-docs 100%' in out 29 | 30 | 31 | @pytest.mark.parametrize('package', [DocFileDependencyPackage]) 32 | def test_doc_file_dep(package, doccheck): 33 | output, test = doccheck 34 | test.check(package) 35 | out = output.print_results(output.results) 36 | assert 'W: doc-file-dependency' in out 37 | assert 'W: install-file-in-docs' not in out 38 | 39 | 40 | @pytest.mark.parametrize('package', [InstallFileInDocPackage]) 41 | def test_install_file_in_docs(package, doccheck): 42 | output, test = doccheck 43 | test.check(package) 44 | out = output.print_results(output.results) 45 | assert 'W: install-file-in-docs' in out 46 | assert 'E: executable-docs' not in out 47 | assert 'W: package-with-huge-docs 100%' not in out 48 | assert 'W: doc-file-dependency' not in out 49 | -------------------------------------------------------------------------------- /test/test_duplicates.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_duplicates import ( 2 | HardlinksAndDuplicatesPresent, 3 | NoHardLinksAndDuplicatesPresent 4 | ) 5 | import pytest 6 | from rpmlint.checks.DuplicatesCheck import DuplicatesCheck 7 | from rpmlint.filter import Filter 8 | 9 | from Testing import CONFIG 10 | 11 | 12 | @pytest.fixture(scope='function', autouse=True) 13 | def duplicatescheck(): 14 | CONFIG.info = True 15 | output = Filter(CONFIG) 16 | test = DuplicatesCheck(CONFIG, output) 17 | yield output, test 18 | 19 | 20 | @pytest.fixture() 21 | def test(duplicatescheck): 22 | _output, test = duplicatescheck 23 | yield test 24 | 25 | 26 | @pytest.fixture() 27 | def output(duplicatescheck): 28 | output, _test = duplicatescheck 29 | yield output 30 | 31 | 32 | @pytest.mark.parametrize('package', [HardlinksAndDuplicatesPresent]) 33 | def test_duplicates1(package, test, output): 34 | test.check(package) 35 | out = output.print_results(output.results) 36 | 37 | assert 'E: hardlink-across-partition /var/foo /etc/foo' in out 38 | assert 'E: hardlink-across-config-files /var/foo2 /etc/foo2' in out 39 | assert 'W: files-duplicate /etc/bar3 /etc/bar:/etc/bar2' in out 40 | assert 'W: files-duplicate /etc/strace2.txt /etc/strace1.txt' in out 41 | assert 'W: files-duplicate /etc/small2 /etc/small' not in out 42 | assert 'E: files-duplicated-waste 270543' in out 43 | 44 | 45 | @pytest.mark.parametrize('package', [NoHardLinksAndDuplicatesPresent]) 46 | def test_duplicates_correct(package, test, output): 47 | test.check(package) 48 | out = output.print_results(output.results) 49 | 50 | assert 'E: hardlink-across-partition' not in out 51 | assert 'E: hardlink-across-config-files' not in out 52 | assert 'W: files-duplicate' not in out 53 | assert 'E: files-duplicated-waste' not in out 54 | -------------------------------------------------------------------------------- /test/test_erlang.py: -------------------------------------------------------------------------------- 1 | from importlib.metadata import distribution 2 | 3 | from mockdata.mock_erlang import ErlangPackage 4 | from packaging.version import parse 5 | import pytest 6 | from rpmlint.checks.ErlangCheck import ErlangCheck 7 | from rpmlint.filter import Filter 8 | 9 | from Testing import CONFIG 10 | 11 | 12 | @pytest.fixture(scope='function', autouse=True) 13 | def erlangcheck(): 14 | CONFIG.info = True 15 | output = Filter(CONFIG) 16 | test = ErlangCheck(CONFIG, output) 17 | return output, test 18 | 19 | 20 | @pytest.mark.skipif(parse(distribution('pybeam').version) < parse('0.7'), reason='pybeam >= 0.7 required') 21 | @pytest.mark.parametrize('package', [ErlangPackage]) 22 | def test_erlang(package, erlangcheck): 23 | output, test = erlangcheck 24 | test.check(package) 25 | out = output.print_results(output.results) 26 | assert 'E: beam-compiled-without-debuginfo /usr/lib/erlang/m.beam' in out 27 | assert 'W: beam-compile-info-missed /usr/lib/erlang/m-no-CInf.beam' in out 28 | -------------------------------------------------------------------------------- /test/test_helpers.py: -------------------------------------------------------------------------------- 1 | from rpmlint import helpers 2 | 3 | 4 | def test_warnprint(capsys): 5 | """ 6 | Check we print stuff to stderr 7 | """ 8 | message = 'I am writing to stderr' 9 | helpers.print_warning(message) 10 | out, err = capsys.readouterr() 11 | assert message not in out 12 | assert message in err 13 | 14 | 15 | def test_bytetostr(): 16 | """ 17 | Test bytetostr function 18 | """ 19 | list_items = ( 20 | b'\xc5\xbe\xc3\xad\xc5\xbeala', 21 | 'texty', 22 | ) 23 | item = b'p\xc5\x99\xc3\xad\xc5\xa1ern\xc4\x9b \xc5\xbelu\xc5\xa5ou\xc4\x8dk\xc3\xbd k\xc5\xaf\xc5\x88' 24 | 25 | result = helpers.byte_to_string(item) 26 | assert isinstance(result, str) 27 | assert result == 'příšerně žluťoučký kůň' 28 | 29 | result = helpers.byte_to_string(list_items) 30 | assert isinstance(result, list) 31 | assert result[0] == 'žížala' 32 | 33 | 34 | def test_centering(capsys): 35 | """ 36 | Check wether centered print works 37 | """ 38 | 39 | message = 'Hello there' 40 | helpers.print_centered(message, '*') 41 | out, err = capsys.readouterr() 42 | assert '** Hello there **' in out 43 | assert not err 44 | -------------------------------------------------------------------------------- /test/test_i18n.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_i18n import I18NPackage, InvalidI18NPackage 2 | import pytest 3 | from rpmlint.checks.I18NCheck import I18NCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def i18ncheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = I18NCheck(CONFIG, output) 14 | yield output, test 15 | 16 | 17 | @pytest.fixture 18 | def output(i18ncheck): 19 | output, _test = i18ncheck 20 | yield output 21 | 22 | 23 | @pytest.fixture 24 | def test(i18ncheck): 25 | _output, test = i18ncheck 26 | yield test 27 | 28 | 29 | @pytest.mark.parametrize('package', [InvalidI18NPackage]) 30 | def test_i18n_invalid_lang(package, output, test): 31 | test.check(package) 32 | out = output.print_results(output.results) 33 | assert 'E: invalid-lc-messages-dir /usr/share/locale/xx_ES/LC_MESSAGES/goodvibes.mo' in out 34 | assert 'E: invalid-lc-messages-dir /usr/share/locale/es_XX/LC_MESSAGES/goodvibes.mo' in out 35 | assert 'E: invalid-lc-messages-dir /usr/share/locale/xx/LC_MESSAGES/goodvibes.mo' in out 36 | 37 | 38 | @pytest.mark.parametrize('package', [I18NPackage]) 39 | def test_i18n_valid_lang(package, output, test): 40 | test.check(package) 41 | out = output.print_results(output.results) 42 | assert 'E: invalid-lc-messages-dir' not in out 43 | -------------------------------------------------------------------------------- /test/test_icon_sizes.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_icon_sizes import WrongIconSizePackage 2 | import pytest 3 | from rpmlint.checks.IconSizesCheck import IconSizesCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def iconsizescheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = IconSizesCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [WrongIconSizePackage]) 18 | def test_icon_sizes(package, iconsizescheck): 19 | output, test = iconsizescheck 20 | test.check(package) 21 | out = output.print_results(output.results) 22 | assert 'E: wrong-icon-size /usr/share/tasque/icons/hicolor/16x16/status/tasque-note.png expected: 16x16 actual: 22x22' in out 23 | -------------------------------------------------------------------------------- /test/test_lib_dependency.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_files import Shlib2DevelPackage 2 | import pytest 3 | from rpmlint.checks.LibraryDependencyCheck import LibraryDependencyCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def libdependencycheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = LibraryDependencyCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [Shlib2DevelPackage]) 18 | def test_shlib2_devel(package, libdependencycheck): 19 | output, test = libdependencycheck 20 | test.check(package) 21 | test.after_checks() 22 | out = output.print_results(output.results) 23 | print(out) 24 | assert 'E: no-library-dependency-for /usr/lib/libfoo.so.1' in out 25 | -------------------------------------------------------------------------------- /test/test_logrotate.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_logrotate import LogrotatePackage 2 | import pytest 3 | from rpmlint.checks.LogrotateCheck import LogrotateCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def logrotatecheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = LogrotateCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [LogrotatePackage]) 18 | def test_logrotate(package, logrotatecheck): 19 | output, test = logrotatecheck 20 | test.check(package) 21 | out = output.print_results(output.results) 22 | assert 'E: logrotate-log-dir-not-packaged /var/log/myapp' in out 23 | assert 'E: logrotate-duplicate /var/log/myapp' in out 24 | assert 'E: logrotate-user-writable-log-dir /tmp/foo marxin:users 0755' in out 25 | assert 'E: logrotate-user-writable-log-dir /tmp/foo2 root:users2 0777' in out 26 | -------------------------------------------------------------------------------- /test/test_mixed_ownership.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_mixed_ownership import MixedOwnershipPackage 2 | import pytest 3 | from rpmlint.checks.MixedOwnershipCheck import MixedOwnershipCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def mixedownershipcheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = MixedOwnershipCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [MixedOwnershipPackage]) 18 | def test_mixed_ownership(package, mixedownershipcheck): 19 | output, test = mixedownershipcheck 20 | test.check(package) 21 | out = output.print_results(output.results) 22 | assert 'noproblem' not in out 23 | assert 'file-parent-ownership-mismatch Path "/var/lib/badfolder/broken1" owned by "root" is stored in directory owned by "nobody"' in out 24 | assert 'file-parent-ownership-mismatch Path "/var/lib/badfolder/correctperms" owned by "root" is stored in directory owned by "nobody"' in out 25 | -------------------------------------------------------------------------------- /test/test_objdump_parser.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | import pytest 4 | from rpmlint.checks.BinariesCheck import BinariesCheck 5 | from rpmlint.filter import Filter 6 | from rpmlint.objdumpparser import ObjdumpParser 7 | from rpmlint.pkg import FakePkg, get_magic 8 | 9 | from Testing import CONFIG, get_tested_path, IS_X86_64 10 | 11 | 12 | @pytest.fixture(scope='function', autouse=True) 13 | def binariescheck(): 14 | CONFIG.info = True 15 | output = Filter(CONFIG) 16 | test = BinariesCheck(CONFIG, output) 17 | return output, test 18 | 19 | 20 | def get_full_path(path): 21 | return str(get_tested_path(Path('readelf', path))) 22 | 23 | 24 | def objdumpparser(path, system_path=None): 25 | if system_path is None: 26 | system_path = path 27 | return ObjdumpParser(get_full_path(path), system_path) 28 | 29 | 30 | def run_elf_checks(test, pkg, pkgfile): 31 | test._detect_attributes(get_magic(pkgfile.path)) 32 | test.run_elf_checks(pkg, pkgfile) 33 | 34 | 35 | def test_basic(): 36 | objdump = objdumpparser('executable-stack', '/lib64/executable-stack') 37 | assert not objdump.parsing_failed_reason 38 | assert len(objdump.compile_units) == 5 39 | first = objdump.compile_units[0] 40 | assert first['name'] == '../sysdeps/x86_64/start.S' 41 | assert first['comp_dir'] == '/home/abuild/rpmbuild/BUILD/glibc-2.29/csu' 42 | assert first['producer'] == 'GNU AS 2.32' 43 | assert first['language'] == '32769\t(MIPS assembler)' 44 | 45 | 46 | @pytest.mark.skipif(not IS_X86_64, reason='x86-64 only') 47 | def test_executable_stack_package(binariescheck): 48 | output, test = binariescheck 49 | 50 | with FakePkg('fake') as pkg: 51 | pkgfile = pkg.add_file(get_full_path('executable-stack'), 'a.out') 52 | run_elf_checks(test, FakePkg('fake'), pkgfile) 53 | out = output.print_results(output.results) 54 | 55 | if 'ldd-failed' in out: 56 | pytest.skip("ldd failed, maybe it's a different architecture") 57 | 58 | assert 'W: missing-mandatory-optflags a.out -fno-PIE -g -Ofast' in out 59 | assert 'E: forbidden-optflags a.out -frounding-math' in out 60 | -------------------------------------------------------------------------------- /test/test_pam_modules.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_pam_modules import PAMModulePackage 2 | import pytest 3 | from rpmlint.checks.PAMModulesCheck import PAMModulesCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def pammodulecheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = PAMModulesCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [PAMModulePackage]) 18 | def test_pam_modules(package, pammodulecheck): 19 | output, test = pammodulecheck 20 | test.check(package) 21 | out = output.print_results(output.results) 22 | assert 'E: pam-unauthorized-module pam-module.so' in out 23 | -------------------------------------------------------------------------------- /test/test_pkg.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import unittest.mock as mock 4 | 5 | import pytest 6 | import rpm 7 | from rpmlint.pkg import parse_deps, rangeCompare 8 | 9 | from Testing import get_tested_package 10 | 11 | 12 | def test_parse_deps(): 13 | for (arg, exp) in ( 14 | ('a, b < 1.0 c = 5:2.0-3 d', 15 | [('a', 0, (None, None, None)), 16 | ('b', rpm.RPMSENSE_LESS, (None, '1.0', None)), 17 | ('c', rpm.RPMSENSE_EQUAL, (5, '2.0', '3')), 18 | ('d', 0, (None, None, None))]), 19 | ): 20 | assert parse_deps(arg) == exp 21 | 22 | 23 | def test_range_compare(): 24 | for (req, prov) in ( 25 | (('foo', rpm.RPMSENSE_LESS, (None, '1.0', None)), 26 | ('foo', rpm.RPMSENSE_EQUAL, (1, '0.5', None))), 27 | ): 28 | assert not rangeCompare(req, prov) 29 | 30 | 31 | @pytest.mark.parametrize('package', ['binary/python311-pytest-xprocess']) 32 | @pytest.mark.skipif(os.getuid() == 0, reason='Root has full permission') 33 | def test_extract_fail(package, tmp_path): 34 | """ 35 | Check that rpm2cpio fails to extract this package because it has no 36 | permissions to some files. 37 | """ 38 | 39 | with mock.patch('shutil.which') as mock_which: 40 | mock_which.return_value = None 41 | # the package cannot be extracted using rpm2cpio because it contains a directory without 'x' permission 42 | with pytest.raises(subprocess.CalledProcessError) as exc: 43 | get_tested_package(package, tmp_path) 44 | mock_which.assert_called_once_with('rpm2archive') 45 | # check that it was rpm2cpio what failed 46 | assert exc.match(r'rpm2cpio .*') 47 | -------------------------------------------------------------------------------- /test/test_pkgconfig.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_pkgconfig import LibReiserFSCoreDevelPackage, PCPackage 2 | import pytest 3 | from rpmlint.checks.PkgConfigCheck import PkgConfigCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def pkgconfigcheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = PkgConfigCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [PCPackage]) 18 | def test_pkg_config(package, pkgconfigcheck): 19 | output, test = pkgconfigcheck 20 | test.check(package) 21 | out = output.print_results(output.results) 22 | assert 'E: invalid-pkgconfig-file /tmp/pkgconfig/xcb.pc' in out 23 | assert 'E: pkgconfig-invalid-libs-dir /tmp/pkgconfig/xcb.pc Libs: -L/usr/lib' in out 24 | assert 'E: double-slash-in-pkgconfig-path /tmp/pkgconfig/xcb.pc includedir=/usr/include//xyz' in out 25 | 26 | 27 | @pytest.mark.parametrize('package', [LibReiserFSCoreDevelPackage]) 28 | def test_pkg_config_correct(package, pkgconfigcheck): 29 | output, test = pkgconfigcheck 30 | test.check(package) 31 | out = output.print_results(output.results) 32 | assert 'E: invalid-pkgconfig-file' not in out 33 | assert 'E: pkgconfig-invalid-libs-dir' not in out 34 | assert 'E: double-slash-in-pkgconfig-path' not in out 35 | -------------------------------------------------------------------------------- /test/test_shlib_policy.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_shlib_policy import ( 2 | Libslp1234Package, 3 | LibslpMissingSuffixPackage, 4 | Libtest1Package, 5 | ) 6 | import pytest 7 | from rpmlint.checks.SharedLibraryPolicyCheck import SharedLibraryPolicyCheck 8 | from rpmlint.filter import Filter 9 | 10 | from Testing import CONFIG 11 | 12 | 13 | @pytest.fixture(scope='function', autouse=True) 14 | def slpcheck(): 15 | CONFIG.info = True 16 | output = Filter(CONFIG) 17 | test = SharedLibraryPolicyCheck(CONFIG, output) 18 | return output, test 19 | 20 | 21 | @pytest.mark.parametrize('package', [Libtest1Package]) 22 | def test_shlib_policy_wrong_name(package, slpcheck): 23 | output, test = slpcheck 24 | test.check(package) 25 | out = output.print_results(output.results) 26 | assert 'W: shlib-unversioned-lib libtest.so.1x' in out 27 | 28 | 29 | @pytest.mark.parametrize('package', [LibslpMissingSuffixPackage]) 30 | def test_shlib_policy_missing_suffix(package, slpcheck): 31 | output, test = slpcheck 32 | test.check(package) 33 | out = output.print_results(output.results) 34 | assert 'E: shlib-policy-excessive-dependency libsparta.so.2' in out 35 | 36 | 37 | @pytest.mark.parametrize('package', [Libslp1234Package]) 38 | def test_shlib_policy_errors(package, slpcheck): 39 | output, test = slpcheck 40 | test.check(package) 41 | out = output.print_results(output.results) 42 | assert 'W: shlib-fixed-dependency libsparta.so.2 = 1.23' in out 43 | -------------------------------------------------------------------------------- /test/test_sources.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from rpmlint.checks.SourceCheck import SourceCheck 3 | from rpmlint.filter import Filter 4 | 5 | from Testing import CONFIG, get_tested_package 6 | 7 | 8 | @pytest.fixture(scope='function', autouse=True) 9 | def sourcescheck(): 10 | CONFIG.info = True 11 | output = Filter(CONFIG) 12 | test = SourceCheck(CONFIG, output) 13 | return output, test 14 | 15 | 16 | @pytest.mark.parametrize('package', ['source/wrongsrc']) 17 | def test_extension_and_permissions(tmp_path, package, sourcescheck): 18 | output, test = sourcescheck 19 | test.check(get_tested_package(package, tmp_path)) 20 | out = output.print_results(output.results) 21 | 22 | assert len(output.results) == 1 23 | 24 | assert 'inconsistent-file-extension' in out 25 | assert 'name extension indicates a different compression format' in out 26 | 27 | assert 'strange-permission' not in out 28 | assert 'a file should have' not in out 29 | 30 | 31 | @pytest.mark.parametrize('package', ['source/not-compressed-multi-spec']) 32 | def test_compression_and_multispec(tmp_path, package, sourcescheck): 33 | output, test = sourcescheck 34 | test.check(get_tested_package(package, tmp_path)) 35 | out = output.print_results(output.results) 36 | 37 | assert 'source-not-compressed' in out 38 | assert 'source archive or file in your package is not compressed' in out 39 | 40 | assert 'multiple-specfiles' in out 41 | assert 'package contains multiple spec files' in out 42 | -------------------------------------------------------------------------------- /test/test_sysvinitonsystemd.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_sysvinitonsystemd import InitPackage, RcLinksPackage 2 | import pytest 3 | from rpmlint.checks.SysVInitOnSystemdCheck import SysVInitOnSystemdCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def sysvcheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = SysVInitOnSystemdCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [InitPackage]) 18 | def test_sysv_init_on_systemd_check(package, sysvcheck): 19 | output, test = sysvcheck 20 | test.check(package) 21 | out = output.print_results(output.results) 22 | assert 'E: obsolete-insserv-requirement' in out 23 | assert 'E: deprecated-init-script weekly.script' in out 24 | assert 'E: deprecated-boot-script boot.script' in out 25 | 26 | 27 | @pytest.mark.parametrize('package', [RcLinksPackage]) 28 | def test_overshadowing_of_initscript(package, sysvcheck): 29 | output, test = sysvcheck 30 | test.check(package) 31 | out = output.print_results(output.results) 32 | assert 'E: systemd-shadowed-initscript bar' in out 33 | -------------------------------------------------------------------------------- /test/test_tmp_files.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_tmp_files import ( 2 | SystemdTempfilesOkPackage, 3 | SystemdTempfilesPackage, 4 | TempfiledPackage, 5 | ) 6 | import pytest 7 | from rpmlint.checks.TmpFilesCheck import TmpFilesCheck 8 | from rpmlint.filter import Filter 9 | 10 | from Testing import CONFIG 11 | 12 | 13 | @pytest.fixture(scope='function', autouse=True) 14 | def tmpfilescheck(): 15 | CONFIG.info = True 16 | output = Filter(CONFIG) 17 | test = TmpFilesCheck(CONFIG, output) 18 | return output, test 19 | 20 | 21 | @pytest.mark.parametrize('package', [TempfiledPackage]) 22 | def test_tmpfiles(package, tmpfilescheck): 23 | output, test = tmpfilescheck 24 | test.check(package) 25 | out = output.print_results(output.results) 26 | 27 | assert 'W: pre-with-tmpfile-creation ' not in out 28 | assert 'W: post-without-tmpfile-creation /usr/lib/tmpfiles.d/krb5.conf' in out 29 | assert 'W: tmpfile-not-in-filelist /var/lib/kerberos' in out 30 | assert 'W: tmpfile-not-regular-file /usr/lib/tmpfiles.d/symlink.conf' in out 31 | 32 | 33 | @pytest.mark.parametrize('package', [SystemdTempfilesPackage]) 34 | def test_tmpfiles2(package, tmpfilescheck): 35 | output, test = tmpfilescheck 36 | test.check(package) 37 | out = output.print_results(output.results) 38 | 39 | assert 'W: pre-with-tmpfile-creation /usr/lib/tmpfiles.d/systemd-tmpfiles.conf' in out 40 | assert 'W: post-without-tmpfile-creation' in out 41 | assert 'W: tmpfile-not-in-filelist /run/my_new_directory' in out 42 | assert 'W: tmpfile-not-regular-file' not in out 43 | 44 | 45 | @pytest.mark.parametrize('package', [SystemdTempfilesOkPackage]) 46 | def test_tmpfiles_correct(package, tmpfilescheck): 47 | output, test = tmpfilescheck 48 | test.check(package) 49 | out = output.print_results(output.results) 50 | 51 | assert 'W: pre-with-tmpfile-creation' not in out 52 | assert 'W: post-without-tmpfile-creation' not in out 53 | assert 'W: tmpfile-not-regular-file' not in out 54 | assert 'W: tmpfile-not-in-filelist' not in out 55 | -------------------------------------------------------------------------------- /test/test_xinetd.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_xinetd import RequireXinetd 2 | import pytest 3 | from rpmlint.checks.XinetdDepCheck import XinetdDepCheck 4 | from rpmlint.filter import Filter 5 | 6 | from Testing import CONFIG 7 | 8 | 9 | @pytest.fixture(scope='function', autouse=True) 10 | def xinetdcheck(): 11 | CONFIG.info = True 12 | output = Filter(CONFIG) 13 | test = XinetdDepCheck(CONFIG, output) 14 | return output, test 15 | 16 | 17 | @pytest.mark.parametrize('package', [RequireXinetd]) 18 | def test_xinetd(package, xinetdcheck): 19 | output, test = xinetdcheck 20 | test.check(package) 21 | out = output.print_results(output.results) 22 | assert 'E: obsolete-xinetd-requirement' in out 23 | -------------------------------------------------------------------------------- /test/test_zypp_syntax.py: -------------------------------------------------------------------------------- 1 | from mockdata.mock_zypp_syntax import ( 2 | SyntaxAndPackage, 3 | SyntaxPackageandPackage, 4 | ) 5 | import pytest 6 | from rpmlint.checks.ZyppSyntaxCheck import ZyppSyntaxCheck 7 | from rpmlint.filter import Filter 8 | 9 | from Testing import CONFIG 10 | 11 | 12 | @pytest.fixture(scope='function', autouse=True) 13 | def zyppsyntaxcheck(): 14 | CONFIG.info = True 15 | output = Filter(CONFIG) 16 | test = ZyppSyntaxCheck(CONFIG, output) 17 | return output, test 18 | 19 | 20 | @pytest.fixture 21 | def output(zyppsyntaxcheck): 22 | output, _test = zyppsyntaxcheck 23 | yield output 24 | 25 | 26 | @pytest.fixture 27 | def test(zyppsyntaxcheck): 28 | _output, test = zyppsyntaxcheck 29 | yield test 30 | 31 | 32 | @pytest.mark.parametrize('package', [SyntaxPackageandPackage]) 33 | def test_packageand(package, test, output): 34 | test.check(package) 35 | out = output.print_results(output.results) 36 | assert 'suse-zypp-packageand packageand(c:d)' in out 37 | assert 'suse-zypp-packageand packageand(a:b)' in out 38 | assert '(a and b)' not in out 39 | assert 'bee' not in out 40 | assert 'suse-zypp-otherproviders otherproviders(yast2_theme)' in out 41 | 42 | 43 | @pytest.mark.parametrize('package', [SyntaxAndPackage]) 44 | def test_packageand_ok(package, test, output): 45 | test.check(package) 46 | out = output.print_results(output.results) 47 | assert 'suse-zypp-packageand' not in out 48 | assert 'suse-zypp-otherproviders' not in out 49 | -------------------------------------------------------------------------------- /tools/generate-fedora-users-groups.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ This script is used to generate values for 3 | config/Fedora/configs/Fedora/users-groups.toml 4 | """ 5 | 6 | import datetime 7 | import os 8 | import re 9 | 10 | users = set() 11 | groups = set() 12 | uidgid_regex = re.compile(r'^\s*(\S+)\s+(-|\d+)\s+(-|\d+|\(\d+\))\s') 13 | for uidgid_file in ['/usr/share/doc/setup/uidgid']: 14 | if os.path.exists(uidgid_file): 15 | with open(uidgid_file) as fobj: 16 | try: 17 | for line in fobj.read().strip().splitlines(): 18 | if line.startswith('#'): 19 | continue 20 | res = uidgid_regex.search(line) 21 | if res: 22 | name = res.group(1) 23 | if res.group(2) != '-': 24 | users.add(name) 25 | if res.group(3) != '-' and '(' not in res.group(3): 26 | groups.add(name) 27 | del res 28 | del line 29 | finally: 30 | fobj.close() 31 | del fobj 32 | 33 | name = '/'.join(__file__.split('/')[-2:]) 34 | date = datetime.datetime.utcnow().strftime('%Y-%m-%d') 35 | print(f'# generated by {name} on {date}\n') 36 | 37 | print(f'StandardUsers = {sorted(users)}\n') 38 | 39 | print(f'StandardGroups = {sorted(groups)}') 40 | -------------------------------------------------------------------------------- /tools/generate-isocodes.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # Generate ISO codes for use with e.g. locale subdir checks 4 | # http://alioth.debian.org/projects/pkg-isocodes/ 5 | 6 | import codecs 7 | import json 8 | import os 9 | from pprint import pprint 10 | import sys 11 | from urllib.request import urlopen 12 | 13 | 14 | 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') 15 | 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') 16 | 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') 17 | iso_15924_url = os.environ.get('ISO_15924_URL', 'https://salsa.debian.org/iso-codes-team/iso-codes/raw/main/data/iso_15924.json') 18 | 19 | langs = set() 20 | countries = set() 21 | 22 | # country codes (2 letters) 23 | with urlopen(iso_3166_1_url) as f: 24 | data = json.load(codecs.getreader('utf-8')(f)) 25 | for entry in data['3166-1']: 26 | countries.add(entry['alpha_2']) 27 | 28 | # language codes (2 or 3 letters, 3 only for ones we don't have 2-letter one) 29 | with urlopen(iso_639_3_url) as f: 30 | data = json.load(codecs.getreader('utf-8')(f)) 31 | for entry in data['639-3']: 32 | langs.add(entry.get('alpha_2') or entry['alpha_3']) 33 | # Need to check iso-639-2 for collective language codes not in iso-639-3 34 | with urlopen(iso_639_2_url) as f: 35 | data = json.load(codecs.getreader('utf-8')(f)) 36 | for entry in data['639-2']: 37 | entry_code = entry.get('alpha_2') or entry['alpha_3'] 38 | if entry_code not in langs: 39 | langs.add(entry_code) 40 | # ISO 15924, Codes for the representation of names of scripts 41 | with urlopen(iso_15924_url) as f: 42 | data = json.load(codecs.getreader('utf-8')(f)) 43 | for entry in data['15924']: 44 | countries.add(entry['alpha_4']) 45 | 46 | print(f'# Generated with {sys.argv[0]}') 47 | print('') 48 | print('LANGUAGES = \\') 49 | pprint(langs) 50 | print('') 51 | print('COUNTRIES = \\') 52 | pprint(countries) 53 | -------------------------------------------------------------------------------- /tools/generate-suse-licenses.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import os 4 | 5 | import requests 6 | 7 | SUSE_EXCEPTIONS = """ 8 | AGPL-3.0 AGPL-3.0+ GFDL-1.1 GFDL-1.1+ GFDL-1.2 GFDL-1.2+ GFDL-1.3 GFDL-1.3+ GPL-3.0-with-GCC-exception \ 9 | GPL-2.0-with-classpath-exception GPL-2.0-with-font-exception SUSE-LGPL-2.1+-with-GCC-exception SUSE-NonFree \ 10 | GPL-1.0+ GPL-1.0 GPL-2.0+ GPL-2.0 GPL-3.0+ GPL-3.0 LGPL-2.0 LGPL-2.0+ LGPL-2.1+ LGPL-2.1 LGPL-3.0+ LGPL-3.0 11 | """ 12 | IGNORED_FOR_PLUS = (' with ', '-with-', ' or ') 13 | 14 | licenses = requests.get('https://raw.githubusercontent.com/openSUSE/obs-service-format_spec_file/master/licenses_changes.txt') 15 | licenses_exceptions = requests.get('https://raw.githubusercontent.com/openSUSE/obs-service-format_spec_file/master/licenses_exceptions.txt') 16 | 17 | with open('../configs/openSUSE/licenses.toml', 'w') as wfile: 18 | script_name = os.path.basename(__file__) 19 | wfile.write('# Generated with %s script:\n' % script_name) 20 | wfile.write('ValidLicenses = [\n') 21 | added = set() 22 | for line in licenses.text.splitlines(): 23 | if line == 'First line': 24 | continue 25 | name = line.strip().split('\t')[0] 26 | if name not in added: 27 | wfile.write(f' "{name}",\n') 28 | added.add(name) 29 | 30 | if not name.endswith('+') and not any(i in name.lower() for i in IGNORED_FOR_PLUS): 31 | plus_name = f'{name}+' 32 | if plus_name not in added: 33 | wfile.write(f' "{plus_name}",\n') 34 | added.add(plus_name) 35 | wfile.write(' # SUSE EXCEPTIONS\n') 36 | for name in SUSE_EXCEPTIONS.strip().split(' '): 37 | wfile.write(f' "{name}",\n') 38 | wfile.write(']\n\n') 39 | 40 | # Licenses Exceptions 41 | wfile.write('ValidLicenseExceptions = [\n') 42 | for line in licenses_exceptions.text.splitlines(): 43 | wfile.write(f' "{line}",\n') 44 | wfile.write(']\n') 45 | --------------------------------------------------------------------------------