Package: debhelper
Version: 5.0.50
Severity: wishlist
Tags: patch

Hi,

comparing dh_link(1)

SYNOPSIS
       dh_link [debhelper options] [-A] [source destination ...]

and ln(1)

SYNOPSIS
       ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)

I'm always confused about the order of arguments and then try to use
dh_link the wrong way round. The patch below fixes the terminology in
dh_link to "destination" "source" to match ln's "target" more closely.

As the patch is fairly intrusive (and the 'way' in which symlinks point
is probably dependent on the reader), an alternative would be to add a
note that the order is the same as with ln.

Thanks for considering,
Christoph
-- 
[EMAIL PROTECTED] | http://www.df7cb.de/
diff -Nru /srv/tmp/zk9SKOEh6i/debhelper-5.0.50/dh_link /srv/tmp/rzOS8dOIm6/debhelper-5.0.50/dh_link
--- /srv/tmp/zk9SKOEh6i/debhelper-5.0.50/dh_link	2006-10-30 06:13:54.000000000 +0100
+++ /srv/tmp/rzOS8dOIm6/debhelper-5.0.50/dh_link	2007-07-08 12:33:38.000000000 +0200
@@ -12,17 +12,17 @@
 
 =head1 SYNOPSIS
 
-B<dh_link> [S<I<debhelper options>>] [B<-A>] [S<I<source destination ...>>]
+B<dh_link> [S<I<debhelper options>>] [B<-A>] [S<I<destination source ...>>]
 
 =head1 DESCRIPTION
 
 dh_link is a debhelper program that creates symlinks in package build
 directories.
 
-dh_link accepts a list of pairs of source and destination files. The source
-files are the already existing files that will be symlinked from. The
-destination files are the symlinks that will be created. There B<must> be
-an equal number of source and destination files specified.
+dh_link accepts a list of pairs of destination and source files. The destination
+files are the already existing files that will be symlinked to. The
+source files are the symlinks that will be created. There B<must> be
+an equal number of destination and source files specified.
 
 The list can be specified in two ways. A file named debian/package.links
 can list pairs of files. If you use this file, you should put each pair
@@ -33,8 +33,8 @@
 package in debian/control, but if you use -p, -i, or -a flags, it will be
 the first package specified by those flags.
 
-Be sure you B<do> specify the full filename to both the source and
-destination files (unlike you would do if you were using something like
+Be sure you B<do> specify the full filename to both the destination and
+source files (unlike you would do if you were using something like
 L<ln(1)>).
 
 dh_link will generate symlinks that comply with debian policy - absolute
@@ -54,9 +54,9 @@
 Create any links specified by command line parameters in ALL packages
 acted on, not just the first.
 
-=item I<source destination ...>
+=item I<destination source ...>
 
-Create a file named "destination" as a link to a file named "source". Do
+Create a file named "source" as a link to a file named "destination". Do
 this in the package build directory of the first package acted on.
 (Or in all packages if -A is specified.)
 
@@ -126,7 +126,7 @@
 	# Make sure it has pairs of symlinks and destinations. If it
 	# doesn't, $#links will be _odd_ (not even, -- it's zero-based).
 	if (int($#links/2) eq $#links/2) {
-		error("$file lists a link without a destination.");
+		error("$file lists a link without a source.");
 	}
 
 	if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
@@ -135,7 +135,7 @@
 
 	# Same test as above, including arguments this time.
 	if (int($#links/2) eq $#links/2) {
-		error("parameters list a link without a destination.");
+		error("parameters list a link without a source.");
 	}
 
 	# v4 or later and only if there is a temp dir already
@@ -161,14 +161,14 @@
 	}
 	
 	while (@links) {
-		my $dest=pop @links;
-		my $src=expand_path(pop @links);
+		my $src=pop @links;
+		my $dest=expand_path(pop @links);
 
-		$src=~s:^/::;
 		$dest=~s:^/::;
+		$src=~s:^/::;
 
 		# Make sure the directory the link will be in exists.
-		my $basedir=dirname("$tmp/$dest");
+		my $basedir=dirname("$tmp/$src");
 		if (! -e $basedir) {
 			doit("install","-d",$basedir);
 		}
@@ -176,36 +176,36 @@
 		# Policy says that if the link is all within one toplevel
 		# directory, it should be relative. If it's between
 		# top level directories, leave it absolute.
-		my @src_dirs=split(m:/+:,$src);
 		my @dest_dirs=split(m:/+:,$dest);
-		if (@src_dirs > 0 && $src_dirs[0] eq $dest_dirs[0]) {
-		    	# Figure out how much of a path $src and $dest
+		my @src_dirs=split(m:/+:,$src);
+		if (@dest_dirs > 0 && $dest_dirs[0] eq $src_dirs[0]) {
+		    	# Figure out how much of a path $dest and $dest
 			# share in common.
 			my $x;
-			for ($x=0; $x<@src_dirs && $src_dirs[$x] eq $dest_dirs[$x]; $x++) {}
-			# Build up the new src.
-			$src="";
-			for (1..$#dest_dirs - $x) {
-				$src.="../";
+			for ($x=0; $x<@dest_dirs && $dest_dirs[$x] eq $src_dirs[$x]; $x++) {}
+			# Build up the new dest.
+			$dest="";
+			for (1..$#src_dirs - $x) {
+				$dest.="../";
 			}
-			for ($x .. $#src_dirs) {
-				$src.=$src_dirs[$_]."/";
+			for ($x .. $#dest_dirs) {
+				$dest.=$dest_dirs[$_]."/";
 			}
-			if ($x > $#src_dirs && ! length $src) {
-				$src.="."; # special case
+			if ($x > $#dest_dirs && ! length $dest) {
+				$dest.="."; # special case
 			}
-			$src=~s:/$::;
+			$dest=~s:/$::;
 		}
 		else {
 			# Make sure it's properly absolute.
-			$src="/$src";
+			$dest="/$dest";
 		}
 
-		if (-d "$tmp/$dest" && ! -l "$tmp/$dest") {
-			error("link destination $tmp/$dest is a directory");
+		if (-d "$tmp/$src" && ! -l "$tmp/$src") {
+			error("link source $tmp/$src is a directory");
 		}
-		doit("rm", "-f", "$tmp/$dest");
-		doit("ln","-sf", $src, "$tmp/$dest");
+		doit("rm", "-f", "$tmp/$src");
+		doit("ln","-sf", $dest, "$tmp/$src");
 	}
 }

Attachment: signature.asc
Description: Digital signature

Reply via email to