diff options
-rw-r--r-- | pcr/expac-relative/0001-fix-target-processing.patch | 27 | ||||
-rw-r--r-- | pcr/expac-relative/0002-conf-always-trim-the-key-name.patch | 30 | ||||
-rw-r--r-- | pcr/expac-relative/PKGBUILD | 15 | ||||
-rw-r--r-- | pcr/expac-relative/add-options-dbpath-and-config.patch | 196 |
4 files changed, 66 insertions, 202 deletions
diff --git a/pcr/expac-relative/0001-fix-target-processing.patch b/pcr/expac-relative/0001-fix-target-processing.patch new file mode 100644 index 000000000..f3c682ff7 --- /dev/null +++ b/pcr/expac-relative/0001-fix-target-processing.patch @@ -0,0 +1,27 @@ +From ea25d7e51c2236e739aef2718499781dd37ef53d Mon Sep 17 00:00:00 2001 +From: Dave Reisner <dreisner@archlinux.org> +Date: Tue, 25 Nov 2014 10:50:19 -0500 +Subject: [PATCH] fix target processing + +lack of targets is not an error. +--- + expac.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/expac.c b/expac.c +index 5a11a59..d89e072 100644 +--- a/expac.c ++++ b/expac.c +@@ -848,9 +848,6 @@ int main(int argc, char *argv[]) + } + + targets = process_targets(argc, argv); +- if(targets == NULL) { +- return 1; +- } + + r = expac_new(&expac, opt_config_file); + if(r < 0) { +-- +2.1.3 + diff --git a/pcr/expac-relative/0002-conf-always-trim-the-key-name.patch b/pcr/expac-relative/0002-conf-always-trim-the-key-name.patch new file mode 100644 index 000000000..c9140a38c --- /dev/null +++ b/pcr/expac-relative/0002-conf-always-trim-the-key-name.patch @@ -0,0 +1,30 @@ +From d4ab6ef08723c2c47802fd56222bf6105919ec3b Mon Sep 17 00:00:00 2001 +From: Dave Reisner <dreisner@archlinux.org> +Date: Thu, 27 Nov 2014 21:55:17 -0500 +Subject: [PATCH] conf: always trim the key name + +--- + conf.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/conf.c b/conf.c +index 96e4d60..aef4cbf 100644 +--- a/conf.c ++++ b/conf.c +@@ -155,12 +155,11 @@ static int parse_one_file(config_t *config, const char *filename, char **section + + strsep(&val, "="); + strtrim(line); ++ strtrim(val); + + if(strcmp(line, "Include") == 0) { + int k; + +- strtrim(val); +- + k = parse_include(config, val, section); + if(k < 0) { + return k; +-- +2.1.3 + diff --git a/pcr/expac-relative/PKGBUILD b/pcr/expac-relative/PKGBUILD index b7a1dcf95..db820175b 100644 --- a/pcr/expac-relative/PKGBUILD +++ b/pcr/expac-relative/PKGBUILD @@ -5,8 +5,8 @@ _pkgname=expac pkgname=expac-relative -pkgver=3 -pkgrel=1 +pkgver=4 +pkgrel=2.parabola1 pkgdesc="pacman database extraction utility, with dbpath and config options support" arch=('i686' 'x86_64' 'mips64el') url="http://github.com/falconindy/expac" @@ -16,15 +16,18 @@ provides=($_pkgname) depends=('pacman') makedepends=('perl') source=("http://code.falconindy.com/archive/$_pkgname/$_pkgname-$pkgver.tar.gz"{,.sig} - 'add-options-dbpath-and-config.patch') -md5sums=('2f53f9663b69948a4a8bb03c1aa435a5' + '0001-fix-target-processing.patch' + '0002-conf-always-trim-the-key-name.patch') +md5sums=('5104ad808155e8d2d381d9282caf7bae' 'SKIP' - '30539a5f7d1acbebb393535ae8ecf570') + '80433a259a4f5996520f42217b1896b8' + '879749918e1a4abef4c51e9f870c99e0') prepare() { cd "$_pkgname-$pkgver" - patch -Np1 -i "$srcdir/add-options-dbpath-and-config.patch" + patch -Np1 < "$srcdir/0001-fix-target-processing.patch" + patch -Np1 < "$srcdir/0002-conf-always-trim-the-key-name.patch" sed '/\*\//q' expac.c >LICENSE } diff --git a/pcr/expac-relative/add-options-dbpath-and-config.patch b/pcr/expac-relative/add-options-dbpath-and-config.patch deleted file mode 100644 index 100fbb31d..000000000 --- a/pcr/expac-relative/add-options-dbpath-and-config.patch +++ /dev/null @@ -1,196 +0,0 @@ -From cc0135f30893b719d34845c088e215900962d8dd Mon Sep 17 00:00:00 2001 -From: Esteban Carnevale <alfplayer@mailoo.org> -Date: Sat, 8 Feb 2014 17:49:10 -0300 -Subject: [PATCH] add options dbpath and config - ---- - README.pod | 12 +++++++++++ - expac.c | 72 +++++++++++++++++++++++++++++++++++++++++--------------------- - 2 files changed, 60 insertions(+), 24 deletions(-) - -diff --git a/README.pod b/README.pod -index 8e51329..ba27281 100644 ---- a/README.pod -+++ b/README.pod -@@ -24,6 +24,18 @@ a query string (in the case of a search), or in repo/package syntax when the - - =over 4 - -+=item B<-b, --dbpath> <path> -+ -+Specify an alternative database location (a typical default is -+/var/lib/pacman). This should not be used unless you know what you are doing. -+NOTE: if specified, this is an absolute path and the root path is not -+automatically prepended. -+ -+=item B<-c, --config> <file> -+ -+Specify an alternate configuration file (a typical default is -+/etc/pacman.conf). -+ - =item B<-Q, --query> - - Search the local database for provided targets. This is the default behavior. -diff --git a/expac.c b/expac.c -index ae3ef6d..3f9b0ba 100644 ---- a/expac.c -+++ b/expac.c -@@ -36,6 +36,8 @@ - #include <time.h> - - #define DEFAULT_DELIM "\n" -+#define DEFAULT_DBPATH "/var/lib/pacman" -+#define DEFAULT_CONFIGFILE "/etc/pacman.conf" - #define DEFAULT_LISTDELIM " " - #define DEFAULT_TIMEFMT "%c" - #define FORMAT_TOKENS "BCDEGLMNOPRSVabdhmnprsuvw%" -@@ -58,10 +60,13 @@ bool local = false; - bool groups = false; - bool localpkg = false; - char humansize = 'B'; -+char dbtype = NULL; - const char *format = NULL; - const char *timefmt = NULL; - const char *listdelim = NULL; - const char *delim = NULL; -+const char *dbpath = NULL; -+const char *configfile = NULL; - int pkgcounter = 0; - - typedef const char *(*extractfn)(void*); -@@ -154,7 +159,7 @@ static alpm_handle_t *alpm_init(void) { - char line[PATH_MAX]; - char *ptr, *section = NULL; - -- handle = alpm_initialize("/", "/var/lib/pacman", &alpm_errno); -+ handle = alpm_initialize("/", dbpath, &alpm_errno); - if (!handle) { - alpm_strerror(alpm_errno); - return NULL; -@@ -162,9 +167,9 @@ static alpm_handle_t *alpm_init(void) { - - db_local = alpm_get_localdb(handle); - -- fp = fopen("/etc/pacman.conf", "r"); -+ fp = fopen(configfile, "r"); - if (!fp) { -- perror("fopen: /etc/pacman.conf"); -+ fprintf(stderr, "fopen:%s\n", configfile); - return handle; - } - -@@ -209,6 +214,8 @@ static void usage(void) { - " Options:\n" - " -Q, --local search local DB (default)\n" - " -S, --sync search sync DBs\n" -+ " -b, --dbpath <path> alternative database location (default: /var/lib/pacman)\n" -+ " -c, --config <path> alternative configuration file (default: /etc/pacman.conf)\n" - " -s, --search search for matching regex\n" - " -g, --group return packages matching targets as groups\n" - " -H, --humansize <size> format package sizes in SI units (default: bytes)\n" -@@ -222,41 +229,43 @@ static void usage(void) { - "For more details see expac(1).\n"); - } - --static int parse_options(int argc, char *argv[], alpm_handle_t *handle) { -+static int parse_options(int argc, char *argv[]) { - int opt, option_index = 0; - const char *i; - - static struct option opts[] = { -- {"readone", no_argument, 0, '1'}, -- {"delim", required_argument, 0, 'd'}, -- {"listdelim", required_argument, 0, 'l'}, -- {"group", required_argument, 0, 'g'}, -- {"help", no_argument, 0, 'h'}, -- {"file", no_argument, 0, 'p'}, -- {"humansize", required_argument, 0, 'H'}, -- {"query", no_argument, 0, 'Q'}, -- {"sync", no_argument, 0, 'S'}, -- {"search", no_argument, 0, 's'}, -- {"timefmt", required_argument, 0, 't'}, -- {"verbose", no_argument, 0, 'v'}, -+ {"readone", no_argument, 0, '1'}, -+ {"delim", required_argument, 0, 'd'}, -+ {"dbpath", required_argument, 0, 'b'}, -+ {"configfile", required_argument, 0, 'c'}, -+ {"listdelim", required_argument, 0, 'l'}, -+ {"group", required_argument, 0, 'g'}, -+ {"help", no_argument, 0, 'h'}, -+ {"file", no_argument, 0, 'p'}, -+ {"humansize", required_argument, 0, 'H'}, -+ {"query", no_argument, 0, 'Q'}, -+ {"sync", no_argument, 0, 'S'}, -+ {"search", no_argument, 0, 's'}, -+ {"timefmt", required_argument, 0, 't'}, -+ {"verbose", no_argument, 0, 'v'}, - {0, 0, 0, 0} - }; - -- while (-1 != (opt = getopt_long(argc, argv, "1l:d:gH:hf:pQSst:v", opts, &option_index))) { -+ while (-1 != (opt = getopt_long(argc, argv, "1l:d:b:c:gH:hf:pQSst:v", opts, &option_index))) { - switch (opt) { - case 'S': -- if (dblist) { -+ if (dbtype) { - fprintf(stderr, "error: can only select one repo option (use -h for help)\n"); - return 1; - } -- dblist = alpm_list_copy(alpm_get_syncdbs(handle)); -+ dbtype = 's'; - break; - case 'Q': -- if (dblist) { -+ if (dbtype) { - fprintf(stderr, "error: can only select one repo option (use -h for help)\n"); - return 1; - } -- dblist = alpm_list_add(dblist, db_local); -+ dbtype = 'q'; - local = true; - break; - case '1': -@@ -265,6 +274,12 @@ static int parse_options(int argc, char *argv[], alpm_handle_t *handle) { - case 'd': - delim = optarg; - break; -+ case 'b': -+ dbpath = optarg; -+ break; -+ case 'c': -+ configfile = optarg; -+ break; - case 'g': - groups = true; - break; -@@ -719,14 +734,23 @@ int main(int argc, char *argv[]) { - alpm_handle_t *handle; - alpm_list_t *results = NULL, *i; - -+ ret = parse_options(argc, argv); -+ if (ret != 0) { -+ goto finish; -+ } -+ -+ dbpath = dbpath ? dbpath : DEFAULT_DBPATH; -+ configfile = configfile ? configfile : DEFAULT_CONFIGFILE; -+ - handle = alpm_init(); - if (!handle) { - return ret; - } - -- ret = parse_options(argc, argv, handle); -- if (ret != 0) { -- goto finish; -+ if (dbtype == 's') { -+ dblist = alpm_list_copy(alpm_get_syncdbs(handle)); -+ } else if (dbtype == 'q') { -+ dblist = alpm_list_add(dblist, db_local); - } - - /* ensure sane defaults */ --- -1.9.0 - - |