use functions

This commit is contained in:
Дмитрий Левин 2003-11-09 16:30:18 +00:00
parent 0a5d3e33d6
commit 8b81f418b6
6 changed files with 24 additions and 44 deletions

View File

@ -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 <ldv@altlinux.org>
# Copyright (C) 2000,2003 Dmitry V. Levin <ldv@altlinux.org>
#
# 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"

View File

@ -3,7 +3,7 @@
# brp-compress - compress info and manpages.
#
# $Id$
# Copyright (C) 2000-2002 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (C) 2000-2003 Dmitry V. Levin <ldv@altlinux.org>
#
# 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"

View File

@ -3,7 +3,7 @@
# brp-fixup - Misc fixups.
#
# $Id$
# Copyright (C) 2002 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (C) 2002,2003 Dmitry V. Levin <ldv@altlinux.org>
#
# 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

View File

@ -3,7 +3,7 @@
# brp-verify_elf - verify ELF objects.
#
# $Id$
# Copyright (C) 2002 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (C) 2002,2003 Dmitry V. Levin <ldv@altlinux.org>
#
# 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

View File

@ -3,7 +3,7 @@
# compress_files - compress files helper.
#
# $Id$
# Copyright (C) 2000-2002 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (C) 2000-2003 Dmitry V. Levin <ldv@altlinux.org>
#
# 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%% }"

View File

@ -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