Browse Source

debian/control: add dependency on binutils for dpkg-dev (needed for objdump)
scripts/update-alternatives.pl:
+ set alternative to manual mode when doing --config
+ Fix typo in test for removed manual alternative
+ Merge patch from Camm Maguire to fix updating of slave links

Wichert Akkerman 26 years ago
parent
commit
150dfb2bc9
4 changed files with 41 additions and 5 deletions
  1. 6 0
      ChangeLog
  2. 4 0
      debian/changelog
  3. 1 1
      debian/control
  4. 30 4
      scripts/update-alternatives.pl

+ 6 - 0
ChangeLog

@@ -1,7 +1,13 @@
 Sat Sep  9 21:17:37 CEST 2000 Wichert Akkerman <wakkerma@debian.org>
 Sat Sep  9 21:17:37 CEST 2000 Wichert Akkerman <wakkerma@debian.org>
 
 
+  * debian/control: add dependency on binutils for dpkg-dev (needed for
+    objdump)
   * scripts/dpkg-shlibdeps.pl: really make it do what the documentation
   * scripts/dpkg-shlibdeps.pl: really make it do what the documentation
     says it does.
     says it does.
+  * scripts/update-alternatives.pl:
+    + set alternative to manual mode when doing --config
+    + Fix typo in test for removed manual alternative
+    + Merge patch from Camm Maguire to fix updating of slave links
 
 
 Fri Sep  8 12:28:34 CEST 2000 Wichert Akkerman <wakkerma@debian.org>
 Fri Sep  8 12:28:34 CEST 2000 Wichert Akkerman <wakkerma@debian.org>
 
 

+ 4 - 0
debian/changelog

@@ -2,6 +2,10 @@ dpkg (1.7.0) unstable; urgency=low
 
 
   * Allow the administrator to override file mode and ownership
   * Allow the administrator to override file mode and ownership
   * Use objdump instead of ldd in dpkg-shlibdeps
   * Use objdump instead of ldd in dpkg-shlibdeps
+  * Fix logic in dpkg-shlibdeps so it looks for dependencies as specified
+    in the documentation
+  * Make update-alternatives update slave links with --config and properly
+    switch the alternative to manual mode
   * HURD updates, Closes: Bug#57753,#57754,#57755
   * HURD updates, Closes: Bug#57753,#57754,#57755
   * dpkg-architecture: -q should not imply -f, Closes: Bug#57761
   * dpkg-architecture: -q should not imply -f, Closes: Bug#57761
   * add dpkg:UpstreamVersion and dpkg:Version substvars in dpkg-genchanges
   * add dpkg:UpstreamVersion and dpkg:Version substvars in dpkg-genchanges

+ 1 - 1
debian/control

@@ -25,7 +25,7 @@ Package: dpkg-dev
 Section: devel
 Section: devel
 Priority: important
 Priority: important
 Architecture: all
 Architecture: all
-Depends: perl5, cpio (>= 2.4.2-2), patch (>= 2.2-1), make
+Depends: perl5, cpio (>= 2.4.2-2), patch (>= 2.2-1), make, binutils
 Recommends: c-compiler
 Recommends: c-compiler
 Suggests: gnupg, debian-keyring
 Suggests: gnupg, debian-keyring
 Conflicts: dpkgname
 Conflicts: dpkgname

+ 30 - 4
scripts/update-alternatives.pl

@@ -15,7 +15,7 @@ sub ENOENT { 2; }
 #                       expected: alternative with highest priority is the active alternative
 #                       expected: alternative with highest priority is the active alternative
 #                       expected-inprogress: busy selecting alternative with highest priority
 #                       expected-inprogress: busy selecting alternative with highest priority
 #                       unexpected: alternative another alternative is active / error during readlink
 #                       unexpected: alternative another alternative is active / error during readlink
-#                       nonexistant: alternative-symlink does not exist
+#                       nonexistent: alternative-symlink does not exist
 #  $link             Link we are working with
 #  $link             Link we are working with
 #  @slavenames       List with names of slavelinks
 #  @slavenames       List with names of slavelinks
 #  %slavenum         Map from name of slavelink to slave-index (into @slavelinks)
 #  %slavenum         Map from name of slavelink to slave-index (into @slavelinks)
@@ -201,7 +201,6 @@ if ($mode eq 'config') {
 	&pr("No alternatives for $name.");
 	&pr("No alternatives for $name.");
     } else {
     } else {
 	&config_alternatives($name);
 	&config_alternatives($name);
-	exit 0;
     }
     }
 }
 }
 
 
@@ -301,7 +300,7 @@ if ($mode eq 'install') {
 }
 }
 
 
 if ($mode eq 'remove') {
 if ($mode eq 'remove') {
-    if ($manual eq "manual" and $state = "expected") {
+    if ($manual eq "manual" and $state eq "expected") {
     	&pr("Removing manually selected alternative - switching to auto mode");
     	&pr("Removing manually selected alternative - switching to auto mode");
 	$manual= "auto";
 	$manual= "auto";
     }
     }
@@ -503,6 +502,7 @@ sub config_alternatives {
     } until $preferred eq '' || $preferred>=1 && $preferred<=$#versions+1 &&
     } until $preferred eq '' || $preferred>=1 && $preferred<=$#versions+1 &&
 	($preferred =~ m/[0-9]*/);
 	($preferred =~ m/[0-9]*/);
     if ($preferred ne '') {
     if ($preferred ne '') {
+    	$manual = "manual";
 	$preferred--;
 	$preferred--;
 	print STDOUT "Using \`$versions[$preferred]' to provide \`$name'.\n";
 	print STDOUT "Using \`$versions[$preferred]' to provide \`$name'.\n";
 	my $spath = $versions[$preferred];
 	my $spath = $versions[$preferred];
@@ -510,6 +510,21 @@ sub config_alternatives {
 	    &quit("unable to make $altdir/$name.dpkg-tmp a symlink to $spath: $!");
 	    &quit("unable to make $altdir/$name.dpkg-tmp a symlink to $spath: $!");
 	rename_mv("$altdir/$name.dpkg-tmp","$altdir/$name") ||
 	rename_mv("$altdir/$name.dpkg-tmp","$altdir/$name") ||
 	    &quit("unable to install $altdir/$name.dpkg-tmp as $altdir/$name: $!");
 	    &quit("unable to install $altdir/$name.dpkg-tmp as $altdir/$name: $!");
+	# Link slaves...
+	for( my $slnum = 0; $slnum &lt; @slavenames; $slnum++ ) {
+	    my $slave = $slavenames[$slnum];
+	    if ($slavepath{$preferred,$slnum} ne '') {
+		checked_symlink($slavepath{$preferred,$slnum},
+			"$altdir/$slave.dpkg-tmp");
+		checked_mv("$altdir/$slave.dpkg-tmp", "$altdir/$slave");
+	    } else {
+		&amp;pr("Removing $slave ($slavelinks[$slnum]), not appropriate with $versions[$preferred].")
+		    if $verbosemode &gt; 0;
+		unlink("$altdir/$slave") || $! == &amp;ENOENT ||
+		    &amp;quit("unable to remove $altdir/$slave: $!");
+	    }
+	}
+
     }
     }
 }
 }
 
 
@@ -528,8 +543,19 @@ sub badfmt {
     &quit("internal error: $admindir/$name corrupt: $_[0]");
     &quit("internal error: $admindir/$name corrupt: $_[0]");
 }
 }
 sub rename_mv {
 sub rename_mv {
-	return (rename($_[0], $_[1]) || (system(("mv", $_[0], $_[1])) == 0));
+    return (rename($_[0], $_[1]) || (system(("mv", $_[0], $_[1])) == 0));
+}
+sub checked_symlink {
+    my ($filename, $linkname) = @_;
+    symlink($filename, $linkname) ||
+	&amp;quit("unable to make $linkname a symlink to $filename: $!");
 }
 }
+sub checked_mv {
+    my ($source, $dest) = @_;
+    rename_mv($source, $dest) ||
+	&amp;quit("unable to install $source as $dest: $!");
+}
+
 exit(0);
 exit(0);
 
 
 # vim: nowrap ts=8 sw=4
 # vim: nowrap ts=8 sw=4