From 8b81f418b61552c900484d26a9514e9b5403198f Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 9 Nov 2003 16:30:18 +0000 Subject: [PATCH] use functions --- scripts/brp-alt.in | 11 +++-------- scripts/brp-compress.in | 22 ++++++++-------------- scripts/brp-fixup.in | 13 ++++--------- scripts/brp-verify_elf.in | 13 ++++--------- scripts/compress_files.in | 4 ++-- scripts/shell.req.in | 5 +++-- 6 files changed, 24 insertions(+), 44 deletions(-) diff --git a/scripts/brp-alt.in b/scripts/brp-alt.in index b2b1b47..9648788 100755 --- a/scripts/brp-alt.in +++ b/scripts/brp-alt.in @@ -1,11 +1,10 @@ #!/bin/sh -e # -# brp-alt # The ALT Linux build root policies invoked # at the end of the %install scriptlet. # # $Id$ -# Copyright (C) 2000 Dmitry V. Levin +# Copyright (C) 2000,2003 Dmitry V. Levin # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,13 +21,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -PROG="${0##*/}" +. @RPMCONFIGDIR@/functions -# If using normal root, avoid changing anything. -if [ -z "$(printf %s "$RPM_BUILD_ROOT" |tr -d ' /.')" ]; then - echo "$PROG: non-/ \$RPM_BUILD_ROOT expected" >&2 - exit 1 -fi +ValidateBuildRoot cd "$RPM_BUILD_ROOT" diff --git a/scripts/brp-compress.in b/scripts/brp-compress.in index 8b4d3fa..9ccd32f 100755 --- a/scripts/brp-compress.in +++ b/scripts/brp-compress.in @@ -3,7 +3,7 @@ # brp-compress - compress info and manpages. # # $Id$ -# Copyright (C) 2000-2002 Dmitry V. Levin +# Copyright (C) 2000-2003 Dmitry V. Levin # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +20,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -PROG="${0##*/}" +. @RPMCONFIGDIR@/functions + +ValidateBuildRoot + +cd "$RPM_BUILD_ROOT" || exit RPM_COMPRESS_METHOD="${RPM_COMPRESS_METHOD## }" RPM_COMPRESS_METHOD="${RPM_COMPRESS_METHOD%% }" @@ -30,14 +34,6 @@ if [ "$RPM_COMPRESS_METHOD" = skip ]; then exit 0 fi -# If using normal root, avoid changing anything. -if [ -z "$(printf %s "$RPM_BUILD_ROOT" |tr -d ' /.')" ]; then - echo "$PROG: non-/ \$RPM_BUILD_ROOT expected" >&2 - exit 1 -fi - -cd "$RPM_BUILD_ROOT" || exit - : ${RPM_COMPRESS_TOPDIR:=} [ -d "$RPM_BUILD_ROOT$RPM_COMPRESS_TOPDIR" ] || exit 0 @@ -100,8 +96,7 @@ for d in `find "$RPM_BUILD_ROOT$RPM_COMPRESS_TOPDIR" -type d -name man`; do fi if [ ! -e "$f_dir/$TO" ]; then # link to nothing - echo "$PROG: file $f points to non-existent file $TARGET_orig" - exit 1 + Fatal "file $f points to non-existent file $TARGET_orig" fi FROM="$f${TO##*$TARGET_base}" rm -fv "$f" @@ -128,8 +123,7 @@ for d in `find "$RPM_BUILD_ROOT$RPM_COMPRESS_TOPDIR" -type d -name man`; do TO="$(relative "$(printf %s\\n "$DIR/$TARGET"*)" "$f")" if [ ! -e "$DIR/$TO" ]; then # Found link to nothing. - echo "$PROG: file $f points to non-existent file $TARGET_orig" - exit 1 + Fatal "file $f points to non-existent file $TARGET_orig" fi FROM="$f${TO#$TARGET}" rm -fv "$f_orig" diff --git a/scripts/brp-fixup.in b/scripts/brp-fixup.in index f95d505..9071d21 100755 --- a/scripts/brp-fixup.in +++ b/scripts/brp-fixup.in @@ -3,7 +3,7 @@ # brp-fixup - Misc fixups. # # $Id$ -# Copyright (C) 2002 Dmitry V. Levin +# Copyright (C) 2002,2003 Dmitry V. Levin # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,13 +20,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -PROG="${0##*/}" +. @RPMCONFIGDIR@/functions -# If using normal root, avoid changing anything. -if [ -z "$(printf %s "$RPM_BUILD_ROOT" |tr -d ' /.')" ]; then - echo "$PROG: non-/ \$RPM_BUILD_ROOT expected" >&2 - exit 1 -fi +ValidateBuildRoot cd "$RPM_BUILD_ROOT" @@ -61,8 +57,7 @@ for t in `printf %s "$RPM_FIXUP_METHOD" |tr , ' '`; do AddShowMethods libtool ;; *) - echo "Unrecognized fixup method: $t" - exit 1 + Fatal "Unrecognized fixup method: $t" ;; esac done diff --git a/scripts/brp-verify_elf.in b/scripts/brp-verify_elf.in index 07a084a..38d07ab 100755 --- a/scripts/brp-verify_elf.in +++ b/scripts/brp-verify_elf.in @@ -3,7 +3,7 @@ # brp-verify_elf - verify ELF objects. # # $Id$ -# Copyright (C) 2002 Dmitry V. Levin +# Copyright (C) 2002,2003 Dmitry V. Levin # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,13 +20,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -PROG="${0##*/}" +. @RPMCONFIGDIR@/functions -# If using normal root, avoid changing anything. -if [ -z "$(printf %s "$RPM_BUILD_ROOT" |tr -d ' /.')" ]; then - echo "$PROG: non-/ \$RPM_BUILD_ROOT expected" >&2 - exit 1 -fi +ValidateBuildRoot cd "$RPM_BUILD_ROOT" @@ -63,8 +59,7 @@ for t in `printf %s "$RPM_VERIFY_ELF_METHOD" |tr , ' '`; do #VERIFY_ELF_TEXTREL=relaxed ;; *) - echo "Unrecognized verify_elf method: $t" - exit 1 + Fatal "Unrecognized verify_elf method: $t" ;; esac done diff --git a/scripts/compress_files.in b/scripts/compress_files.in index 9571839..63d7a31 100755 --- a/scripts/compress_files.in +++ b/scripts/compress_files.in @@ -3,7 +3,7 @@ # compress_files - compress files helper. # # $Id$ -# Copyright (C) 2000-2002 Dmitry V. Levin +# Copyright (C) 2000-2003 Dmitry V. Levin # # This program is free software; you can redistribute it and/or modify # it under the te/bin/rms of the GNU General Public License as published by @@ -20,7 +20,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -PROG="${0##*/}" +. @RPMCONFIGDIR@/functions RPM_COMPRESS_METHOD="${RPM_COMPRESS_METHOD## }" RPM_COMPRESS_METHOD="${RPM_COMPRESS_METHOD%% }" diff --git a/scripts/shell.req.in b/scripts/shell.req.in index db4df2d..828f0c4 100755 --- a/scripts/shell.req.in +++ b/scripts/shell.req.in @@ -18,8 +18,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# If using normal root, avoid changing anything. -[ -n "$(printf %s "$RPM_BUILD_ROOT" |tr -d ' /.')" ] +. @RPMCONFIGDIR@/functions + +ValidateBuildRoot . @RPMCONFIGDIR@/find-package