RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: lua/local/ lrexlib.c rpm/ CHANGES INSTALL configure.ac rpm/...

From: Ralf S. Engelschall <rse@rpm5.org>
Date: Wed 01 Aug 2007 - 17:55:29 CEST
Message-Id: <20070801155529.C91F734844C@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Ralf S. Engelschall
  Root:   /v/rpm/cvs                       Email:  rse@rpm5.org
  Module: rpm lua                          Date:   01-Aug-2007 17:55:29
  Branch: HEAD                             Handle: 2007080116552801

  Modified files:
    lua/local               lrexlib.c
    rpm                     CHANGES INSTALL configure.ac
    rpm/lib                 rpmsx.h
    rpm/rpmio               mire.h

  Log:
    Some Lua/PCRE related enhancements:
    - make sure RPM is also linked against libm if external Lua is used (as liblua required libm)
    - support building against PCRE for its regcomp(3) emulation API pcreposix(3) -- used by RPM internally
    - support building against PCRE for its native API pcre(3) -- used by the Lua "rex" extension library

  Summary:
    Revision    Changes     Path
    1.7         +9  -6      lua/local/lrexlib.c
    1.1537      +3  -0      rpm/CHANGES
    2.42        +1  -0      rpm/INSTALL
    2.232       +16 -2      rpm/configure.ac
    2.11        +4  -0      rpm/lib/rpmsx.h
    1.3         +5  -0      rpm/rpmio/mire.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: lua/local/lrexlib.c
  ============================================================================
  $ cvs diff -u -r1.6 -r1.7 lrexlib.c
  --- lua/local/lrexlib.c	23 Jul 2007 08:14:01 -0000	1.6
  +++ lua/local/lrexlib.c	1 Aug 2007 15:55:29 -0000	1.7
  @@ -14,6 +14,9 @@
   #ifdef LUA_USE_POSIX
   #define WITH_POSIX
   #endif
  +#ifdef LUA_USE_PCRE
  +#define WITH_PCRE
  +#endif
   
   /*@access regex_t @*/
   
  @@ -199,7 +202,7 @@
   
   #ifdef WITH_PCRE
   
  -#include <pcre/pcre.h>
  +#include <pcre.h>
   
   static int pcre_comp(lua_State *L)
   {
  @@ -221,7 +224,7 @@
     return 1;
   }
   
  -static void pcre_getargs(lua_State *L, int *len, int *ncapt, const char **text,
  +static void pcre_getargs(lua_State *L, size_t *len, int *ncapt, const char **text,
                           pcre ***ppr, int **match)
   {
     luaL_checkany(L, 1);
  @@ -254,9 +257,9 @@
     pcre **ppr;
     int *match;
     int ncapt;
  -  int len;
  +  size_t len;
     pcre_getargs(L, &len, &ncapt, &text, &ppr, &match);
  -  res = pcre_exec(*ppr, NULL, text, len, 0, 0, match, (ncapt + 1) * 3);
  +  res = pcre_exec(*ppr, NULL, text, (int)len, 0, 0, match, (ncapt + 1) * 3);
     if (res >= 0) {
       lua_pushnumber(L, match[0] + 1);
       lua_pushnumber(L, match[1]);
  @@ -277,7 +280,7 @@
     int ncapt, nmatch = 0, maxmatch;
     pcre **ppr;
     int *match;
  -  int len;
  +  size_t len;
     pcre_getargs(L, &len, &ncapt, &text, &ppr, &match);
     luaL_checktype(L, 3, LUA_TFUNCTION);
     if (lua_gettop(L) > 3) {
  @@ -285,7 +288,7 @@
       limit = 1;
     }
     while (!limit || nmatch < maxmatch) {
  -    res = pcre_exec(*ppr, NULL, text, len, 0, 0, match, (ncapt + 1) * 3);
  +    res = pcre_exec(*ppr, NULL, text, (int)len, 0, 0, match, (ncapt + 1) * 3);
       if (res == 0) {
         lua_pushvalue(L, 3);
         lua_pushlstring(L, text + match[0], match[1] - match[0]);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1536 -r1.1537 CHANGES
  --- rpm/CHANGES	31 Jul 2007 17:08:56 -0000	1.1536
  +++ rpm/CHANGES	1 Aug 2007 15:55:28 -0000	1.1537
  @@ -1,4 +1,7 @@
   4.5 -> 5.0:
  +    - rse: make sure RPM is also linked against libm if external Lua is used (as liblua required libm)
  +    - rse: support building against PCRE for its regcomp(3) emulation API pcreposix(3) -- used by RPM internally
  +    - rse: support building against PCRE for its native API pcre(3) -- used by the Lua "rex" extension library
       - jbj: query w/o lead/sigh w newmagic (using --nolead --nosigh --newmagic).
       - jbj: query of packages w/o lead/sigh (using --nolead --nosigh).
       - jbj: query of packages w/o lead (using --nolead).
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/INSTALL
  ============================================================================
  $ cvs diff -u -r2.41 -r2.42 INSTALL
  --- rpm/INSTALL	29 Jul 2007 14:10:47 -0000	2.41
  +++ rpm/INSTALL	1 Aug 2007 15:55:28 -0000	2.42
  @@ -39,6 +39,7 @@
   File/magic  [4] optional  4.0     4.21    ftp://ftp.astron.com/pub/file/
   GNU gettext     optional  1.16    1.16.1  http://www.gnu.org/software/gettext/
   GNU iconv       optional  1.11    1.11    http://www.gnu.org/software/libiconv/
  +PCRE            optional  7.0     7.2     http://www.pcre.corg/
   DMalloc         optional  5       5.5.2   http://dmalloc.com/
   Electric Fence  optional  2.1     2.1.13  http://perens.com/FreeSoftware/ElectricFence/
   Linux KeyUtils  optional  1.2     1.2     http://people.redhat.com/~dhowells/keyutils/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/configure.ac
  ============================================================================
  $ cvs diff -u -r2.231 -r2.232 configure.ac
  --- rpm/configure.ac	31 Jul 2007 18:36:33 -0000	2.231
  +++ rpm/configure.ac	1 Aug 2007 15:55:28 -0000	2.232
  @@ -926,11 +926,14 @@
       [lua], [lua_newstate], [lua.h],
       [no,internal:external:none], [lua:local],
       [ if test ".$RPM_CHECK_LIB_LOCATION" = .internal; then
  -          AC_CHECK_LIB(dl, dlopen, [ LIBS="-ldl $LIBS"; WITH_LUA_SUBDIR_LIB="-ldl" ])
  -          AC_CHECK_FUNC(dlopen, [ WITH_LUA_SUBDIR_DEF="-DLUA_USE_DLOPEN" ])
  +          AC_CHECK_LIB(m, fabs)
  +          AC_CHECK_LIB(dl, dlopen)
  +          AC_CHECK_FUNC(dlopen, [ WITH_LUA_SUBDIR_DEF="$WITH_LUA_SUBDIR_DEF -DLUA_USE_DLOPEN" ])
  +          AC_CHECK_FUNC(regcomp, [ WITH_LUA_SUBDIR_DEF="$WITH_LUA_SUBDIR_DEF -DLUA_USE_POSIX" ])
             AC_DEFINE(WITH_LUA_INTERNAL, 1, [Define if building with internal Lua])
             AC_CONFIG_FILES([lua/Makefile])
         else
  +          AC_CHECK_LIB(m, fabs)
             AC_CHECK_LIB(dl, dlopen)
             AC_CHECK_FUNC(dlopen)
         fi
  @@ -938,6 +941,17 @@
   AC_SUBST(WITH_LUA_SUBDIR_DEF)
   AC_SUBST(WITH_LUA_SUBDIR_LIB)
   
  +dnl # PCRE
  +RPM_CHECK_LIB(
  +    [PCRE], [pcre],
  +    [pcre], [pcre_compile], [pcre.h],
  +    [no,external:none], [],
  +    [ AC_CHECK_HEADERS(pcreposix.h)
  +      if test ".$WITH_LUA" = .yes; then
  +          WITH_LUA_SUBDIR_DEF="$WITH_LUA_SUBDIR_DEF -DLUA_USE_PCRE"
  +      fi
  +    ], [])
  +
   dnl # DMalloc
   RPM_CHECK_LIB(
       [DMalloc], [dmalloc],
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmsx.h
  ============================================================================
  $ cvs diff -u -r2.10 -r2.11 rpmsx.h
  --- rpm/lib/rpmsx.h	9 Oct 2004 19:40:09 -0000	2.10
  +++ rpm/lib/rpmsx.h	1 Aug 2007 15:55:29 -0000	2.11
  @@ -6,7 +6,11 @@
    * Structure(s) used for file security context pattern handling
    */
   
  +#if defined(WITH_PCRE) && defined(HAVE_PCREPOSIX_H)
  +#include <pcreposix.h>
  +#else
   #include <regex.h>
  +#endif
   
   /**
    */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/mire.h
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 mire.h
  --- rpm/rpmio/mire.h	25 May 2007 18:34:14 -0000	1.2
  +++ rpm/rpmio/mire.h	1 Aug 2007 15:55:29 -0000	1.3
  @@ -16,7 +16,12 @@
   /*@=declundef =exportheader =redecl @*/
   #endif
   
  +#if defined(WITH_PCRE) && defined(HAVE_PCREPOSIX_H)
  +#include <pcreposix.h>
  +#else
   #include <regex.h>
  +#endif
  +
   #if defined(__LCLINT__)
   /*@-declundef -exportheader @*/ /* LCL: missing modifies (only is bogus) */
   extern void regfree (/*@only@*/ regex_t *preg)
  @@ .
Received on Wed Aug 1 17:55:29 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.