sync with rpm4 branch

This commit is contained in:
Дмитрий Левин 2002-03-25 23:19:22 +00:00
parent 41c8ceaf55
commit c0497676a6
3 changed files with 40 additions and 11 deletions

View File

@ -570,7 +570,7 @@ static inline unsigned char nibble(char c)
*/ */
int (*parseSpecVec) (Spec *specp, const char *specFile, const char *rootdir, int (*parseSpecVec) (Spec *specp, const char *specFile, const char *rootdir,
const char *buildRoot, int recursing, const char *passPhrase, const char *buildRoot, int recursing, const char *passPhrase,
char *cookie, int anyarch, int force) = NULL; char *cookie, int anyarch, int force, int preprocess) = NULL;
/** /**
* @todo Eliminate linkage loop into librpmbuild.a * @todo Eliminate linkage loop into librpmbuild.a
*/ */
@ -691,9 +691,10 @@ restart:
char *cookie = NULL; char *cookie = NULL;
int anyarch = 1; int anyarch = 1;
int force = 1; int force = 1;
int preprocess = 0;
rc = parseSpecVec(&spec, arg, "/", buildRoot, recursing, passPhrase, rc = parseSpecVec(&spec, arg, "/", buildRoot, recursing, passPhrase,
cookie, anyarch, force); cookie, anyarch, force, preprocess);
if (rc || spec == NULL) { if (rc || spec == NULL) {
rpmError(RPMERR_QUERY, rpmError(RPMERR_QUERY,
_("query of specfile %s failed, can't parse\n"), arg); _("query of specfile %s failed, can't parse\n"), arg);
@ -854,16 +855,16 @@ restart:
break; break;
case RPMQV_WHATPROVIDES: case RPMQV_WHATPROVIDES:
if (arg[0] != '/') {
mi = rpmdbInitIterator(rpmdb, RPMTAG_PROVIDENAME, arg, 0); mi = rpmdbInitIterator(rpmdb, RPMTAG_PROVIDENAME, arg, 0);
if (mi == NULL) { if (mi == NULL) {
if (arg[0] != '/')
rpmError(RPMERR_QUERYINFO, _("no package provides %s\n"), arg); rpmError(RPMERR_QUERYINFO, _("no package provides %s\n"), arg);
retcode = 1; retcode = 1;
} else { } else {
retcode = showMatches(qva, mi, showPackage); retcode = showMatches(qva, mi, showPackage);
} }
if (arg[0] != '/')
break; break;
}
/*@fallthrough@*/ /*@fallthrough@*/
case RPMQV_PATH: case RPMQV_PATH:
{ char * fn; { char * fn;
@ -894,10 +895,20 @@ restart:
_("file %s: %s\n"), fn, strerror(myerrno)); _("file %s: %s\n"), fn, strerror(myerrno));
break; break;
case 0: case 0:
rpmError(RPMERR_QUERYINFO, switch (source)
_("file %s is not owned by any package\n"), fn); {
case RPMQV_WHATPROVIDES:
if (retcode) rpmError(RPMERR_QUERYINFO,
_("no package provides %s\n"), fn);
break;
case RPMQV_PATH:
rpmError(RPMERR_QUERYINFO,
_("file %s is not owned by any package\n"), fn);
break;
}
break; break;
} }
if (RPMQV_PATH == source)
retcode = 1; retcode = 1;
} else { } else {
retcode = showMatches(qva, mi, showPackage); retcode = showMatches(qva, mi, showPackage);

View File

@ -37,13 +37,19 @@ int rpmvercmp(const char * a, const char * b)
while (*one && !xisalnum(*one)) one++; while (*one && !xisalnum(*one)) one++;
while (*two && !xisalnum(*two)) two++; while (*two && !xisalnum(*two)) two++;
if ( !*one && !*two )
return 0;
str1 = one; str1 = one;
str2 = two; str2 = two;
/* grab first completely alpha or completely numeric segment */ /* grab first completely alpha or completely numeric segment */
/* leave one and two pointing to the start of the alpha or numeric */ /* leave one and two pointing to the start of the alpha or numeric */
/* segment and walk str1 and str2 to end of segment */ /* segment and walk str1 and str2 to end of segment */
/* Also take care of the case where the two version segments are */
/* different types: one numeric and one alpha */
if (xisdigit(*str1)) { if (xisdigit(*str1)) {
if ( xisalpha(*str2) ) return -1;
while (*str1 && xisdigit(*str1)) str1++; while (*str1 && xisdigit(*str1)) str1++;
while (*str2 && xisdigit(*str2)) str2++; while (*str2 && xisdigit(*str2)) str2++;
isnum = 1; isnum = 1;
@ -53,6 +59,11 @@ int rpmvercmp(const char * a, const char * b)
isnum = 0; isnum = 0;
} }
/* Again, take care of the case where the two version segments are */
/* different types: one numeric and one alpha */
if (one == str1) return -1;
if (two == str2) return 1;
/* save character at the end of the alpha or numeric segment */ /* save character at the end of the alpha or numeric segment */
/* so that they can be restored after the comparison */ /* so that they can be restored after the comparison */
oldch1 = *str1; oldch1 = *str1;
@ -60,11 +71,6 @@ int rpmvercmp(const char * a, const char * b)
oldch2 = *str2; oldch2 = *str2;
*str2 = '\0'; *str2 = '\0';
/* take care of the case where the two version segments are */
/* different types: one numeric, the other alpha (i.e. empty) */
if (one == str1) return -1; /* arbitrary */
if (two == str2) return -1;
if (isnum) { if (isnum) {
/* this used to be done by converting the digit segments */ /* this used to be done by converting the digit segments */
/* to ints using atoi() - it's changed because long */ /* to ints using atoi() - it's changed because long */

View File

@ -3282,6 +3282,9 @@ int rpmdbRebuild(const char * prefix)
newdbpath += strlen(prefix); newdbpath += strlen(prefix);
tfn = _free(tfn); tfn = _free(tfn);
rpmMessage(RPMMESS_VERBOSE, _("rebuilding database %s\n"),
rootdbpath, newrootdbpath);
rpmMessage(RPMMESS_DEBUG, _("rebuilding database %s into %s\n"), rpmMessage(RPMMESS_DEBUG, _("rebuilding database %s into %s\n"),
rootdbpath, newrootdbpath); rootdbpath, newrootdbpath);
@ -3301,6 +3304,15 @@ int rpmdbRebuild(const char * prefix)
} }
removedir = 1; removedir = 1;
{
struct stat st;
if ( !lstat( rootdbpath, &st ) )
{
lchown( newrootdbpath, st.st_uid, st.st_gid );
chmod( newrootdbpath, st.st_mode );
}
}
rpmMessage(RPMMESS_DEBUG, _("opening old database with dbapi %d\n"), rpmMessage(RPMMESS_DEBUG, _("opening old database with dbapi %d\n"),
_dbapi); _dbapi);
_rebuildinprogress = 1; _rebuildinprogress = 1;