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: 27-Mar-2010 17:40:12 Branch: HEAD Handle: 2010032716401200 Modified files: rpm/tools 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 Log: - nix: WIP Summary: Revision Changes Path 2.4 +28 -41 rpm/tools/nix-channel.c 2.3 +53 -44 rpm/tools/nix-collect-garbage.c 2.5 +17 -30 rpm/tools/nix-copy-closure.c 2.3 +14 -43 rpm/tools/nix-install-package.c 2.7 +1 -11 rpm/tools/nix-prefetch-url.c 2.8 +1 -22 rpm/tools/nix-pull.c 2.7 +41 -22 rpm/tools/nix-push.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/tools/nix-channel.c ============================================================================ $ cvs diff -u -r2.3 -r2.4 nix-channel.c --- rpm/tools/nix-channel.c 26 Mar 2010 14:10:32 -0000 2.3 +++ rpm/tools/nix-channel.c 27 Mar 2010 16:40:12 -0000 2.4 @@ -19,22 +19,10 @@ #define F_ISSET(_nix, _FLAG) ((_nix)->flags & ((RPMNIX_FLAGS_##_FLAG) & ~0x40000000)) /** - * Bit field enum for rpmdigest CLI options. + * Bit field enum for rpmnix CLI options. */ enum nixFlags_e { RPMNIX_FLAGS_NONE = 0, - RPMNIX_FLAGS_ADDDRVLINK = _DFB(0), /* --add-drv-link */ - RPMNIX_FLAGS_NOOUTLINK = _DFB(1), /* -o,--no-out-link */ - RPMNIX_FLAGS_DRYRUN = _DFB(2), /* --dry-run */ - - RPMNIX_FLAGS_EVALONLY = _DFB(16), /* --eval-only */ - RPMNIX_FLAGS_PARSEONLY = _DFB(17), /* --parse-only */ - RPMNIX_FLAGS_ADDROOT = _DFB(18), /* --add-root */ - RPMNIX_FLAGS_XML = _DFB(19), /* --xml */ - RPMNIX_FLAGS_STRICT = _DFB(20), /* --strict */ - RPMNIX_FLAGS_SHOWTRACE = _DFB(21), /* --show-trace */ - - RPMNIX_FLAGS_SKIPWRONGSTORE = _DFB(24) /* --skip-wrong-store */ }; /** @@ -46,15 +34,6 @@ struct rpmnix_s { enum nixFlags_e flags; /*!< rpmnix control bits. */ - const char * outLink; - const char * drvLink; - - const char ** instArgs; - const char ** buildArgs; - const char ** exprs; - - const char * attr; - int op; const char * url; @@ -63,7 +42,7 @@ /** */ static struct rpmnix_s _nix = { - .flags = RPMNIX_FLAGS_NOOUTLINK + .flags = RPMNIX_FLAGS_NONE }; static const char * nixDefExpr; @@ -206,14 +185,16 @@ /*...@*/ { uid_t uid = getuid(); + struct stat sb; const char * userName = uidToUname(uid); const char * rootFile; -#ifdef UNUSED + const char * outPath; const char * rval; -#endif const char * cmd; const char * dn; const char * fn; + +const char * inputs = "[]"; /* XXX FIXME */ int xx; DBG((stderr, "--> %s(%p)\n", __FUNCTION__, nix)); @@ -252,15 +233,12 @@ const char * url = channels[i]; cmd = rpmExpand(binDir, "/nix-pull --skip-wrong-store ", url, "/MANIFEST", "; echo $?", NULL); -fprintf(stderr, "<-- cmd: %s\n", cmd); -#ifdef NOTYET rval = rpmExpand("%(", cmd, ")", NULL); if (strcmp(rval, "0")) { fprintf(stderr, "cannot pull cache manifest from `%s'\n", url); exit(1); } rval = _free(rval); -#endif cmd = _freeCmd(cmd); } } @@ -306,13 +284,13 @@ chomp $outPath; */ #endif - -#ifdef REFERENCE -/* - unlink "$rootFile.tmp"; -*/ -#endif fn = rpmGetPath(rootFile, ".tmp", NULL); + outPath = rpmExpand(binDir, "/nix-build --out-link '", rootFile, "'", + " --drv-link '", fn, "'", + "/usr/share/nix/corepkgs/channels/unpack.nix --argstr system i686-linux --arg inputs '", inputs, "'", NULL); + outPath = rpmExpand("%(", cmd, ")", NULL); + cmd = _freeCmd(cmd); + xx = Unlink(fn); fn = _free(fn); @@ -326,6 +304,22 @@ symlink($outPath, $channelLink) or die "cannot symlink `$channelLink' to `$outPath'"; */ #endif + if (Lstat(nixDefExpr, &sb) == 0 && S_ISLNK(sb.st_mode)) + xx = Unlink(nixDefExpr); + if (Lstat(nixDefExpr, &sb) < 0 && errno == ENOENT) { + mode_t dmode = 0755; + if (Mkdir(nixDefExpr, dmode)) { + fprintf(stderr, "Mkdir(%s, 0%o) failed\n", nixDefExpr, dmode); + exit(1); + } + } + fn = rpmGetPath(nixDefExpr, "/channels", NULL); + xx = Unlink(fn); /* !!! not atomic */ + if (Symlink(outPath, fn)) { + fprintf(stderr, "Symlink(%s, %s) failed\n", outPath, fn); + exit(1); + } + fn = _free(fn); rootFile = _free(rootFile); } @@ -421,13 +415,6 @@ if ((s = getenv("NIX_STATE_DIR"))) stateDir = s; /* Turn on caching in nix-prefetch-url. */ -#ifdef REFERENCE -/* -my $channelCache = "$stateDir/channel-cache"; -mkdir $channelCache, 0755 unless -e $channelCache; -$ENV{'NIX_DOWNLOAD_CACHE'} = $channelCache if -W $channelCache; -*/ -#endif channelCache = rpmGetPath(stateDir, "/channel-cache", NULL); xx = rpmioMkpath(channelCache, 0755, (uid_t)-1, (gid_t)-1); if (!Access(channelCache, W_OK)) @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-collect-garbage.c ============================================================================ $ cvs diff -u -r2.2 -r2.3 nix-collect-garbage.c --- rpm/tools/nix-collect-garbage.c 26 Mar 2010 13:03:36 -0000 2.2 +++ rpm/tools/nix-collect-garbage.c 27 Mar 2010 16:40:12 -0000 2.3 @@ -2,6 +2,7 @@ #include <rpmiotypes.h> #include <rpmio.h> +#include <rpmdir.h> #include <rpmlog.h> #include <rpmmacro.h> #include <argv.h> @@ -17,20 +18,10 @@ #define F_ISSET(_nix, _FLAG) ((_nix)->flags & ((RPMNIX_FLAGS_##_FLAG) & ~0x40000000)) /** - * Bit field enum for rpmdigest CLI options. + * Bit field enum for rpmnix CLI options. */ enum nixFlags_e { RPMNIX_FLAGS_NONE = 0, - RPMNIX_FLAGS_ADDDRVLINK = _DFB(0), /* --add-drv-link */ - RPMNIX_FLAGS_NOOUTLINK = _DFB(1), /* -o,--no-out-link */ - RPMNIX_FLAGS_DRYRUN = _DFB(2), /* --dry-run */ - - RPMNIX_FLAGS_EVALONLY = _DFB(16), /* --eval-only */ - RPMNIX_FLAGS_PARSEONLY = _DFB(17), /* --parse-only */ - RPMNIX_FLAGS_ADDROOT = _DFB(18), /* --add-root */ - RPMNIX_FLAGS_XML = _DFB(19), /* --xml */ - RPMNIX_FLAGS_STRICT = _DFB(20), /* --strict */ - RPMNIX_FLAGS_SHOWTRACE = _DFB(21), /* --show-trace */ RPMNIX_FLAGS_DELETEOLD = _DFB(24) /* -d,--delete-old */ }; @@ -43,21 +34,12 @@ */ struct rpmnix_s { enum nixFlags_e flags; /*!< rpmnix control bits. */ - - const char * outLink; - const char * drvLink; - - const char ** instArgs; - const char ** buildArgs; - const char ** exprs; - - const char * attr; }; /** */ static struct rpmnix_s _nix = { - .flags = RPMNIX_FLAGS_NOOUTLINK + .flags = RPMNIX_FLAGS_NONE }; static const char * binDir = "/usr/bin"; @@ -79,9 +61,14 @@ * Of course, this makes rollbacks to before this point in time * impossible. */ -static int removeOldGenerations(rpmnix nix, const char * dir) +static int removeOldGenerations(rpmnix nix, const char * dn) /*...@*/ { + DIR * dir; + struct dirent * dp; + struct stat sb; + int xx; + #ifdef REFERENCE /* my $dh; @@ -102,6 +89,49 @@ closedir $dh or die; */ #endif + dir = Opendir(dn); + if (dn == NULL) { + fprintf(stderr, "Opendir(%s) failed\n", dn); + exit(1); + } + while ((dp = Readdir(dir)) != NULL) { + const char * fn; + if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) + continue; + fn = rpmGetPath(dn, "/", dp->d_name, NULL); + if (Lstat(fn, &sb) < 0) { + fn = _free(fn); + continue; + } + /* Recurse on sub-directories. */ + if (S_ISDIR(sb.st_mode)) { + xx = removeOldGenerations(nix, fn); + fn = _free(fn); + continue; + } + if (S_ISLNK(sb.st_mode)) { + char buf[BUFSIZ]; + ssize_t nr = Readlink(fn, buf, sizeof(buf)); + if (nr >= 0) + buf[nr] = '\0'; + if (!strcmp(buf, "link")) { /* XXX correct test? */ + const char * cmd; + const char * rval; + + fprintf(stderr, "removing old generations of profile %s\n", fn); + cmd = rpmExpand(binDir, "/nix-env -p ", fn, + " --delete-generations old", NULL); + rval = rpmExpand("%(", cmd, ")", NULL); + rval = _free(rval); + cmd = _freeCmd(cmd); + } + fn = _free(fn); + continue; + } + fn = _free(fn); + } + xx = Closedir(dir); + return 0; } @@ -141,7 +171,7 @@ { "delete-old", 'd', POPT_BIT_SET, &_nix.flags, RPMNIX_FLAGS_DELETEOLD, N_("FIXME"), NULL }, -#ifdef NOTYET +#ifndef NOTYET { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, N_("Common options for all rpmio executables:"), NULL }, #endif @@ -172,27 +202,6 @@ if ((s = getenv("NIX_BIN_DIR"))) binDir = s; - /* Process the command line arguments. */ -#ifdef REFERENCE -/* -my @args = (); -my $removeOld = 0; - -for my $arg (@ARGV) { - if ($arg eq "--delete-old" || $arg eq "-d") { - $removeOld = 1; - } else { - push @args, $arg; - } -} -*/ -#endif - -#ifdef REFERENCE -/* -removeOldGenerations $profilesDir if $removeOld; -*/ -#endif if (F_ISSET(nix, DELETEOLD)) xx = removeOldGenerations(nix, profilesDir); @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-copy-closure.c ============================================================================ $ cvs diff -u -r2.4 -r2.5 nix-copy-closure.c --- rpm/tools/nix-copy-closure.c 26 Mar 2010 14:10:32 -0000 2.4 +++ rpm/tools/nix-copy-closure.c 27 Mar 2010 16:40:12 -0000 2.5 @@ -9,6 +9,8 @@ #include "debug.h" +static int _debug = -1; + #define _KFB(n) (1U << (n)) #define _DFB(n) (_KFB(n) | 0x40000000) @@ -19,16 +21,6 @@ */ enum nixFlags_e { RPMNIX_FLAGS_NONE = 0, - RPMNIX_FLAGS_ADDDRVLINK = _DFB(0), /* --add-drv-link */ - RPMNIX_FLAGS_NOOUTLINK = _DFB(1), /* -o,--no-out-link */ - RPMNIX_FLAGS_DRYRUN = _DFB(2), /* --dry-run */ - - RPMNIX_FLAGS_EVALONLY = _DFB(16), /* --eval-only */ - RPMNIX_FLAGS_PARSEONLY = _DFB(17), /* --parse-only */ - RPMNIX_FLAGS_ADDROOT = _DFB(18), /* --add-root */ - RPMNIX_FLAGS_XML = _DFB(19), /* --xml */ - RPMNIX_FLAGS_STRICT = _DFB(20), /* --strict */ - RPMNIX_FLAGS_SHOWTRACE = _DFB(21), /* --show-trace */ RPMNIX_FLAGS_SIGN = _DFB(24), /* --sign */ RPMNIX_FLAGS_GZIP = _DFB(25) /* --gzip */ @@ -43,15 +35,6 @@ struct rpmnix_s { enum nixFlags_e flags; /*!< rpmnix control bits. */ - const char * outLink; - const char * drvLink; - - const char ** instArgs; - const char ** buildArgs; - const char ** exprs; - - const char * attr; - int op; const char * sshHost; @@ -63,13 +46,21 @@ /** */ static struct rpmnix_s _nix = { - .flags = RPMNIX_FLAGS_NOOUTLINK + .flags = RPMNIX_FLAGS_NONE }; static const char * binDir = "/usr/bin"; +#define DBG(_l) if (_debug) fprintf _l /*==============================================================*/ +static char * _freeCmd(const char * cmd) +{ +DBG((stderr, "\t%s\n", cmd)); + cmd = _free(cmd); + return NULL; +} + #ifdef UNUSED static int verbose = 0; #endif @@ -201,9 +192,9 @@ cmd = rpmExpand(binDir, "/nix-store --query --requisites ", s, NULL); s = _free(s); rval = rpmExpand("%(", cmd, ")", NULL); - cmd = _free(cmd); xx = argvSplit(&nix->allStorePaths, rval, NULL); rval = _free(rval); + cmd = _freeCmd(cmd); /* Ask the remote host which paths are invalid. */ #ifdef REFERENCE @@ -225,11 +216,10 @@ xx = argvSplit(&nix->missing, rval, NULL); rval = _free(rval); #else -fprintf(stderr, "--> %s\n", cmd); nix->missing = NULL; fprintf(stderr, "<-- missing assumed NULL\n"); #endif - cmd = _free(cmd); + cmd = _freeCmd(cmd); /* Export the store paths and import them on the remote machine. */ nac = argvCount(nix->missing); @@ -247,8 +237,7 @@ cmd = rpmExpand(binDir, "/nix-store --export ", extraOpts, " ", s, " ", compressor, " | ssh ", nix->sshHost, " ", sshOpts, " '", decompressor, " nix-store --import'", NULL); s = _free(s); -fprintf(stderr, "--> %s\n", cmd); - cmd = _free(cmd); + cmd = _freeCmd(cmd); } break; case NIX_FROM_HOST: /* Copy FROM the remote machine. */ @@ -282,11 +271,10 @@ xx = argvSplit(&nix->missing, rval, NULL); rval = _free(rval); #else -fprintf(stderr, "--> %s\n", cmd); nix->allStorePaths = NULL; fprintf(stderr, "<-- allStorePaths assumed NULL\n"); #endif - cmd = _free(cmd); + cmd = _freeCmd(cmd); /* What paths are already valid locally? */ #ifdef REFERENCE @@ -306,7 +294,7 @@ rval = rpmExpand("%(", cmd, ")", NULL); xx = argvSplit(&nix->missing, rval, NULL); rval = _free(rval); - cmd = _free(cmd); + cmd = _freeCmd(cmd); /* Export the store paths on the remote machine and import them on locally. */ nac = argvCount(nix->missing); @@ -323,8 +311,7 @@ " 'nix-store --export ", extraOpts, " ", s, " ", compressor, "' | ", decompressor, " ", binDir, "/nix-store --import", NULL); s = _free(s); -fprintf(stderr, "--> %s\n", cmd); - cmd = _free(cmd); + cmd = _freeCmd(cmd); } break; } @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-install-package.c ============================================================================ $ cvs diff -u -r2.2 -r2.3 nix-install-package.c --- rpm/tools/nix-install-package.c 26 Mar 2010 14:10:32 -0000 2.2 +++ rpm/tools/nix-install-package.c 27 Mar 2010 16:40:12 -0000 2.3 @@ -21,16 +21,6 @@ */ enum nixFlags_e { RPMNIX_FLAGS_NONE = 0, - RPMNIX_FLAGS_ADDDRVLINK = _DFB(0), /* --add-drv-link */ - RPMNIX_FLAGS_NOOUTLINK = _DFB(1), /* -o,--no-out-link */ - RPMNIX_FLAGS_DRYRUN = _DFB(2), /* --dry-run */ - - RPMNIX_FLAGS_EVALONLY = _DFB(16), /* --eval-only */ - RPMNIX_FLAGS_PARSEONLY = _DFB(17), /* --parse-only */ - RPMNIX_FLAGS_ADDROOT = _DFB(18), /* --add-root */ - RPMNIX_FLAGS_XML = _DFB(19), /* --xml */ - RPMNIX_FLAGS_STRICT = _DFB(20), /* --strict */ - RPMNIX_FLAGS_SHOWTRACE = _DFB(21), /* --show-trace */ RPMNIX_FLAGS_INTERACTIVE = _DFB(24) /* --non-interactive */ }; @@ -44,15 +34,6 @@ struct rpmnix_s { enum nixFlags_e flags; /*!< rpmnix control bits. */ - const char * outLink; - const char * drvLink; - - const char ** instArgs; - const char ** buildArgs; - const char ** exprs; - - const char * attr; - const char * url; const char ** profiles; }; @@ -188,28 +169,16 @@ #endif if ((s = getenv("NIX_BIN_DIR"))) binDir = s; + /* Parse the command line arguments. */ #ifdef REFERENCE /* -sub usageError { - print STDERR <<EOF; -Usage: nix-install-package (FILE | --url URL) - -Install a Nix Package (.nixpkg) either directly from FILE or by -downloading it from URL. - -Flags: - --profile / -p LINK: install into the specified profile - --non-interactive: don't run inside a new terminal -EOF - ; # ' - exit 1; -} - - -# Parse the command line arguments. my @args = @ARGV; usageError if scalar @args == 0; +*/ +#endif +#ifdef REFERENCE +/* my $source; my $fromURL = 0; my @extraNixEnvArgs = (); @@ -250,6 +219,13 @@ /* $ENV{"NIX_HAVE_TERMINAL"} = "1"; $ENV{"LD_LIBRARY_PATH"} = ""; +*/ +#endif + xx = setenv("NIX_HAVE_TERMINAL", "1", 1); + xx = setenv("LD_LIBRARY_PATH", "", 1); + +#ifdef REFERENCE +/* foreach my $term ("xterm", "konsole", "gnome-terminal", "xterm") { exec($term, "-e", "$binDir/nix-install-package", @ARGV); } @@ -273,9 +249,9 @@ goto exit; } + /* Download the package description, if necessary. */ #ifdef REFERENCE /* -# Download the package description, if necessary. my $pkgFile = $source; if ($fromURL) { $pkgFile = "$tmpDir/tmp.nixpkg"; @@ -286,9 +262,9 @@ #endif + /* Read and parse the package file. */ #ifdef REFERENCE /* -# Read and parse the package file. open PKGFILE, "<$pkgFile" or barf "cannot open `$pkgFile': $!"; my $contents = <PKGFILE>; close PKGFILE; @@ -341,11 +317,6 @@ * Store the manifest in the temporary directory so that we don't * pollute /nix/var/nix/manifests. */ -#ifdef REFERENCE -/* -$ENV{NIX_MANIFESTS_DIR} = $tmpDir; -*/ -#endif xx = setenv("NIX_MANIFEST_DIR", tmpDir, 1); @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-prefetch-url.c ============================================================================ $ cvs diff -u -r2.6 -r2.7 nix-prefetch-url.c --- rpm/tools/nix-prefetch-url.c 26 Mar 2010 14:10:32 -0000 2.6 +++ rpm/tools/nix-prefetch-url.c 27 Mar 2010 16:40:12 -0000 2.7 @@ -21,17 +21,6 @@ */ enum nixFlags_e { RPMNIX_FLAGS_NONE = 0, - RPMNIX_FLAGS_ADDDRVLINK = _DFB(0), /* --add-drv-link */ - RPMNIX_FLAGS_NOOUTLINK = _DFB(1), /* -o,--no-out-link */ - RPMNIX_FLAGS_DRYRUN = _DFB(2), /* --dry-run */ - - RPMNIX_FLAGS_EVALONLY = _DFB(16), /* --eval-only */ - RPMNIX_FLAGS_PARSEONLY = _DFB(17), /* --parse-only */ - RPMNIX_FLAGS_ADDROOT = _DFB(18), /* --add-root */ - RPMNIX_FLAGS_XML = _DFB(19), /* --xml */ - RPMNIX_FLAGS_STRICT = _DFB(20), /* --strict */ - RPMNIX_FLAGS_SHOWTRACE = _DFB(21), /* --show-trace */ - }; /** @@ -79,6 +68,7 @@ /** */ static struct rpmnix_s _nix = { + .flags = RPMNIX_FLAGS_NONE, .hashType = "sha256" }; @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-pull.c ============================================================================ $ cvs diff -u -r2.7 -r2.8 nix-pull.c --- rpm/tools/nix-pull.c 26 Mar 2010 14:10:32 -0000 2.7 +++ rpm/tools/nix-pull.c 27 Mar 2010 16:40:12 -0000 2.8 @@ -22,16 +22,6 @@ */ enum nixFlags_e { RPMNIX_FLAGS_NONE = 0, - RPMNIX_FLAGS_ADDDRVLINK = _DFB(0), /* --add-drv-link */ - RPMNIX_FLAGS_NOOUTLINK = _DFB(1), /* -o,--no-out-link */ - RPMNIX_FLAGS_DRYRUN = _DFB(2), /* --dry-run */ - - RPMNIX_FLAGS_EVALONLY = _DFB(16), /* --eval-only */ - RPMNIX_FLAGS_PARSEONLY = _DFB(17), /* --parse-only */ - RPMNIX_FLAGS_ADDROOT = _DFB(18), /* --add-root */ - RPMNIX_FLAGS_XML = _DFB(19), /* --xml */ - RPMNIX_FLAGS_STRICT = _DFB(20), /* --strict */ - RPMNIX_FLAGS_SHOWTRACE = _DFB(21), /* --show-trace */ RPMNIX_FLAGS_SKIPWRONGSTORE = _DFB(24) /* --skip-wrong-store */ }; @@ -45,17 +35,6 @@ struct rpmnix_s { enum nixFlags_e flags; /*!< rpmnix control bits. */ - const char * outLink; - const char * drvLink; - - const char ** instArgs; - const char ** buildArgs; - const char ** exprs; - - const char * attr; - - const char * manifest; - const char ** narFiles; const char ** localPaths; const char ** patches; @@ -64,7 +43,7 @@ /** */ static struct rpmnix_s _nix = { - .flags = RPMNIX_FLAGS_NOOUTLINK + .flags = RPMNIX_FLAGS_NONE }; static const char * tmpDir; @@ . patch -p0 <<'@@ .' Index: rpm/tools/nix-push.c ============================================================================ $ cvs diff -u -r2.6 -r2.7 nix-push.c --- rpm/tools/nix-push.c 26 Mar 2010 14:10:32 -0000 2.6 +++ rpm/tools/nix-push.c 27 Mar 2010 16:40:12 -0000 2.7 @@ -22,16 +22,6 @@ */ enum nixFlags_e { RPMNIX_FLAGS_NONE = 0, - RPMNIX_FLAGS_ADDDRVLINK = _DFB(0), /* --add-drv-link */ - RPMNIX_FLAGS_NOOUTLINK = _DFB(1), /* -o,--no-out-link */ - RPMNIX_FLAGS_DRYRUN = _DFB(2), /* --dry-run */ - - RPMNIX_FLAGS_EVALONLY = _DFB(16), /* --eval-only */ - RPMNIX_FLAGS_PARSEONLY = _DFB(17), /* --parse-only */ - RPMNIX_FLAGS_ADDROOT = _DFB(18), /* --add-root */ - RPMNIX_FLAGS_XML = _DFB(19), /* --xml */ - RPMNIX_FLAGS_STRICT = _DFB(20), /* --strict */ - RPMNIX_FLAGS_SHOWTRACE = _DFB(21), /* --show-trace */ RPMNIX_FLAGS_COPY = _DFB(24) /* --copy */ }; @@ -45,15 +35,6 @@ struct rpmnix_s { enum nixFlags_e flags; /*!< rpmnix control bits. */ - const char * outLink; - const char * drvLink; - - const char ** instArgs; - const char ** buildArgs; - const char ** exprs; - - const char * attr; - const char ** narFiles; const char ** localPaths; const char ** patches; @@ -74,7 +55,7 @@ /** */ static struct rpmnix_s _nix = { - .flags = RPMNIX_FLAGS_NOOUTLINK + .flags = RPMNIX_FLAGS_NONE }; static const char * tmpDir; @@ -323,6 +304,8 @@ ssize_t nw; ARGV_t tav; + const char * curlDefault = "/usr/bin/curl --fail --silent"; + const char * curl = NULL; const char * nixExpr = NULL; const char * manifest = NULL; int localCopy; @@ -348,6 +331,10 @@ $curl = "$curl $extraCurlFlags" if defined $extraCurlFlags; */ #endif + if ((s = getenv("CURL_FLAGS"))) + curl = rpmExpand(curlDefault, " ", s, NULL); + else + curl = rpmExpand(curlDefault, NULL); if ((s = getenv("NIX_BIN_DIR"))) binDir = s; if ((s = getenv("NIX_DATA_DIR"))) dataDir = s; @@ -629,8 +616,8 @@ $deriver = "" if $deriver eq "unknown-deriver"; */ #endif - cmd = rpmExpand(binDir, "/nix-store --query --deriver '", - storePath, "'", NULL); + cmd = rpmExpand(binDir, "/nix-store --query", + " --deriver '", storePath, "'", NULL); deriver = rpmExpand("%(", cmd, ")", NULL); if (!strcmp(deriver, "unknown-deriver")) { deriver = _free(deriver); @@ -690,6 +677,16 @@ die "curl failed on $narArchive: $?"; */ #endif + cmd = rpmExpand(curl, " --show-error", + " --upload-file '", narArchive, "' '", nix->manifestPutURL, "/", bn, "'", + " > /dev/null; echo $?", NULL); + rval = rpmExpand("%(", cmd, ")", NULL); + if (strcmp(rval, "0")) { + fprintf(stderr, "curl failed on %s: %s\n", narArchive, rval); + exit(1); + } + rval = _free(rval); + cmd = _freeCmd(cmd); } } narArchive = _free(narArchive); @@ -715,6 +712,17 @@ die "curl failed on $manifest: $?"; */ #endif + cmd = rpmExpand(curl, " --show-error", + " --upload-file '", manifest, "' '", nix->manifestPutURL, "'", + " > /dev/null; echo $?", NULL); + rval = rpmExpand("%(", cmd, ")", NULL); + if (strcmp(rval, "0")) { + fprintf(stderr, "curl failed on %s: %s\n", manifest, rval); + exit(1); + } + rval = _free(rval); + cmd = _freeCmd(cmd); + #ifdef REFERENCE /* system("$curl --show-error --upload-file " . @@ -722,6 +730,16 @@ die "curl failed on $manifest: $?"; */ #endif + cmd = rpmExpand(curl, " --show-error", + " --upload-file '", manifest, ".bz2' '", nix->manifestPutURL, ".bz2'", + " > /dev/null; echo $?", NULL); + rval = rpmExpand("%(", cmd, ")", NULL); + if (strcmp(rval, "0")) { + fprintf(stderr, "curl failed on %s.bz2: %s\n", manifest, rval); + exit(1); + } + rval = _free(rval); + cmd = _freeCmd(cmd); } ec = 0; /* XXX success */ @@ -734,6 +752,7 @@ */ #endif + curl = _free(curl); manifest = _free(manifest); nixExpr = _free(nixExpr); @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
