The following commit has been merged in the master branch:
commit e255fe0c79d4992fb438d4dccb3d478fd5d4681a
Author: Guillem Jover <[email protected]>
Date: Sun Oct 2 08:48:14 2011 +0200
scripts: Improve error messages when debian/control has no package stanza
dpkg-gencontrol and dpkg-gensymbols now give a descriptive error message
when no binary package stanza is found in debian/control.
Closes: #642473
Based-on-patch-by: Kyle Willmon <[email protected]>
Signed-off-by: Guillem Jover <[email protected]>
diff --git a/debian/changelog b/debian/changelog
index e5a58e7..a81d3c3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,9 @@ dpkg (1.16.2) UNRELEASED; urgency=low
the host architecture, for which dpkg itself is not required.
- Reduces the amount of work performed, including loading and parsing
unnecessary table files or calling either of gcc or dpkg programs.
+ * Improve error message in dpkg-gencontrol and dpkg-gensymbols when
+ debian/control does not have any package stanza. Closes: #642473
+ Based on a patch by Kyle Willmon <[email protected]>.
[ Updated dpkg translations ]
* Italian (Milo Casagrande). Closes: #627832
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index 637d5f5..14d6e48 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -152,9 +152,12 @@ if (defined($oppackage)) {
defined($pkg) || error(_g("package %s not in control info"), $oppackage);
} else {
my @packages = map { $_->{'Package'} } $control->get_packages();
- @packages==1 ||
+ if (@packages == 0) {
+ error(_g("no package stanza found in control info"));
+ } elsif (@packages > 1) {
error(_g("must specify package since control info has many (%s)"),
"@packages");
+ }
$pkg = $control->get_pkg_by_idx(1);
}
$substvars->set_msg_prefix(sprintf(_g("package %s: "), $pkg->{Package}));
diff --git a/scripts/dpkg-gensymbols.pl b/scripts/dpkg-gensymbols.pl
index fa18914..0fb96c0 100755
--- a/scripts/dpkg-gensymbols.pl
+++ b/scripts/dpkg-gensymbols.pl
@@ -155,9 +155,12 @@ if (not defined($sourceversion)) {
if (not defined($oppackage)) {
my $control = Dpkg::Control::Info->new();
my @packages = map { $_->{'Package'} } $control->get_packages();
- @packages == 1 ||
+ if (@packages == 0) {
+ error(_g("no package stanza found in control info"));
+ } elsif (@packages > 1) {
error(_g("must specify package since control info has many (%s)"),
"@packages");
+ }
$oppackage = $packages[0];
}
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]