This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=d8a620900322acede63709a0be6065a194667710 commit d8a620900322acede63709a0be6065a194667710 Author: Guillem Jover <[email protected]> AuthorDate: Mon Aug 25 23:59:47 2025 +0200 Dpkg::Deps::Simple: Move dependency regex into its own variable Instead of inlining the dependency regex in the match itself, move it into a variable and then use that in the conditional. --- scripts/Dpkg/Deps/Simple.pm | 56 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/scripts/Dpkg/Deps/Simple.pm b/scripts/Dpkg/Deps/Simple.pm index a585bdaf5..e3f46586e 100644 --- a/scripts/Dpkg/Deps/Simple.pm +++ b/scripts/Dpkg/Deps/Simple.pm @@ -173,34 +173,36 @@ sub parse_string { $pkgname_re = qr/[a-zA-Z0-9][a-zA-Z0-9+.-]*/; } + my $dep_regex = qr{ + ^\s* # skip leading whitespace + ($pkgname_re) # package name + (?: # start of optional part + : # colon for architecture + ([a-zA-Z0-9][a-zA-Z0-9-]*) # architecture name + )? # end of optional part + (?: # start of optional part + \s* \( # open parenthesis for version part + \s* (<<|<=|=|>=|>>|[<>]) # relation part + \s* ([^\)\s]+) # do not attempt to parse version + \s* \) # closing parenthesis + )? # end of optional part + (?: # start of optional architecture + \s* \[ # open bracket for architecture + \s* ([^\]]+) # don't parse architectures now + \s* \] # closing bracket + )? # end of optional architecture + ( + (?: # start of optional restriction + \s* < # open bracket for restriction + \s* [^>]+ # do not parse restrictions now + \s* > # closing bracket + )+ + )? # end of optional restriction + \s*$ # trailing spaces at end + }x; + ## no critic (RegularExpressions::ProhibitCaptureWithoutTest) - return if not $dep =~ - m{^\s* # skip leading whitespace - ($pkgname_re) # package name - (?: # start of optional part - : # colon for architecture - ([a-zA-Z0-9][a-zA-Z0-9-]*) # architecture name - )? # end of optional part - (?: # start of optional part - \s* \( # open parenthesis for version part - \s* (<<|<=|=|>=|>>|[<>]) # relation part - \s* ([^\)\s]+) # do not attempt to parse version - \s* \) # closing parenthesis - )? # end of optional part - (?: # start of optional architecture - \s* \[ # open bracket for architecture - \s* ([^\]]+) # don't parse architectures now - \s* \] # closing bracket - )? # end of optional architecture - ( - (?: # start of optional restriction - \s* < # open bracket for restriction - \s* [^>]+ # do not parse restrictions now - \s* > # closing bracket - )+ - )? # end of optional restriction - \s*$ # trailing spaces at end - }x; + return if not $dep =~ $dep_regex; if (defined $2) { return if $2 eq 'native' and not $self->{build_dep}; $self->{archqual} = $2; -- Dpkg.Org's dpkg

