summaryrefslogtreecommitdiff
path: root/debian/fixlinks
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2001-11-10 12:02:35 +0000
committerDavid Schleef <ds@schleef.org>2001-11-10 12:02:35 +0000
commit534a83fcf6edb644f1785091c2838c2e2915148e (patch)
tree6385c51850c09cff593aaa865a8bc3a1bbf48ec6 /debian/fixlinks
parent577acda65c42ea3570dd4bb94ed6ab086891b49b (diff)
Limited Debian architectures to the ones we can actually build.
Improved mksnapshot script; now adds a bogus changelog entry. Added fixlinks script that automatically converts symlinks to conform to Debian policy and updated rules to use it. Added another bogus man page, prolonging the pretense that I'll actually write real ones.
Diffstat (limited to 'debian/fixlinks')
-rwxr-xr-xdebian/fixlinks80
1 files changed, 80 insertions, 0 deletions
diff --git a/debian/fixlinks b/debian/fixlinks
new file mode 100755
index 000000000..39f719b12
--- /dev/null
+++ b/debian/fixlinks
@@ -0,0 +1,80 @@
+#!/usr/bin/perl -w
+# vi: set ts=4:
+
+
+@LINKS=`find . -type l|xargs ls -l`;
+
+#print @LINKS;
+
+
+while($_ = shift @LINKS){
+ chomp;
+ my ($perm,$nlinks,$owner,$group,$size,$month,$day,$year,$file) =
+ split(' ', $_, 9);
+ my $link;
+
+ if($perm =~ m/^l/){
+ ($relfile, $link) = split(' -> ', $file);
+ }
+
+ # chop off leading . in $file
+ $file = $relfile;
+ $file =~ s/^\.//;
+
+ if($perm =~ m/^l/){
+ my @pathcomponents = split('/', $file);
+ my @linkcomponents = split('/', $link);
+
+ if($link =~ m/^\//){
+ @newcomponents = @linkcomponents;
+ }else{
+ @newcomponents = @pathcomponents;
+
+ # chop off filename
+ pop(@newcomponents);
+
+ while($comp = shift @linkcomponents){
+ #print "path: ",join(':',@newcomponents)," -- $comp -- ", join(':',@linkcomponents),"\n";
+
+ if($comp eq ""){
+ # ignore
+ }elsif($comp eq ".."){
+ pop(@newcomponents);
+ }else{
+ push @newcomponents,$comp;
+ }
+ }
+ }
+
+ if($newcomponents[0] eq ""){
+ shift(@newcomponents);
+ }
+ if($pathcomponents[0] eq ""){
+ shift(@pathcomponents);
+ }
+
+ #print "from ",join('/',@pathcomponents),"\n";
+ #print "to ",join('/',@newcomponents),"\n";
+
+ if($newcomponents[0] eq $pathcomponents[0]){
+ #print $newcomponents[0],", ",$pathcomponents[0];
+ #print "should be relative\n";
+ while($newcomponents[0] eq $pathcomponents[0]){
+ shift(@newcomponents);
+ shift(@pathcomponents);
+ }
+ while(@pathcomponents > 1){
+ shift(@pathcomponents);
+ unshift(@newcomponents,"..");
+ }
+ }else{
+ #print "should be absolute\n";
+ unshift(@newcomponents,"");
+ }
+ $newlink=join('/',@newcomponents);
+ print "ln -sf $newlink $relfile\n";
+ unlink($relfile);
+ symlink($newlink,$relfile);
+ }
+}
+