RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [email protected] Module: rpm Date: 31-Mar-2010 18:02:21 Branch: HEAD Handle: 2010033116022000 Modified files: rpm CHANGES rpm/tools nix-build.c nix-channel.c nix-collect-garbage.c nix-copy-closure.c nix-install-package.c nix-prefetch-url.c nix-pull.c nix-push.c xiu-echo.c Log: - nix: use the refactored popt tables in -lrpmio. Summary: Revision Changes Path 1.3295 +1 -0 rpm/CHANGES 2.9 +1 -415 rpm/tools/nix-build.c 2.11 +1 -69 rpm/tools/nix-channel.c 2.8 +2 -19 rpm/tools/nix-collect-garbage.c 2.12 +1 -62 rpm/tools/nix-copy-closure.c 2.10 +1 -36 rpm/tools/nix-install-package.c 2.14 +1 -22 rpm/tools/nix-prefetch-url.c 2.15 +1 -24 rpm/tools/nix-pull.c 2.14 +1 -29 rpm/tools/nix-push.c 2.2 +1 -2 rpm/tools/xiu-echo.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3294 -r1.3295 CHANGES --- rpm/CHANGES 31 Mar 2010 12:39:30 -0000 1.3294 +++ rpm/CHANGES 31 Mar 2010 16:02:20 -0000 1.3295 @@ -1,5 +1,6 @@ 5.2b1 -> 5.3a1 + - jbj: nix: use the refactored popt tables in -lrpmio. - jbj: nix: stub-in the '%{nix foo ...:}' macro expansion embedding. - jbj: nix: handle both "nix-foo" and "nix foo" invocations in rpmnix ctor. - jbj: nix: refactor popt tables into -lrpmio. @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-build.c ============================================================================ $ cvs diff -u -r2.8 -r2.9 nix-build.c --- rpm/tools/nix-build.c 28 Mar 2010 20:28:58 -0000 2.8 +++ rpm/tools/nix-build.c 31 Mar 2010 16:02:20 -0000 2.9 @@ -2,428 +2,14 @@ #define _RPMNIX_INTERNAL #include <rpmnix.h> -#include <poptIO.h> #include "debug.h" -#define _BASE 0x40000000 -enum { - NIX_ADD_DRV_LINK = _BASE + 0, /* --add-drv-link */ - NIX_DRV_LINK = _BASE + 1, /* --drv-link NAME */ - NIX_NO_OUT_LINK = _BASE + 2, /* -o,--no-out-link */ - NIX_ATTR = _BASE + 3, /* --attr ATTR */ - - NIX_ARG = _BASE + 4, /* --arg ARG1 ARG2 */ - NIX_LOG_TYPE = _BASE + 5, /* --log-type TYPE */ - NIX_OPTION = _BASE + 6, /* --option OPT1 OPT2 */ - - NIX_MAX_JOBS = _BASE + 7, /* -j,--max-jobs JOBS */ - NIX_DRY_RUN = _BASE + 8, /*X --dry-run */ - NIX_SHOW_TRACE = _BASE + 9, /*X --show-trace */ - NIX_VERBOSE = _BASE + 10, /* -v,--verbose */ - -/* XXX from both nix-instatiate and nix-store: */ - NIX_ADD_ROOT = _BASE + 20, /*X --add-root */ - NIX_VERSION = _BASE + 21, /* --version */ - -/* XXX from nix-instatiate: */ - NIX_EVAL_ONLY = _BASE + 22, /* --eval-only */ - NIX_PARSE_ONLY = _BASE + 23, /* --parse-only */ - NIX_XML = _BASE + 24, /* --xml */ - NIX_STRICT = _BASE + 25, /* --strict */ - -/* XXX from nix-store: */ - NIX_REALISE = _BASE + 30, /* -r,--realise */ - NIX_ADD = _BASE + 31, /* -A,--add */ - NIX_DELETE = _BASE + 32, /* --delete */ - - NIX_READ_LOG = _BASE + 33, /* -l,--read-log */ - NIX_REGISTER_VALIDITY = _BASE + 34, /* --register-validity */ - NIX_CHECK_VALIDITY = _BASE + 35, /* --check-validity */ - - NIX_DUMP = _BASE + 36, /* --dump */ - NIX_RESTORE = _BASE + 37, /* --restore */ - NIX_EXPORT = _BASE + 38, /* --export */ - NIX_IMPORT = _BASE + 39, /* --import */ - NIX_VERIFY = _BASE + 40, /* --verify */ - NIX_OPTIMISE = _BASE + 41, /* --optimise */ - - NIX_QUERY = _BASE + 256, /* -q,--query */ - NIX_QUERY_OUTPUTS = _BASE + 256+1, /* --outputs */ - NIX_QUERY_REQUISITES = _BASE + 256+2, /* --requisites */ - NIX_QUERY_REFERENCES = _BASE + 256+3, /* --references */ - NIX_QUERY_REFERRERS = _BASE + 256+4, /* --referrers */ - NIX_QUERY_REFERRERS_CLOSURE = _BASE+256+5, /* --referrers-closure */ - NIX_QUERY_TREE = _BASE + 256+6, /* --tree */ - NIX_QUERY_GRAPH = _BASE + 256+7, /* --graph */ - NIX_QUERY_HASH = _BASE + 256+8, /* --hash */ - NIX_QUERY_ROOTS = _BASE + 256+9, /* --roots */ - NIX_QUERY_USE_OUTPUT = _BASE + 256+10, /* --use-output */ - NIX_QUERY_FORCE_REALISE = _BASE + 256+11, /* --force-realise */ - NIX_QUERY_INCLUDE_OUTPUTS = _BASE + 256+12, /* --include-outputs */ - - NIX_GC = _BASE + 512, /* --gc */ - NIX_GC_PRINT_ROOTS = _BASE + 512+1, /* --print-roots */ - NIX_GC_PRINT_LIVE = _BASE + 512+2, /* --print-live */ - NIX_GC_PRINT_DEAD = _BASE + 512+3, /* --print-dead */ - NIX_GC_DELETE = _BASE + 512+4, /* --delete */ - -}; - -static void rpmnixBuildInstantiateArgCallback(poptContext con, - /*...@unused@*/ enum poptCallbackReason reason, - const struct poptOption * opt, const char * arg, - /*...@unused@*/ void * data) - /*...@*/ -{ - rpmnix nix = &_nix; - const char * s = NULL; - int xx; - - /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ - if (opt->arg == NULL) - switch (opt->val) { - case NIX_ATTR: /* --attr ATTR */ - case NIX_LOG_TYPE: /* --log-type TYPE */ - s = rpmExpand("--", opt->longName, NULL); - xx = argvAdd(&nix->instArgs, s); - xx = argvAdd(&nix->instArgs, arg); - s = _free(s); - break; - case NIX_ARG: /* --arg ARG1 ARG2 */ -#ifdef NOTYET /* XXX needs next 2 args */ - xx = argvAdd(&nix->instArgs, arg1); - xx = argvAdd(&nix->instArgs, arg2); -#endif - break; - case NIX_OPTION: /* --option OPT1 OPT2 */ -#ifdef NOTYET /* XXX needs next 2 args */ - xx = argvAdd(&nix->instArgs, opt1); - xx = argvAdd(&nix->instArgs, opt2); -#endif - break; - case NIX_VERBOSE: /* -v,--verbose */ - xx = argvAdd(&nix->instArgs, "-v"); - break; - - case NIX_SHOW_TRACE: /* --show-trace */ - - case NIX_ADD_ROOT: /* --add-root */ - case NIX_VERSION: /* --version */ - - case NIX_EVAL_ONLY: /* --eval-only */ - case NIX_PARSE_ONLY: /* --parse-only */ - case NIX_XML: /* --xml */ - case NIX_STRICT: /* --strict */ - s = rpmExpand("--", opt->longName, NULL); - xx = argvAdd(&nix->instArgs, s); - s = _free(s); - break; - default: - fprintf(stderr, _("%s: Unknown callback(0x%x)\n"), __FUNCTION__, (unsigned) opt->val); - poptPrintUsage(con, stderr, 0); - /*...@-exitarg@*/ exit(2); /*...@=exitarg@*/ - /*...@notreached@*/ break; - } -} - -static struct poptOption rpmnixBuildInstantiateOptions[] = { -/*...@-type@*/ /* FIX: cast? */ - { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, - rpmnixBuildInstantiateArgCallback, 0, NULL, NULL }, -/*...@=type@*/ - - { "eval-only", '\0', POPT_ARG_NONE, 0, NIX_EVAL_ONLY, - N_("evaluate and print resulting term; do not instantiate"), NULL }, - { "parse-only", '\0', POPT_ARG_NONE, 0, NIX_PARSE_ONLY, - N_("parse and print abstract syntax tree"), NULL }, - { "attr", 'A', POPT_ARG_STRING, 0, NIX_ATTR, - N_("select a specific ATTR from the Nix expression"), N_("ATTR") }, - { "add-root", '\0', POPT_ARG_NONE, 0, NIX_ADD_ROOT, - N_("add garbage collector roots for the result"), NULL }, - - { "xml", '\0', POPT_ARG_NONE, 0, NIX_XML, - N_("print an XML representation of the abstract syntax tree"), NULL }, - { "strict", '\0', POPT_ARG_NONE, 0, NIX_STRICT, - N_("compute attributes and list elements, rather than being lazy"), NULL }, - - { "log-type", '\0', POPT_ARG_STRING, 0, NIX_LOG_TYPE, - N_("FIXME"), N_("TYPE") }, -/* XXX needs next 2 args */ - { "arg", '\0', POPT_ARG_NONE, 0, NIX_ARG, - N_("FIXME"), N_("ARG1 ARG2") }, - { "argstr", '\0', POPT_ARG_NONE|POPT_ARGFLAG_DOC_HIDDEN, 0, NIX_ARG, - N_("FIXME"), N_("ARG1 ARG2") }, -/* XXX needs next 2 args */ - { "option", '\0', POPT_ARG_NONE, 0, NIX_OPTION, - N_("FIXME"), N_("OPT1 OPT2") }, - { "show-trace", '\0', POPT_ARG_NONE, 0, NIX_SHOW_TRACE, - N_("FIXME"), NULL }, - - { "verbose", 'v', POPT_ARG_NONE, 0, NIX_VERBOSE, - N_("verbose operation (may be repeated)"), NULL }, - - { "version", '\0', POPT_ARG_NONE, 0, NIX_VERSION, - N_("output version information"), NULL }, - - POPT_TABLEEND -}; - -static void rpmnixBuildStoreArgCallback(poptContext con, - /*...@unused@*/ enum poptCallbackReason reason, - const struct poptOption * opt, const char * arg, - /*...@unused@*/ void * data) - /*...@*/ -{ - rpmnix nix = &_nix; - const char * s = NULL; - int xx; - - /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ - if (opt->arg == NULL) - switch (opt->val) { - case NIX_LOG_TYPE: /* --log-type TYPE */ - case NIX_MAX_JOBS: /* --max-jobs JOBS */ - s = rpmExpand("--", opt->longName, NULL); - xx = argvAdd(&nix->buildArgs, s); - xx = argvAdd(&nix->buildArgs, arg); - s = _free(s); - break; - case NIX_OPTION: /* --option OPT1 OPT2 */ -#ifdef NOTYET /* XXX needs next 2 args */ - xx = argvAdd(&nix->buildArgs, opt1); - xx = argvAdd(&nix->buildArgs, opt2); -#endif - break; - - case NIX_VERBOSE: /* -v,--verbose */ - xx = argvAdd(&nix->buildArgs, "-v"); - break; - case NIX_DRY_RUN: /* --dry-run */ - case NIX_ADD_ROOT: /* --add-root */ - case NIX_VERSION: /* --version */ - case NIX_REALISE: /* -r,--realise */ - case NIX_ADD: /* -A,--add */ - case NIX_DELETE: /* --delete */ - case NIX_READ_LOG: /* -l,--read-log */ - case NIX_REGISTER_VALIDITY: /* --register-validity */ - case NIX_CHECK_VALIDITY: /* --check-validity */ - case NIX_DUMP: /* --dump */ - case NIX_RESTORE: /* --restore */ - case NIX_EXPORT: /* --export */ - case NIX_IMPORT: /* --import */ - case NIX_VERIFY: /* --verify */ - case NIX_OPTIMISE: /* --optimise */ - case NIX_QUERY: /* -q,--query */ - case NIX_QUERY_OUTPUTS: /* --outputs */ - case NIX_QUERY_REQUISITES: /* --requisites */ - case NIX_QUERY_REFERENCES: /* --references */ - case NIX_QUERY_REFERRERS: /* --referrers */ - case NIX_QUERY_REFERRERS_CLOSURE: /* --referrers-closure */ - case NIX_QUERY_TREE: /* --tree */ - case NIX_QUERY_GRAPH: /* --graph */ - case NIX_QUERY_HASH: /* --hash */ - case NIX_QUERY_ROOTS: /* --roots */ - case NIX_QUERY_USE_OUTPUT: /* --use-output */ - case NIX_QUERY_FORCE_REALISE: /* --force-realise */ - case NIX_QUERY_INCLUDE_OUTPUTS: /* --include-outputs */ - case NIX_GC: /* --gc */ - case NIX_GC_PRINT_ROOTS: /* --print-roots */ - case NIX_GC_PRINT_LIVE: /* --print-live */ - case NIX_GC_PRINT_DEAD: /* --print-dead */ - case NIX_GC_DELETE: /* --delete */ - s = rpmExpand("--", opt->longName, NULL); - xx = argvAdd(&nix->buildArgs, s); - s = _free(s); - break; - - default: - fprintf(stderr, _("%s: Unknown callback(0x%x)\n"), __FUNCTION__, (unsigned) opt->val); - poptPrintUsage(con, stderr, 0); - /*...@-exitarg@*/ exit(2); /*...@=exitarg@*/ - /*...@notreached@*/ break; - } -} - -static struct poptOption rpmnixBuildStoreOptions[] = { -/*...@-type@*/ /* FIX: cast? */ - { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, - rpmnixBuildStoreArgCallback, 0, NULL, NULL }, -/*...@=type@*/ - - { "log-type", '\0', POPT_ARG_STRING, 0, NIX_LOG_TYPE, - N_("FIXME"), N_("TYPE") }, -/* XXX needs next 2 args */ - { "option", '\0', POPT_ARG_NONE, 0, NIX_OPTION, - N_("FIXME"), N_("OPT1 OPT2") }, - { "max-jobs", 'j', POPT_ARG_STRING, 0, NIX_MAX_JOBS, - N_("FIXME"), N_("JOBS") }, - - { "verbose", 'v', POPT_ARG_NONE, 0, NIX_VERBOSE, - N_("verbose operation (may be repeated)"), NULL }, - { "dry-run", '\0', POPT_ARG_NONE, 0, NIX_DRY_RUN, - N_("FIXME"), NULL }, - - { "add-root", '\0', POPT_ARG_NONE, 0, NIX_ADD_ROOT, - N_("add garbage collector roots for the result"), NULL }, - { "version", '\0', POPT_ARG_NONE, 0, NIX_VERSION, - N_("output version information"), NULL }, - - { "realise", 'r', POPT_ARG_NONE, 0, NIX_REALISE, - N_("ensure path validity; if a derivation, ensure the validity of the outputs"), NULL }, -/* XXX conflict with -A,--attr otherwise -A,--add */ - { "add", '\0', POPT_ARG_NONE, 0, NIX_ADD, - N_("copy a path to the Nix store"), NULL }, - { "delete", '\0', POPT_ARG_NONE, 0, NIX_DELETE, - N_("safely delete paths from the Nix store"), NULL }, - { "read-log", 'l', POPT_ARG_NONE, 0, NIX_READ_LOG, - N_("print build log of given store paths"), NULL }, - { "register-validity", '\0', POPT_ARG_NONE, 0, NIX_REGISTER_VALIDITY, - N_("register path validity (dangerous!)"), NULL }, - { "check-validity", '\0', POPT_ARG_NONE, 0, NIX_CHECK_VALIDITY, - N_("check path validity"), NULL }, - { "dump", '\0', POPT_ARG_NONE, 0, NIX_DUMP, - N_("dump a path as a Nix archive, forgetting dependencies"), NULL }, - { "restore", '\0', POPT_ARG_NONE, 0, NIX_RESTORE, - N_("restore a path from a Nix archive, without registering validity"), NULL }, - { "export", '\0', POPT_ARG_NONE, 0, NIX_EXPORT, - N_("export a path as a Nix archive, marking dependencies"), NULL }, - { "import", '\0', POPT_ARG_NONE, 0, NIX_IMPORT, - N_("import a path from a Nix archive, and register as valid"), NULL }, - { "verify", '\0', POPT_ARG_NONE, 0, NIX_VERIFY, - N_("verify Nix structures"), NULL }, - { "optimise", '\0', POPT_ARG_NONE, 0, NIX_OPTIMISE, - N_("optimise the Nix store by hard-linking identical files"), NULL }, - { "query", 'q', POPT_ARG_NONE, 0, NIX_QUERY, - N_("query information"), NULL }, - { "outputs", '\0', POPT_ARG_NONE, 0, NIX_QUERY_OUTPUTS, - N_("query the output paths of a Nix derivation (default)"), NULL }, - { "requisites", '\0', POPT_ARG_NONE, 0, NIX_QUERY_REQUISITES, - N_("print all paths necessary to realise the path"), NULL }, - { "references", '\0', POPT_ARG_NONE, 0, NIX_QUERY_REFERENCES, - N_("print all paths referenced by the path"), NULL }, - { "referrers", '\0', POPT_ARG_NONE, 0, NIX_QUERY_REFERRERS, - N_("print all paths directly refering to the path"), NULL }, - { "referrers-closure", '\0', POPT_ARG_NONE, 0, NIX_QUERY_REFERRERS_CLOSURE, - N_("print all paths (in)directly refering to the path"), NULL }, - { "tree", '\0', POPT_ARG_NONE, 0, NIX_QUERY_TREE, - N_("print a tree showing the dependency graph of the path"), NULL }, - { "graph", '\0', POPT_ARG_NONE, 0, NIX_QUERY_GRAPH, - N_("print a dot graph rooted at given path"), NULL }, - { "hash", '\0', POPT_ARG_NONE, 0, NIX_QUERY_HASH, - N_("print the SHA-256 hash of the contents of the path"), NULL }, - { "roots", '\0', POPT_ARG_NONE, 0, NIX_QUERY_ROOTS, - N_("print the garbage collector roots that point to the path"), NULL }, - { "use-output", '\0', POPT_ARG_NONE, 0, NIX_QUERY_USE_OUTPUT, - N_("perform query on output of derivation, not derivation itself"), NULL }, - { "force-realise", '\0', POPT_ARG_NONE, 0, NIX_QUERY_FORCE_REALISE, - N_("realise the path before performing the query"), NULL }, - { "include-outputs", '\0', POPT_ARG_NONE, 0, NIX_QUERY_INCLUDE_OUTPUTS, - N_("in `-R' on a derivation, include requisites of outputs"), NULL }, - { "gc", '\0', POPT_ARG_NONE, 0, NIX_GC, - N_("run the garbage collector"), NULL }, - { "print-roots", '\0', POPT_ARG_NONE, 0, NIX_GC_PRINT_ROOTS, - N_("print GC roots and exit"), NULL }, - { "print-live", '\0', POPT_ARG_NONE, 0, NIX_GC_PRINT_LIVE, - N_("print live paths and exit"), NULL }, - { "print-dead", '\0', POPT_ARG_NONE, 0, NIX_GC_PRINT_DEAD, - N_("print dead paths and exit"), NULL }, -/* XXX conflict with --delete */ - { "gcdelete", '\0', POPT_ARG_NONE, 0, NIX_GC_DELETE, - N_("delete dead paths (default)"), NULL }, - - POPT_TABLEEND -}; - -static void nixBuildArgCallback(poptContext con, - /*...@unused@*/ enum poptCallbackReason reason, - const struct poptOption * opt, const char * arg, - /*...@unused@*/ void * data) - /*...@*/ -{ - rpmnix nix = &_nix; - - /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ - if (opt->arg == NULL) - switch (opt->val) { -/* XXX must be callback to continue through tables. */ - case NIX_DRY_RUN: /* --dry-run */ - nix->flags |= RPMNIX_FLAGS_DRYRUN; - break; - case NIX_VERBOSE: /* -v,--verbose */ - nix->verbose++; - break; - - /* XXX Collect and filter unknown options for pass thru. */ - default: - fprintf(stderr, _("%s: Unknown callback(0x%x)\n"), __FUNCTION__, (unsigned) opt->val); - poptPrintUsage(con, stderr, 0); - /*...@-exitarg@*/ exit(2); /*...@=exitarg@*/ - /*...@notreached@*/ break; - } -} - -static struct poptOption nixBuildOptions[] = { -/*...@-type@*/ /* FIX: cast? */ - { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, - nixBuildArgCallback, 0, NULL, NULL }, -/*...@=type@*/ - - { "add-drv-link", '\0', POPT_BIT_SET, &_nix.flags, RPMNIX_FLAGS_ADDDRVLINK, - N_("create a symlink `derivation' to the store derivation"), NULL }, - { "no-out-link", 'o', POPT_BIT_CLR, &_nix.flags, RPMNIX_FLAGS_NOOUTLINK, - N_("do not create the `result' symlink"), NULL }, - { "no-link", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &_nix.flags, RPMNIX_FLAGS_NOOUTLINK, - N_("do not create the `result' symlink"), NULL }, - - { "drv-link", '\0', POPT_ARG_STRING, &_nix.drvLink, 0, - N_("create symlink NAME instead of `derivation'"), N_("NAME") }, - { "out-link", 'o', POPT_ARG_STRING, &_nix.outLink, 0, - N_("create symlink NAME instead of `result'"), N_("NAME") }, - -/* XXX must be callback to continue through tables. */ - { "dry-run", '\0', POPT_ARG_NONE, 0, NIX_DRY_RUN, - N_("FIXME"), NULL }, - { "verbose", 'v', POPT_ARG_NONE, 0, NIX_VERBOSE, - N_("verbose operation (may be repeated)"), NULL }, - -#ifdef NOTYET - { "version", '\0', POPT_ARG_NONE, 0, NIX_VERSION, - N_("output version information"), NULL }, -#endif - - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmnixBuildInstantiateOptions, 0, - N_("Options passed to nix-instantiate:"), NULL }, - - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmnixBuildStoreOptions, 0, - N_("Options passed to nix-store:"), NULL }, - -#ifdef NOTYET - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, - N_("Common options for all rpmio executables:"), NULL }, -#endif - - POPT_AUTOHELP - - { NULL, (char)-1, POPT_ARG_INCLUDE_TABLE, NULL, 0, - N_("\ -Usage: nix-build [OPTION]... [FILE]...\n\ -\n\ -`nix-build' builds the given Nix expressions (which\n\ -default to ./default.nix if none are given). A symlink called\n\ -`result' is placed in the current directory.\n\ -"), NULL }, - - POPT_TABLEEND -}; - int main(int argc, char *argv[]) { - rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_NOOUTLINK, nixBuildOptions); + rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_NOOUTLINK, NULL); int ec = rpmnixBuild(nix); - nix = rpmnixFree(nix); - return ec; } @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-channel.c ============================================================================ $ cvs diff -u -r2.10 -r2.11 nix-channel.c --- rpm/tools/nix-channel.c 28 Mar 2010 21:15:17 -0000 2.10 +++ rpm/tools/nix-channel.c 31 Mar 2010 16:02:20 -0000 2.11 @@ -1,81 +1,13 @@ #include "system.h" -#define _RPMNIX_INTERNAL #include <rpmnix.h> -#include <ugid.h> -#include <poptIO.h> #include "debug.h" -/*==============================================================*/ - -static void rpmnixChannelArgCallback(poptContext con, - /*...@unused@*/ enum poptCallbackReason reason, - const struct poptOption * opt, const char * arg, - /*...@unused@*/ void * data) - /*...@*/ -{ - rpmnix nix = &_nix; - - /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ - if (opt->arg == NULL) - switch (opt->val) { - case NIX_CHANNEL_ADD: - case NIX_CHANNEL_REMOVE: - nix->url = xstrdup(arg); - /*...@fallthrough@*/ - case NIX_CHANNEL_LIST: - case NIX_CHANNEL_UPDATE: - nix->op = opt->val; - break; - default: - fprintf(stderr, _("%s: Unknown callback(0x%x)\n"), __FUNCTION__, (unsigned) opt->val); - poptPrintUsage(con, stderr, 0); - /*...@-exitarg@*/ exit(2); /*...@=exitarg@*/ - /*...@notreached@*/ break; - } -} - -static struct poptOption rpmnixChannelOptions[] = { -/*...@-type@*/ /* FIX: cast? */ - { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, - rpmnixChannelArgCallback, 0, NULL, NULL }, -/*...@=type@*/ - - { "add", '\0', POPT_ARG_STRING, 0, NIX_CHANNEL_ADD, - N_("subscribe to a Nix channel"), N_("URL") }, - { "remove", '\0', POPT_ARG_STRING, 0, NIX_CHANNEL_REMOVE, - N_("unsubscribe from a Nix channel"), N_("URL") }, - { "list", '\0', POPT_ARG_NONE, 0, NIX_CHANNEL_LIST, - N_("list subscribed channels"), NULL }, - { "update", '\0', POPT_ARG_NONE, 0, NIX_CHANNEL_UPDATE, - N_("download latest Nix expressions"), NULL }, - -#ifndef NOTYET - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, - N_("Common options for all rpmio executables:"), NULL }, -#endif - - POPT_AUTOHELP - -#ifdef DYING - { NULL, (char)-1, POPT_ARG_INCLUDE_TABLE, NULL, 0, - N_("\ -Usage:\n\ - nix-channel --add URL\n\ - nix-channel --remove URL\n\ - nix-channel --list\n\ - nix-channel --update\n\ -"), NULL }, -#endif - - POPT_TABLEEND -}; - int main(int argc, char *argv[]) { - rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_NONE, rpmnixChannelOptions); + rpmnix nix = rpmnixNew(argv, 0, NULL); int ec = rpmnixChannel(nix); nix = rpmnixFree(nix); @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-collect-garbage.c ============================================================================ $ cvs diff -u -r2.7 -r2.8 nix-collect-garbage.c --- rpm/tools/nix-collect-garbage.c 28 Mar 2010 21:28:46 -0000 2.7 +++ rpm/tools/nix-collect-garbage.c 31 Mar 2010 16:02:20 -0000 2.8 @@ -1,30 +1,13 @@ #include "system.h" -#define _RPMNIX_INTERNAL #include <rpmnix.h> -#include <rpmdir.h> -#include <poptIO.h> -/*==============================================================*/ - -static struct poptOption rpmnixCollectGarbageOptions[] = { - - { "delete-old", 'd', POPT_BIT_SET, &_nix.flags, RPMNIX_FLAGS_DELETEOLD, - N_("FIXME"), NULL }, - -#ifndef NOTYET - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, - N_("Common options for all rpmio executables:"), NULL }, -#endif - - POPT_AUTOHELP - POPT_TABLEEND -}; +#include "debug.h" int main(int argc, char *argv[]) { - rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_NONE, rpmnixCollectGarbageOptions); + rpmnix nix = rpmnixNew(argv, 0, NULL); int ec = rpmnixCollectGarbage(nix); nix = rpmnixFree(nix); @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-copy-closure.c ============================================================================ $ cvs diff -u -r2.11 -r2.12 nix-copy-closure.c --- rpm/tools/nix-copy-closure.c 28 Mar 2010 21:47:08 -0000 2.11 +++ rpm/tools/nix-copy-closure.c 31 Mar 2010 16:02:20 -0000 2.12 @@ -1,74 +1,13 @@ #include "system.h" -#define _RPMNIX_INTERNAL #include <rpmnix.h> -#include <poptIO.h> #include "debug.h" -/*==============================================================*/ - -static void nixCopyClosureArgCallback(poptContext con, - /*...@unused@*/ enum poptCallbackReason reason, - const struct poptOption * opt, const char * arg, - /*...@unused@*/ void * data) - /*...@*/ -{ - rpmnix nix = &_nix; - - /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ - if (opt->arg == NULL) - switch (opt->val) { - case NIX_COPY_CLOSURE_FROM_HOST: - nix->op = opt->val; - nix->sshHost = xstrdup(arg); - break; - case NIX_COPY_CLOSURE_TO_HOST: - nix->op = opt->val; - nix->sshHost = xstrdup(arg); - break; - default: - fprintf(stderr, _("%s: Unknown callback(0x%x)\n"), __FUNCTION__, (unsigned) opt->val); - poptPrintUsage(con, stderr, 0); - /*...@-exitarg@*/ exit(2); /*...@=exitarg@*/ - /*...@notreached@*/ break; - } -} - -static struct poptOption nixCopyClosureOptions[] = { -/*...@-type@*/ /* FIX: cast? */ - { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, - nixCopyClosureArgCallback, 0, NULL, NULL }, -/*...@=type@*/ - - { "from", '\0', POPT_ARG_STRING, 0, NIX_COPY_CLOSURE_FROM_HOST, - N_("FIXME"), NULL }, - { "to", '\0', POPT_ARG_STRING, 0, NIX_COPY_CLOSURE_TO_HOST, - N_("FIXME"), NULL }, - { "gzip", '\0', POPT_BIT_SET, &_nix.flags, RPMNIX_FLAGS_GZIP, - N_("FIXME"), NULL }, - { "sign", '\0', POPT_BIT_SET, &_nix.flags, RPMNIX_FLAGS_SIGN, - N_("FIXME"), NULL }, - -#ifndef NOTYET - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, - N_("Common options for all rpmio executables:"), NULL }, -#endif - - POPT_AUTOHELP - - { NULL, (char)-1, POPT_ARG_INCLUDE_TABLE, NULL, 0, - N_("\ -Usage: nix-copy-closure [--from | --to] HOSTNAME [--sign] [--gzip] PATHS...\n\ -"), NULL }, - - POPT_TABLEEND -}; - int main(int argc, char *argv[]) { - rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_NONE, nixCopyClosureOptions); + rpmnix nix = rpmnixNew(argv, 0, NULL); int ec = rpmnixCopyClosire(nix); nix = rpmnixFree(nix); @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-install-package.c ============================================================================ $ cvs diff -u -r2.9 -r2.10 nix-install-package.c --- rpm/tools/nix-install-package.c 28 Mar 2010 22:37:59 -0000 2.9 +++ rpm/tools/nix-install-package.c 31 Mar 2010 16:02:20 -0000 2.10 @@ -1,48 +1,13 @@ #include "system.h" -#define _RPMNIX_INTERNAL #include <rpmnix.h> -#include <poptIO.h> #include "debug.h" -/*==============================================================*/ - -static struct poptOption rpmnixInstallPackageOptions[] = { - - { "profile", 'p', POPT_ARG_ARGV, &_nix.profiles, 0, - N_("FIXME"), NULL }, - { "non-interactive", '\0', POPT_BIT_CLR, &_nix.flags, RPMNIX_FLAGS_INTERACTIVE, - N_("FIXME"), NULL }, - { "url", '\0', POPT_ARG_STRING, &_nix.url, 0, - N_("FIXME"), NULL }, - -#ifndef NOTYET - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, - N_("Common options for all rpmio executables:"), NULL }, -#endif - - POPT_AUTOHELP - - { NULL, (char)-1, POPT_ARG_INCLUDE_TABLE, NULL, 0, - N_("\ -Usage: nix-install-package (FILE | --url URL)\n\ -\n\ -Install a Nix Package (.nixpkg) either directly from FILE or by\n\ -downloading it from URL.\n\ -\n\ -Flags:\n\ - --profile / -p LINK: install into the specified profile\n\ - --non-interactive: don't run inside a new terminal\n\ -"), NULL }, - - POPT_TABLEEND -}; - int main(int argc, char *argv[]) { - rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_INTERACTIVE, rpmnixInstallPackageOptions); + rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_INTERACTIVE, NULL); int ec = rpmnixInstallPackage(nix); nix = rpmnixFree(nix); @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-prefetch-url.c ============================================================================ $ cvs diff -u -r2.13 -r2.14 nix-prefetch-url.c --- rpm/tools/nix-prefetch-url.c 28 Mar 2010 22:52:57 -0000 2.13 +++ rpm/tools/nix-prefetch-url.c 31 Mar 2010 16:02:20 -0000 2.14 @@ -1,34 +1,13 @@ #include "system.h" -#define _RPMNIX_INTERNAL #include <rpmnix.h> -#include <poptIO.h> #include "debug.h" -static struct poptOption nixPrefetchUrlOptions[] = { - - /* XXX add --quiet and --print options. */ - -#ifndef NOTYET - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, - N_("Common options for all rpmio executables:"), NULL }, -#endif - - POPT_AUTOHELP - - { NULL, (char)-1, POPT_ARG_INCLUDE_TABLE, NULL, 0, - N_("\ -syntax: nix-prefetch-url URL [EXPECTED-HASH]\n\ -"), NULL }, - - POPT_TABLEEND -}; - int main(int argc, char *argv[]) { - rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_NONE, nixPrefetchUrlOptions); + rpmnix nix = rpmnixNew(argv, 0, NULL); int ec = rpmnixPrefetchURL(nix); nix = rpmnixFree(nix); @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-pull.c ============================================================================ $ cvs diff -u -r2.14 -r2.15 nix-pull.c --- rpm/tools/nix-pull.c 29 Mar 2010 13:52:59 -0000 2.14 +++ rpm/tools/nix-pull.c 31 Mar 2010 16:02:20 -0000 2.15 @@ -1,36 +1,13 @@ #include "system.h" -#define _RPMNIX_INTERNAL #include <rpmnix.h> -#include <poptIO.h> #include "debug.h" -static struct poptOption nixPullOptions[] = { - - { "skip-wrong-store", '\0', POPT_BIT_SET, &_nix.flags, RPMNIX_FLAGS_SKIPWRONGSTORE, - N_("FIXME"), NULL }, - -#ifndef NOTYET - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, - N_("Common options for all rpmio executables:"), NULL }, -#endif - - POPT_AUTOHELP - -#ifdef DYING - { NULL, (char)-1, POPT_ARG_INCLUDE_TABLE, NULL, 0, - N_("\ -"), NULL }, -#endif - - POPT_TABLEEND -}; - int main(int argc, char *argv[]) { - rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_NONE, nixPullOptions); + rpmnix nix = rpmnixNew(argv, 0, NULL); int ec = rpmnixPull(nix); nix = rpmnixFree(nix); @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-push.c ============================================================================ $ cvs diff -u -r2.13 -r2.14 nix-push.c --- rpm/tools/nix-push.c 29 Mar 2010 14:30:21 -0000 2.13 +++ rpm/tools/nix-push.c 31 Mar 2010 16:02:20 -0000 2.14 @@ -1,41 +1,13 @@ #include "system.h" -#define _RPMNIX_INTERNAL #include <rpmnix.h> -#include <poptIO.h> #include "debug.h" -static struct poptOption nixPushOptions[] = { - - { "copy", '\0', POPT_BIT_SET, &_nix.flags, RPMNIX_FLAGS_COPY, - N_("FIXME"), NULL }, - { "target", '\0', POPT_ARG_STRING, &_nix.targetArchivesUrl, 0, - N_("FIXME"), NULL }, - -#ifndef NOTYET - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, - N_("Common options for all rpmio executables:"), NULL }, -#endif - - POPT_AUTOHELP - - { NULL, (char)-1, POPT_ARG_INCLUDE_TABLE, NULL, 0, - N_("\ -Usage: nix-push --copy ARCHIVES_DIR MANIFEST_FILE PATHS...\n\ - or: nix-push ARCHIVES_PUT_URL ARCHIVES_GET_URL MANIFEST_PUT_URL PATHS...\n\ -\n\ -`nix-push' copies or uploads the closure of PATHS to the given\n\ -destination.\n\ -"), NULL }, - - POPT_TABLEEND -}; - int main(int argc, char *argv[]) { - rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_NONE, nixPushOptions); + rpmnix nix = rpmnixNew(argv, 0, NULL); int ec = rpmnixPull(nix); nix = rpmnixFree(nix); @@ . patch -p0 <<'@@ .' Index: rpm/tools/xiu-echo.c ============================================================================ $ cvs diff -u -r2.1 -r2.2 xiu-echo.c --- rpm/tools/xiu-echo.c 29 Mar 2010 22:05:23 -0000 2.1 +++ rpm/tools/xiu-echo.c 31 Mar 2010 16:02:20 -0000 2.2 @@ -1,6 +1,5 @@ #include "system.h" -#define _RPMNIX_INTERNAL #include <rpmnix.h> #include "debug.h" @@ -8,7 +7,7 @@ int main(int argc, char *argv[]) { - rpmnix nix = rpmnixNew(argv, RPMNIX_FLAGS_NONE, _rpmnixEchoOptions); + rpmnix nix = rpmnixNew(argv, 0, NULL); int ec = rpmnixEcho(nix); nix = rpmnixFree(nix); @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
