#include <getopt.h>
+#include <libintl.h>
+#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rpmlib.h"
#include "build/build.h"
+#define _(String) gettext(String)
+
char * version = VERSION;
enum modes { MODE_QUERY, MODE_INSTALL, MODE_UNINSTALL, MODE_VERIFY,
int build(char * arg, int buildAmount, char *passPhrase);
void printVersion(void) {
- printf("RPM version %s\n", version);
+ printf(_("RPM version %s\n"), version);
}
void printBanner(void) {
- puts("Copyright (C) 1995 - Red Hat Software");
- puts("This may be freely redistributed under the terms of the GNU "
- "Public License");
+ puts(_("Copyright (C) 1995 - Red Hat Software"));
+ puts(_("This may be freely redistributed under the terms of the GNU "
+ "Public License"));
}
void printUsage(void) {
printBanner();
puts("");
- puts("usage: rpm {--help}");
- puts(" rpm {--version}");
- puts(" rpm {--install -i} [-v] [--hash -h] [--percent] [--force] [--test]");
- puts(" [--replacepkgs] [--replacefiles] [--search]");
- puts(" [--root <dir>] file1.rpm ... filen.rpm");
- puts(" rpm {--upgrage -U} [-v] [--hash -h] [--percent] [--force] [--test]");
- puts(" [--search] [--oldpackage] [--root <dir>]");
- puts(" file1.rpm ... fileN.rpm");
- puts(" rpm {--query -q} [-afFpP] [-i] [-l] [-s] [-d] [-c] [-v] ");
- puts(" [--root <dir>] [targets]");
- puts(" rpm {--verify -V -y] [-afFpP] [--root <dir>] [targets]");
- puts(" rpm {--erase -e] [--root <dir>] package1 package2 ... packageN");
- puts(" rpm {-b}[plciba] [-v] [--short-circuit] [--clean] [--keep-temps]");
- puts(" [--sign] [--test] [--time-check <s>] specfile");
- puts(" rpm {--rebuild} [-v] source1.rpm source2.rpm ... sourceN.rpm");
- puts(" rpm {--where} package1 package2 ... packageN");
- puts(" rpm {--checksig} package1 package2 ... packageN");
+ puts(_("usage: rpm {--help}"));
+ puts(_(" rpm {--version}"));
+ puts(_(" rpm {--install -i} [-v] [--hash -h] [--percent] [--force] [--test]"));
+ puts(_(" [--replacepkgs] [--replacefiles] [--search]"));
+ puts(_(" [--root <dir>] file1.rpm ... filen.rpm"));
+ puts(_(" rpm {--upgrage -U} [-v] [--hash -h] [--percent] [--force] [--test]"));
+ puts(_(" [--search] [--oldpackage] [--root <dir>]"));
+ puts(_(" file1.rpm ... fileN.rpm"));
+ puts(_(" rpm {--query -q} [-afFpP] [-i] [-l] [-s] [-d] [-c] [-v] "));
+ puts(_(" [--root <dir>] [targets]"));
+ puts(_(" rpm {--verify -V -y] [-afFpP] [--root <dir>] [targets]"));
+ puts(_(" rpm {--erase -e] [--root <dir>] package1 package2 ... packageN"));
+ puts(_(" rpm {-b}[plciba] [-v] [--short-circuit] [--clean] [--keep-temps]"));
+ puts(_(" [--sign] [--test] [--time-check <s>] specfile"));
+ puts(_(" rpm {--rebuild} [-v] source1.rpm source2.rpm ... sourceN.rpm"));
+ puts(_(" rpm {--where} package1 package2 ... packageN"));
+ puts(_(" rpm {--checksig} package1 package2 ... packageN"));
}
void printHelp(void) {
printVersion();
printBanner();
- puts("");
-
- puts("usage:");
- puts(" --help - print this message");
- puts(" --version - print the version of rpm being used");
- puts(" -q - query mode");
- puts(" --root <dir> - use <dir> as the top level directory");
- puts(" Package specification options:");
- puts(" -a - query all packages");
- puts(" -f <file>+ - query package owning <file>");
- puts(" -F - like -f, but read file names from stdin");
- puts(" -p <packagefile>+ - query (uninstalled) package <packagefile>");
- puts(" -P - like -f, but read package names from stdin");
- puts(" Information selection options:");
- puts(" -i - display package information");
- puts(" -l - display package file list");
- puts(" -s - show file states (implies -l)");
- puts(" -d - list only documentation files (implies -l)");
- puts(" -c - list only configuration files (implies -l)");
- puts("");
- puts(" -V");
- puts(" -y");
- puts(" --verify - verify a package installation");
- puts(" same package specification options as -q");
- puts(" --root <dir> - use <dir> as the top level directory");
- puts("");
- puts(" --install <packagefile>");
- puts(" -i <packagefile> - install package");
- puts(" -v - be a little verbose ");
- puts(" -h");
- puts(" --hash - print hash marks as package installs (good with -v)");
- puts(" --percent - print percentages as package installs");
- puts(" --replacepkgs - reinstall if the package is already present");
- puts(" --replacefiles - install even if the package replaces installed files");
- puts(" --force - short hand for --replacepkgs --replacefiles");
- puts(" --test - don't install, but tell if it would work or not");
- puts(" --search - search the paths listed in /etc/rpmrc for rpms");
- puts(" --root <dir> - use <dir> as the top level directory");
- puts("");
- puts(" --upgrade <packagefile>");
- puts(" -U <packagefile> - upgrade package (same options as --install, plus)");
- puts(" --oldpackage - upgrade to an old version of the package (--force");
- puts(" on upgrades does this automatically)");
- puts("");
- puts(" --erase <package>");
- puts(" -e <package> - uninstall (erase) package");
- puts(" --root <dir> - use <dir> as the top level directory");
- puts("");
- puts(" -b<stage> <spec> - build package, where <stage> is one of:");
- puts(" p - prep (unpack sources and apply patches)");
- puts(" l - list check (do some cursory checks on %files)");
- puts(" c - compile (prep and compile)");
- puts(" i - install (prep, compile, install)");
- puts(" b - binary package (prep, compile, install, package)");
- puts(" a - bin/src package (prep, compile, install, package)");
- puts(" --short-circuit - skip straight to specified stage (only for c,i)");
- puts(" --clean - remove build tree when done");
- puts(" --sign - generate PGP signature");
- puts(" --keep-temps - do not delete scripts (or any temp files) in /tmp");
- puts(" --test - do not execute any stages, implies --keep-temps");
- puts(" in /tmp - useful for testing");
- puts(" --time-check <s> - set the time check to S seconds (0 disables it)");
- puts("");
- puts(" --where <pkg>+ - search paths listed in /etc/rpmrc for rpms");
- puts(" matching <pkg>");
- puts("");
- puts(" --rebuild <source_package>");
- puts(" - install source package, build binary package,");
- puts(" and remove spec file, sources, patches, and icons.");
- puts(" -K");
- puts(" --checksig <pkg>+ - verify PGP signature");
+ puts(_(""));
+
+ puts(_("usage:"));
+ puts(_(" --help - print this message"));
+ puts(_(" --version - print the version of rpm being used"));
+ puts(_(" -q - query mode"));
+ puts(_(" --root <dir> - use <dir> as the top level directory"));
+ puts(_(" Package specification options:"));
+ puts(_(" -a - query all packages"));
+ puts(_(" -f <file>+ - query package owning <file>"));
+ puts(_(" -F - like -f, but read file names from stdin"));
+ puts(_(" -p <packagefile>+ - query (uninstalled) package <packagefile>"));
+ puts(_(" -P - like -f, but read package names from stdin"));
+ puts(_(" Information selection options:"));
+ puts(_(" -i - display package information"));
+ puts(_(" -l - display package file list"));
+ puts(_(" -s - show file states (implies -l)"));
+ puts(_(" -d - list only documentation files (implies -l)"));
+ puts(_(" -c - list only configuration files (implies -l)"));
+ puts(_(""));
+ puts(_(" -V"));
+ puts(_(" -y"));
+ puts(_(" --verify - verify a package installation"));
+ puts(_(" same package specification options as -q"));
+ puts(_(" --root <dir> - use <dir> as the top level directory"));
+ puts(_(""));
+ puts(_(" --install <packagefile>"));
+ puts(_(" -i <packagefile> - install package"));
+ puts(_(" -v - be a little verbose "));
+ puts(_(" -h"));
+ puts(_(" --hash - print hash marks as package installs (good with -v)"));
+ puts(_(" --percent - print percentages as package installs"));
+ puts(_(" --replacepkgs - reinstall if the package is already present"));
+ puts(_(" --replacefiles - install even if the package replaces installed files"));
+ puts(_(" --force - short hand for --replacepkgs --replacefiles"));
+ puts(_(" --test - don't install, but tell if it would work or not"));
+ puts(_(" --search - search the paths listed in /etc/rpmrc for rpms"));
+ puts(_(" --root <dir> - use <dir> as the top level directory"));
+ puts(_(""));
+ puts(_(" --upgrade <packagefile>"));
+ puts(_(" -U <packagefile> - upgrade package (same options as --install, plus)"));
+ puts(_(" --oldpackage - upgrade to an old version of the package (--force"));
+ puts(_(" on upgrades does this automatically)"));
+ puts(_(""));
+ puts(_(" --erase <package>"));
+ puts(_(" -e <package> - uninstall (erase) package"));
+ puts(_(" --root <dir> - use <dir> as the top level directory"));
+ puts(_(""));
+ puts(_(" -b<stage> <spec> - build package, where <stage> is one of:"));
+ puts(_(" p - prep (unpack sources and apply patches)"));
+ puts(_(" l - list check (do some cursory checks on %files)"));
+ puts(_(" c - compile (prep and compile)"));
+ puts(_(" i - install (prep, compile, install)"));
+ puts(_(" b - binary package (prep, compile, install, package)"));
+ puts(_(" a - bin/src package (prep, compile, install, package)"));
+ puts(_(" --short-circuit - skip straight to specified stage (only for c,i)"));
+ puts(_(" --clean - remove build tree when done"));
+ puts(_(" --sign - generate PGP signature"));
+ puts(_(" --keep-temps - do not delete scripts (or any temp files) in /tmp"));
+ puts(_(" --test - do not execute any stages, implies --keep-temps"));
+ puts(_(" in /tmp - useful for testing"));
+ puts(_(" --time-check <s> - set the time check to S seconds (0 disables it)"));
+ puts(_(""));
+ puts(_(" --where <pkg>+ - search paths listed in /etc/rpmrc for rpms"));
+ puts(_(" matching <pkg>"));
+ puts(_(""));
+ puts(_(" --rebuild <source_package>"));
+ puts(_(" - install source package, build binary package,"));
+ puts(_(" and remove spec file, sources, patches, and icons."));
+ puts(_(" -K"));
+ puts(_(" --checksig <pkg>+ - verify PGP signature"));
}
int build(char * arg, int buildAmount, char *passPhrase) {
}
if (!(f = fopen(specfile, "r"))) {
- fprintf(stderr, "unable to open: %s\n", specfile);
+ fprintf(stderr, _("unable to open: %s\n"), specfile);
return 1;
}
s = parseSpec(f, specfile);
fclose(f);
if (s) {
if (doBuild(s, buildAmount, passPhrase)) {
- fprintf(stderr, "Build failed.\n");
+ fprintf(stderr, _("Build failed.\n"));
res = 1;
}
freeSpec(s);
/* Spec parse failed -- could be Exclude: Exclusive: */
res = 1;
if (errCode() == RPMERR_BADARCH) {
- fprintf(stderr, "%s doesn't build on this architecture\n", arg);
+ fprintf(stderr, _("%s doesn't build on this architecture\n"), arg);
} else {
- fprintf(stderr, "Build failed.\n");
+ fprintf(stderr, _("Build failed.\n"));
}
}
{ 0, 0, 0, 0 }
} ;
+ /* set up the correct locale via the LANG environment variable */
+ setlocale(LC_ALL, "" );
+
+ bindtextdomain(NLSPACKAGE, "/usr/lib/locale");
+ textdomain(NLSPACKAGE);
+
if (readConfigFiles()) /* reading this early makes it easy to override */
exit(-1);
case 'K':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_CHECKSIG)
- argerror("only one major mode may be specified");
+ argerror(_("only one major mode may be specified"));
bigMode = MODE_CHECKSIG;
break;
case 'Q':
if (querySource != QUERY_PACKAGE && querySource != QUERY_SPACKAGE)
- argerror("only one type of query may be performed at a time");
+ argerror(_("only one type of query may be performed at a "
+ "time"));
querySource = QUERY_SPACKAGE;
/* fallthrough */
case 'q':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_QUERY)
- argerror("only one major mode may be specified");
+ argerror(_("only one major mode may be specified"));
bigMode = MODE_QUERY;
break;
case 'Y':
if (verifySource != VERIFY_PACKAGE &&
verifySource != VERIFY_SPACKAGE)
- argerror("only one type of verify may be performed at a time");
+ argerror(_("only one type of verify may be performed at a "
+ "time"));
verifySource = VERIFY_SPACKAGE;
/* fallthrough */
case 'V':
case 'y':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_VERIFY)
- argerror("only one major mode may be specified");
+ argerror(_("only one major mode may be specified"));
bigMode = MODE_VERIFY;
break;
case 'u':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_UNINSTALL)
- argerror("only one major mode may be specified");
+ argerror(_("only one major mode may be specified"));
bigMode = MODE_UNINSTALL;
- message(MESS_WARNING, "-u and --uninstall are depricated and will"
- " be removed soon.\n");
- message(MESS_WARNING, "Use -e or --erase instead.\n");
+ message(MESS_WARNING, _("-u and --uninstall are depricated and will"
+ " be removed soon.\n"));
+ message(MESS_WARNING, _("Use -e or --erase instead.\n"));
break;
case 'e':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_UNINSTALL)
- argerror("only one major mode may be specified");
+ argerror(_("only one major mode may be specified"));
bigMode = MODE_UNINSTALL;
break;
case 'b':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_BUILD)
- argerror("only one major mode may be specified");
+ argerror(_("only one major mode may be specified"));
bigMode = MODE_BUILD;
if (strlen(optarg) > 1)
- argerror("--build (-b) requires one of a,b,i,c,p,l as "
- "its sole argument");
+ argerror(_("--build (-b) requires one of a,b,i,c,p,l as "
+ "its sole argument"));
switch (optarg[0]) {
/* these fallthroughs are intentional */
case 'U':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
- argerror("only one major mode may be specified");
+ argerror(_("only one major mode may be specified"));
bigMode = MODE_INSTALL;
installFlags |= INSTALL_UPGRADE;
break;
case 'P':
if (querySource != QUERY_PACKAGE && querySource != QUERY_SRPM)
- argerror("one type of query/verify may be performed at a time");
+ argerror(_("one type of query/verify may be performed at a "
+ "time"));
querySource = QUERY_SRPM;
verifySource = VERIFY_SRPM;
break;
case 'p':
if (querySource != QUERY_PACKAGE && querySource != QUERY_RPM)
- argerror("one type of query/verify may be performed at a time");
+ argerror(_("one type of query/verify may be performed at a " "time"));
querySource = QUERY_RPM;
verifySource = VERIFY_RPM;
break;
case 'G':
if (querySource != QUERY_PACKAGE && querySource != QUERY_SGROUP)
- argerror("one type of query/verify may be performed at a time");
+ argerror(_("one type of query/verify may be performed at a "
+ "time"));
querySource = QUERY_SGROUP;
verifySource = VERIFY_SGROUP;
break;
case 'g':
if (querySource != QUERY_PACKAGE && querySource != QUERY_GROUP)
+ argerror(_("one type of query/verify may be performed at a "
+ "time"));
argerror("one type of query/verify may be performed at a time");
querySource = QUERY_GROUP;
verifySource = VERIFY_GRP;
case 'F':
if (querySource != QUERY_PACKAGE && querySource != QUERY_SPATH)
- argerror("one type of query/verify may be performed at a time");
+ argerror(_("one type of query/verify may be performed at a "
+ "time"));
querySource = QUERY_SPATH;
verifySource = VERIFY_SPATH;
break;
case 'f':
if (querySource != QUERY_PACKAGE && querySource != QUERY_PATH)
- argerror("one type of query/verify may be performed at a time");
+ argerror(_("one type of query/verify may be performed at a "
+ "time"));
querySource = QUERY_PATH;
verifySource = VERIFY_PATH;
break;
case 'a':
if (querySource != QUERY_PACKAGE && querySource != QUERY_ALL)
- argerror("one type of query/verify may be performed at a time");
+ argerror(_("one type of query/verify may be performed at a "
+ "time"));
querySource = QUERY_ALL;
verifySource = VERIFY_EVERY;
break;
case 'r':
if (optarg[0] != '/')
- argerror("arguments to --root (-r) must begin with a /");
+ argerror(_("arguments to --root (-r) must begin with a /"));
prefix = optarg;
break;
*options[long_index].flag = 1;
else if (!strcmp(options[long_index].name, "rebuild")) {
if (bigMode != MODE_UNKNOWN && bigMode != MODE_REBUILD)
- argerror("only one major mode may be specified");
+ argerror(_("only one major mode may be specified"));
bigMode = MODE_REBUILD;
}
}
exit(1);
if (bigMode != MODE_QUERY && queryFor)
- argerror("unexpected query specifiers");
+ argerror(_("unexpected query specifiers"));
if (bigMode != MODE_QUERY && bigMode != MODE_VERIFY &&
querySource != QUERY_PACKAGE)
- argerror("unexpected query source");
+ argerror(_("unexpected query source"));
if (bigMode != MODE_INSTALL && force)
- argerror("only installation and upgrading may be forced");
+ argerror(_("only installation and upgrading may be forced"));
if (bigMode != MODE_INSTALL && showHash)
- argerror("--hash (-h) may only be specified during package installation");
+ argerror(_("--hash (-h) may only be specified during package "
+ "installation"));
if (bigMode != MODE_INSTALL && showPercents)
- argerror("--percent may only be specified during package installation");
+ argerror(_("--percent may only be specified during package "
+ "installation"));
if (bigMode != MODE_INSTALL && replaceFiles)
- argerror("--replacefiles may only be specified during package installation");
+ argerror(_("--replacefiles may only be specified during package "
+ "installation"));
if (bigMode != MODE_INSTALL && replacePackages)
- argerror("--replacepkgs may only be specified during package installation");
+ argerror(_("--replacepkgs may only be specified during package "
+ "installation"));
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL && test)
- argerror("--test may only be specified during package installation "
- "and uninstallation");
+ argerror(_("--test may only be specified during package installation "
+ "and uninstallation"));
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
bigMode != MODE_QUERY && prefix[1])
- argerror("--root (-r) may only be specified during "
- "installation, uninstallation, and querying");
+ argerror(_("--root (-r) may only be specified during "
+ "installation, uninstallation, and querying"));
if (bigMode != MODE_BUILD && clean)
- argerror("--clean may only be used during package building");
+ argerror(_("--clean may only be used during package building"));
if (oldPackage && !(installFlags & INSTALL_UPGRADE))
- argerror("--oldpackage may only be used during upgrades");
+ argerror(_("--oldpackage may only be used during upgrades"));
if (oldPackage || (force && (installFlags & INSTALL_UPGRADE)))
installFlags |= INSTALL_UPGRADETOOLD;
if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD) {
if ((optind != argc) && (sigLookupType() == RPMSIG_PGP262_1024)) {
if (!(passPhrase = getPassPhrase("Enter pass phrase: "))) {
- fprintf(stderr, "Pass phrase check failed\n");
+ fprintf(stderr, _("Pass phrase check failed\n"));
exit(1);
} else {
- fprintf(stderr, "Pass phrase is good.\n");
+ fprintf(stderr, _("Pass phrase is good.\n"));
passPhrase = strdup(passPhrase);
}
}
} else {
- argerror("--sign may only be used during package building");
+ argerror(_("--sign may only be used during package building"));
}
} else {
/* Override any rpmrc setting */
case MODE_CHECKSIG:
if (optind == argc)
- argerror("no packages given for signature check");
+ argerror(_("no packages given for signature check"));
exit(doCheckSig(argv + optind));
case MODE_REBUILD:
setVerbosity(MESS_VERBOSE);
if (optind == argc)
- argerror("no packages files given for rebuild");
+ argerror(_("no packages files given for rebuild"));
while (optind < argc) {
buildAmount = RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL |
buildAmount |= RPMBUILD_SWEEP;
if (optind == argc)
- argerror("no spec files given for build");
+ argerror(_("no spec files given for build"));
while (optind < argc)
if (build(argv[optind++], buildAmount, passPhrase)) {
case MODE_UNINSTALL:
if (optind == argc)
- argerror("no packages given for uninstall");
+ argerror(_("no packages given for uninstall"));
while (optind < argc)
doUninstall(prefix, argv[optind++], test, 0);
if (showHash) interfaceFlags |= RPMINSTALL_HASH;
if (optind == argc)
- argerror("no packages given for install");
+ argerror(_("no packages given for install"));
while (optind < argc)
doInstall(prefix, argv[optind++], installFlags, interfaceFlags);
}
} else {
if (optind == argc)
- argerror("no arguments given for query");
+ argerror(_("no arguments given for query"));
while (optind < argc)
doQuery(prefix, querySource, queryFor, argv[optind++]);
}
}
} else {
if (optind == argc)
- argerror("no arguments given for verify");
+ argerror(_("no arguments given for verify"));
doVerify(prefix, verifySource, argv + optind);
}
break;