luci-app-opkg: relax dependency parsing

Align depdendency parse logic with opkg to properly process certain
malformed dependency specifications. In particular do not require a
depdendency specification to end after the closing paren of a version
constraint and perform non-greedy matching in order to extract the
first version constraint only.

Fixes: #5997
Ref: https://forum.openwrt.org/t/x/138328
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2022-09-30 09:59:39 +02:00
parent 3393e15815
commit 84ba6a5c36

View file

@ -601,7 +601,7 @@ function renderDependencies(depends, info, flat)
if (deps[i] === 'libc') if (deps[i] === 'libc')
continue; continue;
if (deps[i].match(/^(.+)\s+\((<=|>=|<<|>>|<|>|=)(.+)\)$/)) { if (deps[i].match(/^(.+?)\s+\((<=|>=|<<|>>|<|>|=)(.+?)\)/)) {
dep = RegExp.$1.trim(); dep = RegExp.$1.trim();
vop = RegExp.$2.trim(); vop = RegExp.$2.trim();
ver = RegExp.$3.trim(); ver = RegExp.$3.trim();