Skip to content

Commit

Permalink
Merge branch 'main' into opensuse
Browse files Browse the repository at this point in the history
  • Loading branch information
danigm committed Oct 20, 2023
2 parents 276506d + 8faa54d commit e2048a6
Show file tree
Hide file tree
Showing 16 changed files with 853 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .packit/rpmlint.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%{!?python3: %global python3 %{__python3}}

Name: rpmlint
Version: 2.4.0
Version: 2.5.0
Release: 0%{?dist}
Summary: Tool for checking common errors in RPM packages

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rpmlint"
version = "2.4.0"
version = "2.5.0"
description = "Check for common errors in RPM packages"
license = {text = "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)"}
authors = [
Expand Down Expand Up @@ -75,7 +75,7 @@ include-package-data = true

[tool.setuptools.package-data]
rpmlint = ["configdefaults.toml"]
"rpmlint.descriptions" = ["*.toml"]
"rpmlint.descriptions" = ["*.toml"]

[tool.ruff]

Expand Down
184 changes: 183 additions & 1 deletion rpmlint/__isocodes__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7996,6 +7996,15 @@
'AW',
'AX',
'AZ',
'Adlm',
'Afak',
'Aghb',
'Ahom',
'Arab',
'Aran',
'Armi',
'Armn',
'Avst',
'BA',
'BB',
'BD',
Expand All @@ -8017,6 +8026,18 @@
'BW',
'BY',
'BZ',
'Bali',
'Bamu',
'Bass',
'Batk',
'Beng',
'Bhks',
'Blis',
'Bopo',
'Brah',
'Brai',
'Bugi',
'Buhd',
'CA',
'CC',
'CD',
Expand All @@ -8036,19 +8057,37 @@
'CX',
'CY',
'CZ',
'Cakm',
'Cans',
'Cari',
'Cham',
'Cher',
'Cirt',
'Copt',
'Cprt',
'Cyrl',
'Cyrs',
'DE',
'DJ',
'DK',
'DM',
'DO',
'DZ',
'Deva',
'Dsrt',
'Dupl',
'EC',
'EE',
'EG',
'EH',
'ER',
'ES',
'ET',
'Egyd',
'Egyh',
'Egyp',
'Elba',
'Ethi',
'FI',
'FJ',
'FK',
Expand All @@ -8074,12 +8113,33 @@
'GU',
'GW',
'GY',
'Geok',
'Geor',
'Glag',
'Goth',
'Gran',
'Grek',
'Gujr',
'Guru',
'HK',
'HM',
'HN',
'HR',
'HT',
'HU',
'Hanb',
'Hang',
'Hani',
'Hano',
'Hans',
'Hant',
'Hatr',
'Hebr',
'Hira',
'Hluw',
'Hmng',
'Hrkt',
'Hung',
'ID',
'IE',
'IL',
Expand All @@ -8090,10 +8150,16 @@
'IR',
'IS',
'IT',
'Inds',
'Ital',
'JE',
'JM',
'JO',
'JP',
'Jamo',
'Java',
'Jpan',
'Jurc',
'KE',
'KG',
'KH',
Expand All @@ -8105,6 +8171,17 @@
'KW',
'KY',
'KZ',
'Kali',
'Kana',
'Khar',
'Khmr',
'Khoj',
'Kitl',
'Kits',
'Knda',
'Kore',
'Kpel',
'Kthi',
'LA',
'LB',
'LC',
Expand All @@ -8116,6 +8193,20 @@
'LU',
'LV',
'LY',
'Lana',
'Laoo',
'Latf',
'Latg',
'Latn',
'Leke',
'Lepc',
'Limb',
'Lina',
'Linb',
'Lisu',
'Loma',
'Lyci',
'Lydi',
'MA',
'MC',
'MD',
Expand All @@ -8139,6 +8230,22 @@
'MX',
'MY',
'MZ',
'Mahj',
'Mand',
'Mani',
'Marc',
'Maya',
'Mend',
'Merc',
'Mero',
'Mlym',
'Modi',
'Mong',
'Moon',
'Mroo',
'Mtei',
'Mult',
'Mymr',
'NA',
'NC',
'NE',
Expand All @@ -8151,7 +8258,19 @@
'NR',
'NU',
'NZ',
'Narb',
'Nbat',
'Newa',
'Nkgb',
'Nkoo',
'Nshu',
'OM',
'Ogam',
'Olck',
'Orkh',
'Orya',
'Osge',
'Osma',
'PA',
'PE',
'PF',
Expand All @@ -8166,12 +8285,28 @@
'PT',
'PW',
'PY',
'Palm',
'Pauc',
'Perm',
'Phag',
'Phli',
'Phlp',
'Phlv',
'Phnx',
'Piqd',
'Plrd',
'Prti',
'QA',
'Qaaa',
'Qabx',
'RE',
'RO',
'RS',
'RU',
'RW',
'Rjng',
'Roro',
'Runr',
'SA',
'SB',
'SC',
Expand All @@ -8193,6 +8328,23 @@
'SX',
'SY',
'SZ',
'Samr',
'Sara',
'Sarb',
'Saur',
'Sgnw',
'Shaw',
'Shrd',
'Sidd',
'Sind',
'Sinh',
'Sora',
'Sund',
'Sylo',
'Syrc',
'Syre',
'Syrj',
'Syrn',
'TC',
'TD',
'TF',
Expand All @@ -8209,23 +8361,53 @@
'TV',
'TW',
'TZ',
'Tagb',
'Takr',
'Tale',
'Talu',
'Taml',
'Tang',
'Tavt',
'Telu',
'Teng',
'Tfng',
'Tglg',
'Thaa',
'Thai',
'Tibt',
'Tirh',
'UA',
'UG',
'UM',
'US',
'UY',
'UZ',
'Ugar',
'VA',
'VC',
'VE',
'VG',
'VI',
'VN',
'VU',
'Vaii',
'Visp',
'WF',
'WS',
'Wara',
'Wole',
'Xpeo',
'Xsux',
'YE',
'YT',
'Yiii',
'ZA',
'ZM',
'ZW'}
'ZW',
'Zinh',
'Zmth',
'Zsye',
'Zsym',
'Zxxx',
'Zyyy',
'Zzzz'}
30 changes: 30 additions & 0 deletions rpmlint/checks/FilesCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,35 @@ def _check_file_link_relative(self, pkg, fname, pkgfile):
'symlink-contains-up-and-down-segments',
fname, link)

def _check_file_link_bindir_shebang(self, pkg, fname, pkgfile):
basedir = Path(fname).parent
linkto = str((basedir / Path(pkgfile.linkto)).resolve())
# Link to a file not in the package, so ignore
if linkto not in pkg.files:
return

realbin = pkg.files[linkto]
# Link to something in bindir is okay
if bin_regex.search(realbin.name):
return
if not stat.S_ISREG(realbin.mode):
return

file_chunk, file_istext = self.peek(realbin.path, pkg)
file_interpreter, _file_interpreter_args = script_interpreter(file_chunk)
# Not a script with shebang, so ignore
if not file_interpreter:
return

# If the shebang interpreter is a dependency, it's okay
deps = [x[0] for x in pkg.requires]
if file_interpreter in deps:
return

self.output.add_info('W', pkg, 'symlink-to-binary-with-shebang', fname,
f'is a link to a script ({realbin.name}) but missing'
f' requires for {file_interpreter}')

def _check_file_link(self, pkg, fname, pkgfile):
if not stat.S_ISLNK(pkgfile.mode):
return
Expand All @@ -871,6 +900,7 @@ def _check_file_link(self, pkg, fname, pkgfile):
self._check_file_link_bindir_exes(pkg, fname)
self._check_file_link_absolute(pkg, fname, pkgfile)
self._check_file_link_relative(pkg, fname, pkgfile)
self._check_file_link_bindir_shebang(pkg, fname, pkgfile)

def _check_file_dir(self, pkg, fname, pkgfile):
if not stat.S_ISDIR(pkgfile.mode):
Expand Down
2 changes: 1 addition & 1 deletion rpmlint/checks/SpecCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def re_tag_compile(tag):


patch_regex = re_tag_compile(r'Patch(\d*)')
applied_patch_regex = re.compile(r'^%patch(\d*)')
applied_patch_regex = re.compile(r'^%patch\s*(\d*)')
applied_patch_p_regex = re.compile(r'\s-P\s*(\d+)\b')
applied_patch_pipe_regex = re.compile(r'\s%\{PATCH(\d+)\}\s*\|\s*(%\{?__)?patch\b')
applied_patch_i_regex = re.compile(r'(?:%\{?__)?patch\}?.*?\s+(?:<|-i)\s+%\{PATCH(\d+)\}')
Expand Down
Loading

0 comments on commit e2048a6

Please sign in to comment.