repoquery: add --upgrades option

This commit is contained in:
Oliver Kurth 2021-07-16 11:44:25 -07:00 committed by Oliver Kurth
parent c1fe2a0779
commit d6394b165d
4 changed files with 9 additions and 1 deletions

View File

@ -1390,7 +1390,8 @@ TDNFRepoQuery(
BAIL_ON_TDNF_ERROR(dwError);
}
dwError = TDNFApplyScopeFilter(pQuery, SCOPE_ALL);
dwError = TDNFApplyScopeFilter(pQuery,
pRepoqueryArgs->nUpgrades ? SCOPE_UPGRADES : SCOPE_ALL);
BAIL_ON_TDNF_ERROR(dwError);
if (pRepoqueryArgs->pszSpec)

View File

@ -380,6 +380,7 @@ typedef struct _TDNF_REPOQUERY_ARGS
int anDeps[REPOQUERY_KEY_COUNT];
int nRequiresPre;
int nList;
int nUpgrades;
}TDNF_REPOQUERY_ARGS, *PTDNF_REPOQUERY_ARGS;
#ifdef __cplusplus

View File

@ -53,6 +53,7 @@ static SetOptArgs OptValTable[] = {
{CMDOPT_KEYVALUE, "enhances", "1"},
{CMDOPT_KEYVALUE, "requires-pre", "1"},
{CMDOPT_KEYVALUE, "list", "1"},
{CMDOPT_KEYVALUE, "upgrades", "1"},
{CMDOPT_KEYVALUE, "whatdepends", NULL},
{CMDOPT_KEYVALUE, "whatprovides", NULL},
{CMDOPT_KEYVALUE, "whatobsoletes", NULL},
@ -143,6 +144,7 @@ static struct option pstOptions[] =
{"enhances", no_argument, 0, 0},
{"requires-pre", no_argument, 0, 0},
{"list", no_argument, 0, 0},
{"upgrades", no_argument, 0, 0},
{0, 0, 0, 0}
};

View File

@ -100,6 +100,10 @@ TDNFCliParseRepoQueryArgs(
{
pRepoqueryArgs->nList = 1;
}
else if (strcasecmp(pSetOpt->pszOptName, "upgrades") == 0)
{
pRepoqueryArgs->nUpgrades = 1;
}
else
{
int i;