Poifect, thanks!
There's still some wartlets that I see:
1) %{_rpmdir} isn't the right default value, there are ARCH/*.rpm. OTOH
there is no way to choose a default glob pattern that pleases everyone.
2) there's the *.src.rpm <-> *.i386.rpm glob confusion if SRPM's
coexist.
Don't do that! is okay for the moment (and %_rpmdir certainly has no
*.src.rpm's).
3) lusers are going to want "best" (as in "newest", or
rpmPlatformScore'd) rather than first found as
currently implemented in rpmcliInstallElementPath(). OTOH the pattern
application loop
is easily continued if/when a better definition of "best" is proposed.
I'll try using fts(3) instead of glob(3) so that multiple prefixes,
not just a single
glob pattern, can be supported. I need that to chase multiple pubkey
keyrings,
and multiple %{buildroot} paths, and likely a few more todo items
I've forgot ...
73 de Jeff
On Feb 3, 2008, at 11:05 AM, Jeff Johnson wrote:
> RPM Package Manager, CVS Repository
> http://rpm5.org/cvs/
>
> ______________________________________________________________________
> ______
>
> Server: rpm5.org Name: Jeff Johnson
> Root: /v/rpm/cvs Email: jbj@rpm5.org
> Module: rpm Date: 03-Feb-2008
> 17:05:24
> Branch: HEAD Handle: 2008020316052400
>
> Modified files:
> rpm CHANGES macros.in
> rpm/lib rpminstall.c
>
> Log:
> - rse: add _rpmgi_pattern_{glob,regex} macros for "+N" arg-to-path
> rewrite.
>
> Summary:
> Revision Changes Path
> 1.2127 +1 -0 rpm/CHANGES
> 1.195 +11 -5 rpm/lib/rpminstall.c
> 1.230 +6 -1 rpm/macros.in
>
> ______________________________________________________________________
> ______
>
> patch -p0 <<'@@ .'
> Index: rpm/CHANGES
>
> ======================================================================
> ======
> $ cvs diff -u -r1.2126 -r1.2127 CHANGES
> --- rpm/CHANGES 3 Feb 2008 09:55:02 -0000 1.2126
> +++ rpm/CHANGES 3 Feb 2008 16:05:24 -0000 1.2127
> @@ -1,4 +1,5 @@
> 5.0.0 -> 5.1a1:
> + - rse: add _rpmgi_pattern_{glob,regex} macros for "+N" arg-
> to-path rewrite.
> - jbj: functional "+N-V-R.A" path-to-repository expansions
> with -i/-U.
> - jbj: mire.c: add STANDALONE test exerciser.
> - jbj: use struct timeval timestamp for INSTALL{TID,TIME}
> and ORIGIN{TID,TIME}.
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/lib/rpminstall.c
>
> ======================================================================
> ======
> $ cvs diff -u -r1.194 -r1.195 rpminstall.c
> --- rpm/lib/rpminstall.c 3 Feb 2008 08:28:38 -0000 1.194
> +++ rpm/lib/rpminstall.c 3 Feb 2008 16:05:24 -0000 1.195
> @@ -334,18 +334,24 @@
>
> static const char * rpmcliInstallElementPath(rpmts ts, const
> char * arg)
> {
> - static const char * pkgpat = "-[^-]+-[^-]+\\.[^.]+\\.rpm$";
> - const char * mirePattern = rpmExpand(arg, pkgpat, NULL);
> + /* XXX note the added "-*.rpm" to force globbing on '-'
> boundaries. */
> + const char * fn = rpmGetPath(
> + "%{?_rpmgi_pattern_glob:%{_rpmgi_pattern_glob ", arg, "}}"
> + "%{!?_rpmgi_pattern_glob:", arg, "-*-*.*.rpm}",
> + NULL
> + );
> + const char * mirePattern = rpmExpand(
> + "%{?_rpmgi_pattern_regex:%{_rpmgi_pattern_regex ", arg,
> "}}"
> + "%{!?_rpmgi_pattern_regex:", arg, "-[^-]+-[^-]+\\.[^.]+\
> \.rpm$}",
> + NULL
> + );
> miRE mire = mireNew(RPMMIRE_REGEX, 0);
> - const char * fn = NULL;
> ARGV_t av = NULL;
> int ac = 0;
> int xx = mireRegcomp(mire, mirePattern);
> int i;
>
> /* Get list of candidate package paths. */
> - /* XXX note the added "-*.rpm" to force globbing on '-'
> boundaries. */
> - fn = rpmGetPath("%{?_rpmgi_prefix:%{?_rpmgi_prefix}/}", arg,
> "-*.rpm", NULL);
> xx = rpmGlob(fn, &ac, &av);
> fn = _free(fn);
>
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/macros.in
>
> ======================================================================
> ======
> $ cvs diff -u -r1.229 -r1.230 macros.in
> --- rpm/macros.in 27 Jan 2008 01:54:39 -0000 1.229
> +++ rpm/macros.in 3 Feb 2008 16:05:24 -0000 1.230
> @@ -1,7 +1,7 @@
> #/*! \page config_macros Default configuration: @USRLIBRPM@/macros
> # \verbatim
> #
> -# $Id: macros.in,v 1.229 2008/01/27 01:54:39 jbj Exp $
> +# $Id: macros.in,v 1.230 2008/02/03 16:05:24 jbj Exp $
> #
> # This is a global RPM configuration file. All changes made here
> will
> # be lost when the rpm package is upgraded. Any per-system
> configuration
> @@ -979,6 +979,11 @@
> # Permit network access? (".fdio" prohibits network access)
> %_rpmgio .fdio
>
> +#
> +# Pattern matching for installation via "+N-V-R.A" CLI arguments
> +%_rpmgi_pattern_glob() %{_rpmdir}/%1-*-*.*.rpm
> +%_rpmgi_pattern_regex() ^.+/%1-[^-]+-[^-]+\\.[^.]+\\.rpm$
> +
>
> #=====================================================================
> =========
> # ---- Run-time probe dependency macros.
>
> @@ .
> ______________________________________________________________________
> RPM Package Manager http://rpm5.org
> CVS Sources Repository rpm-cvs@rpm5.org
Received on Sun Feb 3 17:17:04 2008