Control: tags 905702 + patch
Control: tags 905702 + pending

Dear maintainer,

I've prepared an NMU for rcconf (versioned as 3.2+nmu1) and
uploaded it to DELAYED/15. Please feel free to tell me if I
should delay it longer.

I have taken the liberty of including some minor clean ups (such as
the now mandatory build-arch and build-indep targets).  Please let me
know if you prefer the NMU without these changes.

Regards.

diff -Nru rcconf-3.2/debian/changelog rcconf-3.2+nmu1/debian/changelog
--- rcconf-3.2/debian/changelog 2016-08-20 14:49:12.000000000 +0000
+++ rcconf-3.2+nmu1/debian/changelog    2018-11-11 16:16:28.000000000 +0000
@@ -1,3 +1,19 @@
+rcconf (3.2+nmu1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix access to internal dpkg database.  (Closes: #905702)
+  * Replace call to "dh_clean -k" with "dh_prep" in debian/rules as the
+    latter is deprecated
+  * Add required build-arch and build-indep targets to debian/rules
+  * Set "Rules-Requires-Root" to "no" as menu-xdg does not need
+    (fake)root to build."
+  * Remove dependency on perl-modules as it is implied by the dependency
+    on perl and the perl maintainers consider perl-modules an
+    implementation-detail that we must not rely on.
+  * Remove empty "usr/bin" folder in the rcconf package.
+
+ -- Niels Thykier <ni...@thykier.net>  Sun, 11 Nov 2018 16:16:28 +0000
+
 rcconf (3.2) unstable; urgency=low
 
   * Closes: #831936
diff -Nru rcconf-3.2/debian/control rcconf-3.2+nmu1/debian/control
--- rcconf-3.2/debian/control   2010-03-10 04:38:25.000000000 +0000
+++ rcconf-3.2+nmu1/debian/control      2018-11-11 16:12:10.000000000 +0000
@@ -5,10 +5,11 @@
 Build-Depends-Indep: perl
 Build-Depends: debhelper (>= 7)
 Standards-Version: 3.8.4
+Rules-Requires-Root: no
 
 Package: rcconf
 Architecture: all
-Depends: whiptail | whiptail-provider | dialog, sysv-rc, perl, perl-modules
+Depends: whiptail | whiptail-provider | dialog, sysv-rc, perl
 Conflicts: file-rc
 Description: Debian Runlevel configuration tool
  This tool configures system services in connection with system
diff -Nru rcconf-3.2/debian/dirs rcconf-3.2+nmu1/debian/dirs
--- rcconf-3.2/debian/dirs      2010-03-10 04:35:58.000000000 +0000
+++ rcconf-3.2+nmu1/debian/dirs 2018-11-11 16:14:57.000000000 +0000
@@ -1,3 +1,2 @@
-usr/bin
 usr/sbin
 var/lib/rcconf
diff -Nru rcconf-3.2/debian/rules rcconf-3.2+nmu1/debian/rules
--- rcconf-3.2/debian/rules     2016-08-20 14:50:38.000000000 +0000
+++ rcconf-3.2+nmu1/debian/rules        2018-11-11 16:10:12.000000000 +0000
@@ -15,7 +15,9 @@
        touch configure-stamp
 
 
-build: build-stamp
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
 
 build-stamp: configure-stamp 
        dh_testdir
@@ -40,7 +42,7 @@
 install: build
        dh_testdir
        dh_testroot
-       dh_clean -k 
+       dh_prep
        dh_installdirs
 
        install -m 755 rcconf `pwd`/debian/rcconf/usr/sbin
diff -Nru rcconf-3.2/update-rcconf-guide rcconf-3.2+nmu1/update-rcconf-guide
--- rcconf-3.2/update-rcconf-guide      2010-03-10 04:33:22.000000000 +0000
+++ rcconf-3.2+nmu1/update-rcconf-guide 2018-11-11 16:06:17.000000000 +0000
@@ -81,7 +81,7 @@
 
 my $initd_files_array = &read_initd_dir($INITD_DIR);
 
-my $filepath_hash = &create_dpkg_installed_filepath("/var/lib/dpkg/info");
+my $filepath_hash = &create_dpkg_installed_filepath();
 
 print "Writing package default guide to $GUIDE_FILE ...\n";
 
@@ -205,64 +205,28 @@
 ## STATUS:
 ## END:
 sub create_dpkg_installed_filepath {
-  my ($info_dir) = @_;
-##
-  if ( ( $info_dir eq "" ) || ( ! -d $info_dir ) ) {
-    die "No such directory: $info_dir .\n";
-  }
+  my $pid = open(my $fd, '-|', q{dpkg-query -S '/etc/init.d/*'})
+      // die(qq{fork+exec of "dpkg-query -S '/etc/init.d/*'" failed: $!});
 
-  my $dh = DirHandle->new($info_dir);
-  if ( ! defined($dh) ) {
-    die "Can't open directory: $info_dir .\n";
+  my %filepath_hash;
+  while (my $line = <$fd>) {
+      my ($package, $file);
+      chomp($line);
+      ($package, $file) = split(m/: /, $line, 2);
+      $filepath_hash{$file} = $package;
+  }
+
+  if (!close($fd)) {
+      die("close of dpkg-query's stdout failed: $!") if $!;
+      my $exit_code = ($? >> 8) & 0xff;
+      my $signal = $? & 0x7f;
+      if ($signal) {
+          die(qq{dpkg-query -S '/etc/init.d/*' was killed by signal 
${signal}});
+      } else {
+          die(qq{dpkg-query -S '/etc/init.d/*' failed with exit code 
${exit_code}});
+      }
   }
 
-  my $file;
-  my $package;
-  my %filepath_hash = ();
-  while ( defined($file = $dh->read()) ) {
-    if ( $file =~ /(.*)\.list$/ ) {
-      $package = $1;
-#      print "$package $file\n";
-      &insert_filepath($info_dir."/".$file, \%filepath_hash, $package);
-    }
-  }
-  undef $dh;
-
   return(\%filepath_hash);
 } ## create_dpkg_installed_filepath
 
-#######################################################################
-## MODULE: insert_filepath
-## DESC: 
-## IN:
-## OUT:
-## OP:
-## STATUS:
-## END:
-sub insert_filepath {
-  my ($info_filelist_file, $filepath_hash, $package) = @_;
-##
-  if ( ( $info_filelist_file eq "" ) || ( ! -f $info_filelist_file ) ) {
-    die "No such directory: $info_filelist_file.\n";
-  }
-  if ( ref($filepath_hash) ne "HASH" ) {
-    die "arg(filepath_hash) isn't HASH ref.\n";
-  }
-  if ( $package eq "" ) {
-    die "arg(package) is null.\n";
-  }
-
-  my $fh = FileHandle->new($info_filelist_file);
-  if ( ! defined($fh) ) {
-    die "Can't open $info_filelist_file.\n";
-  }
-
-  my $line;
-  while ( $line = <$fh> ) {
-    ## If we check $line whether file or not, go very slowly.
-    chomp($line);
-    $filepath_hash->{$line} = $package;
-  }
-
-  undef $fh;
-} ## insert_filepath

Reply via email to