use functions

This commit is contained in:
Дмитрий Левин 2003-11-09 16:47:45 +00:00
parent 8b81f418b6
commit ebc53cf631
22 changed files with 66 additions and 98 deletions

View File

@ -3,7 +3,7 @@
# brp-adjust_libraries - update symbolic links to shared libraries.
#
# $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
@ -20,13 +20,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
# 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
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
cd "$RPM_BUILD_ROOT"

View File

@ -22,7 +22,6 @@
#
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
cd "$RPM_BUILD_ROOT"

View File

@ -3,7 +3,7 @@
# brp-bytecompile_python - compile python modules.
#
# $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
@ -20,13 +20,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
# 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
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
cd "$RPM_BUILD_ROOT"

View File

@ -3,7 +3,7 @@
# brp-cleanup - cleanup buildroot.
#
# $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,25 +20,16 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
cd "$RPM_BUILD_ROOT"
RPM_CLEANUP_METHOD="${RPM_CLEANUP_METHOD## }"
RPM_CLEANUP_METHOD="${RPM_CLEANUP_METHOD%% }"
echo "Cleaning files in $RPM_BUILD_ROOT ($RPM_CLEANUP_METHOD)"
if [ "$RPM_CLEANUP_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"
if [ "$RPM_CLEANUP_METHOD" = none ]; then
if [ "$RPM_CLEANUP_METHOD" = skip -o "$RPM_CLEANUP_METHOD" = none ]; then
exit 0
fi

View File

@ -21,7 +21,6 @@
#
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
cd "$RPM_BUILD_ROOT" || exit

View File

@ -3,7 +3,7 @@
# brp-fix-perms - try to fix filesystem permissions.
#
# $Id$
# Copyright (C) 2001,2002 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (C) 2001-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,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
# 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
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
cd "$RPM_BUILD_ROOT"
@ -37,7 +32,8 @@ done
# Following objects should not be group/world writable.
for d in usr/*; do
[ "$d" = "usr/src" -o -L "$d" -o ! -d "$d" ] || chmod -R go-w "$d"
[ "$d" = "usr/src" -o -L "$d" -o ! -d "$d" ] ||
chmod -R go-w "$d"
done
# Following files should not be group/world readable.

View File

@ -21,7 +21,6 @@
#
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
cd "$RPM_BUILD_ROOT"

View File

@ -4,7 +4,7 @@
# Inspired by brp-strip script from RPM source code.
#
# $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,6 +22,7 @@
#
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
Usage()
{

View File

@ -21,7 +21,6 @@
#
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
cd "$RPM_BUILD_ROOT"

View File

@ -20,8 +20,8 @@
# 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
cd "$RPM_BUILD_ROOT"
@ -36,7 +36,7 @@ exit_handler()
trap exit_handler SIGHUP SIGINT SIGQUIT SIGTERM EXIT
WORKDIR="$(mktemp -dt check-files.XXXXXXXXXX)"
WORKDIR="$(mktemp -dt "$PROG.XXXXXXXXXX")"
export LC_ALL=C

View File

@ -21,6 +21,7 @@
#
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
RPM_COMPRESS_METHOD="${RPM_COMPRESS_METHOD## }"
RPM_COMPRESS_METHOD="${RPM_COMPRESS_METHOD%% }"

View File

@ -21,13 +21,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
Fatal()
{
echo "${0##*/}: $*" >&2
exit 1
}
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
Usage()
{

View File

@ -18,8 +18,8 @@
# 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
FindPackage()
{
@ -34,7 +34,7 @@ FindPackage()
# Does it start with buildroot?
if [ -z "${r##$RPM_BUILD_ROOT*}" ]; then
echo "$f: invalid dependence: $r" >&2
Info "$f: invalid dependence: $r"
return 1
fi

View File

@ -20,7 +20,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
WORKDIR="$(mktemp -dt "$PROG.XXXXXXXXXX")"
TMPFILE="$WORKDIR/tmp"
@ -117,8 +118,8 @@ fix()
fi
if ! cmp -s "$f_new" "$f"; then
echo "$fname:" >&2
diff "$f" "$f_new" >&2 ||:
echo "$fname:"
diff "$f" "$f_new" ||:
cat "$f_new" >"$f" || return 1
fi
@ -162,8 +163,8 @@ fix()
fi
if ! cmp -s "$f_new" "$f"; then
echo "$fname:" >&2
diff "$f" "$f_new" >&2 ||:
echo "$fname:"
diff "$f" "$f_new" ||:
cat "$f_new" >"$f" || return 1
fi
}
@ -171,7 +172,7 @@ fix()
rc=0
for f in "$@"; do
if [ ! -f "$f" ]; then
echo "$PROG: $f: file unavailable" >&2
Info "$f: file unavailable"
rc=1
continue
fi

View File

@ -20,14 +20,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
: ${RPM_FIXUP_SKIPLIST:=}
rc=0
for f in "$@"; do
if [ ! -f "$f" ]; then
echo "$PROG: $f: file unavailable" >&2
Info "$f: file unavailable"
rc=1
continue
fi
@ -50,7 +51,7 @@ for f in "$@"; do
if [ "$new_val" != "$old_val" ]; then
subst -p "s,^libdir='[^']*'\$,libdir='$new_val',g" "$f"
echo "${fname#.}: libdir: '$old_val' --> '$new_val'" >&2
echo "${fname#.}: libdir: '$old_val' --> '$new_val'"
fi
# fix dependency_libs
@ -81,7 +82,7 @@ for f in "$@"; do
if [ "$new_val" != "$old_val" ]; then
subst -p "s,^dependency_libs='[^']*'\$,dependency_libs='$new_val',g" "$f"
echo "${fname#.}: dependency_libs: '$old_val' --> '$new_val'" >&2
echo "${fname#.}: dependency_libs: '$old_val' --> '$new_val'"
fi
done

View File

@ -3,7 +3,7 @@
# fixup-pkgconfig - /usr/lib/pkgconfig/*.pc 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,7 +20,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
TMPFILE="$(mktemp -t "$PROG.XXXXXXXXXX")"
@ -98,7 +99,7 @@ fix()
if [ "$new_val" != "$old_val" ]; then
subst -p "s|^Cflags: .*|Cflags: $new_val|g" -- "$f" || return 1
echo "$fname: Cflags: '$old_val' --> '$new_val'" >&2
echo "$fname: Cflags: '$old_val' --> '$new_val'"
fi
# fix libs
@ -137,14 +138,14 @@ fix()
if [ "$new_val" != "$old_val" ]; then
subst -p "s|^Libs: .*|Libs: $new_val|g" -- "$f" || return 1
echo "$fname: Libs: '$old_val' --> '$new_val'" >&2
echo "$fname: Libs: '$old_val' --> '$new_val'"
fi
}
rc=0
for f in "$@"; do
if [ ! -f "$f" ]; then
echo "$PROG: $f: file unavailable" >&2
Info "$f: file unavailable"
rc=1
continue
fi

View File

@ -18,16 +18,15 @@
# 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
file="$1"
head -1 "$file" |grep -qs '^#%PAM' || exit 0
if [ -n "$PAM_NAME_SUFFIX" -a -z "${PAM_NAME_SUFFIX##%*}" ]; then
echo "error: PAM_NAME_SUFFIX=$PAM_NAME_SUFFIX" >&2
exit 1
Fatal "invalid PAM_NAME_SUFFIX=$PAM_NAME_SUFFIX"
fi
echo "pam$PAM_NAME_SUFFIX(${file##*/})"

View File

@ -18,21 +18,19 @@
# 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
file="$1"
head -1 "$file" |grep -qs '^#%PAM' || exit 0
if [ -n "$PAM_SO_SUFFIX" -a -z "${PAM_SO_SUFFIX##%*}" ]; then
echo "error: PAM_SO_SUFFIX=$PAM_SO_SUFFIX" >&2
exit 1
Fatal "invalid PAM_SO_SUFFIX=$PAM_SO_SUFFIX"
fi
if [ -n "$PAM_NAME_SUFFIX" -a -z "${PAM_NAME_SUFFIX##%*}" ]; then
echo "error: PAM_NAME_SUFFIX=$PAM_NAME_SUFFIX" >&2
exit 1
Fatal "invalid PAM_NAME_SUFFIX=$PAM_NAME_SUFFIX"
fi
# hack for "buildreq -bi".

View File

@ -18,8 +18,8 @@
# 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
file="$1"

View File

@ -18,10 +18,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
. @RPMCONFIGDIR@/find-package
FIND_REQ="/bin/sh --rpm-requires"

View File

@ -3,7 +3,7 @@
# strip_files - strip 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 terms of the GNU General Public License as published by
@ -20,7 +20,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
StripNote()
{
@ -43,7 +44,7 @@ DoStrip()
rc=0
for f in "$@"; do
if [ ! -f "$f" ]; then
echo "$PROG: $f: file unavailable" >&2
Info "$f: file unavailable"
rc=1
continue
fi

View File

@ -20,14 +20,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
PROG="${0##*/}"
. @RPMCONFIGDIR@/functions
ValidateBuildRoot
: ${RPM_VERIFY_ELF_SKIPLIST:=}
rc=0
for f in "$@"; do
if [ ! -f "$f" ]; then
echo "$PROG: $f: file unavailable" >&2
Info "$f: file unavailable"
rc=1
continue
fi
@ -55,7 +56,7 @@ for f in "$@"; do
found=
for p in $RPM_BUILD_ROOT $RPM_BUILD_DIR $RPM_SOURCE_DIR; do
if printf %s "$rpath" |fgrep -qs "$p"; then
echo "$f: RPATH entry contains \"$p\": $rpath" >&2
Info "$f: RPATH entry contains \"$p\": $rpath"
found=1
fi
done
@ -65,7 +66,7 @@ for f in "$@"; do
fi
if printf %s "$rpath" |fgrep -qs :; then
echo "$f: RPATH entry contains \":\": $rpath" >&2
Info "$f: RPATH entry contains \":\": $rpath"
[ "$VERIFY_ELF_RPATH" = relaxed ] || rc=1
break
fi
@ -74,7 +75,7 @@ for f in "$@"; do
break
fi
echo "$f: RPATH entry found: $rpath" >&2
Info "$f: RPATH entry found: $rpath"
rc=1
break
done
@ -86,7 +87,7 @@ for f in "$@"; do
if [ "$VERIFY_ELF_TEXTREL" = relaxed ]; then
break
fi
echo "$f: TEXTREL entry found: $textrel" >&2
Info "$f: TEXTREL entry found: $textrel"
rc=1
break
done