aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@mandriva.org>2000-07-20 19:31:02 +0000
committerChmouel Boudjnah <chmouel@mandriva.org>2000-07-20 19:31:02 +0000
commit74d25aa2e637b05bb2a1518d0a405bf6e574d41c (patch)
treea7ab5db16aa2e99618a93e453978e29071ccae44
parent8b3637f106ecc00be07d5d41acc81340054ef77e (diff)
downloadspec-helper-74d25aa2e637b05bb2a1518d0a405bf6e574d41c.tar
spec-helper-74d25aa2e637b05bb2a1518d0a405bf6e574d41c.tar.gz
spec-helper-74d25aa2e637b05bb2a1518d0a405bf6e574d41c.tar.bz2
spec-helper-74d25aa2e637b05bb2a1518d0a405bf6e574d41c.tar.xz
spec-helper-74d25aa2e637b05bb2a1518d0a405bf6e574d41c.zip
macroszification: a new greatest hit.
-rw-r--r--ChangeLog4
-rw-r--r--Makefile3
-rw-r--r--macroszification89
-rw-r--r--spec-helper.spec8
4 files changed, 102 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a74d167..cd99b35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-07-20 Chmouel Boudjnah <chmouel@mandrakesoft.com>
+
+ * macroszification: a new greatest hit.
+
2000-07-20 chmouel <chmouel@mandrakesoft.com>
* Makefile: Add the changelog target
diff --git a/Makefile b/Makefile
index 0472e56..ead184e 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,7 @@ 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)
+bindir=/usr/bin
all:
@echo "use make install or make dist"
@@ -26,6 +27,8 @@ dist:
rm -rf $(DIST)
install:
+ install -d -m755 $(bindir)
+ install -m755 macroszification $(bindir)/
install -d -m 755 $(DESTDIR)/usr/share/spec-helper
install -m 755 $(FILES) $(DESTDIR)/usr/share/spec-helper
diff --git a/macroszification b/macroszification
new file mode 100644
index 0000000..98eb02c
--- /dev/null
+++ b/macroszification
@@ -0,0 +1,89 @@
+#!/bin/bash
+# -*- Mode: shell-script -*-
+# 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:
+# Macroszification of files to be mandrake compliant, also do some check.
+
+
+function usage () {
+ rval=$1
+ echo "Usage: $(basename $0) -d --nocheck --clean SPEC-FILE"
+ echo -e "\t-d: Product only a diff don't change nothing"
+ echo -e "\t--nocheck: Don't try do check about Prefix %configure"
+ echo -e "\t--clean: remove the old files after"
+ echo -e "\t--nodiff: I don't want to see the diff output"
+ exit $rval;
+}
+while [[ $1 == -* ]];do
+ case $1 in
+ -d)
+ only_diff=1;
+ shift;
+ ;;
+ --nocheck)
+ nocheck=1;
+ shift;
+ ;;
+ --nodiff)
+ nodiff=1;
+ shift;
+ ;;
+ --clean)
+ clean=1;
+ shift;
+ ;;
+ -*)
+ usage 0
+ ;;
+ esac
+done
+
+file=$1;
+
+if [[ ! -f $file ]];then
+ echo -e "Error: i really need a spec file to work\n";
+ usage $val;
+fi
+
+[[ -z $nocheck ]] && egrep -q "^Prefix:[[:space:]]+" $file || {
+ echo "sound like you don't have a Prefix set"
+ exit;
+}
+
+egrep -q "^%configure" $file && {
+ egrep -q "^%makeinstall" $file || {
+ echo "sound like you don't have a %makeinstall"
+ exit;
+ }
+}
+
+mv -f $file $file.old
+cat $file.old | perl -e "
+while (<>) {
+ s@[/]?(usr|%{[_]?prefix})/bin@%{_bindir}@g;
+ s@[/]?(usr|%{[_]?prefix})/man@%{_mandir}@g;
+ s@[/]?(usr|%{[_]?prefix})/sbin@%{_sbindir}@g;
+ s@[/]?(usr|%{[_]?prefix})/etc@%{_sysconfdir}@g;
+ s@[/]?(usr|%{[_]?prefix})/lib@%{_libdir}@g;
+ s@[/]?(usr|%{[_]?prefix})/share@%{_datadir}@g;
+ s@[/]?(usr|%{[_]?prefix})/include@%{_includedir}@g;
+ s@[/]?(usr|%{[_]?prefix})/info@%{_infodir}@g;
+ s@/etc@%{_sysconfdir}@;
+ s@/usr@%{prefix}@;
+ print;
+}
+" > $file
+
+if [[ -z $nodiff ]];then
+ diff -u $file.old $file
+fi
+
+if [[ -n $only_diff ]];then
+ mv -f $file.old $file
+fi
+
+if [[ -n $clean ]];then
+ rm -f $file.old
+fi \ No newline at end of file
diff --git a/spec-helper.spec b/spec-helper.spec
index 7f2fcdc..45167c0 100644
--- a/spec-helper.spec
+++ b/spec-helper.spec
@@ -1,6 +1,6 @@
%define name spec-helper
%define version 0.2
-%define release 8mdk
+%define release 9mdk
Summary: Tools to ease the creation of rpm packages
Name: %{name}
@@ -27,7 +27,7 @@ Compress man pages using bzip2, strip executables, convert links...
%install
rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT bindir=%{buildroot}/%{_bindir}
%clean
rm -rf $RPM_BUILD_ROOT
@@ -35,9 +35,13 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc Howto-spec-helper ChangeLog
+%{_bindir}/macroszification
/usr/share/spec-helper
%changelog
+* Thu Jul 20 2000 Chmouel Boudjnah <chmouel@mandrakesoft.com> 0.2-9mdk
+- macroszification: a new greatest hit.
+
* Tue May 9 2000 Frederic Lepied <flepied@mandrakesoft.com> 0.2-8mdk
- exit 0 if no RPM_BUILD_ROOT variable set to allow build with no BuildRoot.