summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2021-03-17 19:31:55 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2021-04-25 12:02:19 +0200
commitd7e3d28412c5269276d8d7cd72427ab88ee3e3d1 (patch)
tree9c231ab2cb2b6bfd0de8bdf01c360c5533b04e59
parent25e11a6b4bf11e5ffa364a0e2961ae89289f4611 (diff)
Allow superfluous commas in build-dependency lines
This code can interact with handwritten files who can have unneeded commas for writing easy. As dpkg allows it, we should do as well. Reported-By: Arnaud Ferraris <arnaud.ferraris@gmail.com> References: https://lists.debian.org/debian-devel/2021/03/msg00101.html
-rw-r--r--apt-pkg/deb/debsrcrecords.cc11
-rwxr-xr-xtest/integration/test-apt-get-build-dep-file3
2 files changed, 10 insertions, 4 deletions
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index 0a1f91f22..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);
@@ -141,9 +149,6 @@ bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDe
} 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