Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions rpmlint/checks/InitScriptCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def shell_var_value(var, script):
if res2 and res2.group(2) == var: # infinite loop
return None
return substitute_shell_vars(res.group(1), script)
else:
return None
return None


def substitute_shell_vars(val, script):
Expand All @@ -54,8 +53,7 @@ def substitute_shell_vars(val, script):
value = ''
return res.group(1) + value + \
substitute_shell_vars(res.group(3), script)
else:
return val
return val


class InitScriptCheck(AbstractCheck):
Expand Down
5 changes: 2 additions & 3 deletions rpmlint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,9 @@ def _sort_config_files(self, config_file):
"""
if config_file == self.config_defaults:
return 0
elif not self._is_override_config(config_file):
if not self._is_override_config(config_file):
return 1
else:
return 2
return 2

def load_config(self, config=None):
"""
Expand Down
39 changes: 18 additions & 21 deletions rpmlint/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,13 @@ def compression_algorithm(fname):
fname = str(fname)
if gzip_regex.search(fname):
return gzip
elif bz2_regex.search(fname):
if bz2_regex.search(fname):
return bz2
elif xz_regex.search(fname):
if xz_regex.search(fname):
return lzma
elif zst_regex.search(fname):
if zst_regex.search(fname):
return zstd
else:
return None
return None


def is_utf8(fname):
Expand Down Expand Up @@ -519,8 +518,7 @@ def grep(self, regex, filename):
match = regex.search(data)
if match:
return data.count('\n', 0, match.start()) + 1
else:
return None
return None


class Pkg(AbstractPkg):
Expand Down Expand Up @@ -589,20 +587,19 @@ def __getitem__(self, key):
val = []
if val == []:
return None
else:
# Note that text tags we want to try decoding for real in TagsCheck
# such as summary, description and changelog are not here.
if key in (rpm.RPMTAG_NAME, rpm.RPMTAG_VERSION, rpm.RPMTAG_RELEASE,
rpm.RPMTAG_ARCH, rpm.RPMTAG_GROUP, rpm.RPMTAG_BUILDHOST,
rpm.RPMTAG_LICENSE, rpm.RPMTAG_HEADERI18NTABLE,
rpm.RPMTAG_PACKAGER, rpm.RPMTAG_SOURCERPM,
rpm.RPMTAG_DISTRIBUTION, rpm.RPMTAG_VENDOR) \
or key in (x[0] for x in SCRIPT_TAGS) \
or key in (x[1] for x in SCRIPT_TAGS):
val = byte_to_string(val)
if key == rpm.RPMTAG_GROUP and val == 'Unspecified':
val = None
return val
# Note that text tags we want to try decoding for real in TagsCheck
# such as summary, description and changelog are not here.
if key in (rpm.RPMTAG_NAME, rpm.RPMTAG_VERSION, rpm.RPMTAG_RELEASE,
rpm.RPMTAG_ARCH, rpm.RPMTAG_GROUP, rpm.RPMTAG_BUILDHOST,
rpm.RPMTAG_LICENSE, rpm.RPMTAG_HEADERI18NTABLE,
rpm.RPMTAG_PACKAGER, rpm.RPMTAG_SOURCERPM,
rpm.RPMTAG_DISTRIBUTION, rpm.RPMTAG_VENDOR) \
or key in (x[0] for x in SCRIPT_TAGS) \
or key in (x[1] for x in SCRIPT_TAGS):
val = byte_to_string(val)
if key == rpm.RPMTAG_GROUP and val == 'Unspecified':
val = None
return val

# return the name of the directory where the package is extracted
def dir_name(self):
Expand Down
Loading