mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 14:59:05 +00:00
refactor(deb): classify dependency architecture polarity once (#16871)
This commit is contained in:
1 parent
e7d9d17ef5
commit
554c752d38
1 file changed
+6
-11
@@ -366,19 +366,14 @@ export const parseDebianDependency = (
|
||||
countWhitespaceTokens(inner, maxArchitectureItems) > maxArchitectureItems
|
||||
)
|
||||
return null;
|
||||
const tokens = inner
|
||||
.trim()
|
||||
.split(/\s+/u)
|
||||
.filter((token) => token.length > 0);
|
||||
if (tokens.length === 0) return null;
|
||||
const negated = tokens.every((token) => token.startsWith("!"));
|
||||
const mixed = tokens.some((token) => token.startsWith("!")) !== negated;
|
||||
if (mixed) return null;
|
||||
const text = inner.trim();
|
||||
if (text === "") return null;
|
||||
const tokens = text.split(/\s+/u);
|
||||
const negated = text.startsWith("!");
|
||||
if (tokens.some((token) => token.startsWith("!") !== negated)) return null;
|
||||
arch_restriction = {
|
||||
negated,
|
||||
architectures: tokens.map((token) =>
|
||||
token.startsWith("!") ? token.slice(1) : token,
|
||||
),
|
||||
architectures: negated ? tokens.map((token) => token.slice(1)) : tokens,
|
||||
};
|
||||
rest = rest.slice(close + 1).trim();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user