diff options
author | jbj <devnull@localhost> | 2002-07-04 21:08:05 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-07-04 21:08:05 +0000 |
commit | 6dca216517ffb04f30d84ce1d1335efc37e7736d (patch) | |
tree | 0321a51a42d454fb20473111111ea4d983c061ea /lib | |
parent | af3c677f06687e5ad1e33eb24f984c7ac5ff2a33 (diff) | |
download | librpm-tizen-6dca216517ffb04f30d84ce1d1335efc37e7736d.tar.gz librpm-tizen-6dca216517ffb04f30d84ce1d1335efc37e7736d.tar.bz2 librpm-tizen-6dca216517ffb04f30d84ce1d1335efc37e7736d.zip |
- fix: forgot lazy open of database on --freshen path (#67907).
- proof-of-concept rpmcache functionality.
CVS patchset: 5539
CVS date: 2002/07/04 21:08:05
Diffstat (limited to 'lib')
-rw-r--r-- | lib/misc.c | 32 | ||||
-rw-r--r-- | lib/misc.h | 11 | ||||
-rw-r--r-- | lib/psm.c | 46 | ||||
-rw-r--r-- | lib/rpminstall.c | 6 | ||||
-rw-r--r-- | lib/rpmlib.h | 6 |
5 files changed, 56 insertions, 45 deletions
diff --git a/lib/misc.c b/lib/misc.c index 21f196d6c..839dcb18b 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -21,6 +21,38 @@ const char * RPMVERSION = VERSION; /*@access Header@*/ /* XXX compared with NULL */ /*@access FD_t@*/ /* XXX compared with NULL */ +rpmRC rpmMkdirPath (const char * dpath, const char * dname) +{ + struct stat st; + int rc; + + if ((rc = Stat(dpath, &st)) < 0) { + int ut = urlPath(dpath, NULL); + switch (ut) { + case URL_IS_PATH: + case URL_IS_UNKNOWN: + if (errno != ENOENT) + break; + /*@fallthrough@*/ + case URL_IS_FTP: + case URL_IS_HTTP: + rc = Mkdir(dpath, 0755); + break; + case URL_IS_DASH: + break; + } + if (rc < 0) { + rpmError(RPMERR_CREATE, _("cannot create %%%s %s\n"), dname, dpath); + return RPMRC_FAIL; + } + } + if ((rc = Access(dpath, W_OK))) { + rpmError(RPMERR_CREATE, _("cannot write to %%%s %s\n"), dname, dpath); + return RPMRC_FAIL; + } + return RPMRC_OK; +} + /*@-bounds@*/ char ** splitString(const char * str, int length, char sep) { diff --git a/lib/misc.h b/lib/misc.h index c45a0b1bf..ce603501b 100644 --- a/lib/misc.h +++ b/lib/misc.h @@ -11,6 +11,17 @@ extern "C" { #endif /** + * Create directory if it does not exist, and make sure path is writable. + * @note This will only create last component of directory path. + * @param dpath directory path + * @param dname directory use string + * @return rpmRC return code + */ +rpmRC rpmMkdirPath (const char * dpath, const char * dname) + /*@globals fileSystem@*/ + /*@modifies fileSystem @*/; + +/** * Split string into fields separated by a character. * @param str string * @param length length of string @@ -429,48 +429,6 @@ static int markReplacedFiles(const PSM_t psm) } /*@=bounds@*/ -/** - * Create directory if it does not exist, make sure path is writable. - * @note This will only create last component of directory path. - * @param dpath directory path - * @param dname directory use - * @return rpmRC return code - */ -static rpmRC chkdir (const char * dpath, const char * dname) - /*@globals fileSystem@*/ - /*@modifies fileSystem @*/ -{ - struct stat st; - int rc; - - if ((rc = Stat(dpath, &st)) < 0) { - int ut = urlPath(dpath, NULL); - switch (ut) { - case URL_IS_PATH: - case URL_IS_UNKNOWN: - if (errno != ENOENT) - break; - /*@fallthrough@*/ - case URL_IS_FTP: - case URL_IS_HTTP: - rc = Mkdir(dpath, 0755); - break; - case URL_IS_DASH: - break; - } - if (rc < 0) { - rpmError(RPMERR_CREATE, _("cannot create %%%s %s\n"), - dname, dpath); - return RPMRC_FAIL; - } - } - if ((rc = Access(dpath, W_OK))) { - rpmError(RPMERR_CREATE, _("cannot write to %%%s %s\n"), dname, dpath); - return RPMRC_FAIL; - } - return RPMRC_OK; -} - rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, const char ** specFilePtr, const char ** cookie) { @@ -578,14 +536,14 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, } _sourcedir = rpmGenPath(rpmtsRootDir(ts), "%{_sourcedir}", ""); - rc = chkdir(_sourcedir, "sourcedir"); + rc = rpmMkdirPath(_sourcedir, "sourcedir"); if (rc) { rc = RPMRC_FAIL; goto exit; } _specdir = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", ""); - rc = chkdir(_specdir, "specdir"); + rc = rpmMkdirPath(_specdir, "specdir"); if (rc) { rc = RPMRC_FAIL; goto exit; diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 691711b9e..79a3a9584 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -400,6 +400,12 @@ restart: if (eiu->rpmrc == RPMRC_OK || eiu->rpmrc == RPMRC_BADSIZE) { + /* Make sure rpmdb is open for binary packages. */ + if (ts->rdb == NULL && rpmtsOpenDB(ts, O_RDONLY)) { + eiu->numFailed++; + goto exit; + } + if (eiu->relocations) { const char ** paths; int pft; diff --git a/lib/rpmlib.h b/lib/rpmlib.h index cb59e5661..5abffabf6 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -381,10 +381,14 @@ typedef enum rpmTag_e { RPMTAG_INSTALLTID = 1128, RPMTAG_REMOVETID = 1129, /*@-enummemuse@*/ - RPMTAG_SHA1RHN = 1130, /*!< internal */ + RPMTAG_SHA1RHN = 1130, /*!< internal - obsolete */ /*@=enummemuse@*/ RPMTAG_RHNPLATFORM = 1131, RPMTAG_PLATFORM = 1132, + RPMTAG_CACHECTIME = 1133, + RPMTAG_CACHEPKGPATH = 1134, + RPMTAG_CACHEPKGSIZE = 1135, + RPMTAG_CACHEPKGMTIME = 1136, /*@-enummemuse@*/ RPMTAG_FIRSTFREE_TAG /*!< internal */ /*@=enummemuse@*/ |