239 строки
7.3 KiB
Diff
239 строки
7.3 KiB
Diff
From 795b7b10046b710607add602f204166d64867385 Mon Sep 17 00:00:00 2001
|
|
From: Joe Schmitt <joschmit@microsoft.com>
|
|
Date: Thu, 21 Nov 2019 20:46:05 +0000
|
|
Subject: [PATCH 1/2] Merged PR 239: Add showorder argument to TDNF
|
|
|
|
Add a `--showorder` argument to TDNF. This can be used in conjunction with TDNF commands such as `install`, `download`, etc.
|
|
|
|
When this argument is specified, TDNF will print out the list of RPM transactions in-install-order (or in-remove-order).
|
|
---
|
|
client/init.c | 1 +
|
|
client/prototypes.h | 8 +++-
|
|
client/rpmtrans.c | 84 ++++++++++++++++++++++++++++++++++++---
|
|
include/tdnftypes.h | 1 +
|
|
tools/cli/lib/help.c | 1 +
|
|
tools/cli/lib/parseargs.c | 2 +
|
|
6 files changed, 90 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/client/init.c b/client/init.c
|
|
index 5cc71c4..652d5ae 100644
|
|
--- a/client/init.c
|
|
+++ b/client/init.c
|
|
@@ -50,6 +50,7 @@ TDNFCloneCmdArgs(
|
|
pCmdArgs->nRpmVerbosity = pCmdArgsIn->nRpmVerbosity;
|
|
pCmdArgs->nShowDuplicates= pCmdArgsIn->nShowDuplicates;
|
|
pCmdArgs->nShowHelp = pCmdArgsIn->nShowHelp;
|
|
+ pCmdArgs->nShowOrder = pCmdArgsIn->nShowOrder;
|
|
pCmdArgs->nShowVersion = pCmdArgsIn->nShowVersion;
|
|
pCmdArgs->nVerbose = pCmdArgsIn->nVerbose;
|
|
pCmdArgs->nIPv4 = pCmdArgsIn->nIPv4;
|
|
diff --git a/client/prototypes.h b/client/prototypes.h
|
|
index 38d8125..f4d3e8c 100644
|
|
--- a/client/prototypes.h
|
|
+++ b/client/prototypes.h
|
|
@@ -687,7 +687,13 @@ TDNFTransAddUpgradePkgs(
|
|
uint32_t
|
|
TDNFRunTransaction(
|
|
PTDNFRPMTS pTS,
|
|
- PTDNF pTdnf
|
|
+ PTDNF pTdnf,
|
|
+ TDNF_ALTERTYPE nAlterType
|
|
+ );
|
|
+
|
|
+uint32_t
|
|
+TDNFPrintTransactionOrder(
|
|
+ PTDNFRPMTS pTS
|
|
);
|
|
|
|
uint32_t
|
|
diff --git a/client/rpmtrans.c b/client/rpmtrans.c
|
|
index 4b8434d..31cf454 100644
|
|
--- a/client/rpmtrans.c
|
|
+++ b/client/rpmtrans.c
|
|
@@ -90,11 +90,8 @@ TDNFRpmExecTransaction(
|
|
dwError = TDNFPopulateTransaction(&ts, pTdnf, pSolvedInfo);
|
|
BAIL_ON_TDNF_ERROR(dwError);
|
|
|
|
- if (nAlterType != ALTER_INSTALL_ONLY_DOWNLOAD)
|
|
- {
|
|
- dwError = TDNFRunTransaction(&ts, pTdnf);
|
|
- BAIL_ON_TDNF_ERROR(dwError);
|
|
- }
|
|
+ dwError = TDNFRunTransaction(&ts, pTdnf, nAlterType);
|
|
+ BAIL_ON_TDNF_ERROR(dwError);
|
|
|
|
cleanup:
|
|
if(ts.pTS)
|
|
@@ -260,7 +257,8 @@ doCheck(PTDNFRPMTS pTS)
|
|
uint32_t
|
|
TDNFRunTransaction(
|
|
PTDNFRPMTS pTS,
|
|
- PTDNF pTdnf
|
|
+ PTDNF pTdnf,
|
|
+ TDNF_ALTERTYPE nAlterType
|
|
)
|
|
{
|
|
uint32_t dwError = 0;
|
|
@@ -291,6 +289,18 @@ TDNFRunTransaction(
|
|
dwError = TDNFGetSkipDigestOption(pTdnf, &dwSkipDigest);
|
|
BAIL_ON_TDNF_ERROR(dwError);
|
|
|
|
+ if(!nSilent && pTdnf->pArgs->nShowOrder)
|
|
+ {
|
|
+ dwError = TDNFPrintTransactionOrder(pTS);
|
|
+ BAIL_ON_TDNF_ERROR(dwError);
|
|
+ }
|
|
+
|
|
+ // Skip testing/running the transaction if this is a download only operation
|
|
+ if (nAlterType == ALTER_INSTALL_ONLY_DOWNLOAD)
|
|
+ {
|
|
+ goto cleanup;
|
|
+ }
|
|
+
|
|
//TODO do callbacks for output
|
|
if(!nSilent)
|
|
{
|
|
@@ -341,6 +351,68 @@ error:
|
|
goto cleanup;
|
|
}
|
|
|
|
+uint32_t
|
|
+TDNFPrintTransactionOrder(
|
|
+ PTDNFRPMTS pTS
|
|
+ )
|
|
+{
|
|
+ uint32_t dwError = 0;
|
|
+ const rpmElementType nElementFilterType = 0;
|
|
+
|
|
+ rpmtsi pIter = NULL;
|
|
+ rpmte pElement = NULL;
|
|
+ rpmElementType nElementType = 0;
|
|
+
|
|
+ if(!pTS || !pTS->pTS)
|
|
+ {
|
|
+ dwError = ERROR_TDNF_INVALID_PARAMETER;
|
|
+ BAIL_ON_TDNF_ERROR(dwError);
|
|
+ }
|
|
+
|
|
+ fprintf(stdout, "\nTransaction order\n");
|
|
+
|
|
+ pIter = rpmtsiInit(pTS->pTS);
|
|
+ while ((pElement = rpmtsiNext(pIter, nElementFilterType)) != NULL)
|
|
+ {
|
|
+ nElementType = rpmteType(pElement);
|
|
+
|
|
+ switch(nElementType)
|
|
+ {
|
|
+ case TR_ADDED:
|
|
+ fprintf(stdout, "Install/Upgrade: ");
|
|
+ break;
|
|
+
|
|
+ case TR_REMOVED:
|
|
+ fprintf(stdout, "Remove: ");
|
|
+ break;
|
|
+
|
|
+ default:
|
|
+ fprintf(stdout, "Unknown action: %d", nElementType);
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ fprintf(
|
|
+ stdout,
|
|
+ "%s-%s.%s.%s\n",
|
|
+ rpmteN(pElement),
|
|
+ rpmteV(pElement),
|
|
+ rpmteR(pElement),
|
|
+ rpmteA(pElement));
|
|
+ }
|
|
+
|
|
+ fprintf(stdout, "\n");
|
|
+
|
|
+cleanup:
|
|
+ if (pIter)
|
|
+ {
|
|
+ rpmtsiFree(pIter);
|
|
+ }
|
|
+ return dwError;
|
|
+
|
|
+error:
|
|
+ goto cleanup;
|
|
+}
|
|
+
|
|
uint32_t
|
|
TDNFTransAddInstallPkgs(
|
|
PTDNFRPMTS pTS,
|
|
diff --git a/include/tdnftypes.h b/include/tdnftypes.h
|
|
index e58bf12..e0fc9c4 100644
|
|
--- a/include/tdnftypes.h
|
|
+++ b/include/tdnftypes.h
|
|
@@ -229,6 +229,7 @@ typedef struct _TDNF_CMD_ARGS
|
|
int nRefresh; //expire metadata before running commands
|
|
int nRpmVerbosity; //set to rpm verbosity level
|
|
int nShowDuplicates; //show dups in list/search
|
|
+ int nShowOrder; //show transaction order
|
|
int nShowVersion; //show version and exit
|
|
int nNoGPGCheck; //skip gpg check
|
|
int nNoOutput; //if quiet and assumeyes are provided
|
|
diff --git a/tools/cli/lib/help.c b/tools/cli/lib/help.c
|
|
index c223ea2..d9fbfd6 100644
|
|
--- a/tools/cli/lib/help.c
|
|
+++ b/tools/cli/lib/help.c
|
|
@@ -54,6 +54,7 @@ TDNFCliShowHelp(
|
|
printf(" [--exclude [file1,file2,...]]\n");
|
|
printf(" [--security]\n");
|
|
printf(" [--sec-severity CVSS_v3.0_Severity]\n");
|
|
+ printf(" [--showorder]\n");
|
|
printf(" [--reboot-required]\n");
|
|
printf(" [--skipsignature]\n");
|
|
printf(" [--skipdigest]\n");
|
|
diff --git a/tools/cli/lib/parseargs.c b/tools/cli/lib/parseargs.c
|
|
index 0f1498c..8be8ff5 100644
|
|
--- a/tools/cli/lib/parseargs.c
|
|
+++ b/tools/cli/lib/parseargs.c
|
|
@@ -42,6 +42,7 @@ static struct option pstOptions[] =
|
|
{"help", no_argument, 0, 'h'}, //-h --help
|
|
{"installroot", required_argument, 0, 'i'}, //--installroot
|
|
{"nogpgcheck", no_argument, &_opt.nNoGPGCheck, 1}, //--nogpgcheck
|
|
+ {"showorder", no_argument, &_opt.nShowOrder, 1}, //--showorder
|
|
{"quiet", no_argument, &_opt.nQuiet, 1}, //--nogpgcheck
|
|
{"refresh", no_argument, &_opt.nRefresh, 1}, //--refresh
|
|
{"releasever", required_argument, 0, 0}, //--releasever
|
|
@@ -240,6 +241,7 @@ TDNFCopyOptions(
|
|
pArgs->nRefresh = pOptionArgs->nRefresh;
|
|
pArgs->nShowDuplicates= pOptionArgs->nShowDuplicates;
|
|
pArgs->nShowHelp = pOptionArgs->nShowHelp;
|
|
+ pArgs->nShowOrder = pOptionArgs->nShowOrder;
|
|
pArgs->nShowVersion = pOptionArgs->nShowVersion;
|
|
pArgs->nVerbose = pOptionArgs->nVerbose;
|
|
pArgs->nIPv4 = pOptionArgs->nIPv4;
|
|
--
|
|
2.17.1
|
|
|
|
|
|
From 73552c5227ab7a063c8e09fe8e43e3ba5be27b62 Mon Sep 17 00:00:00 2001
|
|
From: Joe Schmitt <joschmit@microsoft.com>
|
|
Date: Thu, 21 Nov 2019 23:59:37 +0000
|
|
Subject: [PATCH 2/2] Merged PR 245: Fix tdnf showorder package name output
|
|
|
|
`showorder` incorrectly formatted package names, using a `.` in between version and release instead of a `-`.
|
|
---
|
|
client/rpmtrans.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/client/rpmtrans.c b/client/rpmtrans.c
|
|
index 31cf454..82c203b 100644
|
|
--- a/client/rpmtrans.c
|
|
+++ b/client/rpmtrans.c
|
|
@@ -393,7 +393,7 @@ TDNFPrintTransactionOrder(
|
|
|
|
fprintf(
|
|
stdout,
|
|
- "%s-%s.%s.%s\n",
|
|
+ "%s-%s-%s.%s\n",
|
|
rpmteN(pElement),
|
|
rpmteV(pElement),
|
|
rpmteR(pElement),
|
|
--
|
|
2.17.1
|
|
|