new _topdir/_skiplist macros

This commit is contained in:
Дмитрий Левин 2002-09-27 13:41:26 +00:00
parent b1daddbfc5
commit c68dcc3265
11 changed files with 157 additions and 19 deletions

View File

@ -153,7 +153,20 @@ FindLibProvs()
fi
}
: ${RPM_FINDPROV_TOPDIR:=}
: ${RPM_FINDPROV_SKIPLIST:=}
while IFS= read -r f; do
if [ -n "$RPM_FINDPROV_TOPDIR" ] && [ -z "${f%%$RPM_BUILD_ROOT$RPM_FINDPROV_TOPDIR/*}" ]; then
continue;
fi
if [ -n "$RPM_FINDPROV_SKIPLIST" ]; then
for skip in $RPM_FINDPROV_SKIPLIST; do
if [ -z "${f//$skip}" ]; then
continue 2
fi
done
fi
if t="$(file -bL "$f")"; then
if [ -z "${t##* text*}" ]; then
ListScriptProvs "$f" "$t"

View File

@ -211,7 +211,20 @@ if [ -n "$RPM_SUBPACKAGE_NAME" ]; then
fi
fi
: ${RPM_FINDREQ_TOPDIR:=}
: ${RPM_FINDREQ_SKIPLIST:=}
while IFS= read -r f; do
if [ -n "$RPM_FINDREQ_TOPDIR" ] && [ -z "${f%%$RPM_BUILD_ROOT$RPM_FINDREQ_TOPDIR/*}" ]; then
continue;
fi
if [ -n "$RPM_FINDREQ_SKIPLIST" ]; then
for skip in $RPM_FINDREQ_SKIPLIST; do
if [ -z "${f//$skip}" ]; then
continue 2
fi
done
fi
if [ -n "$FIND_FILES" ]; then
for p in \
/etc/chroot.d \

View File

@ -600,12 +600,23 @@
%{?_cleanup_method:export RPM_CLEANUP_METHOD=\"%_cleanup_method\"}\
%{?_compress_method:export RPM_COMPRESS_METHOD=\"%_compress_method\"}\
%{?_strip_method:export RPM_STRIP_METHOD=\"%_strip_method\"}\
%{?_strip_autoskip:export RPM_STRIP_AUTOSKIP=\"%_strip_autoskip\"}\
%{?_verify_elf_method:export RPM_VERIFY_ELF_METHOD=\"%_verify_elf_method\"}\
%{?_findreq_method:export RPM_FINDREQ_METHOD=\"%_findreq_method\"}\
%{?_findprov_method:export RPM_FINDPROV_METHOD=\"%_findprov_method\"}\
%{?_findreq_default_method:export RPM_FINDREQ_DEFAULT_METHOD=\"%_findreq_default_method\"}\
%{?_findprov_default_method:export RPM_FINDPROV_DEFAULT_METHOD=\"%_findprov_default_method\"}\
%{?_cleanup_topdir:export RPM_CLEANUP_TOPDIR=\"%_cleanup_topdir\"}\
%{?_compress_topdir:export RPM_COMPRESS_TOPDIR=\"%_compress_topdir\"}\
%{?_strip_topdir:export RPM_STRIP_TOPDIR=\"%_strip_topdir\"}\
%{?_verify_elf_topdir:export RPM_VERIFY_ELF_TOPDIR=\"%_verify_elf_topdir\"}\
%{?_findreq_topdir:export RPM_FINDREQ_TOPDIR=\"%_findreq_topdir\"}\
%{?_findprov_topdir:export RPM_FINDPROV_TOPDIR=\"%_findprov_topdir\"}\
%{?_cleanup_skiplist:export RPM_CLEANUP_SKIPLIST=\"%_cleanup_skiplist\"}\
%{?_compress_skiplist:export RPM_COMPRESS_SKIPLIST=\"%_compress_skiplist\"}\
%{?_strip_skiplist:export RPM_STRIP_SKIPLIST=\"%_strip_skiplist\"}\
%{?_verify_elf_skiplist:export RPM_VERIFY_ELF_SKIPLIST=\"%_verify_elf_skiplist\"}\
%{?_findreq_skiplist:export RPM_FINDREQ_SKIPLIST=\"%_findreq_skiplist\"}\
%{?_findprov_skiplist:export RPM_FINDPROV_SKIPLIST=\"%_findprov_skiplist\"}\
%{?_perl_lib_path:export RPM_PERL_LIB_PATH=\"%_perl_lib_path\"}\
%{?__python:export RPM_PYTHON=\"%__python\"}\
\

View File

@ -347,7 +347,7 @@
@alt@%clean_wms [ "$1" = 0 -a -x %_update_wms_bin ] && %_update_wms_bin ||:
@alt@
@alt@# Synchronize the scrollkeeper database.
@alt@%_update_scrollkeeper_bin %_sbindir/scrollkeeper-update
@alt@%_update_scrollkeeper_bin %_bindir/scrollkeeper-update
@alt@%update_scrollkeeper [ -x %_update_scrollkeeper_bin ] && %_update_scrollkeeper_bin ||:
@alt@%clean_scrollkeeper [ "$1" = 0 -a -x %_update_scrollkeeper_bin ] && %_update_scrollkeeper_bin ||:
@alt@
@ -361,11 +361,46 @@
@alt@%_findreq_default_method files lib pam perl shell
@alt@%_findprov_default_method pam lib perl
@alt@
@alt@%_cleanup_topdir %nil
@alt@%_compress_topdir %_usr
@alt@%_strip_topdir %nil
@alt@%_verify_elf_topdir %nil
@alt@%_findreq_topdir %nil
@alt@%_findprov_topdir %nil
@alt@
@alt@%_cleanup_skiplist %nil
@alt@%_compress_skiplist %nil
@alt@%_strip_skiplist */debug/*
@alt@%_verify_elf_skiplist %nil
@alt@%_findreq_skiplist %_docdir/*
@alt@%_findprov_skiplist %_docdir/*
@alt@
@alt@%set_cleanup_method() %global _cleanup_method %*
@alt@%set_compress_method() %global _compress_method %*
@alt@%set_strip_method() %global _strip_method %*
@alt@%set_strip_autoskip() %global _strip_autoskip %*
@alt@%set_verify_elf_method() %global _verify_elf_method %*
@alt@
@alt@%set_cleanup_topdir() %global _cleanup_topdir %*
@alt@%set_compress_topdir() %global _compress_topdir %*
@alt@%set_strip_topdir() %global _strip_topdir %*
@alt@%set_verify_elf_topdir() %global _verify_elf_topdir %*
@alt@%set_findreq_topdir() %global _findreq_topdir %*
@alt@%set_findprov_topdir() %global _findprov_topdir %*
@alt@
@alt@%set_cleanup_skiplist() %global _cleanup_skiplist %*
@alt@%set_compress_skiplist() %global _compress_skiplist %*
@alt@%set_strip_skiplist() %global _strip_skiplist %*
@alt@%set_verify_elf_skiplist() %global _verify_elf_skiplist %*
@alt@%set_findreq_skiplist() %global _findreq_skiplist %*
@alt@%set_findprov_skiplist() %global _findprov_skiplist %*
@alt@
@alt@%add_cleanup_skiplist() %global _cleanup_skiplist %_cleanup_skiplist %*
@alt@%add_compress_skiplist() %global _compress_skiplist %_compress_skiplist %*
@alt@%add_strip_skiplist() %global _strip_skiplist %_strip_skiplist %*
@alt@%add_verify_elf_skiplist() %global _verify_elf_skiplist %_verify_elf_skiplist %*
@alt@%add_findreq_skiplist() %global _findreq_skiplist %_findreq_skiplist %*
@alt@%add_findprov_skiplist() %global _findprov_skiplist %_findprov_skiplist %*
@alt@
@alt@%strip_executable RPM_STRIP_METHOD=executable @RPMCONFIGDIR@/brp-strip
@alt@%strip_relocatable RPM_STRIP_METHOD=relocatable @RPMCONFIGDIR@/brp-strip
@alt@%strip_shared RPM_STRIP_METHOD=shared @RPMCONFIGDIR@/brp-strip

View File

@ -4,7 +4,7 @@
Name: rpm
Version: %rpm_version
Release: alt4
Release: alt5
%define ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
%define get_dep() %(rpm -q --qf '%%{NAME} >= %%|SERIAL?{%%{SERIAL}:}|%%{VERSION}-%%{RELEASE}' %1 2>/dev/null)
@ -472,6 +472,39 @@ fi
%endif #with contrib
%changelog
* Thu Sep 26 2002 Dmitry V. Levin <ldv@altlinux.org> 4.0.4-alt5
- New macros:
+ %%_cleanup_topdir
+ %%_compress_topdir
+ %%_strip_topdir
+ %%_verify_elf_topdir
+ %%_findreq_topdir
+ %%_findprov_topdir
+ %%_cleanup_skiplist
+ %%_compress_skiplist
+ %%_strip_skiplist
+ %%_verify_elf_skiplist
+ %%_findreq_skiplist
+ %%_findprov_skiplist
+ %%set_cleanup_topdir()
+ %%set_compress_topdir()
+ %%set_strip_topdir()
+ %%set_verify_elf_topdir()
+ %%set_findreq_topdir()
+ %%set_findprov_topdir()
+ %%set_cleanup_skiplist()
+ %%set_compress_skiplist()
+ %%set_strip_skiplist()
+ %%set_verify_elf_skiplist()
+ %%set_findreq_skiplist()
+ %%set_findprov_skiplist()
+ %%add_cleanup_skiplist()
+ %%add_compress_skiplist()
+ %%add_strip_skiplist()
+ %%add_verify_elf_skiplist()
+ %%add_findreq_skiplist()
+ %%add_findprov_skiplist()
* Mon Sep 09 2002 Dmitry V. Levin <ldv@altlinux.org> 4.0.4-alt4
- new brp method: verify_elf.
- platform:

View File

@ -41,11 +41,17 @@ if [ "$RPM_CLEANUP_METHOD" = none ]; then
exit 0
fi
: ${RPM_CLEANUP_TOPDIR:=}
[ -d "$RPM_BUILD_ROOT$RPM_CLEANUP_TOPDIR" ] || exit 0
: ${RPM_CLEANUP_SKIPLIST:=}
export RPM_CLEANUP_SKIPLIST
if [ -n "$RPM_CLEANUP_METHOD" -a "$RPM_CLEANUP_METHOD" != auto ]; then
exec "$RPM_CLEANUP_METHOD"
fi
find -type f \( \
find .$RPM_CLEANUP_TOPDIR -type f \( \
-name '#*#' \
-o -name '*~' \
-o -name DEADJOE \
@ -62,10 +68,12 @@ find -type f \( \
\) -print0 |
xargs -r0 rm -vf --
find -type d -name CVS -print0 |
find .$RPM_CLEANUP_TOPDIR -type d -name CVS -print0 |
xargs -r0 rm -vrf --
cd usr/lib/perl5 &>/dev/null || exit 0
# All the rest is perl cleanup stuff.
cd ./usr/lib/perl5 &>/dev/null || exit 0
find -type f -name .packlist -print0 |
xargs -r0 rm -vf --

View File

@ -36,6 +36,9 @@ fi
cd "$RPM_BUILD_ROOT" || exit
: ${RPM_COMPRESS_TOPDIR:=}
[ -d "$RPM_BUILD_ROOT$RPM_COMPRESS_TOPDIR" ] || exit 0
StripSuffix()
{
for s in gz bz2 Z; do
@ -48,13 +51,13 @@ StripSuffix()
echo -nE "$1"
}
for d in `find "$RPM_BUILD_ROOT" -type d -name info`; do
for d in `find "$RPM_BUILD_ROOT$RPM_COMPRESS_TOPDIR" -type d -name info`; do
find "$d" -type f \( -name \*.gz -o -name \*.Z \) -print0 |xargs -r0 gunzip
find "$d" -type f -name \*.bz2 -print0 |xargs -r0 bunzip2
find "$d" -type f -a \! -name dir -print0 |xargs -r0 @RPMCONFIGDIR@/compress_files
done
for d in `find "$RPM_BUILD_ROOT" -type d -name man`; do
for d in `find "$RPM_BUILD_ROOT$RPM_COMPRESS_TOPDIR" -type d -name man`; do
find "$d" -type f -size 0 -print0 |xargs -r0 rm -fv
find "$d" -type f -print0 |xargs -r0 chmod a-x
# Uncompress everything.

View File

@ -70,10 +70,12 @@ EOF
TEMP=`getopt -n "$PROG" -o hpR:sgSN:K:xXvT: -l help,preserve-dates,remove-section:,skip-files:,strip-all,strip-symbol:,keep-symbol:,discard-all,discard-locals,verbose,topdir: -- "$@"` || USAGE
eval set -- "$TEMP"
: ${TOPDIR:=$RPM_BUILD_ROOT}
: ${RPM_STRIP_SKIPLIST:=}
: ${RPM_STRIP_TOPDIR:=}
export RPM_STRIP_SKIPLIST
export STRIP_FORCED=
export STRIP_FORCED_OPTS=
export STRIP_AUTOSKIP="$RPM_STRIP_AUTOSKIP"
AddForcedOpts()
{
@ -101,7 +103,7 @@ while :; do
;;
--skip-files)
shift
STRIP_AUTOSKIP="$STRIP_AUTOSKIP $1"
RPM_STRIP_SKIPLIST="$RPM_STRIP_SKIPLIST $1"
shift
;;
-s|--strip-all)
@ -161,8 +163,16 @@ while :; do
esac
done
cd "$TOPDIR"
cd "$OLDPWD"
if [ -z "$TOPDIR" ]; then
TOPDIR="$RPM_BUILD_ROOT"
cd "$TOPDIR"
cd "$OLDPWD"
[ -d "$TOPDIR$RPM_STRIP_TOPDIR" ] || exit 0
TOPDIR="$TOPDIR$RPM_STRIP_TOPDIR"
else
cd "$TOPDIR"
cd "$OLDPWD"
fi
TOPDIR="$(echo "$TOPDIR" |sed '
s:/\(\./\)\+:/:g
@ -230,8 +240,6 @@ StripTree()
find "$1" -type f $PERMS -print0 |xargs -r0 @RPMCONFIGDIR@/strip_files
}
[ -n "$STRIP_AUTOSKIP" ] || STRIP_AUTOSKIP='*/debug/*'
if [ -n "$*" ]; then
for d in "$@"; do
if [ -d "$d" ]; then

View File

@ -40,4 +40,7 @@ case "$RPM_VERIFY_ELF_METHOD" in
;;
esac
find -type f -print0 |xargs -r0 @RPMCONFIGDIR@/verify-elf
: ${RPM_VERIFY_ELF_TOPDIR:=}
[ -d "$RPM_BUILD_ROOT$RPM_VERIFY_ELF_TOPDIR" ] || exit 0
find .$RPM_VERIFY_ELF_TOPDIR -type f -print0 |xargs -r0 @RPMCONFIGDIR@/verify-elf

View File

@ -47,8 +47,8 @@ for f in "$@"; do
continue
fi
if [ -n "$STRIP_AUTOSKIP" ]; then
for skip in $STRIP_AUTOSKIP; do
if [ -n "$RPM_STRIP_SKIPLIST" ]; then
for skip in $RPM_STRIP_SKIPLIST; do
if [ -z "${f//$skip}" ]; then
continue 2
fi

View File

@ -21,6 +21,9 @@
PROG="${0##*/}"
: ${RPM_VERIFY_ELF_SKIPLIST:=}
export RPM_VERIFY_ELF_SKIPLIST
rc=0
for f in "$@"; do
if [ ! -f "$f" ]; then
@ -29,6 +32,14 @@ for f in "$@"; do
continue
fi
if [ -n "$RPM_VERIFY_ELF_SKIPLIST" ]; then
for skip in $RPM_VERIFY_ELF_SKIPLIST; do
if [ -z "${f//$skip}" ]; then
continue 2
fi
done
fi
t="$(/usr/bin/file -b "$f")"
[ -z "${t//*ELF*}" ] || continue