Use only one list of patterns/rules for debug packages
Signed-off-by: Till Maas <opensource@till.name>
This commit is contained in:
parent
938531e2b2
commit
b26547ae77
@ -24,9 +24,7 @@ import pungi.common
|
|||||||
import pungi.dnf_wrapper
|
import pungi.dnf_wrapper
|
||||||
import pungi.multilib_dnf
|
import pungi.multilib_dnf
|
||||||
from pungi.profiler import Profiler
|
from pungi.profiler import Profiler
|
||||||
|
from pungi.util import DEBUG_PATTERNS
|
||||||
# Globs for package name that should match all debuginfo packages
|
|
||||||
DEBUG_GLOBS = ["*-debuginfo", "*-debuginfo-*", "*-debugsource"]
|
|
||||||
|
|
||||||
|
|
||||||
def get_source_name(pkg):
|
def get_source_name(pkg):
|
||||||
@ -123,7 +121,7 @@ class GatherBase(object):
|
|||||||
q_multilib = q.difference(q_native).union(q_noarch).apply()
|
q_multilib = q.difference(q_native).union(q_noarch).apply()
|
||||||
|
|
||||||
# debug packages
|
# debug packages
|
||||||
self.q_debug_packages = q.filter(name__glob=DEBUG_GLOBS).apply()
|
self.q_debug_packages = q.filter(name__glob=DEBUG_PATTERNS).apply()
|
||||||
self.q_native_debug_packages = self.q_debug_packages.intersection(q_native)
|
self.q_native_debug_packages = self.q_debug_packages.intersection(q_native)
|
||||||
self.q_multilib_debug_packages = self.q_debug_packages.intersection(q_multilib)
|
self.q_multilib_debug_packages = self.q_debug_packages.intersection(q_multilib)
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# along with this program; if not, see <https://gnu.org/licenses/>.
|
# along with this program; if not, see <https://gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
import fnmatch
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
@ -33,6 +34,8 @@ import functools
|
|||||||
from kobo.shortcuts import run, force_list
|
from kobo.shortcuts import run, force_list
|
||||||
from productmd.common import get_major_version
|
from productmd.common import get_major_version
|
||||||
|
|
||||||
|
# Patterns that match all names of debuginfo packages
|
||||||
|
DEBUG_PATTERNS = ["*-debuginfo", "*-debuginfo-*", "*-debugsource"]
|
||||||
|
|
||||||
def _doRunCommand(command, logger, rundir='/tmp', output=subprocess.PIPE, error=subprocess.PIPE, env=None):
|
def _doRunCommand(command, logger, rundir='/tmp', output=subprocess.PIPE, error=subprocess.PIPE, env=None):
|
||||||
"""Run a command and log the output. Error out if we get something on stderr"""
|
"""Run a command and log the output. Error out if we get something on stderr"""
|
||||||
@ -190,14 +193,17 @@ def pkg_is_srpm(pkg_obj):
|
|||||||
def pkg_is_debug(pkg_obj):
|
def pkg_is_debug(pkg_obj):
|
||||||
if pkg_is_srpm(pkg_obj):
|
if pkg_is_srpm(pkg_obj):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if isinstance(pkg_obj, str):
|
if isinstance(pkg_obj, str):
|
||||||
# string
|
# string
|
||||||
if "-debuginfo" in pkg_obj or '-debugsource' in pkg_obj:
|
name = pkg_obj
|
||||||
return True
|
|
||||||
else:
|
else:
|
||||||
# package object
|
name = pkg_obj.name
|
||||||
if "-debuginfo" in pkg_obj.name or '-debugsource' in pkg_obj.name:
|
|
||||||
|
for pattern in DEBUG_PATTERNS:
|
||||||
|
if fnmatch.fnmatch(name, pattern):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user