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 Date: 20-Jan-2008 11:32:36
Branch: HEAD Handle: 2008012010323501
Modified files:
rpm CHANGES configure.ac devtool.conf
rpm/rpmio rpmlua.c
Log:
Make RPM Lua more a first-class citizen in the RPM world by let its
init procedure load all init scripts configured with Autoconf option
--with-path-rpmlua. This is similar to what we already do for POPT
(--with-path-rpmpopt) and RPM Macros (--with-path-macros).
Summary:
Revision Changes Path
1.2082 +1 -0 rpm/CHANGES
2.278 +24 -0 rpm/configure.ac
2.176 +1 -0 rpm/devtool.conf
2.44 +44 -0 rpm/rpmio/rpmlua.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.2081 -r1.2082 CHANGES
--- rpm/CHANGES 19 Jan 2008 14:07:34 -0000 1.2081
+++ rpm/CHANGES 20 Jan 2008 10:32:35 -0000 1.2082
@@ -1,4 +1,5 @@
5.0.0 -> 5.1a1:
+ - rse: let RPM Lua init procedure load all init scripts configured with new Autoconf option --with-path-rpmlua
- rse: fix Autoconf procedure by running python(1) based checks only under --with-python
- rse: provide RPM Lua function rpm.realpath(<path>) to complement RPM macro %{realpath:<path>}
- rse: unconditionally provide RPM Lua functions posix.{setenv,unsetenv}
@@ .
patch -p0 <<'@@ .'
Index: rpm/configure.ac
============================================================================
$ cvs diff -u -r2.277 -r2.278 configure.ac
--- rpm/configure.ac 19 Jan 2008 14:07:35 -0000 2.277
+++ rpm/configure.ac 20 Jan 2008 10:32:35 -0000 2.278
@@ -1467,6 +1467,30 @@
AC_SUBST(RPMPOPTFILES)
AC_MSG_RESULT([$RPMPOPTFILES])
+dnl # determine RPM Lua script files path
+AC_MSG_CHECKING([for RPM Lua script files path])
+RPMLUAFILES="${USRLIBRPM}/rpmlua"
+RPMLUAFILES="${RPMLUAFILES}:${USRLIBRPM}/%{_target}/rpmlua"
+RPMLUAFILES="${RPMLUAFILES}:${SYSCONFIGDIR}/rpmlua.*"
+RPMLUAFILES="${RPMLUAFILES}:${SYSCONFIGDIR}/rpmlua"
+RPMLUAFILES="${RPMLUAFILES}:${SYSCONFIGDIR}/%{_target}/rpmlua"
+if test ".$WITH_PATH_VERSIONED" = .yes; then
+ RPMLUAFILES="${RPMLUAFILES}:~/.rpmlua-${VERSION}"
+else
+ RPMLUAFILES="${RPMLUAFILES}:~/.rpmlua"
+fi
+AC_ARG_WITH(
+ [path-rpmlua],
+ AS_HELP_STRING([--with-path-rpmlua=ARG], [build with colon-separated RPM Lua script file path]),
+ [RPMLUAFILES="$withval"]
+)
+AC_DEFINE_UNQUOTED(
+ [RPMLUAFILES], ["$RPMLUAFILES"],
+ [Colon separated RPM Lua script files path]
+)
+AC_SUBST(RPMLUAFILES)
+AC_MSG_RESULT([$RPMLUAFILES])
+
testdir="`pwd`/tests"
AC_SUBST(testdir)
@@ .
patch -p0 <<'@@ .'
Index: rpm/devtool.conf
============================================================================
$ cvs diff -u -r2.175 -r2.176 devtool.conf
--- rpm/devtool.conf 11 Jan 2008 19:06:57 -0000 2.175
+++ rpm/devtool.conf 20 Jan 2008 10:32:35 -0000 2.176
@@ -902,6 +902,7 @@
OPTION="$OPTION --with-path-cfg=\"$prefix/etc/rpm\""
OPTION="$OPTION --with-path-rpmpopt=\"$prefix/lib/rpm/rpmpopt:$prefix/etc/rpm/rpmpopt:~/.rpmpopt\""
OPTION="$OPTION --with-path-macros=\"$prefix/lib/rpm/macros:$prefix/etc/rpm/macros:~/.rpmmacros\""
+ OPTION="$OPTION --with-path-rpmlua=\"$prefix/lib/rpm/rpmlua:$prefix/etc/rpm/rpmlua:~/.rpmlua\""
OPTION="$OPTION --with-path-lib=\"$prefix/lib/rpm\""
OPTION="$OPTION --with-path-locale=\"$prefix/share/rpm/locale\""
OPTION="$OPTION --with-path-database=\"$prefix/var/rpm/db\""
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmlua.c
============================================================================
$ cvs diff -u -r2.43 -r2.44 rpmlua.c
--- rpm/rpmio/rpmlua.c 19 Jan 2008 13:55:14 -0000 2.43
+++ rpm/rpmio/rpmlua.c 20 Jan 2008 10:32:36 -0000 2.44
@@ -92,6 +92,9 @@
/*@observer@*/ /*@unchecked@*/
const luaL_reg *lib = lualibs;
/*@=readonlytrans@*/
+ char *path_buf;
+ char *path_next;
+ char *path;
lua->L = L;
for (; lib->name; lib++) {
@@ -123,6 +126,47 @@
}
}
#undef _LUADOTDIR
+
+ /* load all standard RPM Lua script files */
+ path_buf = xstrdup(RPMLUAFILES);
+ for (path = path_buf; path != NULL && *path != '\0'; path = path_next) {
+ const char **av;
+ struct stat st;
+ int ac, i;
+
+ /* locate start of next path element */
+ path_next = strchr(path, ':');
+ if (path_next != NULL && *path_next == ':')
+ *path_next++ = '\0';
+ else
+ path_next = path + strlen(path);
+
+ /* glob-expand the path element */
+ ac = 0;
+ av = NULL;
+ if ((i = rpmGlob(path, &ac, &av)) != 0)
+ continue;
+
+ /* work-off each resulting file from the path element */
+ for (i = 0; i < ac; i++) {
+ const char *fn = av[i];
+#if defined(RPM_VENDOR_OPENPKG) /* security-sanity-check-rpmpopt-and-rpmmacros */
+ if (fn[0] == '@' /* attention */) {
+ fn++;
+ if (!rpmSecuritySaneFile(fn)) {
+ rpmlog(RPMLOG_WARNING, "existing RPM Lua script file \"%s\" considered INSECURE -- not loaded\n", fn);
+ continue;
+ }
+ }
+#endif
+ if (Stat(fn, &st) != -1)
+ (void)rpmluaRunScriptFile(lua, fn);
+ av[i] = _free(av[i]);
+ }
+ av = _free(av);
+ }
+ path_buf = _free(path_buf);
+
return lua;
}
/*@=mods@*/
@@ .
Received on Sun Jan 20 11:32:36 2008