]> git.proxmox.com Git - debcargo-conf.git/commitdiff
dev/chain_build.py: improve RE usage
authorBlair Noctis <n@sail.ng>
Fri, 7 Jul 2023 05:50:48 +0000 (13:50 +0800)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 20 Sep 2023 09:26:10 +0000 (11:26 +0200)
dev/chain_build.py

index e2e00d124b76acb989825d298d94064d1dacd228..518c7d3077e3be0a4782a1cab11bc9b72f500178 100755 (executable)
@@ -79,7 +79,7 @@ def find_built(specs: list[tuple[str, str]]) -> list[tuple[str, str, str]]:
        _print('Conducting search in apt cache and build/ directory for existing debs')
        for crate, ver in specs:
                _crate = _todash(crate)
-               pkg_re = re.compile(f'^librust-{_crate}(?:\+.*?)?-dev_{ver}')
+               pkg_re = re.compile(f'librust-{_crate}(?:\+.*?)?-dev_{ver}')
                if ver == '*':
                        try:
                                ver = _get_dch_version(crate)
@@ -94,7 +94,7 @@ def find_built(specs: list[tuple[str, str]]) -> list[tuple[str, str, str]]:
                        # means it's yet to be `./update.sh`d, move on
                        continue
                for deb in debs:
-                       if pkg_re.match(deb) is not None:
+                       if pkg_re.match(deb):
                                built.append((crate, deb, 'build'))
        return built
 
@@ -218,13 +218,13 @@ def chain_build(specs):
                if ver == '*':
                        # used in a glob, so
                        ver = ''
-               _crate=_todash(crate)
-               pkg_re = re.compile(f'^librust-{_crate}(?:\+.*?)?-dev_{ver}')
+               _crate = _todash(crate)
+               pkg_re = re.compile(f'librust-{_crate}(?:\+.*?)?-dev_{ver}')
                chdir('build')
                all_debs = _find('*.deb')
                chdir('..')
                for deb in all_debs:
-                       if pkg_re.match(deb) is not None:
+                       if pkg_re.match(deb):
                                debs.add(deb)