- unify rpmError and rpmMessge interfaces through rpmlog.

- collect and display rpm build error messages at end of build.

CVS patchset: 4149
CVS date: 2000/09/01 21:15:40
This commit is contained in:
jbj 2000-09-01 21:15:40 +00:00
parent 4f0179f7ee
commit f2efc7263e
48 changed files with 15194 additions and 12271 deletions

View File

@ -5,6 +5,8 @@
- consistent return for all signature verification. - consistent return for all signature verification.
- use enums for almost all rpmlib #define's. - use enums for almost all rpmlib #define's.
- API: change rpmProblem typedef to pass by reference, not value. - API: change rpmProblem typedef to pass by reference, not value.
- unify rpmError and rpmMessge interfaces through rpmlog.
- collect and display rpm build error messages at end of build.
3.0.6 -> 4.0 3.0.6 -> 4.0
- use DIRNAMES/BASENAMES/DIRINDICES not FILENAMES in packages and db. - use DIRNAMES/BASENAMES/DIRINDICES not FILENAMES in packages and db.

View File

@ -134,7 +134,6 @@ install-data-local:
@case "@build_os@" in \ @case "@build_os@" in \
mint) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/m68kmint ;;\ mint) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/m68kmint ;;\
solaris*|linux*) \ solaris*|linux*) \
chmod u+x ./installplatform; DESTDIR="$(DESTDIR)" pkglibdir="$(pkglibdir)" ./installplatform rpmrc macros platform ; \
$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/@build_cpu@ ;;\ $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/@build_cpu@ ;;\
*) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/@build_cpu@ ;;\ *) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/@build_cpu@ ;;\
esac esac
@ -144,6 +143,9 @@ install-data-local:
@$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/SRPMS @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/SRPMS
@$(mkinstalldirs) $(DESTDIR)/var/tmp @$(mkinstalldirs) $(DESTDIR)/var/tmp
#chmod u+x ./installplatform; DESTDIR="$(DESTDIR)" pkglibdir="$(pkglibdir)" ./installplatform rpmrc macros platform ; \
#
.PHONY: tar .PHONY: tar
tar: tar:
rm -rf /tmp/rpm-$(VERSION) rm -rf /tmp/rpm-$(VERSION)

27
build.c
View File

@ -22,7 +22,7 @@ static int checkSpec(Header h)
if (rpmdbOpen(rootdir, &db, mode, 0644)) { if (rpmdbOpen(rootdir, &db, mode, 0644)) {
const char *dn; const char *dn;
dn = rpmGetPath( (rootdir ? rootdir : ""), "%{_dbpath}", NULL); dn = rpmGetPath( (rootdir ? rootdir : ""), "%{_dbpath}", NULL);
rpmMessage(RPMMESS_ERROR, _("cannot open %s/packages.rpm\n"), dn); rpmError(RPMERR_OPEN, _("cannot open %s/packages.rpm\n"), dn);
xfree(dn); xfree(dn);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -61,7 +61,7 @@ static int isSpecFile(const char *specfile)
fd = Fopen(specfile, "r.ufdio"); fd = Fopen(specfile, "r.ufdio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
fprintf(stderr, _("Unable to open spec file %s: %s\n"), specfile, Fstrerror(fd)); rpmError(RPMERR_OPEN, _("Unable to open spec file %s: %s\n"), specfile, Fstrerror(fd));
return 0; return 0;
} }
count = Fread(buf, sizeof(buf[0]), sizeof(buf), fd); count = Fread(buf, sizeof(buf[0]), sizeof(buf), fd);
@ -123,8 +123,7 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
sprintf(cmd, "%s < %s | tar xOvf - Specfile 2>&1 > %s", sprintf(cmd, "%s < %s | tar xOvf - Specfile 2>&1 > %s",
zcmds[res & 0x3], arg, tmpSpecFile); zcmds[res & 0x3], arg, tmpSpecFile);
if (!(fp = popen(cmd, "r"))) { if (!(fp = popen(cmd, "r"))) {
fprintf(stderr, _("Failed to open tar pipe: %s\n"), rpmError(RPMERR_POPEN, _("Failed to open tar pipe: %m"));
strerror(errno));
xfree(specDir); xfree(specDir);
xfree(tmpSpecFile); xfree(tmpSpecFile);
return 1; return 1;
@ -136,15 +135,14 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
sprintf(cmd, "%s < %s | tar xOvf - \\*.spec 2>&1 > %s", sprintf(cmd, "%s < %s | tar xOvf - \\*.spec 2>&1 > %s",
zcmds[res & 0x3], arg, tmpSpecFile); zcmds[res & 0x3], arg, tmpSpecFile);
if (!(fp = popen(cmd, "r"))) { if (!(fp = popen(cmd, "r"))) {
fprintf(stderr, _("Failed to open tar pipe: %s\n"), rpmError(RPMERR_POPEN, _("Failed to open tar pipe: %m"));
strerror(errno));
xfree(specDir); xfree(specDir);
xfree(tmpSpecFile); xfree(tmpSpecFile);
return 1; return 1;
} }
if (!fgets(buf, sizeof(buf) - 1, fp)) { if (!fgets(buf, sizeof(buf) - 1, fp)) {
/* Give up */ /* Give up */
fprintf(stderr, _("Failed to read spec file from %s\n"), arg); rpmError(RPMERR_READ, _("Failed to read spec file from %s"), arg);
unlink(tmpSpecFile); unlink(tmpSpecFile);
xfree(specDir); xfree(specDir);
xfree(tmpSpecFile); xfree(tmpSpecFile);
@ -171,8 +169,8 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
xfree(specDir); xfree(specDir);
if (res) { if (res) {
fprintf(stderr, _("Failed to rename %s to %s: %s\n"), rpmError(RPMERR_RENAME, _("Failed to rename %s to %s: %m"),
tmpSpecFile, s, strerror(errno)); tmpSpecFile, s);
unlink(tmpSpecFile); unlink(tmpSpecFile);
xfree(tmpSpecFile); xfree(tmpSpecFile);
return 1; return 1;
@ -209,16 +207,21 @@ static int buildForTarget(const char *arg, struct rpmBuildArguments *ba,
if (specut != URL_IS_DASH) { if (specut != URL_IS_DASH) {
struct stat st; struct stat st;
Stat(specURL, &st); if (Stat(specURL, &st) < 0) {
rpmError(RPMERR_STAT, _("failed to stat %s: %m"), specURL);
rc = 1;
goto exit;
}
if (! S_ISREG(st.st_mode)) { if (! S_ISREG(st.st_mode)) {
fprintf(stderr, _("File is not a regular file: %s\n"), specURL); rpmError(RPMERR_NOTREG, _("File %s is not a regular file."),
specURL);
rc = 1; rc = 1;
goto exit; goto exit;
} }
/* Try to verify that the file is actually a specfile */ /* Try to verify that the file is actually a specfile */
if (!isSpecFile(specURL)) { if (!isSpecFile(specURL)) {
fprintf(stderr, _("File %s does not appear to be a specfile.\n"), rpmError(RPMERR_BADSPEC, _("File %s does not appear to be a specfile."),
specURL); specURL);
rc = 1; rc = 1;
goto exit; goto exit;

View File

@ -249,46 +249,46 @@ int buildSpec(Spec spec, int what, int test)
(what & ~RPMBUILD_RMSOURCE) | (what & ~RPMBUILD_RMSOURCE) |
(x ? 0 : (what & RPMBUILD_PACKAGESOURCE)), (x ? 0 : (what & RPMBUILD_PACKAGESOURCE)),
test))) { test))) {
return rc; goto exit;
} }
} }
} else { } else {
if ((what & RPMBUILD_PREP) && if ((what & RPMBUILD_PREP) &&
(rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test))) (rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
return rc; goto exit;
if ((what & RPMBUILD_BUILD) && if ((what & RPMBUILD_BUILD) &&
(rc = doScript(spec, RPMBUILD_BUILD, NULL, NULL, test))) (rc = doScript(spec, RPMBUILD_BUILD, NULL, NULL, test)))
return rc; goto exit;
if ((what & RPMBUILD_INSTALL) && if ((what & RPMBUILD_INSTALL) &&
(rc = doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test))) (rc = doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test)))
return rc; goto exit;
if ((what & RPMBUILD_PACKAGESOURCE) && if ((what & RPMBUILD_PACKAGESOURCE) &&
(rc = processSourceFiles(spec))) (rc = processSourceFiles(spec)))
return rc; goto exit;
if (((what & RPMBUILD_INSTALL) || (what & RPMBUILD_PACKAGEBINARY) || if (((what & RPMBUILD_INSTALL) || (what & RPMBUILD_PACKAGEBINARY) ||
(what & RPMBUILD_FILECHECK)) && (what & RPMBUILD_FILECHECK)) &&
(rc = processBinaryFiles(spec, what & RPMBUILD_INSTALL, test))) (rc = processBinaryFiles(spec, what & RPMBUILD_INSTALL, test)))
return rc; goto exit;
if (((what & RPMBUILD_PACKAGESOURCE) && !test) && if (((what & RPMBUILD_PACKAGESOURCE) && !test) &&
(rc = packageSources(spec))) (rc = packageSources(spec)))
return rc; goto exit;
if (((what & RPMBUILD_PACKAGEBINARY) && !test) && if (((what & RPMBUILD_PACKAGEBINARY) && !test) &&
(rc = packageBinaries(spec))) (rc = packageBinaries(spec)))
return rc; goto exit;
if ((what & RPMBUILD_CLEAN) && if ((what & RPMBUILD_CLEAN) &&
(rc = doScript(spec, RPMBUILD_CLEAN, NULL, NULL, test))) (rc = doScript(spec, RPMBUILD_CLEAN, NULL, NULL, test)))
return rc; goto exit;
if ((what & RPMBUILD_RMBUILD) && if ((what & RPMBUILD_RMBUILD) &&
(rc = doScript(spec, RPMBUILD_RMBUILD, NULL, NULL, test))) (rc = doScript(spec, RPMBUILD_RMBUILD, NULL, NULL, test)))
return rc; goto exit;
} }
if (what & RPMBUILD_RMSOURCE) if (what & RPMBUILD_RMSOURCE)
@ -296,6 +296,13 @@ int buildSpec(Spec spec, int what, int test)
if (what & RPMBUILD_RMSPEC) if (what & RPMBUILD_RMSPEC)
unlink(spec->specFile); unlink(spec->specFile);
rc = 0;
return 0; exit:
if (rc && rpmlogGetNrecs() > 0) {
rpmMessage(RPMMESS_NORMAL, _("\n\nRPM build errors:\n"));
rpmlogPrint(NULL);
}
return rc;
} }

View File

@ -16,7 +16,6 @@ static gid_t gids[1024];
/*@owned@*/ /*@null@*/ static const char *gnames[1024]; /*@owned@*/ /*@null@*/ static const char *gnames[1024];
static int gid_used = 0; static int gid_used = 0;
/** */
void freeNames(void) void freeNames(void)
{ {
int x; int x;
@ -26,11 +25,6 @@ void freeNames(void)
xfree(gnames[x]); xfree(gnames[x]);
} }
/*
* getUname() takes a uid, gets the username, and creates an entry in the
* table to hold a string containing the user name.
*/
/** */
const char *getUname(uid_t uid) const char *getUname(uid_t uid)
{ {
struct passwd *pw; struct passwd *pw;
@ -43,10 +37,8 @@ const char *getUname(uid_t uid)
} }
/* XXX - This is the other hard coded limit */ /* XXX - This is the other hard coded limit */
if (x == 1024) { if (x == 1024)
fprintf(stderr, _("RPMERR_INTERNAL: Hit limit in getUname()\n")); rpmlog(RPMLOG_CRIT, _("getUname: too many uid's\n"));
exit(EXIT_FAILURE);
}
pw = getpwuid(uid); pw = getpwuid(uid);
uids[x] = uid; uids[x] = uid;
@ -59,11 +51,6 @@ const char *getUname(uid_t uid)
return unames[x]; return unames[x];
} }
/*
* getUnameS() takes a username, gets the uid, and creates an entry in the
* table to hold a string containing the user name.
*/
/** */
const char *getUnameS(const char *uname) const char *getUnameS(const char *uname)
{ {
struct passwd *pw; struct passwd *pw;
@ -76,10 +63,8 @@ const char *getUnameS(const char *uname)
} }
/* XXX - This is the other hard coded limit */ /* XXX - This is the other hard coded limit */
if (x == 1024) { if (x == 1024)
fprintf(stderr, _("RPMERR_INTERNAL: Hit limit in getUname()\n")); rpmlog(RPMLOG_CRIT, _("getUnameS: too many uid's\n"));
exit(EXIT_FAILURE);
}
pw = getpwnam(uname); pw = getpwnam(uname);
uid_used++; uid_used++;
@ -93,11 +78,6 @@ const char *getUnameS(const char *uname)
return unames[x]; return unames[x];
} }
/*
* getGname() takes a gid, gets the group name, and creates an entry in the
* table to hold a string containing the group name.
*/
/** */
const char *getGname(gid_t gid) const char *getGname(gid_t gid)
{ {
struct group *gr; struct group *gr;
@ -110,10 +90,8 @@ const char *getGname(gid_t gid)
} }
/* XXX - This is the other hard coded limit */ /* XXX - This is the other hard coded limit */
if (x == 1024) { if (x == 1024)
fprintf(stderr, _("RPMERR_INTERNAL: Hit limit in getGname()\n")); rpmlog(RPMLOG_CRIT, _("getGname: too many gid's\n"));
exit(EXIT_FAILURE);
}
gr = getgrgid(gid); gr = getgrgid(gid);
gids[x] = gid; gids[x] = gid;
@ -126,11 +104,6 @@ const char *getGname(gid_t gid)
return gnames[x]; return gnames[x];
} }
/*
* getGnameS() takes a group name, gets the gid, and creates an entry in the
* table to hold a string containing the group name.
*/
/** */
const char *getGnameS(const char *gname) const char *getGnameS(const char *gname)
{ {
struct group *gr; struct group *gr;
@ -143,10 +116,8 @@ const char *getGnameS(const char *gname)
} }
/* XXX - This is the other hard coded limit */ /* XXX - This is the other hard coded limit */
if (x == 1024) { if (x == 1024)
fprintf(stderr, _("RPMERR_INTERNAL: Hit limit in getGname()\n")); rpmlog(RPMLOG_CRIT, _("getGnameS: too many gid's\n"));
exit(EXIT_FAILURE);
}
gr = getgrnam(gname); gr = getgrnam(gname);
gid_used++; gid_used++;
@ -160,19 +131,15 @@ const char *getGnameS(const char *gname)
return gnames[x]; return gnames[x];
} }
/** */
time_t *const getBuildTime(void) time_t *const getBuildTime(void)
{ {
static time_t buildTime = 0; static time_t buildTime = 0;
if (! buildTime) { if (! buildTime)
buildTime = time(NULL); buildTime = time(NULL);
}
return &buildTime; return &buildTime;
} }
/** */
const char *const buildHost(void) const char *const buildHost(void)
{ {
static char hostname[1024]; static char hostname[1024];

View File

@ -465,24 +465,24 @@ int writeRPM(Header h, const char *fileName, int type,
/* Append the header and archive */ /* Append the header and archive */
ifd = Fopen(sigtarget, "r.ufdio"); ifd = Fopen(sigtarget, "r.ufdio");
if (ifd == NULL || Ferror(ifd)) { if (ifd == NULL || Ferror(ifd)) {
rpmError(RPMERR_READERROR, _("Unable to open sigtarget %s: %s"), rpmError(RPMERR_READ, _("Unable to open sigtarget %s: %s"),
sigtarget, Fstrerror(ifd)); sigtarget, Fstrerror(ifd));
Fclose(fd); Fclose(fd);
Unlink(sigtarget); Unlink(sigtarget);
xfree(sigtarget); xfree(sigtarget);
Unlink(fileName); Unlink(fileName);
return RPMERR_READERROR; return RPMERR_READ;
} }
while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), ifd)) > 0) { while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), ifd)) > 0) {
if (count == -1) { if (count == -1) {
rpmError(RPMERR_READERROR, _("Unable to read sigtarget %s: %s"), rpmError(RPMERR_READ, _("Unable to read sigtarget %s: %s"),
sigtarget, Fstrerror(ifd)); sigtarget, Fstrerror(ifd));
Fclose(ifd); Fclose(ifd);
Fclose(fd); Fclose(fd);
unlink(sigtarget); unlink(sigtarget);
xfree(sigtarget); xfree(sigtarget);
unlink(fileName); unlink(fileName);
return RPMERR_READERROR; return RPMERR_READ;
} }
if (Fwrite(buf, sizeof(buf[0]), count, fd) < 0) { if (Fwrite(buf, sizeof(buf[0]), count, fd) < 0) {
rpmError(RPMERR_NOSPACE, _("Unable to write package %s: %s"), rpmError(RPMERR_NOSPACE, _("Unable to write package %s: %s"),

View File

@ -77,29 +77,55 @@ typedef enum rpmParseState_e {
extern "C" { extern "C" {
#endif #endif
/* from build/names.h */ /**
* Destroy uid/gid caches.
/** */ */
void freeNames(void); void freeNames(void);
/** */ /**
* Return cached user name from user id.
* @todo Implement using hash.
* @param user id
* @return cached user name
*/
/*@observer@*/ const char *getUname(uid_t uid); /*@observer@*/ const char *getUname(uid_t uid);
/** */ /**
* Return cached user name.
* @todo Implement using hash.
* @param user name
* @return cached user name
*/
/*@observer@*/ const char *getUnameS(const char *uname); /*@observer@*/ const char *getUnameS(const char *uname);
/** */ /**
* Return cached group name from group id.
* @todo Implement using hash.
* @param group id
* @return cached group name
*/
/*@observer@*/ const char *getGname(gid_t gid); /*@observer@*/ const char *getGname(gid_t gid);
/** */ /**
* Return cached group name.
* @todo Implement using hash.
* @param group name
* @return cached group name
*/
/*@observer@*/ const char *getGnameS(const char *gname); /*@observer@*/ const char *getGnameS(const char *gname);
/** */ /**
/*@observer@*/ const char *const buildHost(void); * Return build time stamp.
* @return build time stamp
/** */ */
/*@observer@*/ time_t *const getBuildTime(void); /*@observer@*/ time_t *const getBuildTime(void);
/**
* Return build hostname.
* @return build hostname
*/
/*@observer@*/ const char *const buildHost(void);
/* from build/read.h */ /* from build/read.h */
/** /**

View File

@ -916,7 +916,7 @@ SYSCONFIGDIR="`echo /etc/rpm`"
AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR") AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR")
AC_SUBST(SYSCONFIGDIR) AC_SUBST(SYSCONFIGDIR)
MACROFILES="${RPMCONFIGDIR}/macros:${RPMCONFIGDIR}/%{_target}/macros:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/macros.specspo:${SYSCONFIGDIR}/%{_target}/macros:~/.rpmmacros" MACROFILES="${RPMCONFIGDIR}/macros:${RPMCONFIGDIR}/%{_target_platform}/macros:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/macros.specspo:${SYSCONFIGDIR}/%{_target_platform}/macros:~/.rpmmacros"
AC_DEFINE_UNQUOTED(MACROFILES, "$MACROFILES") AC_DEFINE_UNQUOTED(MACROFILES, "$MACROFILES")
AC_SUBST(MACROFILES) AC_SUBST(MACROFILES)

View File

@ -435,7 +435,10 @@ void headerCopyTags(Header headerFrom, Header headerTo, int_32 *tagstocopy)
#define RPM_MIN_TYPE 0 #define RPM_MIN_TYPE 0
enum tagTypes { /**
* @todo Add RPM_XREF_TYPE to carry (hdrNum,tagNum,valNum) cross reference.
*/
typedef enum rpmTagType_e {
RPM_NULL_TYPE = 0, RPM_NULL_TYPE = 0,
RPM_CHAR_TYPE = 1, RPM_CHAR_TYPE = 1,
RPM_INT8_TYPE = 2, RPM_INT8_TYPE = 2,
@ -446,7 +449,7 @@ enum tagTypes {
RPM_BIN_TYPE = 7, RPM_BIN_TYPE = 7,
RPM_STRING_ARRAY_TYPE = 8, RPM_STRING_ARRAY_TYPE = 8,
RPM_I18NSTRING_TYPE = 9 RPM_I18NSTRING_TYPE = 9
}; } rpmTagType;
#define RPM_MAX_TYPE 9 #define RPM_MAX_TYPE 9

View File

@ -97,6 +97,7 @@ static void * showProgress(const void * arg, const rpmCallbackType what,
return rc; return rc;
} }
/** @todo Generalize --freshen policies. */
int rpmInstall(const char * rootdir, const char ** fileArgv, int rpmInstall(const char * rootdir, const char ** fileArgv,
rpmtransFlags transFlags, rpmtransFlags transFlags,
rpmInstallInterfaceFlags interfaceFlags, rpmInstallInterfaceFlags interfaceFlags,

View File

@ -49,7 +49,7 @@ int writeLead(FD_t fd, struct rpmlead *lead)
int readLead(FD_t fd, struct rpmlead *lead) int readLead(FD_t fd, struct rpmlead *lead)
{ {
if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) { if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) {
rpmError(RPMERR_READERROR, _("read failed: %s (%d)"), Fstrerror(fd), rpmError(RPMERR_READ, _("read failed: %s (%d)"), Fstrerror(fd),
errno); errno);
return 1; return 1;
} }

View File

@ -339,8 +339,8 @@ typedef enum rpmsenseFlags_e {
/* ==================================================================== */ /* ==================================================================== */
/** \name RPMRC */ /** \name RPMRC */
/*@{*/ /*@{*/
/* Stuff for maintaining "variables" like SOURCEDIR, BUILDDIR, etc */
/* Stuff for maintaining "variables" like SOURCEDIR, BUILDDIR, etc */
#define RPMVAR_OPTFLAGS 3 #define RPMVAR_OPTFLAGS 3
#define RPMVAR_PROVIDES 38 #define RPMVAR_PROVIDES 38
#define RPMVAR_INCLUDE 43 #define RPMVAR_INCLUDE 43
@ -349,18 +349,9 @@ typedef enum rpmsenseFlags_e {
#define RPMVAR_NUM 55 /* number of RPMVAR entries */ #define RPMVAR_NUM 55 /* number of RPMVAR entries */
/** \ingroup rpmrc /** \ingroup rpmrc
* Return value of rpmrc variable. * List of macro files to read for configuring rpm.
* @deprecated Use rpmExpand() with appropriate macro expression.
* @todo Eliminate from API.
*/ */
const char * rpmGetVar(int var); const char * macrofiles;
/** \ingroup rpmrc
* Set value of rpmrc variable.
* @deprecated Use rpmDefineMacro() to change appropriate macro instead.
* @todo Eliminate from API.
*/
void rpmSetVar(int var, const char *val);
/** \ingroup rpmrc /** \ingroup rpmrc
* Build and install arch/os table identifiers. * Build and install arch/os table identifiers.
@ -375,20 +366,13 @@ enum rpm_machtable_e {
#define RPM_MACHTABLE_COUNT 4 /* number of arch/os tables */ #define RPM_MACHTABLE_COUNT 4 /* number of arch/os tables */
/** \ingroup rpmrc /** \ingroup rpmrc
* Read rpmrc (and macro) configuration file(s) for a target. * Read macro configuration file(s) for a target.
* @param file colon separated files to read (NULL uses default) * @param file colon separated files to read (NULL uses default)
* @param target target platform (NULL uses default) * @param target target platform (NULL uses default)
* @return 0 on success, -1 on error * @return 0 on success, -1 on error
*/ */
int rpmReadConfigFiles(const char * file, const char * target); int rpmReadConfigFiles(const char * file, const char * target);
/** \ingroup rpmrc
* Read rpmrc (and macro) configuration file(s).
* @param file colon separated files to read (NULL uses default)
* @return 0 on succes
*/
int rpmReadRC(const char * file);
/** \ingroup rpmrc /** \ingroup rpmrc
* Return current arch name and/or number. * Return current arch name and/or number.
* @todo Generalize to extract arch component from target_platform macro. * @todo Generalize to extract arch component from target_platform macro.
@ -396,6 +380,10 @@ int rpmReadRC(const char * file);
* @retval num address of arch number (or NULL) * @retval num address of arch number (or NULL)
*/ */
void rpmGetArchInfo( /*@out@*/ const char ** name, /*@out@*/ int * num); void rpmGetArchInfo( /*@out@*/ const char ** name, /*@out@*/ int * num);
void XrpmGetArchInfo( /*@out@*/ const char ** name, /*@out@*/ int * num,
const char * _f, unsigned _l);
#define rpmGetArchInfo(_name, _num) \
XrpmGetArchInfo(_name, _num, __FILE__, __LINE__)
/** \ingroup rpmrc /** \ingroup rpmrc
* Return current os name and/or number. * Return current os name and/or number.
@ -404,6 +392,10 @@ void rpmGetArchInfo( /*@out@*/ const char ** name, /*@out@*/ int * num);
* @retval num address of os number (or NULL) * @retval num address of os number (or NULL)
*/ */
void rpmGetOsInfo( /*@out@*/ const char ** name, /*@out@*/ int * num); void rpmGetOsInfo( /*@out@*/ const char ** name, /*@out@*/ int * num);
void XrpmGetOsInfo( /*@out@*/ const char ** name, /*@out@*/ int * num,
const char * _f, unsigned _l);
#define rpmGetOsInfo(_name, _num) \
XrpmGetOsInfo(_name, _num, __FILE__, __LINE__)
/** \ingroup rpmrc /** \ingroup rpmrc
* Return arch/os score of a name. * Return arch/os score of a name.
@ -419,6 +411,9 @@ void rpmGetOsInfo( /*@out@*/ const char ** name, /*@out@*/ int * num);
* @return arch score * @return arch score
*/ */
int rpmMachineScore(int type, const char * name); int rpmMachineScore(int type, const char * name);
int XrpmMachineScore(int type, const char * name, const char *_f, unsigned _l);
#define rpmMachineScore(_type, _name) \
XrpmMachineScore(_type, _name, __FILE__, __LINE__)
/** \ingroup rpmrc /** \ingroup rpmrc
* Display current rpmrc (and macro) configuration. * Display current rpmrc (and macro) configuration.
@ -446,6 +441,10 @@ void rpmSetTables(int archTable, int osTable); /* only used by build code */
* @param os os name (or NULL) * @param os os name (or NULL)
*/ */
void rpmSetMachine(const char * arch, const char * os); void rpmSetMachine(const char * arch, const char * os);
void XrpmSetMachine( /*@out@*/ const char *arch, /*@out@*/ const char *os,
const char *_f, unsigned _l);
#define rpmSetMachine(_arch, _os) \
XrpmSetMachine(_arch, _os, __FILE__, __LINE__)
/** \ingroup rpmrc /** \ingroup rpmrc
* Return current arch/os names. * Return current arch/os names.
@ -456,6 +455,10 @@ void rpmSetMachine(const char * arch, const char * os);
* @retval os address of os name (or NULL) * @retval os address of os name (or NULL)
*/ */
void rpmGetMachine( /*@out@*/ const char **arch, /*@out@*/ const char **os); void rpmGetMachine( /*@out@*/ const char **arch, /*@out@*/ const char **os);
void XrpmGetMachine( /*@out@*/ const char **arch, /*@out@*/ const char **os,
const char *_f, unsigned _l);
#define rpmGetMachine(_arch, _os) \
XrpmGetMachine(_arch, _os, __FILE__, __LINE__)
/** \ingroup rpmrc /** \ingroup rpmrc
* Destroy rpmrc arch/os compatibility tables. * Destroy rpmrc arch/os compatibility tables.

View File

@ -55,44 +55,44 @@ static struct _os_canon {
{ NULL, 0 } { NULL, 0 }
}; };
static const char *macrofiles = MACROFILES; const char *macrofiles = MACROFILES;
#ifndef DYING #ifndef DYING
const char *rpmGetVar(int var)
{
return NULL;
}
void rpmGetArchInfo(const char ** name, int * num) void XrpmGetArchInfo(const char ** name, int * num, const char *_f, unsigned _l)
{ {
fprintf(stderr, "*** rpmGetArchInfo(%p,%p)\n", name, num); fprintf(stderr, "*** rpmGetArchInfo(%p,%p) %s:%u\n", name, num, _f, _l);
if (name) if (name)
*name = rpmExpand("%{_target_cpu}", NULL); *name = rpmExpand("%{_target_cpu}", NULL);
} }
void rpmGetOsInfo(const char ** name, int * num) void XrpmGetOsInfo(const char ** name, int * num, const char *_f, unsigned _l)
{ {
fprintf(stderr, "*** rpmGetOsInfo(%p,%p)\n", name, num); fprintf(stderr, "*** rpmGetOsInfo(%p,%p) %s:%u\n", name, num, _f, _l);
if (name) if (name)
*name = rpmExpand("%{_target_os}", NULL); *name = rpmExpand("%{_target_os}", NULL);
} }
void rpmGetMachine(const char **arch, const char **os) void XrpmGetMachine(const char **arch, const char **os, const char *_f, unsigned _l)
{ {
fprintf(stderr, "*** rpmGetMachine(%p,%p) %s:%u\n", arch, os, _f, _l);
} }
void rpmSetMachine(const char * arch, const char * os) void XrpmSetMachine(const char * arch, const char * os, const char *_f, unsigned _l)
{ {
fprintf(stderr, "*** rpmSetMachine(%p,%p) %s:%u\n", arch, os, _f, _l);
} }
#endif #endif
int rpmMachineScore(int type, const char * name) int XrpmMachineScore(int type, const char * name, const char * _f, unsigned _l)
{ {
fprintf(stderr, "*** rpmMachineScore(%d,\"%s\") %s:%u\n", type, name, _f, _l);
return 0; return 0;
} }
void rpmFreeRpmrc(void) void rpmFreeRpmrc(void)
{ {
fprintf(stderr, "*** rpmFreeRpmrc()\n");
} }
static void defaultMachine(/*@out@*/ char ** arch, /*@out@*/ char ** os) static void defaultMachine(/*@out@*/ char ** arch, /*@out@*/ char ** os)
@ -218,7 +218,6 @@ fprintf(stderr, "*** _target: \"%s\"\n", *ct);
int rpmReadConfigFiles(const char * mfiles, const char * target) int rpmReadConfigFiles(const char * mfiles, const char * target)
{ {
fprintf(stderr, "*** rpmReadConfigFiles(%s,%s) %s\n", mfiles, target, macrofiles);
if (mfiles == NULL) if (mfiles == NULL)
mfiles = macrofiles; mfiles = macrofiles;
@ -227,11 +226,14 @@ fprintf(stderr, "*** rpmReadConfigFiles(%s,%s) %s\n", mfiles, target, macrofiles
if (mfiles) { if (mfiles) {
mfiles = rpmExpand(mfiles, NULL); mfiles = rpmExpand(mfiles, NULL);
fprintf(stderr, "*** rpmInitMacros(NULL,\"%s\")\n", mfiles);
rpmInitMacros(NULL, mfiles); rpmInitMacros(NULL, mfiles);
xfree(mfiles); xfree(mfiles);
#ifdef DYING
/* Reset target macros */ /* Reset target macros */
rpmRebuildTargetVars(&target); rpmRebuildTargetVars(&target);
#endif
} }
return 0; return 0;
@ -239,5 +241,6 @@ fprintf(stderr, "*** rpmReadConfigFiles(%s,%s) %s\n", mfiles, target, macrofiles
int rpmShowRC(FILE *fp) int rpmShowRC(FILE *fp)
{ {
fprintf(stderr, "*** rpmShowRC(%p)\n", fp);
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
# $Id: macros.in,v 1.67 2000/08/28 15:25:04 jbj Exp $ # $Id: macros.in,v 1.68 2000/09/01 21:15:41 jbj Exp $
# #
# This is a global RPM configuration file. All changes made here will # This is a global RPM configuration file. All changes made here will
# be lost when the rpm package is upgraded. Any per-system configuration # be lost when the rpm package is upgraded. Any per-system configuration
@ -274,10 +274,13 @@
%_vendor @RPMCANONVENDOR@ %_vendor @RPMCANONVENDOR@
%_os @RPMCANONOS@ %_os @RPMCANONOS@
%_target_platform %{_target_cpu}-%{_vendor}-%{_target_os} %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
#
# XXX use the rpmrc instantiated macro for now
#%optflags -O2
#
# Define a generic value for optflags. Normally overridden by per-target macros.
%optflags -O2
#
# Define per-arch and per-os defaults. Normally overridden by per-target macros.
%__arch_install_post %{nil} %__arch_install_post %{nil}
%__os_install_post %{___build_post} %__os_install_post %{___build_post}
@ -500,7 +503,7 @@ cd %{u2p:%{_builddir}}\
# gotcha is that arguments, if present, should be on the same line as the # gotcha is that arguments, if present, should be on the same line as the
# %configure. # %configure.
# #
# This is the version of %configure used throuugh rpm-3.0.4. # This is the version of %configure used through rpm-3.0.4.
#%configure \ #%configure \
# %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \ # %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
# CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} # CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}

948
po/cs.po

File diff suppressed because it is too large Load Diff

948
po/da.po

File diff suppressed because it is too large Load Diff

923
po/de.po

File diff suppressed because it is too large Load Diff

925
po/es.po

File diff suppressed because it is too large Load Diff

912
po/fi.po

File diff suppressed because it is too large Load Diff

965
po/fr.po

File diff suppressed because it is too large Load Diff

925
po/gl.po

File diff suppressed because it is too large Load Diff

925
po/hu.po

File diff suppressed because it is too large Load Diff

925
po/id.po

File diff suppressed because it is too large Load Diff

957
po/is.po

File diff suppressed because it is too large Load Diff

925
po/it.po

File diff suppressed because it is too large Load Diff

953
po/ja.po

File diff suppressed because it is too large Load Diff

925
po/ko.po

File diff suppressed because it is too large Load Diff

960
po/no.po

File diff suppressed because it is too large Load Diff

935
po/pl.po

File diff suppressed because it is too large Load Diff

929
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

925
po/ro.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

947
po/ru.po

File diff suppressed because it is too large Load Diff

936
po/sk.po

File diff suppressed because it is too large Load Diff

940
po/sl.po

File diff suppressed because it is too large Load Diff

932
po/sr.po

File diff suppressed because it is too large Load Diff

948
po/sv.po

File diff suppressed because it is too large Load Diff

923
po/tr.po

File diff suppressed because it is too large Load Diff

925
po/uk.po

File diff suppressed because it is too large Load Diff

925
po/wa.po

File diff suppressed because it is too large Load Diff

925
po/zh.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

10
rpm.c
View File

@ -17,6 +17,7 @@
#define GETOPT_EXCLUDEPATH 1019 #define GETOPT_EXCLUDEPATH 1019
#define GETOPT_DEFINEMACRO 1020 #define GETOPT_DEFINEMACRO 1020
#define GETOPT_EVALMACRO 1021 #define GETOPT_EVALMACRO 1021
#define GETOPT_RCFILE 1022
enum modes { enum modes {
MODE_UNKNOWN = 0, MODE_UNKNOWN = 0,
@ -123,6 +124,7 @@ static struct poptOption optionsTable[] = {
/* info and install both using 'i' is dumb */ /* info and install both using 'i' is dumb */
{ "install", '\0', 0, 0, GETOPT_INSTALL, NULL, NULL}, { "install", '\0', 0, 0, GETOPT_INSTALL, NULL, NULL},
{ "justdb", '\0', 0, &justdb, 0, NULL, NULL}, { "justdb", '\0', 0, &justdb, 0, NULL, NULL},
{ "macros", '\0', POPT_ARG_STRING, &macrofiles, 0, NULL, NULL},
{ "nodeps", '\0', 0, &noDeps, 0, NULL, NULL}, { "nodeps", '\0', 0, &noDeps, 0, NULL, NULL},
{ "nodirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 1, NULL, NULL}, { "nodirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 1, NULL, NULL},
{ "nogpg", '\0', 0, &noGpg, 0, NULL, NULL}, { "nogpg", '\0', 0, &noGpg, 0, NULL, NULL},
@ -139,7 +141,7 @@ static struct poptOption optionsTable[] = {
{ "pipe", '\0', POPT_ARG_STRING, &pipeOutput, 0, NULL, NULL}, { "pipe", '\0', POPT_ARG_STRING, &pipeOutput, 0, NULL, NULL},
{ "prefix", '\0', POPT_ARG_STRING, &prefix, 0, NULL, NULL}, { "prefix", '\0', POPT_ARG_STRING, &prefix, 0, NULL, NULL},
{ "quiet", '\0', 0, &quiet, 0, NULL, NULL}, { "quiet", '\0', 0, &quiet, 0, NULL, NULL},
{ "rcfile", '\0', POPT_ARG_STRING, &rcfile, 0, NULL, NULL}, { "rcfile", '\0', 0, 0, GETOPT_RCFILE, NULL, NULL},
{ "rebuilddb", '\0', 0, 0, GETOPT_REBUILDDB, NULL, NULL}, { "rebuilddb", '\0', 0, 0, GETOPT_REBUILDDB, NULL, NULL},
{ "relocate", '\0', POPT_ARG_STRING, 0, GETOPT_RELOCATE, NULL, NULL}, { "relocate", '\0', POPT_ARG_STRING, 0, GETOPT_RELOCATE, NULL, NULL},
{ "replacefiles", '\0', 0, &replaceFiles, 0, NULL, NULL}, { "replacefiles", '\0', 0, &replaceFiles, 0, NULL, NULL},
@ -776,6 +778,12 @@ int main(int argc, const char ** argv)
relocations[numRelocations++].newPath = NULL; relocations[numRelocations++].newPath = NULL;
break; break;
case GETOPT_RCFILE:
fprintf(stderr, _("The --rcfile option has been eliminated.\n"));
fprintf(stderr, _("Use --macros with a colon separated list of macro files to read.\n"));
exit(EXIT_FAILURE);
/*@notreached@*/ break;
default: default:
fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg); fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

View File

@ -55,14 +55,17 @@ typedef FILE * FD_t;
struct MacroContext rpmGlobalMacroContext; struct MacroContext rpmGlobalMacroContext;
struct MacroContext rpmCLIMacroContext; struct MacroContext rpmCLIMacroContext;
/**
* Macro expansion data structure.
*/
typedef struct MacroBuf { typedef struct MacroBuf {
const char *s; /* text to expand */ const char *s; /*!< Text to expand. */
char *t; /* expansion buffer */ char *t; /*!< Expansion buffer. */
size_t nb; /* no. bytes remaining in expansion buffer */ size_t nb; /*!< No. bytes remaining in expansion buffer. */
int depth; /* current expansion depth */ int depth; /*!< Current expansion depth. */
int macro_trace; /* pre-print macro to expand? */ int macro_trace; /*!< Pre-print macro to expand? */
int expand_trace; /* post-print macro expansion? */ int expand_trace; /*!< Post-print macro expansion? */
void *spec; /* (future) %file expansion info */ void *spec; /*!< (future) %file expansion info. */
MacroContext *mc; MacroContext *mc;
} MacroBuf; } MacroBuf;
@ -837,8 +840,10 @@ doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t
} }
} }
/* The main recursion engine */ /**
* The main recursion engine.
* @todo Dynamically reallocate target buffer.
*/
static int static int
expandMacro(MacroBuf *mb) expandMacro(MacroBuf *mb)
{ {

View File

@ -60,7 +60,7 @@ typedef enum rpmerrCode_e {
RPMERR_UNMATCHEDIF = _em(107), /*!< unclosed %ifarch or %ifos */ RPMERR_UNMATCHEDIF = _em(107), /*!< unclosed %ifarch or %ifos */
RPMERR_BADARG = _em(109), /*!< @todo Document. */ RPMERR_BADARG = _em(109), /*!< @todo Document. */
RPMERR_SCRIPT = _em(110), /*!< errors related to script exec */ RPMERR_SCRIPT = _em(110), /*!< errors related to script exec */
RPMERR_READERROR = _em(111), /*!< @todo Document. */ RPMERR_READ = _em(111), /*!< @todo Document. */
RPMERR_UNKNOWNOS = _em(112), /*!< @todo Document. */ RPMERR_UNKNOWNOS = _em(112), /*!< @todo Document. */
RPMERR_UNKNOWNARCH = _em(113), /*!< @todo Document. */ RPMERR_UNKNOWNARCH = _em(113), /*!< @todo Document. */
RPMERR_EXEC = _em(114), /*!< @todo Document. */ RPMERR_EXEC = _em(114), /*!< @todo Document. */
@ -70,6 +70,9 @@ typedef enum rpmerrCode_e {
RPMERR_BADSPEC = _em(118), /*!< @todo Document. */ RPMERR_BADSPEC = _em(118), /*!< @todo Document. */
RPMERR_LDD = _em(119), /*!< couldn't understand ldd output */ RPMERR_LDD = _em(119), /*!< couldn't understand ldd output */
RPMERR_BADFILENAME = _em(120), /*!< @todo Document. */ RPMERR_BADFILENAME = _em(120), /*!< @todo Document. */
RPMERR_OPEN = _em(121), /*!< @todo Document. */
RPMERR_POPEN = _em(122), /*!< @todo Document. */
RPMERR_NOTREG = _em(122), /*!< File %s is not a regular file */
RPMERR_BADSIGTYPE = _em(200), /*!< Unknown signature type */ RPMERR_BADSIGTYPE = _em(200), /*!< Unknown signature type */
RPMERR_SIGGEN = _em(201) /*!< Error generating signature */ RPMERR_SIGGEN = _em(201) /*!< Error generating signature */
@ -78,6 +81,10 @@ typedef enum rpmerrCode_e {
/** /**
* Retrofit rpmError() onto rpmlog sub-system. * Retrofit rpmError() onto rpmlog sub-system.
*/ */
#define rpmError rpmlog #define rpmError rpmlog
#define rpmErrorString() rpmlogMessage()
#define rpmErrorSetCallback(_cb) rpmlogSetCallback(_cb)
typedef rpmlogCallback rpmErrorCallBackType;
#endif /* H_RPMERR */ #endif /* H_RPMERR */

View File

@ -39,32 +39,75 @@ typedef /*@abstract@*/ struct MacroContext {
extern "C" { extern "C" {
#endif #endif
/**
*/
void rpmDumpMacroTable (MacroContext * mc, FILE * fp); void rpmDumpMacroTable (MacroContext * mc, FILE * fp);
/* XXX this is used only in build/expression.c and will go away. */ /**
* @deprecated Used only in build/expression.c.
* @todo Eliminate.
*/
const char *getMacroBody (MacroContext *mc, const char *name); const char *getMacroBody (MacroContext *mc, const char *name);
/**
* @deprecated Use rpmExpand().
* @todo Eliminate from API.
*/
int expandMacros (void * spec, MacroContext * mc, char * sbuf, int expandMacros (void * spec, MacroContext * mc, char * sbuf,
size_t sbuflen); size_t sbuflen);
/**
*/
void addMacro (MacroContext * mc, const char * n, const char * o, void addMacro (MacroContext * mc, const char * n, const char * o,
const char * b, int depth); const char * b, int depth);
/**
*/
void delMacro (MacroContext * mc, const char * n); void delMacro (MacroContext * mc, const char * n);
/**
*/
int rpmDefineMacro (MacroContext * mc, const char * macro, int level); int rpmDefineMacro (MacroContext * mc, const char * macro, int level);
/**
*/
void rpmLoadMacros (MacroContext *mc, int level); void rpmLoadMacros (MacroContext *mc, int level);
/**
*/
void rpmInitMacros (MacroContext * mc, const char * macrofiles); void rpmInitMacros (MacroContext * mc, const char * macrofiles);
/**
*/
void rpmFreeMacros (MacroContext * mc); void rpmFreeMacros (MacroContext * mc);
#define COMPRESSED_NOT 0 #define COMPRESSED_NOT 0
#define COMPRESSED_OTHER 1 #define COMPRESSED_OTHER 1
#define COMPRESSED_BZIP2 2 #define COMPRESSED_BZIP2 2
/**
*/
int isCompressed (const char * file, int * compressed); int isCompressed (const char * file, int * compressed);
/**
*/
char * rpmExpand (const char * arg, ...); char * rpmExpand (const char * arg, ...);
/**
*/
char * rpmCleanPath (char * path); char * rpmCleanPath (char * path);
/**
*/
const char *rpmGetPath (const char * path, ...); const char *rpmGetPath (const char * path, ...);
/**
*/
const char *rpmGenPath (const char * root, const char * mdir, const char *rpmGenPath (const char * root, const char * mdir,
const char * file); const char * file);
/**
*/
int rpmExpandNumeric (const char * arg); int rpmExpandNumeric (const char * arg);
#ifdef __cplusplus #ifdef __cplusplus

52
rpmqv.c
View File

@ -61,6 +61,7 @@ static int noPgp = 0;
#define GETOPT_SHOWRC 1018 #define GETOPT_SHOWRC 1018
#define GETOPT_DEFINEMACRO 1020 #define GETOPT_DEFINEMACRO 1020
#define GETOPT_EVALMACRO 1021 #define GETOPT_EVALMACRO 1021
#define GETOPT_RCFILE 1022
enum modes { enum modes {
@ -147,8 +148,10 @@ static struct poptOption optionsTable[] = {
{ "quiet", '\0', 0, &quiet, 0, NULL, NULL}, { "quiet", '\0', 0, &quiet, 0, NULL, NULL},
{ "verbose", 'v', 0, 0, 'v', NULL, NULL}, { "verbose", 'v', 0, 0, 'v', NULL, NULL},
{ "define", '\0', POPT_ARG_STRING, 0, GETOPT_DEFINEMACRO,NULL, NULL}, { "define", '\0', POPT_ARG_STRING, 0, GETOPT_DEFINEMACRO,
{ "eval", '\0', POPT_ARG_STRING, 0, GETOPT_EVALMACRO, NULL, NULL}, N_("define macro <name> with value <body>"), N_("'<name> <body>'") },
{ "eval", '\0', POPT_ARG_STRING, 0, GETOPT_EVALMACRO,
N_("print macro expansion to stdout"), N_("<expr>+") },
{ "nodirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 1, NULL, NULL}, { "nodirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 1, NULL, NULL},
{ "dirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 0, NULL, NULL}, { "dirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 0, NULL, NULL},
@ -172,7 +175,10 @@ static struct poptOption optionsTable[] = {
{ "pipe", '\0', POPT_ARG_STRING, &pipeOutput, 0, NULL, NULL}, { "pipe", '\0', POPT_ARG_STRING, &pipeOutput, 0, NULL, NULL},
{ "root", 'r', POPT_ARG_STRING, &rootdir, 0, NULL, NULL}, { "root", 'r', POPT_ARG_STRING, &rootdir, 0, NULL, NULL},
{ "rcfile", '\0', POPT_ARG_STRING, &rcfile, 0, NULL, NULL}, { "macros", '\0', POPT_ARG_STRING, &macrofiles, 0,
N_("read <file:...> instead of default macro file(s)"),
N_("<file:...>") },
{ "rcfile", '\0', 0, 0, GETOPT_RCFILE, NULL, NULL},
{ "showrc", '\0', 0, &showrc, GETOPT_SHOWRC, NULL, NULL}, { "showrc", '\0', 0, &showrc, GETOPT_SHOWRC, NULL, NULL},
#if defined(IAM_RPMQV) || defined(IAM_RPMK) #if defined(IAM_RPMQV) || defined(IAM_RPMK)
@ -286,14 +292,14 @@ static void printUsage(void) {
#ifdef IAM_RPMDB #ifdef IAM_RPMDB
fprintf(fp, _(" %s {--initdb} [--dbpath <dir>]\n"), __progname); fprintf(fp, _(" %s {--initdb} [--dbpath <dir>]\n"), __progname);
fprintf(fp, _(" %s {--rebuilddb} [--rcfile <file>] [--dbpath <dir>]\n"), __progname); fprintf(fp, _(" %s {--rebuilddb} [--macros <file:...>] [--dbpath <dir>]\n"), __progname);
#endif #endif
#ifdef IAM_RPMEIU #ifdef IAM_RPMEIU
fprintf(fp, _(" %s {--install -i} [-v] [--hash -h] [--percent] [--force] [--test]\n"), __progname); fprintf(fp, _(" %s {--install -i} [-v] [--hash -h] [--percent] [--force] [--test]\n"), __progname);
puts(_(" [--replacepkgs] [--replacefiles] [--root <dir>]")); puts(_(" [--replacepkgs] [--replacefiles] [--root <dir>]"));
puts(_(" [--excludedocs] [--includedocs] [--noscripts]")); puts(_(" [--excludedocs] [--includedocs] [--noscripts]"));
puts(_(" [--rcfile <file>] [--ignorearch] [--dbpath <dir>]")); puts(_(" [--macros <file:...>] [--ignorearch] [--dbpath <dir>]"));
puts(_(" [--prefix <dir>] [--ignoreos] [--nodeps] [--allfiles]")); puts(_(" [--prefix <dir>] [--ignoreos] [--nodeps] [--allfiles]"));
puts(_(" [--ftpproxy <host>] [--ftpport <port>]")); puts(_(" [--ftpproxy <host>] [--ftpport <port>]"));
puts(_(" [--httpproxy <host>] [--httpport <port>]")); puts(_(" [--httpproxy <host>] [--httpport <port>]"));
@ -302,7 +308,7 @@ static void printUsage(void) {
puts(_(" [--ignoresize] file1.rpm ... fileN.rpm")); puts(_(" [--ignoresize] file1.rpm ... fileN.rpm"));
fprintf(fp, (" %s {--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test]\n"), __progname); fprintf(fp, (" %s {--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test]\n"), __progname);
puts(_(" [--oldpackage] [--root <dir>] [--noscripts]")); puts(_(" [--oldpackage] [--root <dir>] [--noscripts]"));
puts(_(" [--excludedocs] [--includedocs] [--rcfile <file>]")); puts(_(" [--excludedocs] [--includedocs] [--macros <file:...>]"));
puts(_(" [--ignorearch] [--dbpath <dir>] [--prefix <dir>] ")); puts(_(" [--ignorearch] [--dbpath <dir>] [--prefix <dir>] "));
puts(_(" [--ftpproxy <host>] [--ftpport <port>]")); puts(_(" [--ftpproxy <host>] [--ftpport <port>]"));
puts(_(" [--httpproxy <host>] [--httpport <port>]")); puts(_(" [--httpproxy <host>] [--httpport <port>]"));
@ -310,21 +316,21 @@ static void printUsage(void) {
puts(_(" [--noorder] [--relocate oldpath=newpath]")); puts(_(" [--noorder] [--relocate oldpath=newpath]"));
puts(_(" [--badreloc] [--excludepath <path>] [--ignoresize]")); puts(_(" [--badreloc] [--excludepath <path>] [--ignoresize]"));
puts(_(" file1.rpm ... fileN.rpm")); puts(_(" file1.rpm ... fileN.rpm"));
fprintf(fp, _(" %s {--erase -e} [--root <dir>] [--noscripts] [--rcfile <file>]\n"), __progname); fprintf(fp, _(" %s {--erase -e} [--root <dir>] [--noscripts] [--macros <file:...>]\n"), __progname);
puts(_(" [--dbpath <dir>] [--nodeps] [--allmatches]")); puts(_(" [--dbpath <dir>] [--nodeps] [--allmatches]"));
puts(_(" [--justdb] [--notriggers] package1 ... packageN")); puts(_(" [--justdb] [--notriggers] package1 ... packageN"));
#endif /* IAM_RPMEIU */ #endif /* IAM_RPMEIU */
#ifdef IAM_RPMQV #ifdef IAM_RPMQV
fprintf(fp, (" %s {--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R]\n"), __progname); fprintf(fp, (" %s {--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R]\n"), __progname);
puts(_(" [--scripts] [--root <dir>] [--rcfile <file>]")); puts(_(" [--scripts] [--root <dir>] [--macros <file:...>]"));
puts(_(" [--whatprovides] [--whatrequires] [--requires]")); puts(_(" [--whatprovides] [--whatrequires] [--requires]"));
puts(_(" [--triggeredby]")); puts(_(" [--triggeredby]"));
puts(_(" [--ftpproxy <host>] [--ftpport <port>]")); puts(_(" [--ftpproxy <host>] [--ftpport <port>]"));
puts(_(" [--httpproxy <host>] [--httpport <port>]")); puts(_(" [--httpproxy <host>] [--httpport <port>]"));
puts(_(" [--provides] [--triggers] [--dump]")); puts(_(" [--provides] [--triggers] [--dump]"));
puts(_(" [--changelog] [--dbpath <dir>] [targets]")); puts(_(" [--changelog] [--dbpath <dir>] [targets]"));
fprintf(fp, _(" %s {--verify -V -y} [-afpg] [--root <dir>] [--rcfile <file>]\n"), __progname); fprintf(fp, _(" %s {--verify -V -y} [-afpg] [--root <dir>] [--macros <file:...>]\n"), __progname);
puts(_(" [--dbpath <dir>] [--nodeps] [--nofiles] [--noscripts]")); puts(_(" [--dbpath <dir>] [--nodeps] [--nofiles] [--noscripts]"));
puts(_(" [--nomd5] [targets]")); puts(_(" [--nomd5] [targets]"));
fprintf(fp, (" %s {--querytags}\n"), __progname); fprintf(fp, (" %s {--querytags}\n"), __progname);
@ -333,20 +339,20 @@ static void printUsage(void) {
#endif /* IAM_RPMQV */ #endif /* IAM_RPMQV */
#ifdef IAM_RPMBT #ifdef IAM_RPMBT
fprintf(fp, _(" %s {-b|t}[plcibas] [-v] [--short-circuit] [--clean] [--rcfile <file>]\n"), __progname); fprintf(fp, _(" %s {-b|t}[plcibas] [-v] [--short-circuit] [--clean] [--macros <file:...>]\n"), __progname);
puts( (" [--sign] [--nobuild] ]")); puts( (" [--sign] [--nobuild] ]"));
puts(_(" [--target=platform1[,platform2...]]")); puts(_(" [--target=platform1[,platform2...]]"));
puts(_(" [--rmsource] [--rmspec] specfile")); puts(_(" [--rmsource] [--rmspec] specfile"));
fprintf(fp, _(" %s {--rmsource} [--rcfile <file>] [-v] specfile\n"), __progname); fprintf(fp, _(" %s {--rmsource} [--macros <file:...>] [-v] specfile\n"), __progname);
fprintf(fp, _(" %s {--rebuild} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm\n"), __progname); fprintf(fp, _(" %s {--rebuild} [--macros <file:...>] [-v] source1.rpm ... sourceN.rpm\n"), __progname);
fprintf(fp, _(" %s {--recompile} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm\n"), __progname); fprintf(fp, _(" %s {--recompile} [--macros <file:...>] [-v] source1.rpm ... sourceN.rpm\n"), __progname);
fprintf(fp, _(" %s {--freshen -F} file1.rpm ... fileN.rpm\n"), __progname); fprintf(fp, _(" %s {--freshen -F} file1.rpm ... fileN.rpm\n"), __progname);
#endif /* IAM_RPMBT */ #endif /* IAM_RPMBT */
#ifdef IAM_RPMK #ifdef IAM_RPMK
fprintf(fp, _(" %s {--resign} [--rcfile <file>] package1 package2 ... packageN\n"), __progname); fprintf(fp, _(" %s {--resign} [--macros <file:...>] package1 package2 ... packageN\n"), __progname);
fprintf(fp, _(" %s {--addsign} [--rcfile <file>] package1 package2 ... packageN"), __progname); fprintf(fp, _(" %s {--addsign} [--macros <file:...>] package1 package2 ... packageN"), __progname);
fprintf(fp, _(" %s {--checksig -K} [--nopgp] [--nogpg] [--nomd5] [--rcfile <file>]\n"), __progname); fprintf(fp, _(" %s {--checksig -K} [--nopgp] [--nogpg] [--nomd5] [--macros <file:...>]\n"), __progname);
puts(_(" package1 ... packageN")); puts(_(" package1 ... packageN"));
#endif /* IAM_RPMK */ #endif /* IAM_RPMK */
@ -393,12 +399,12 @@ static void printHelp(void) {
puts( _(" All modes support the following options:")); puts( _(" All modes support the following options:"));
printHelpLine(_(" --define '<name> <body>'"), printHelpLine(_(" --define '<name> <body>'"),
_("define macro <name> with value <body>")); _("define macro <name> with value <body>"));
printHelpLine(_(" --eval '<name>+' "), printHelpLine(_(" --eval '<expr>+' "),
_("print the expansion of macro <name> to stdout")); _("print the expansion of macro <expr> to stdout"));
printHelpLine(_(" --pipe <cmd> "), printHelpLine(_(" --pipe <cmd> "),
_("send stdout to <cmd>")); _("send stdout to <cmd>"));
printHelpLine(_(" --rcfile <file> "), printHelpLine(_(" --macros <file:...> "),
_("use <file> instead of /etc/rpmrc and $HOME/.rpmrc")); _("use <file:...> instead of default list of macro files"));
printHelpLine( " --showrc ", printHelpLine( " --showrc ",
_("display final rpmrc and macro configuration")); _("display final rpmrc and macro configuration"));
#if defined(IAM_RPMBT) || defined(IAM_RPMDB) || defined(IAM_RPMEIU) || defined(IAM_RPMQV) #if defined(IAM_RPMBT) || defined(IAM_RPMDB) || defined(IAM_RPMEIU) || defined(IAM_RPMQV)
@ -913,6 +919,12 @@ int main(int argc, const char ** argv)
noUsageMsg = 1; noUsageMsg = 1;
} break; } break;
case GETOPT_RCFILE:
fprintf(stderr, _("The --rcfile option has been eliminated.\n"));
fprintf(stderr, _("Use \"--macros <file:...>\" instead..\n"));
exit(EXIT_FAILURE);
/*@notreached@*/ break;
default: default:
fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg); fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);