4 #include <rpm/rpmcli.h>
5 #include <rpm/rpmlib.h>
6 #include <rpm/rpmlog.h>
10 #include <sys/types.h>
16 #if defined(IAM_RPMQ) || defined(IAM_RPMV)
24 #define MODES_QV (MODE_QUERY | MODE_VERIFY)
28 #define MODES_IE (MODE_INSTALL | MODE_ERASE)
33 #define MODES_FOR_NODEPS (MODES_IE | MODE_VERIFY)
34 #define MODES_FOR_TEST (MODES_IE)
43 N_(
"Query/Verify package selection options:"),
48 N_(
"Query options (with -q or --query):"),
53 N_(
"Verify options (with -V or --verify):"),
59 N_(
"Install/Upgrade/Erase options:"),
63 {
"quiet",
'\0', POPT_ARGFLAG_DOC_HIDDEN, &
quiet, 0, NULL, NULL},
66 N_(
"Common options for all rpm modes and executables:"),
74 int main(
int argc,
char *argv[])
79 #if defined(IAM_RPMQV)
101 #if defined(IAM_RPMQV)
123 argerror(
_(
"one type of query/verify may be performed at a "
126 if (qva->
qva_flags && (bigMode & ~MODES_QV))
145 argerror(
_(
"only one major mode may be specified"));
153 #if defined(IAM_RPMEIU)
156 argerror(
_(
"only installation and upgrading may be forced"));
158 argerror(
_(
"files may only be relocated during package installation"));
161 argerror(
_(
"cannot use --prefix with --relocate or --excludepath"));
164 argerror(
_(
"--relocate and --excludepath may only be used when installing new packages"));
167 argerror(
_(
"--prefix may only be used when installing new packages"));
170 argerror(
_(
"arguments to --prefix must begin with a /"));
173 argerror(
_(
"--hash (-h) may only be specified during package "
174 "installation and erasure"));
177 argerror(
_(
"--percent may only be specified during package "
178 "installation and erasure"));
181 argerror(
_(
"--replacepkgs may only be specified during package "
185 argerror(
_(
"--excludedocs may only be specified during package "
189 argerror(
_(
"--includedocs may only be specified during package "
193 argerror(
_(
"only one of --excludedocs and --includedocs may be "
197 argerror(
_(
"--ignorearch may only be specified during package "
201 argerror(
_(
"--ignoreos may only be specified during package "
206 argerror(
_(
"--ignoresize may only be specified during package "
210 argerror(
_(
"--allmatches may only be specified during package "
214 argerror(
_(
"--allfiles may only be specified during package "
219 argerror(
_(
"--justdb may only be specified during package "
220 "installation and erasure"));
224 argerror(
_(
"script disabling options may only be specified during "
225 "package installation and erasure"));
229 argerror(
_(
"trigger disabling options may only be specified during "
230 "package installation and erasure"));
233 argerror(
_(
"--nodeps may only be specified during package "
234 "installation, erasure, and verification"));
237 argerror(
_(
"--test may only be specified during package installation "
242 argerror(
_(
"arguments to --root (-r) must begin with a /"));
261 printf(
"Use root to operate.\n");
266 if (!poptPeekArg(optCon)) {
267 argerror(
_(
"no packages given for erase"));
280 printf(
"Use root to operate.\n");
306 if (!poptPeekArg(optCon)) {
307 argerror(
_(
"no packages given for install"));
319 argerror(
_(
"no arguments given for query"));
331 argerror(
_(
"no arguments given for verify"));
336 #if !defined(IAM_RPMQV)
340 #if !defined(IAM_RPMEIU)
345 if (poptPeekArg(optCon) != NULL || argc <= 1 ||
rpmIsVerbose()) {
void printUsage(poptContext con, FILE *fp, int flags)
rpmprobFilterFlags probFilter
static struct poptOption optionsTable[]
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
int rpmErase(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_const_t argv)
Erase binary rpm package.
poptContext rpmcliInit(int argc, char *const argv[], struct poptOption *optionsTable)
Initialize most everything needed by an rpm CLI executable context.
int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv)
Display package information.
rpmRelocation * relocations
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
Describe query/verify/signature command line operation.
struct rpmQVKArguments_s rpmQVKArgs
rpmts rpmtsCreate(void)
Create an empty transaction set.
struct poptOption rpmInstallPoptTable[]
poptContext rpmcliFini(poptContext optCon)
Destroy most everything needed by an rpm CLI executable context.
const char * rpmcliPipeOutput
void argerror(const char *desc)
struct poptOption rpmQueryPoptTable[]
int main(int argc, char *argv[])
static int rstreq(const char *s1, const char *s2)
Test for string equality.
struct poptOption rpmQVSourcePoptTable[]
int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv)
Verify package install.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
rpmInstallFlags installInterfaceFlags
struct rpmInstallArguments_s rpmIArgs
const char * rpmcliRootDir
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
char *const * ARGV_const_t
#define UNINSTALL_ALLMATCHES
Describe database command line requests.
struct poptOption rpmVerifyPoptTable[]
int rpmInstall(rpmts ts, struct rpmInstallArguments_s *ia, ARGV_t fileArgv)
Install/upgrade/freshen/reinstall binary rpm package.
#define rpmSetVerbosity(_lvl)
int rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
#define xrealloc(_ptr, _size)