Implemented shell functions provides autodetection

This commit is contained in:
Дмитрий Левин 2003-04-25 15:53:21 +00:00
parent bc77b340a3
commit c243e50fce
5 changed files with 65 additions and 11 deletions

View File

@ -32,6 +32,7 @@ fi
FIND_LIBS=
FIND_PAM=
FIND_PERL=
FIND_SHELL=
ParseMethod()
{
@ -42,6 +43,7 @@ ParseMethod()
FIND_LIBS=
FIND_PAM=
FIND_PERL=
FIND_SHELL=
;;
lib)
FIND_LIBS=1
@ -61,10 +63,17 @@ ParseMethod()
noperl)
FIND_PERL=
;;
sh|shell)
FIND_SHELL=1
;;
nosh|noshell)
FIND_SHELL=
;;
all)
FIND_LIBS=1
FIND_PAM=1
FIND_PERL=1
FIND_SHELL=1
;;
default|yes|true)
ParseMethod $RPM_FINDPROV_DEFAULT_METHOD || return 1
@ -78,7 +87,7 @@ ParseMethod()
}
ParseMethod $RPM_FINDPROV_METHOD
if [ -z "$FIND_LIBS" -a -z "$FIND_PAM" -a -z "$FIND_PERL" ]; then
if [ -z "$FIND_LIBS" -a -z "$FIND_PAM" -a -z "$FIND_PERL" -a -z "$FIND_SHELL" ]; then
# Nothing to do
cat >/dev/null 2>&1
exit 0
@ -103,12 +112,22 @@ ListScriptProvs()
local f t
f="$1"
t="$2"
if [ -z "${t##ASCII *text*}" -a -z "${f%%$RPM_BUILD_ROOT/etc/pam.d/*}" ]; then
if [ -n "$FIND_PAM" ]; then
local r
r="$(@RPMCONFIGDIR@/pam.prov "$f")" || return 1
[ -z "$FOUND_PROVS" ] && FOUND_PROVS="$r" || FOUND_PROVS="$FOUND_PROVS
if [ -z "${t##ASCII *text*}" ]; then
if [ -z "${f%%$RPM_BUILD_ROOT/etc/pam.d/*}" ]; then
if [ -n "$FIND_PAM" ]; then
local r
r="$(@RPMCONFIGDIR@/pam.prov "$f")" || return 1
[ -z "$FOUND_PROVS" ] && FOUND_PROVS="$r" || FOUND_PROVS="$FOUND_PROVS
$r"
fi
elif [ "${f##*/}" = ".provides.sh" ]; then
if [ -n "$FIND_SHELL" ]; then
local r
r="$(@RPMCONFIGDIR@/shell.prov "$f")" || return 1
[ -z "$FOUND_PROVS" ] && FOUND_PROVS="$r" || FOUND_PROVS="$FOUND_PROVS
$r"
fi
fi
elif [ -z "${t##perl script text*}" -o -z "${f%%*.p[lmh]}" ]; then
if [ -n "$FIND_PERL" ]; then

View File

@ -406,7 +406,7 @@
@alt@%_fixup_method binconfig pkgconfig libtool
@alt@%_strip_method %{?_enable_debug:none}%{!?_enable_debug:executable shared}
@alt@%_findreq_default_method files lib pam perl shell
@alt@%_findprov_default_method pam lib perl
@alt@%_findprov_default_method pam lib perl shell
@alt@
@alt@%_cleanup_topdir %nil
@alt@%_compress_topdir %_usr

View File

@ -6,7 +6,7 @@
Name: %rpm_name
Version: %rpm_version
Release: alt15
Release: alt16
%define ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
%define get_dep() %(rpm -q --qf '%%{NAME} >= %%|SERIAL?{%%{SERIAL}:}|%%{VERSION}-%%{RELEASE}' %1 2>/dev/null)
@ -16,7 +16,7 @@ Release: alt15
%define if_without() %if %{expand:%%{?_without_%{1}:1}%%{!?_without_%{1}:0}}
%def_with python
%def_with apidocs
%def_without apidocs
%def_without db
%def_without contrib
@ -482,6 +482,11 @@ fi
%endif #with contrib
%changelog
* Thu Apr 24 2003 Dmitry V. Levin <ldv@altlinux.org> 4.0.4-alt16
- Fixed segfault on "rpmquery --qf '%{FILENAMES}' ncurses" command.
- Implemented shell functions provides autodetection.
- Do not build API docs by default.
* Tue Apr 22 2003 Dmitry V. Levin <ldv@altlinux.org> 4.0.4-alt15
- Fixed `rpmbuild -bE' return code (#0001021).
- platform.in:

View File

@ -12,7 +12,7 @@ EXTRA_DIST = \
get_magic.pl getpo.sh http.req \
magic.prov magic.req pam.prov pam.req perl.prov perl.req rpmdiff rpmdiff.cgi \
rpm.daily rpm.log rpm.xinetd rpm2cpio.sh \
shell.req sql.prov sql.req strip_files tcl.req trpm u_pkg.sh \
shell.req shell.prov sql.prov sql.req strip_files tcl.req trpm u_pkg.sh \
verify-elf vpkg-provides.sh vpkg-provides2.sh
installprefix = $(DESTDIR)
@ -30,5 +30,5 @@ config_SCRIPTS = \
get_magic.pl getpo.sh http.req \
magic.prov magic.req pam.prov pam.req perl.prov perl.req rpmdiff rpmdiff.cgi \
rpm.daily rpm.log rpm.xinetd rpm2cpio.sh \
shell.req sql.prov sql.req strip_files tcl.req trpm u_pkg.sh \
shell.req shell.prov sql.prov sql.req strip_files tcl.req trpm u_pkg.sh \
verify-elf vpkg-provides.sh vpkg-provides2.sh

30
scripts/shell.prov Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh -e
#
# $Id$
# Copyright (C) 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# If using normal root, avoid changing anything.
[ -n "$(echo "$RPM_BUILD_ROOT" |tr -d ' /.')" ]
file="$1"
head -1 "$file" |grep -qs '^# shell functions provides list' || exit 0
fname="${file##$RPM_BUILD_ROOT}"
dname="${fname%/*}"
cat "$file" | sed -ne "s,^[^#]\+$,$dname(&),pg"