aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@mandriva.org>2000-04-23 01:45:35 +0000
committerChmouel Boudjnah <chmouel@mandriva.org>2000-04-23 01:45:35 +0000
commit66fdcee26a2734e9e19dd20ce20e69a2d3c19eb0 (patch)
treead08d61139d39eb30c210df73f2cc4ad01cc12ee
parent34b5a18391c152e42d2581489f1a5bb68ae8b28b (diff)
downloadspec-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.
-rw-r--r--Makefile2
-rwxr-xr-xrelative_me_babe21
-rwxr-xr-xspec-helper5
-rw-r--r--spec-helper.spec7
4 files changed, 31 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 6bed2fe..c5f2046 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
#---------------------------------------------------------------
VERSION=0.2
-FILES= spec-helper clean_files compress_files strip_files
+FILES= spec-helper clean_files compress_files strip_files relative_me_babe
DISTFILES= Makefile ChangeLog Howto-spec-helper $(FILES)
NAME=spec-helper
DIST=$(NAME)-$(VERSION)
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");
+ }
+}
diff --git a/spec-helper b/spec-helper
index 29756a9..a78282a 100755
--- a/spec-helper
+++ b/spec-helper
@@ -19,10 +19,11 @@ export PATH
# usage
usage() {
- echo "usage: spec-helper [-c|-m|-s]" 1>&2
+ echo "usage: spec-helper [-l|-c|-m|-s]" 1>&2
echo "-c don't clean up files" 1>&2
echo "-m don't compress files" 1>&2
echo "-s don't strip files" 1>&2
+ echo "-l don't fix full link as relative."
}
# handle options
@@ -31,6 +32,7 @@ while [ $# != 0 ]; do
-c) DONT_CLEANUP=1;;
-m) DONT_COMPRESS=1;;
-s) DONT_STRIP=1;;
+ -l) DONT_RELINK=1;;
*) usage; exit 1;;
esac
@@ -40,6 +42,7 @@ done
test -z "$DONT_CLEANUP" && echo -n "Cleaning files..." && clean_files && echo "done"
test -z "$DONT_COMPRESS" && echo -n "Compressing files..." && compress_files && echo "done"
test -z "$DONT_STRIP" && echo -n "Stripping files..." && strip_files && echo "done"
+test -z "$DONT_RELINK" && echo -n "Relativisation of links..." && relative_me_babe && echo "done"
exit 0
diff --git a/spec-helper.spec b/spec-helper.spec
index 9e35245..2ec7b52 100644
--- a/spec-helper.spec
+++ b/spec-helper.spec
@@ -1,6 +1,6 @@
%define name spec-helper
%define version 0.2
-%define release 6mdk
+%define release 7mdk
Summary: Tools to ease the creation of rpm packages
Name: %{name}
@@ -18,7 +18,7 @@ Requires: perl
%description
Tools to ease the creation of rpm packages for the Linux-Mandrake distribution.
-Compress man pages using bzip2, strip executables, ...
+Compress man pages using bzip2, strip executables, convert links...
%prep
%setup
@@ -38,6 +38,9 @@ rm -rf $RPM_BUILD_ROOT
/usr/share/spec-helper
%changelog
+* Sat Apr 22 2000 Chmouel Boudjnah <chmouel@mandrakesoft.com> 0.2-7mdk
+- relative_me_babe: a new greatest hit.
+
* Fri Apr 7 2000 Chmouel Boudjnah <chmouel@mandrakesoft.com> 0.2-6mdk
- compress_files: Remove orphan link only for manpage.