[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#332311: [Patch] Fixes the bug.



The bug was a bit weird. The option "-f/--follow" wasn't parsed at all, but given as a plain string instead of the AptPkg::Deb::* enumeration. (Maybe AptPkg API changed in 2005...?)

~~patch attached
diff -u apt-rdepends-1.3.0/apt-rdepends apt-rdepends-1.3.0/apt-rdepends
--- apt-rdepends-1.3.0/apt-rdepends
+++ apt-rdepends-1.3.0/apt-rdepends
@@ -132,13 +132,47 @@
 close(OLDOUT);
 select(STDOUT); $| = 0;
 
+# Converts a string like "Depends" to the corresponding AptPkg::Dep::* enum.
+sub depstr_to_enum {
+  my $depstr = shift(@_);
+  if ($depstr eq "Depends") {
+    return AptPkg::Dep::Depends;
+  }
+  if ($depstr eq "PreDepends") {
+    return AptPkg::Dep::PreDepends;
+  }
+  if ($depstr eq "Suggests") {
+    return AptPkg::Dep::Suggests;
+  }
+  if ($depstr eq "Recommends") {
+    return AptPkg::Dep::Recommends;
+  }
+  if ($depstr eq "Conflicts") {
+    return AptPkg::Dep::Conflicts;
+  }
+  if ($depstr eq "Replaces") {
+    return AptPkg::Dep::Replaces;
+  }
+  if ($depstr eq "Obsoletes") {
+    return AptPkg::Dep::Obsoletes;
+  }
+  print(STDERR "invalid argument given to -f (--follow): ${depstr}\n");
+  exit 101;
+}
+
 # Set defaults if they weren't defined on the command line.
 if ($builddep) {
   @follow = ("Build-Depends", "Build-Depends-Indep") unless (@follow);
   @show = ("Build-Depends", "Build-Depends-Indep") unless (@show);
 }
 else {
-  @follow = (AptPkg::Dep::Depends, AptPkg::Dep::PreDepends) unless (@follow);
+  unless(@follow) {
+    @follow = (AptPkg::Dep::Depends, AptPkg::Dep::PreDepends);
+  }
+  else {
+    @follow = map{depstr_to_enum($_)}(@follow);
+  }
+
   @show = (AptPkg::Dep::Depends, AptPkg::Dep::PreDepends) unless (@show);
 }
 my %deptype_dict;
diff -u apt-rdepends-1.3.0/debian/changelog apt-rdepends-1.3.0/debian/changelog
--- apt-rdepends-1.3.0/debian/changelog
+++ apt-rdepends-1.3.0/debian/changelog
@@ -1,3 +1,11 @@
+apt-rdepends (1.3.0-3) UNRELEASED; urgency=low
+
+  * QA upload.
+  * Fixes (adds) parsing of the -f/--follow option. (closes #332311), 
+    thanks for help to kuroi
+
+ -- Roman Naumann <namor_debian@hemio.de>  Fri, 14 Sep 2012 17:47:13 +0200
+
 apt-rdepends (1.3.0-2) unstable; urgency=low
 
   * QA upload.

Reply to: