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: 09-Feb-2008 21:44:49
Branch: HEAD Handle: 2008020920444900
Modified files:
rpm CHANGES
rpm/rpmio librpmio.vers poptIO.h tdir.c tfts.c tget.c
tglob.c
Log:
- jbj: use poptIO with rpmio noinst_PROGRAMS.
Summary:
Revision Changes Path
1.2168 +1 -0 rpm/CHANGES
2.37 +5 -0 rpm/rpmio/librpmio.vers
1.2 +1 -0 rpm/rpmio/poptIO.h
2.13 +7 -33 rpm/rpmio/tdir.c
2.20 +13 -63 rpm/rpmio/tfts.c
1.15 +7 -34 rpm/rpmio/tget.c
2.12 +7 -34 rpm/rpmio/tglob.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.2167 -r1.2168 CHANGES
--- rpm/CHANGES 9 Feb 2008 20:12:19 -0000 1.2167
+++ rpm/CHANGES 9 Feb 2008 20:44:49 -0000 1.2168
@@ -1,4 +1,5 @@
5.0.0 -> 5.1a1:
+ - jbj: use poptIO with rpmio noinst_PROGRAMS.
- jbj: rpmio: clone poptIO.[ch] from poptALL.c for rpmio noinst_PROGRAMS.
- jbj: rpmcli: remove duplicate nolibio entry in poptALL.c
- jbj: pemit %{___NVRA} to parameterize the displayed NVRA while installing.
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/librpmio.vers
============================================================================
$ cvs diff -u -r2.36 -r2.37 librpmio.vers
--- rpm/rpmio/librpmio.vers 8 Feb 2008 17:42:48 -0000 2.36
+++ rpm/rpmio/librpmio.vers 9 Feb 2008 20:44:49 -0000 2.37
@@ -239,7 +239,12 @@
rpmInitMacros;
_rpmio_debug;
rpmioAccess;
+ rpmioAllPoptTable;
rpmioClean;
+ rpmioFini;
+ rpmioFtsOpts;
+ rpmioFtsPoptTable;
+ rpmioInit;
rpmioMkpath;
rpmioSlurp;
rpmLoadMacroFile;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/poptIO.h
============================================================================
$ cvs diff -u -r1.1 -r1.2 poptIO.h
--- rpm/rpmio/poptIO.h 9 Feb 2008 20:12:20 -0000 1.1
+++ rpm/rpmio/poptIO.h 9 Feb 2008 20:44:49 -0000 1.2
@@ -9,6 +9,7 @@
#include <rpmmacro.h>
#include <rpmcb.h>
#include <rpmmg.h>
+#include <rpmsw.h>
#include <rpmurl.h>
#include <argv.h>
#include <fts.h>
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/tdir.c
============================================================================
$ cvs diff -u -r2.12 -r2.13 tdir.c
--- rpm/rpmio/tdir.c 9 Feb 2008 02:54:50 -0000 2.12
+++ rpm/rpmio/tdir.c 9 Feb 2008 20:44:49 -0000 2.13
@@ -1,10 +1,7 @@
#include "system.h"
#include <rpmio_internal.h>
-#include <rpmmacro.h>
-#include <rpmcb.h>
-#include <argv.h>
-#include <popt.h>
+#include <poptIO.h>
#include "debug.h"
@@ -57,17 +54,10 @@
static struct poptOption optionsTable[] = {
{ "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
- { "avdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_av_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "davdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_dav_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
- N_("debug rpmio I/O"), NULL},
- { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
- N_("debug URL cache handling"), NULL},
- { "verbose", 'v', 0, 0, 'v', NULL, NULL },
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0,
+ N_("Common options for all rpmio executables:"),
+ NULL },
+
POPT_AUTOHELP
POPT_TABLEEND
};
@@ -75,27 +65,13 @@
int
main(int argc, char *argv[])
{
- poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
+ poptContext optCon = rpmioInit(argc, argv, optionsTable);
ARGV_t av = NULL;
int ac;
const char * dn;
int rc;
- while ((rc = poptGetNextOpt(optCon)) > 0) {
- const char * optArg = poptGetOptArg(optCon);
- switch (rc) {
- case 'v':
- rpmIncreaseVerbosity();
- /*@switchbreak@*/ break;
- default:
- /*@switchbreak@*/ break;
- }
- optArg = _free(optArg);
- }
-
if (_debug) {
- rpmIncreaseVerbosity();
- rpmIncreaseVerbosity();
_av_debug = -1;
_dav_debug = -1;
_ftp_debug = -1;
@@ -121,9 +97,7 @@
exit:
-/*@i@*/ urlFreeCache();
-
- optCon = poptFreeContext(optCon);
+ optCon = rpmioFini(optCon);
return rc;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/tfts.c
============================================================================
$ cvs diff -u -r2.19 -r2.20 tfts.c
--- rpm/rpmio/tfts.c 9 Feb 2008 02:54:50 -0000 2.19
+++ rpm/rpmio/tfts.c 9 Feb 2008 20:44:49 -0000 2.20
@@ -2,13 +2,7 @@
#include <fts.h>
#include <rpmio_internal.h>
-#include <rpmmacro.h>
-#include <rpmcb.h>
-#include <rpmmg.h>
-#include <mire.h>
-#include <argv.h>
-#include <rpmsw.h>
-#include <popt.h>
+#include <poptIO.h>
#include "debug.h"
@@ -126,7 +120,7 @@
return 0;
}
-static int ftsOpts = 0;
+extern int rpmioFtsOpts;
static int ftsWalk(ARGV_t av)
{
@@ -138,7 +132,7 @@
xx = rpmswEnter(op, 0);
ndirs = nfiles = 0;
- if ((ftsp = Fts_open((char *const *)av, ftsOpts, NULL)) == NULL)
+ if ((ftsp = Fts_open((char *const *)av, rpmioFtsOpts, NULL)) == NULL)
goto exit;
while((fts = Fts_read(ftsp)) != NULL)
xx = ftsPrint(ftsp, fts);
@@ -158,46 +152,19 @@
{ "pattern", '\0', POPT_ARG_STRING, &mirePattern, 0, NULL, NULL },
{ "magic", '\0', POPT_ARG_STRING, &mgFile, 0, NULL, NULL },
- { "comfollow", '\0', POPT_BIT_SET, &ftsOpts, FTS_COMFOLLOW,
- N_("follow command line symlinks"), NULL },
- { "logical", '\0', POPT_BIT_SET, &ftsOpts, FTS_LOGICAL,
- N_("logical walk"), NULL },
- { "nochdir", '\0', POPT_BIT_SET, &ftsOpts, FTS_NOCHDIR,
- N_("don't change directories"), NULL },
- { "nostat", '\0', POPT_BIT_SET, &ftsOpts, FTS_NOSTAT,
- N_("don't get stat info"), NULL },
- { "physical", '\0', POPT_BIT_SET, &ftsOpts, FTS_PHYSICAL,
- N_("physical walk"), NULL },
- { "seedot", '\0', POPT_BIT_SET, &ftsOpts, FTS_SEEDOT,
- N_("return dot and dot-dot"), NULL },
- { "xdev", '\0', POPT_BIT_SET, &ftsOpts, FTS_XDEV,
- N_("don't cross devices"), NULL },
- { "whiteout", '\0', POPT_BIT_SET, &ftsOpts, FTS_WHITEOUT,
- N_("return whiteout information"), NULL },
-
{ "options", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_dav_nooptions, 0,
N_("always send http OPTIONS"), NULL},
{ "nooptions", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_dav_nooptions, -1,
N_("use cached http OPTIONS"), NULL},
- { "avdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_av_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "davdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_dav_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "ftsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_fts_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "mgdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmmg_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "miredebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_mire_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
- N_("debug rpmio I/O"), NULL},
- { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
- N_("debug URL cache handling"), NULL},
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioFtsPoptTable, 0,
+ N_("Options for Fts(3):"),
+ NULL },
+
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0,
+ N_("Common options for all rpmio executables:"),
+ NULL },
- { "verbose", 'v', 0, 0, 'v', NULL, NULL },
POPT_AUTOHELP
POPT_TABLEEND
};
@@ -211,26 +178,11 @@
ARGV_t dav;
const char * dn;
int rc;
- int xx;
-
- while ((rc = poptGetNextOpt(optCon)) > 0) {
- const char * optArg = poptGetOptArg(optCon);
- switch (rc) {
- case 'v':
- rpmIncreaseVerbosity();
- /*@switchbreak@*/ break;
- default:
- /*@switchbreak@*/ break;
- }
- optArg = _free(optArg);
- }
- if (ftsOpts == 0)
- ftsOpts = (FTS_COMFOLLOW | FTS_LOGICAL | FTS_NOSTAT);
+ if (rpmioFtsOpts == 0)
+ rpmioFtsOpts = (FTS_COMFOLLOW | FTS_LOGICAL | FTS_NOSTAT);
if (_fts_debug) {
- rpmIncreaseVerbosity();
- rpmIncreaseVerbosity();
_av_debug = -1;
_dav_debug = -1;
_ftp_debug = -1;
@@ -274,9 +226,7 @@
av = argvFree(av);
-/*@i@*/ urlFreeCache();
-
- optCon = poptFreeContext(optCon);
+ optCon = rpmioFini(optCon);
return rc;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/tget.c
============================================================================
$ cvs diff -u -r1.14 -r1.15 tget.c
--- rpm/rpmio/tget.c 9 Feb 2008 02:54:50 -0000 1.14
+++ rpm/rpmio/tget.c 9 Feb 2008 20:44:49 -0000 1.15
@@ -1,10 +1,7 @@
#include "system.h"
#include <rpmio_internal.h>
-#include <rpmmacro.h>
-#include <rpmcb.h>
-#include <argv.h>
-#include <popt.h>
+#include <poptIO.h>
#include "debug.h"
@@ -124,17 +121,10 @@
static struct poptOption optionsTable[] = {
{ "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
- { "avdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_av_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "davdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_dav_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
- N_("debug rpmio I/O"), NULL},
- { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
- N_("debug URL cache handling"), NULL},
- { "verbose", 'v', 0, 0, 'v', NULL, NULL },
+
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0,
+ N_("Common options for all rpmio executables:"),
+ NULL },
POPT_AUTOHELP
POPT_TABLEEND
@@ -143,28 +133,13 @@
int
main(int argc, char *argv[])
{
- poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
+ poptContext optCon = rpmioInit(argc, argv, optionsTable);
ARGV_t av = NULL;
int ac;
const char * fn;
int rc;
- int xx;
-
- while ((rc = poptGetNextOpt(optCon)) > 0) {
- const char * optArg = poptGetOptArg(optCon);
- switch (rc) {
- case 'v':
- rpmIncreaseVerbosity();
- /*@switchbreak@*/ break;
- default:
- /*@switchbreak@*/ break;
- }
- optArg = _free(optArg);
- }
if (_debug) {
- rpmIncreaseVerbosity();
- rpmIncreaseVerbosity();
_av_debug = -1;
_dav_debug = -1;
_ftp_debug = -1;
@@ -185,9 +160,7 @@
exit:
-/*@i@*/ urlFreeCache();
-
- optCon = poptFreeContext(optCon);
+ optCon = rpmioFini(optCon);
return rc;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/tglob.c
============================================================================
$ cvs diff -u -r2.11 -r2.12 tglob.c
--- rpm/rpmio/tglob.c 9 Feb 2008 02:54:50 -0000 2.11
+++ rpm/rpmio/tglob.c 9 Feb 2008 20:44:49 -0000 2.12
@@ -1,10 +1,7 @@
#include "system.h"
#include <rpmio_internal.h>
-#include <rpmmacro.h>
-#include <rpmcb.h>
-#include <argv.h>
-#include <popt.h>
+#include <poptIO.h>
#include "debug.h"
@@ -47,17 +44,10 @@
static struct poptOption optionsTable[] = {
{ "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL },
- { "avdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_av_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "davdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_dav_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
- N_("debug protocol data stream"), NULL},
- { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
- N_("debug rpmio I/O"), NULL},
- { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
- N_("debug URL cache handling"), NULL},
- { "verbose", 'v', 0, 0, 'v', NULL, NULL },
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0,
+ N_("Common options for all rpmio executables:"),
+ NULL },
+
POPT_AUTOHELP
POPT_TABLEEND
};
@@ -65,28 +55,13 @@
int
main(int argc, char *argv[])
{
- poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
+ poptContext optCon = rpmioInit(argc, argv, optionsTable);
ARGV_t av;
int ac;
const char * dn;
int rc;
- int xx;
-
- while ((rc = poptGetNextOpt(optCon)) > 0) {
- const char * optArg = poptGetOptArg(optCon);
- switch (rc) {
- case 'v':
- rpmIncreaseVerbosity();
- /*@switchbreak@*/ break;
- default:
- /*@switchbreak@*/ break;
- }
- optArg = _free(optArg);
- }
if (_debug) {
- rpmIncreaseVerbosity();
- rpmIncreaseVerbosity();
_av_debug = -1;
_dav_debug = -1;
_ftp_debug = -1;
@@ -107,9 +82,7 @@
exit:
-/*@i@*/ urlFreeCache();
-
- optCon = poptFreeContext(optCon);
+ optCon = rpmioFini(optCon);
return rc;
}
@@ .
Received on Sat Feb 9 21:44:49 2008