Am Montag, den 17.05.2010, 21:17 +1000 schrieb Allan McRae: > On 17/05/10 18:35, Marc - A. Dahlhaus wrote: > > Am Mittwoch, den 05.05.2010, 20:08 +0200 schrieb Marc - A. Dahlhaus > > [ Administration | Westermann GmbH ]: > >> Am Mittwoch, den 05.05.2010, 16:13 +1000 schrieb Allan McRae: > >>> On 26/04/10 19:05, Marc - A. Dahlhaus [ Administration | Westermann GmbH > >>> ] wrote: > >>>> It handled the GLOB_NOMATCH case silently in the default handler. > >>>> But a debug print would help alot eg. on typos in include rules. > >>>> You can find an altered version attached. > >>>> > >>> > >>> The updated version looks fine to me now (although I have not thoroughly > >>> tested). We will also need an update to the pacman.conf manpage > >>> indicating that globbing can be used for Include. > >> > >> > >> As i'm not an english native, is the following correct? > >> > >> Marc > >> > >> --- a/doc/pacman.conf.5 > >> +++ b/doc/pacman.conf.5 > >> @@ -281,7 +281,7 @@ Instructs pacman to ignore any upgrades > >> .PP > >> \fBInclude =\fR path > >> .RS 4 > >> -Include another config file\&. This file can include repositories or > >> general configuration options\&. > >> +Include another config file\&. This file can include repositories or > >> general configuration options\&. Wildcards in path get expanded\&. > >> .RE > >> .PP > >> \fBXferCommand =\fR /path/to/command %u > >> > > > > Is there anything still missing on this one? > > > > It _looks_ fine to me. However, I have not taken it for a test run yet > as the patch did not apply easily with git. > > How are you creating the patch?
I used the last tarball release to work against and master is far away from the code in the last release with the config parsing and error reporting that got added. I rebased the patch against a fresh clone of master. I also adapted the debug output to contain filename and line as this would make the outputs really useful on a large include chain. It builds but i have a problem in my test environment. I doesn't let me use Include in the global section to include the repositorys one per file. This is a behaviour change compared to version 3.3. Was the removal of support for Include from outside of repository context in pacman.conf done intentional? http://projects.archlinux.org/pacman.git/commit/?id=51f9e5e40a7b4c9a2a4bb61562a07946adc2bb2d The Include directive should work from anywhere in the pacman.conf imo. > Can you use "git format-patch" and > send the entire patch (it looks like the main one is missing the header) > either using "git send-email" or less preferably as an attachment. The work in progress version is Attached. I still try to change the code to something that works as intended... Thanks, Marc
>From 4d8b09454ae7ed2c1197c0ef88782bbfcad6c9e9 Mon Sep 17 00:00:00 2001 From: Marc-A. Dahlhaus <m...@wol.de> Date: Mon, 17 May 2010 14:10:03 +0200 Subject: [PATCH] Allow to include a path containing wildcards Signed-off-by: Marc-A. Dahlhaus <m...@wol.de> --- configure.ac | 2 +- doc/pacman.conf.5.txt | 2 +- src/pacman/pacman.c | 24 ++++++++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 9760ba8..4307fb1 100644 --- a/configure.ac +++ b/configure.ac @@ -155,7 +155,7 @@ fi AM_CONDITIONAL(INTERNAL_DOWNLOAD, test "x$internaldownload" = "xyes") # Checks for header files. -AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h string.h strings.h sys/ioctl.h sys/param.h sys/statvfs.h sys/syslimits.h sys/time.h syslog.h wchar.h]) +AC_CHECK_HEADERS([fcntl.h glob.h libintl.h limits.h locale.h string.h strings.h sys/ioctl.h sys/param.h sys/statvfs.h sys/syslimits.h sys/time.h syslog.h wchar.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_INLINE diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt index 89c22a1..339019d 100644 --- a/doc/pacman.conf.5.txt +++ b/doc/pacman.conf.5.txt @@ -98,7 +98,7 @@ Options *Include =* path:: Include another config file. This file can include repositories or - general configuration options. + general configuration options. Wildcards in path get expanded. *Architecture =* auto | i686 | x86_64 | ...:: If set, pacman will only allow installation of packages of the given diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 09a8105..c0009cd 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -39,6 +39,7 @@ #include <locale.h> /* setlocale */ #include <time.h> /* time_t */ #include <errno.h> +#include <glob.h> #if defined(PACMAN_DEBUG) && defined(HAVE_MCHECK_H) #include <mcheck.h> /* debug tracing (mtrace) */ #endif @@ -976,8 +977,27 @@ static int _parseconfig(const char *file, const char *givensection, ret = 1; goto cleanup; } - pm_printf(PM_LOG_DEBUG, "config: including %s\n", value); - _parseconfig(value, section, db); + int globret; + glob_t globbuf; + globret = glob(value, GLOB_NOCHECK, NULL, &globbuf); + switch(globret) { + case GLOB_NOSPACE: + pm_printf(PM_LOG_DEBUG, "config file %s, line %d: include globing out of space\n", file, linenum); + break; + case GLOB_ABORTED: + pm_printf(PM_LOG_DEBUG, "config file %s, line %d: include globing read error for %s\n", file, linenum, value); + break; + case GLOB_NOMATCH: + pm_printf(PM_LOG_DEBUG, "config file %s, line %d: no include found for %s\n", file, linenum, value); + break; + default: + for(int gindex = 0; gindex < globbuf.gl_pathc; gindex++) { + pm_printf(PM_LOG_DEBUG, "config file %s, line %d: including %s\n", file, linenum, globbuf.gl_pathv[gindex]); + _parseconfig(globbuf.gl_pathv[gindex], section, db); + } + break; + } + globfree(&globbuf); /* Ignore include failures... assume non-critical */ } else if(strcmp(key, "Server") == 0) { if(value == NULL) { -- 1.7.0.5