diff options
author | Chmouel Boudjnah <chmouel@mandriva.org> | 2000-04-23 01:45:35 +0000 |
---|---|---|
committer | Chmouel Boudjnah <chmouel@mandriva.org> | 2000-04-23 01:45:35 +0000 |
commit | 66fdcee26a2734e9e19dd20ce20e69a2d3c19eb0 (patch) | |
tree | ad08d61139d39eb30c210df73f2cc4ad01cc12ee /relative_me_babe | |
parent | 34b5a18391c152e42d2581489f1a5bb68ae8b28b (diff) | |
download | spec-helper-66fdcee26a2734e9e19dd20ce20e69a2d3c19eb0.tar spec-helper-66fdcee26a2734e9e19dd20ce20e69a2d3c19eb0.tar.gz spec-helper-66fdcee26a2734e9e19dd20ce20e69a2d3c19eb0.tar.bz2 spec-helper-66fdcee26a2734e9e19dd20ce20e69a2d3c19eb0.tar.xz spec-helper-66fdcee26a2734e9e19dd20ce20e69a2d3c19eb0.zip |
relative_me_babe: a new greatest hit.
Diffstat (limited to 'relative_me_babe')
-rwxr-xr-x | relative_me_babe | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/relative_me_babe b/relative_me_babe new file mode 100755 index 0000000..e390a18 --- /dev/null +++ b/relative_me_babe @@ -0,0 +1,21 @@ +#!/usr/bin/perl +# -*- Mode: cperl -*- +# Copyright (C) 2000 by Chmouel Boudjnah <chmouel@mandrakesoft.com> +# Redistribution of this file is permitted under the terms of the GNU +# Public License (GPL) +## description: Convert full link to relative links. + +my $r=$ENV{RPM_BUILD_ROOT}; +chdir($r) or "Can't cd to $ENV{RPM_BUILD_ROOT}: $!"; + +push my @files, split(/\n/, `find -type l 2> /dev/null`); +for (@files) { + my $file = $_; + my $link=readlink($file); + if ($link =~ /^\//) { + $link =~ s|^/||; + # Ugly ? no simply chmou. + (my $dirname = $file) =~ s|/[^/]*$||; $dirname =~ s|/[^/]+|../|g; $dirname =~ s|^\.||; + system("ln -sf $dirname$link $file"); + } +} |