From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 28 Mar 2007 21:30:44 +0400 From: Alexey Tourbin To: devel@lists.altlinux.org Message-ID: <20070328173044.GC5336@solemn.turbinal> Mail-Followup-To: devel@lists.altlinux.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="t0UkRYy7tHLRMCai" Content-Disposition: inline Subject: [devel] alternatives.prov X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.9rc1 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Mar 2007 17:31:06 -0000 Archived-At: List-Archive: List-Post: --t0UkRYy7tHLRMCai Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =F0=D2=C9 =D3=C2=CF=D2=CB=C5 git-1.5.1 =D3 kernel.org =D3 =CD=CF=C9=CD rpm-= build (=C2=D2=C1=CE=DE mod) =D5 =D0=C1=CB=C5=D4=C1 git-core =D0=CF=D1=D7=C9=CC=D3=D1 unmet =CE=C1 /usr/bin/emacs. =F7=D9=D1= =D3=CE=C9=CC=CF=D3=D8, =DE=D4=CF =CE=CF=D7=D9=CA =D3=CB=D2=C9=D0=D4 /usr/bin/git-mergetool =D7=D9=D4=C1=D3=CB=C9=D7=C1=C5=D4 =CD=CE=CF=C7=CF = =CC=C9=DB=CE=C9=C8 =DA=C1=D7=C9=D3=C9=CD=CF=D3=D4=C5=CA =CE=C1 =D7=D3=D1=CB= =C9=C5 =D5=D4=C9=CC=C9=D4=D9 =D4=C9=D0=C1 vimdiff, kdiff3 =C9 =C4=CF =CB=D5=DE=C9 = emacs. =EE=C1=C9=C2=CF=CC=C5=C5 =D0=D2=C1=D7=C9=CC=D8=CE=D9=CD =D2=C5=DB=C5=CE=C9=C5=CD =D4=D5=D4 =C2=D5=C4=C5=D4 =D0=D2=C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F=D7=C1=D4=D8=D3= =D1 =CE=C5=CB=CF=D4=CF=D2=CF=C5 (=CE=C5=C2=CF=CC=D8=DB=CF=C5) =CB=CF=CC=C9= =DE=C5=D3=D4=D7=CF "=CD=D5=D3=CF=D2=CE=D9=C8" provides, =D4=C9=D0=C1 /usr/bin/autoconf-default =C9=CC=C9 /usr/bin/i586-al= t-linux-gcc. =F3 =C4=D2=D5=C7=CF=CA =D3=D4=CF=D2=CF=CE=D9, =D7 =D0=D2=C9=CE=C3=C9=D0=C5 = =D0=D2=C5=C4=D5=D3=CD=CF=D4=D2=C5=CE=CF =CF=D4=CB=CC=C0=DE=C5=CE=C9=C5 =CC= =C0=C2=CF=C7=CF prov =CD=C5=D4=CF=C4=C1. commit 28c294aeb30f638727477724b1f3cf3328855d7e Author: Alexey Tourbin Date: Wed Mar 28 14:58:54 2007 +0400 alternatives.prov: check that alternative target is acutally available =20 $ rpm -qf /etc/alternatives/packages.d/xemacs xemacsen-0.4-alt1 $ cat /etc/alternatives/packages.d/xemacs /usr/bin/xemacs /usr/bin/xemacs-x11 80 /usr/bin/xemacs /usr/bin/xemacs-nox 70 /usr/bin/xemacs /usr/bin/xemacs-mule 60 /usr/bin/xemacs /usr/bin/xemacs-mule-nextaw 50 /usr/bin/xemacs /usr/bin/xemacs-nomule 40 /usr/bin/xemacs /usr/bin/xemacs-nomule-nextaw 30 /usr/bin/xemacs /usr/bin/xemacs-nox-mule 20 /usr/bin/xemacs /usr/bin/xemacs-nox-nomule 10 $ ls /usr/bin/xemacs* zsh: no matches found: /usr/bin/xemacs* $ =20 In this case, we should NOT provide /usr/bin/xemacs. diff --git a/alternatives/alternatives.prov b/alternatives/alternatives.prov index e7e7e58..ccba5d5 100755 --- a/alternatives/alternatives.prov +++ b/alternatives/alternatives.prov @@ -5,7 +5,18 @@ AlternativesProv() { local f=3D"$1"; shift - awk '$1 ~ /^\/usr\/s?bin\// {print $1}' "$f" + local link bin rest + while read -r link bin rest; do + case "${link-}" in + /usr/bin/*|/usr/sbin/*) + ;; + *) + continue ;; + esac + if [ -x "${RPM_BUILD_ROOT-}$bin" ]; then + echo "$link" + fi + done <"$f" } =20 ArgvFileAction AlternativesProv "$@" commit e51b5a69a2f3a2bc92abc16462e3137366ce995e Author: Alexey Tourbin Date: Wed Mar 28 14:23:42 2007 +0400 added alternatives.prov and alternatives.prov.files, for new rpm-build =20 /usr/bin/emacs is not provided by any package: =20 $ rpm -q --whatprovides /usr/bin/emacs warning: no package provides /usr/bin/emacs $ =20 Now consider shell script which invokes emacs. Depending on /usr/lib/rpm/find-package peculiarities, there are two possible outcome= s: 1) dependency on emacs is lost; 2) /usr/bin/emacs unmet dependency is generated. =20 I think that both variants are not quite acceptable. =20 Note that the root of the problem is that /usr/bin/emacs is not provided by any package. Also note that /usr/bin/emacs is really an alternative: =20 $ ls -l /usr/bin/emacs lrwxrwxrwx 1 root root 38 Jul 5 2006 /usr/bin/emacs -> /etc/alternati= ves/links/|usr|bin|emacs $ =20 The idea is that we can process the alternatives/packages.d/ file and automatically provide paths under /usr/bin and /usr/sbin. =20 $ grep /usr/bin/ /etc/alternatives/packages.d/emacs22-nox /usr/bin/emacs22 /usr/bin/emacs22-nox 10 /usr/bin/emacs /usr/bin/emacs22-nox 10 $ alternatives/alternatives.prov /etc/alternatives/packages.d/emacs22-n= ox /usr/bin/emacs22 /usr/bin/emacs $ =20 Also note that there are a few other similar cases: =20 $ rpm -q --whatprovides /usr/bin/javac warning: no package provides /usr/bin/javac $ rpm -q --whatprovides `realpath /usr/bin/javac` j2se1.5-sun-devel-1.5.0_11-alt1 $ diff --git a/alternatives.spec b/alternatives.spec index ef2f759..327de0d 100644 --- a/alternatives.spec +++ b/alternatives.spec @@ -62,6 +62,9 @@ cat >$RPM_BUILD_ROOT%_sysconfdir/rpm/macros.d/%name</dev/null ||: %_sbindir/* %_datadir/%name %_man1dir/* +%_rpmlibdir/alternatives.prov +%_rpmlibdir/alternatives.prov.files =20 %changelog * Thu Feb 01 2007 Stanislav Ievlev 0.3-alt1 diff --git a/alternatives/alternatives.prov b/alternatives/alternatives.prov new file mode 100755 index 0000000..e7e7e58 --- /dev/null +++ b/alternatives/alternatives.prov @@ -0,0 +1,11 @@ +#!/bin/sh -efu + +. /usr/lib/rpm/functions + +AlternativesProv() +{ + local f=3D"$1"; shift + awk '$1 ~ /^\/usr\/s?bin\// {print $1}' "$f" +} + +ArgvFileAction AlternativesProv "$@" diff --git a/alternatives/alternatives.prov.files b/alternatives/alternativ= es.prov.files new file mode 100755 index 0000000..7b98b83 --- /dev/null +++ b/alternatives/alternatives.prov.files @@ -0,0 +1,5 @@ +#!/bin/sh -efu +while IFS=3D$'\t' read -r f t; do + [ -z "${f##${RPM_BUILD_ROOT-}/etc/alternatives/packages.d/*}" ] && + [ -z "${t##* text*}" ] && echo "$f" ||: +done --t0UkRYy7tHLRMCai Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFGCqZEfBKgtDjnu0YRAmd2AKCw7i+NhE47JwKYKpI0Iypw2RLbNQCfS8B+ HBj1fu663QlpBkLwa8zQZvw= =338M -----END PGP SIGNATURE----- --t0UkRYy7tHLRMCai--