diff options
author | Julian Andres Klode <jak@debian.org> | 2021-04-29 08:25:34 +0000 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2021-04-29 08:25:34 +0000 |
commit | b942031ddfe5b40b527668a8561b5ab137632fd9 (patch) | |
tree | 9c231ab2cb2b6bfd0de8bdf01c360c5533b04e59 | |
parent | 408f4e0d32d11d3f7b7ec0e27fe8cf73cad23a6c (diff) | |
parent | d7e3d28412c5269276d8d7cd72427ab88ee3e3d1 (diff) |
Merge branch 'pu/commasallover' into 'main'
Allow superfluous commas in build-dependency lines
See merge request apt-team/apt!167
-rw-r--r-- | apt-pkg/deb/debsrcrecords.cc | 21 | ||||
-rwxr-xr-x | test/integration/test-apt-get-build-dep-file | 3 |
2 files changed, 13 insertions, 11 deletions
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 0b6cf1ff0..89f3f1667 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -123,6 +123,14 @@ bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDe while (1) { + // Strip off leading spaces (is done by ParseDepends, too) and + // superfluous commas (encountered in user-written dsc/control files) + do { + for (;Start != Stop && isspace_ascii(*Start) != 0; ++Start); + } while (*Start == ',' && ++Start != Stop); + if (Start == Stop) + break; + BuildDepRec rec; Start = debListParser::ParseDepends(Start, Stop, rec.Package, rec.Version, rec.Op, true, StripMultiArch, true); @@ -135,19 +143,12 @@ bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDe // or something). if (rec.Package.empty()) { - // If we are in an OR group, we need to set the "Or" flag of the - // previous entry to our value. - if (BuildDeps.empty() == false && (BuildDeps[BuildDeps.size() - 1].Op & pkgCache::Dep::Or) == pkgCache::Dep::Or) - { - BuildDeps[BuildDeps.size() - 1].Op &= ~pkgCache::Dep::Or; - BuildDeps[BuildDeps.size() - 1].Op |= (rec.Op & pkgCache::Dep::Or); - } + // If this was the last or-group member, close the or-group with the previous entry + if (not BuildDeps.empty() && (BuildDeps.back().Op & pkgCache::Dep::Or) == pkgCache::Dep::Or && (rec.Op & pkgCache::Dep::Or) != pkgCache::Dep::Or) + BuildDeps.back().Op &= ~pkgCache::Dep::Or; } else { BuildDeps.emplace_back(std::move(rec)); } - - if (Start == Stop) - break; } } diff --git a/test/integration/test-apt-get-build-dep-file b/test/integration/test-apt-get-build-dep-file index dc405da90..c4b6947bf 100755 --- a/test/integration/test-apt-get-build-dep-file +++ b/test/integration/test-apt-get-build-dep-file @@ -108,7 +108,8 @@ Source: apturl Section: admin Priority: optional Maintainer: Michael Vogt <mvo@ubuntu.com> -Build-Depends: debhelper (>= 7) +Build-Depends: ,debhelper (>= 7), +Build-Conflicts: ,,, Build-Depends-Indep: X-Python3-Version: >= 3.2 Standards-Version: 3.9.3 |