How to use the rpmlint.pkg.parse_deps function in rpmlint

To help you get started, we’ve selected a few rpmlint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rpm-software-management / rpmlint / test / test_pkg.py View on Github external
def test_parse_deps():
    for (arg, exp) in (
        ('a, b < 1.0 c = 5:2.0-3 d',
         [('a', 0, (None, None, None)),
          ('b', rpm.RPMSENSE_LESS, (None, '1.0', None)),
          ('c', rpm.RPMSENSE_EQUAL, ('5', '2.0', '3')),
          ('d', 0, (None, None, None))]),
    ):
        assert parse_deps(arg) == exp
github rpm-software-management / rpmlint / rpmlint / checks / SpecCheck.py View on Github external
if res:
                    reqs = Pkg.parse_deps(res.group(1))
                    e = Pkg.has_forbidden_controlchars(reqs)
                    if e:
                        self.output.add_info('E', pkg,
                                             'forbidden-controlchar-found',
                                             'Requires: %s' % e)
                    for req in unversioned(reqs):
                        if compop_regex.search(req):
                            self.output.add_info('W', pkg,
                                                 'comparison-operator-in-deptoken',
                                                 req)

                res = provides_regex.search(line)
                if res:
                    provs = Pkg.parse_deps(res.group(1))
                    e = Pkg.has_forbidden_controlchars(provs)
                    if e:
                        self.output.add_info('E', pkg,
                                             'forbidden-controlchar-found',
                                             'Provides: %s' % e)
                    for prov in unversioned(provs):
                        if not prov.startswith('/'):
                            self.output.add_info('W', pkg, 'unversioned-explicit-provides',
                                                 prov)
                        if compop_regex.search(prov):
                            self.output.add_info('W', pkg,
                                                 'comparison-operator-in-deptoken',
                                                 prov)

                res = obsoletes_regex.search(line)
                if res:
github rpm-software-management / rpmlint / rpmlint / checks / SpecCheck.py View on Github external
res = prereq_regex.search(line)
                if res:
                    self.output.add_info('E', pkg, 'prereq-use', res.group(2))

                res = buildprereq_regex.search(line)
                if res:
                    self.output.add_info('E', pkg, 'buildprereq-use', res.group(1))

                if scriptlet_requires_regex.search(line):
                    self.output.add_info('E', pkg, 'broken-syntax-in-scriptlet-requires',
                                         line.strip())

                res = requires_regex.search(line)
                if res:
                    reqs = Pkg.parse_deps(res.group(1))
                    e = Pkg.has_forbidden_controlchars(reqs)
                    if e:
                        self.output.add_info('E', pkg,
                                             'forbidden-controlchar-found',
                                             'Requires: %s' % e)
                    for req in unversioned(reqs):
                        if compop_regex.search(req):
                            self.output.add_info('W', pkg,
                                                 'comparison-operator-in-deptoken',
                                                 req)

                res = provides_regex.search(line)
                if res:
                    provs = Pkg.parse_deps(res.group(1))
                    e = Pkg.has_forbidden_controlchars(provs)
                    if e:
github rpm-software-management / rpmlint / rpmlint / checks / SpecCheck.py View on Github external
if e:
                        self.output.add_info('E', pkg,
                                             'forbidden-controlchar-found',
                                             'Provides: %s' % e)
                    for prov in unversioned(provs):
                        if not prov.startswith('/'):
                            self.output.add_info('W', pkg, 'unversioned-explicit-provides',
                                                 prov)
                        if compop_regex.search(prov):
                            self.output.add_info('W', pkg,
                                                 'comparison-operator-in-deptoken',
                                                 prov)

                res = obsoletes_regex.search(line)
                if res:
                    obses = Pkg.parse_deps(res.group(1))
                    e = Pkg.has_forbidden_controlchars(obses)
                    if e:
                        self.output.add_info('E', pkg,
                                             'forbidden-controlchar-found',
                                             'Obsoletes: %s' % e)
                    for obs in unversioned(obses):
                        if not obs.startswith('/'):
                            self.output.add_info('W', pkg, 'unversioned-explicit-obsoletes',
                                                 obs)
                        if compop_regex.search(obs):
                            self.output.add_info('W', pkg,
                                                 'comparison-operator-in-deptoken',
                                                 obs)

                res = conflicts_regex.search(line)
                if res:
github rpm-software-management / rpmlint / rpmlint / checks / SpecCheck.py View on Github external
if e:
                        self.output.add_info('E', pkg,
                                             'forbidden-controlchar-found',
                                             'Obsoletes: %s' % e)
                    for obs in unversioned(obses):
                        if not obs.startswith('/'):
                            self.output.add_info('W', pkg, 'unversioned-explicit-obsoletes',
                                                 obs)
                        if compop_regex.search(obs):
                            self.output.add_info('W', pkg,
                                                 'comparison-operator-in-deptoken',
                                                 obs)

                res = conflicts_regex.search(line)
                if res:
                    confs = Pkg.parse_deps(res.group(1))
                    e = Pkg.has_forbidden_controlchars(confs)
                    if e:
                        self.output.add_info('E', pkg,
                                             'forbidden-controlchar-found',
                                             'Conflicts: %s' % e)
                    for conf in unversioned(confs):
                        if compop_regex.search(conf):
                            self.output.add_info('W', pkg,
                                                 'comparison-operator-in-deptoken',
                                                 conf)

            if current_section == 'changelog':
                e = Pkg.has_forbidden_controlchars(line)
                if e:
                    self.output.add_info('E', pkg,
                                         'forbidden-controlchar-found',