From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 1 Sep 2008 21:30:46 +0400 From: Alexey Tourbin To: ALT Linux Team development discussions Message-ID: <20080901173046.GI6477@altlinux.org> Mail-Followup-To: ALT Linux Team development discussions References: <200809011621.38135.ledest@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ECcIMtargrIi2fbc" Content-Disposition: inline In-Reply-To: <200809011621.38135.ledest@gmail.com> Subject: Re: [devel] rpm-requires in headers X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.10b3 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 17:30:47 -0000 Archived-At: List-Archive: List-Post: --ECcIMtargrIi2fbc Content-Type: multipart/mixed; boundary="Dxzxec4+BSbG6TGA" Content-Disposition: inline --Dxzxec4+BSbG6TGA Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 01, 2008 at 04:21:38PM +0300, Led wrote: > =F5 =CE=C1=D3 =DA=C1=D7=C9=D3=C9=CD=CF=D3=D4=C9 =D7 *.h =C6=C1=CA=CC=C1= =C8 =CE=C5 =C9=DD=D5=D4=D3=D1? =ED=CF=D6=C5=D4 =C9=CD=C5=C5=D4 =D3=CD=D9=D3= =CC =D0=C1=D2=D3=C9=D4=D8 =C8=DC=C4=C5=D2=D9 =CE=C1=20 > =D0=D2=C5=C4=CD=C5=D4 > ^#[[:blank:]]*include[[:blank:]]+\<[^>]\> > =C9 =D0=D2=CF=D3=D4=C1=D7=CC=D1=D4=D8 =DA=C1=D7=C9=D3=C9=CD=CF=D3=D4=C9 = =CE=C1 =D3=CF=CF=D4=D7=C5=D4=D3=D4=D7=D5=C0=DD=C9=C5 *-devel? =E5=D3=D4=D8 =D2=C1=C2=CF=DE=C9=CA =D0=D2=CF=D4=CF=C9=D0, =CB=CF=D4=CF=D2= =D9=CA =C9=D3=D0=CF=CC=D8=DA=D5=C5=D4 =D0=D2=C5=D0=D2=CF=C3=C5=D3=D3=CF=D2. --Dxzxec4+BSbG6TGA Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="cpp.req" #!/bin/sh -efu # # Copyright (C) 2008 Alexey Tourbin # # 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. . /usr/lib/rpm/functions . /usr/lib/rpm/find-package [ -n "${RPM_LIBDIR-}" ] || RPM_LIBDIR=`rpm --eval %_libdir` PKG_CONFIG_PATH=$RPM_LIBDIR/pkgconfig:/usr/share/pkgconfig [ -z "${RPM_BUILD_ROOT-}" ] || PKG_CONFIG_PATH=$RPM_BUILD_ROOT$RPM_LIBDIR/pkgconfig:$RPM_BUILD_ROOT/usr/share/pkgconfig:$PKG_CONFIG_PATH export PKG_CONFIG_PATH PkgconfigCflags() { local f="$1"; shift local pc_files if [ -n "${RPM_BUILD_ROOT-}" ]; then pc_files=$(set +f; ls "$RPM_BUILD_ROOT$RPM_LIBDIR/pkgconfig"/*.pc 2>/dev/null ||:) else pc_files=$(rpmquery -f "$f" --list 2>/dev/null | egrep "^$RPM_LIBDIR/pkgconfig/[^/]+[.]pc\$" || [ $? = 1 ]) fi [ -n "$pc_files" ] || return 0 local pc for pc in $pc_files; do pkg-config --enable-recursion --cflags "$pc" || Fatal "$pc: pkg-config failed" done } Cflags() { local f="$1"; shift local cflags cflags=$(PkgconfigCflags "$f") set -- $cflags -I/usr/include -I${f%/*} -I${f%/*/*} -I${f%/*/*/*} local cf for cf; do case $cf in -D?*) echo $cf ;; esac done for cf; do [ -n "${RPM_BUILD_ROOT-}" ] || continue case $cf in -I/*) echo -I$RPM_BUILD_ROOT${cf#-I} ;; esac done for cf; do case $cf in -I/*) echo $cf ;; esac done } cpp= IncludedFiles() { local f="$1"; shift if [ -z "$cpp" ]; then cpp=/usr/bin/${RPM_ARCH:-noarch}-alt-linux-cpp [ -x "$cpp" ] || cpp=/usr/bin/cpp [ -z "${GCC_VERSION-}" ] || cpp=$cpp-$GCC_VERSION Debug "cpp=$cpp" fi cflags=$(Cflags "$f") Debug "$f: cflags:" $cflags if ! out=$("$cpp" -w -x c++ $cflags "$f"); then Warning "$f: cpp failed" return 0 fi echo "$out" |grep '^#' |awk -v prog="$PROG" -v hdr="$f" ' # info cpp "Preprocessor Output" BEGIN { SP = 0 Stack[SP] = hdr } function filename(f) { if (!sub(/^"\//, "/", f) || !sub(/"$/, "", f)) printf "%s: %s: bad path %s\n", prog, hdr, f >"/dev/stderr" return f } function Push(f) { f=filename(f) Stack[++SP]=f if (SP==1) print f } function Pop(f) { f=filename(f) if (f != Stack[--SP]) printf "%s: %s: expected pop %s, got pop %s\n", prog, hdr, Stack[SP], f >"/dev/stderr" } $4==1 { Push($3) } $4==2 { Pop($3) } END { if (SP > 0) printf "%s: %s: non-empty stack, top %s\n", prog, hdr, Stack[SP] >"/dev/stderr" }' } CppReq() { local f="$1"; shift local files files=$(IncludedFiles "$f") [ -n "$files" ] || return 0 local RPM_FINDPACKAGE_HOST_PKG_NAMES=1 local inc echo "$files" |while read -r inc; do FindPackage "$f" "${inc#${RPM_BUILD_ROOT-}}" done } ArgvFileAction CppReq "$@" --Dxzxec4+BSbG6TGA-- --ECcIMtargrIi2fbc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAki8JsYACgkQfBKgtDjnu0bbjwCfYeuB4xfeXuIHuT0wC6m2Onjv GKAAoJAd/X6bNIbLdBl69Hzxfey4cSrj =Acdp -----END PGP SIGNATURE----- --ECcIMtargrIi2fbc--