Changes include:
1. tdnf --sec-severity [value] updateinfo and
tdnf --sec-severity [value] updateinfo summary commands to filter
the results based on the condition.
2. "tdnf --sec-severity [value] update" prints "0 updates available"
when there are no updates.
Change-Id: I8944fa78a8fe1032edf853cf06c1060e09dd6a8a
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6010
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Keerthana K <keerthanak@vmware.com>
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,170 @@ |
0 |
+From 86689f5eb557e4a542661f306fecc621459af400 Mon Sep 17 00:00:00 2001 |
|
1 |
+From: Keerthana K <keerthanak@vmware.com> |
|
2 |
+Date: Tue, 23 Oct 2018 06:02:22 +0000 |
|
3 |
+Subject: [PATCH] Bug 2219020: --sec-severity option updates |
|
4 |
+ |
|
5 |
+Changes include: |
|
6 |
+ 1. tdnf --sec-severity [value] updateinfo and |
|
7 |
+ tdnf --sec-severity [value] updateinfo summary commands to filter |
|
8 |
+ the results based on the condition. |
|
9 |
+ 2. tdnf --sec-severity [value] update prints "No data available" |
|
10 |
+ instead of Error message when there is no results. |
|
11 |
+ |
|
12 |
+Change-Id: I34fb08be74a825236fc84bbe7f98b1715fec1f02 |
|
13 |
+--- |
|
14 |
+ |
|
15 |
+From bfb6c724e5ee74b3c5a2e762aaa740b072fcea66 Mon Sep 17 00:00:00 2001 |
|
16 |
+From: Keerthana K <keerthanak@vmware.com> |
|
17 |
+Date: Tue, 13 Nov 2018 10:27:38 +0000 |
|
18 |
+Subject: [PATCH] Bug 2219020: --sec-severity option updates |
|
19 |
+ |
|
20 |
+"tdnf updateinfo" and "tdnf update" commands return "0 updates available" |
|
21 |
+instead of ERROR_TDNF_NO_DATA when there are no updates. |
|
22 |
+ |
|
23 |
+Change-Id: I4144b4d59973d55625804354cddb5abca3945118 |
|
24 |
+--- |
|
25 |
+ |
|
26 |
+diff --git a/client/api.c b/client/api.c |
|
27 |
+index 6b7e8ac..7b84cc2 100644 |
|
28 |
+--- a/client/api.c |
|
29 |
+@@ -1166,6 +1166,8 @@ TDNFUpdateInfo( |
|
30 |
+ |
|
31 |
+ if(!pUpdateInfos) |
|
32 |
+ { |
|
33 |
++ printf( |
|
34 |
++ "\n%d updates. \n", nCount); |
|
35 |
+ dwError = ERROR_TDNF_NO_DATA; |
|
36 |
+ BAIL_ON_TDNF_ERROR(dwError); |
|
37 |
+ } |
|
38 |
+@@ -1173,6 +1175,7 @@ TDNFUpdateInfo( |
|
39 |
+ *ppUpdateInfo = pUpdateInfos; |
|
40 |
+ |
|
41 |
+ cleanup: |
|
42 |
++ TDNF_SAFE_FREE_MEMORY(pszSeverity); |
|
43 |
+ if(hAdvList) |
|
44 |
+ { |
|
45 |
+ hy_advisorylist_free(hAdvList); |
|
46 |
+diff --git a/client/updateinfo.c b/client/updateinfo.c |
|
47 |
+index 2ec7ff6..f776870 100644 |
|
48 |
+--- a/client/updateinfo.c |
|
49 |
+@@ -41,6 +41,9 @@ TDNFUpdateInfoSummary( |
|
50 |
+ HyAdvisory hAdv = NULL; |
|
51 |
+ HyAdvisoryType nType = HY_ADVISORY_UNKNOWN; |
|
52 |
+ int nTypeCount = HY_ADVISORY_ENHANCEMENT; |
|
53 |
++ char* pszSeverity = NULL; |
|
54 |
++ uint32_t dwSecurity = 0; |
|
55 |
++ const char* pszTemp = NULL; |
|
56 |
+ |
|
57 |
+ if(!pTdnf || !ppszPackageNameSpecs || !ppSummary) |
|
58 |
+ { |
|
59 |
+@@ -69,6 +72,12 @@ TDNFUpdateInfoSummary( |
|
60 |
+ pSummary[HY_ADVISORY_BUGFIX].nType = UPDATE_BUGFIX; |
|
61 |
+ pSummary[HY_ADVISORY_ENHANCEMENT].nType = UPDATE_ENHANCEMENT; |
|
62 |
+ |
|
63 |
++ dwError = TDNFGetSecuritySeverityOption( |
|
64 |
++ pTdnf, |
|
65 |
++ &dwSecurity, |
|
66 |
++ &pszSeverity); |
|
67 |
++ BAIL_ON_TDNF_ERROR(dwError); |
|
68 |
++ |
|
69 |
+ FOR_PACKAGELIST(hPkg, hPkgList, iPkg) |
|
70 |
+ { |
|
71 |
+ hAdvList = hy_package_get_advisories(hPkg, HY_GT); |
|
72 |
+@@ -87,6 +96,21 @@ TDNFUpdateInfoSummary( |
|
73 |
+ BAIL_ON_TDNF_ERROR(dwError); |
|
74 |
+ } |
|
75 |
+ nType = hy_advisory_get_type(hAdv); |
|
76 |
++ if (dwSecurity) |
|
77 |
++ { |
|
78 |
++ if (nType != HY_ADVISORY_SECURITY) |
|
79 |
++ { |
|
80 |
++ continue; |
|
81 |
++ } |
|
82 |
++ } |
|
83 |
++ else if (pszSeverity) |
|
84 |
++ { |
|
85 |
++ pszTemp = hy_advisory_get_severity(hAdv); |
|
86 |
++ if (!pszTemp || atof(pszSeverity) > atof(pszTemp)) |
|
87 |
++ { |
|
88 |
++ continue; |
|
89 |
++ } |
|
90 |
++ } |
|
91 |
+ if(nType < HY_ADVISORY_UNKNOWN || nType > HY_ADVISORY_ENHANCEMENT) |
|
92 |
+ { |
|
93 |
+ dwError = ERROR_TDNF_INVALID_PARAMETER; |
|
94 |
+@@ -102,6 +126,7 @@ TDNFUpdateInfoSummary( |
|
95 |
+ *ppSummary = pSummary; |
|
96 |
+ |
|
97 |
+ cleanup: |
|
98 |
++ TDNF_SAFE_FREE_MEMORY(pszSeverity); |
|
99 |
+ if(hAdv) |
|
100 |
+ { |
|
101 |
+ hy_advisory_free(hAdv); |
|
102 |
+diff --git a/tools/cli/lib/updateinfocmd.c b/tools/cli/lib/updateinfocmd.c |
|
103 |
+index 2d9c171..fc6a0f4 100644 |
|
104 |
+--- a/tools/cli/lib/updateinfocmd.c |
|
105 |
+@@ -91,10 +91,6 @@ cleanup: |
|
106 |
+ return dwError; |
|
107 |
+ |
|
108 |
+ error: |
|
109 |
+- if(dwError == ERROR_TDNF_NO_DATA) |
|
110 |
+- { |
|
111 |
+- dwError = 0; |
|
112 |
+- } |
|
113 |
+ goto cleanup; |
|
114 |
+ } |
|
115 |
+ |
|
116 |
+@@ -108,6 +104,7 @@ TDNFCliUpdateInfoSummary( |
|
117 |
+ { |
|
118 |
+ uint32_t dwError = 0; |
|
119 |
+ int i = 0; |
|
120 |
++ int nCount = 0; |
|
121 |
+ PTDNF_UPDATEINFO_SUMMARY pSummary = NULL; |
|
122 |
+ |
|
123 |
+ if(!pContext || !pCmdArgs) |
|
124 |
+@@ -127,12 +124,20 @@ TDNFCliUpdateInfoSummary( |
|
125 |
+ { |
|
126 |
+ if(pSummary[i].nCount > 0) |
|
127 |
+ { |
|
128 |
++ nCount++; |
|
129 |
+ printf( |
|
130 |
+ "%d %s notice(s)\n", |
|
131 |
+ pSummary[i].nCount, |
|
132 |
+ TDNFGetUpdateInfoType(pSummary[i].nType)); |
|
133 |
+ } |
|
134 |
+ } |
|
135 |
++ if (nCount == 0) |
|
136 |
++ { |
|
137 |
++ printf( |
|
138 |
++ "\n%d updates. \n", nCount); |
|
139 |
++ dwError = ERROR_TDNF_NO_DATA; |
|
140 |
++ BAIL_ON_CLI_ERROR(dwError); |
|
141 |
++ } |
|
142 |
+ |
|
143 |
+ cleanup: |
|
144 |
+ if(pSummary) |
|
145 |
+diff --git a/tools/cli/main.c b/tools/cli/main.c |
|
146 |
+index c0a2b5f..759dde0 100644 |
|
147 |
+--- a/tools/cli/main.c |
|
148 |
+@@ -152,7 +152,7 @@ cleanup: |
|
149 |
+ |
|
150 |
+ error: |
|
151 |
+ TDNFCliPrintError(dwError); |
|
152 |
+- if (dwError == ERROR_TDNF_CLI_NOTHING_TO_DO) |
|
153 |
++ if (dwError == ERROR_TDNF_CLI_NOTHING_TO_DO || dwError == ERROR_TDNF_NO_DATA) |
|
154 |
+ { |
|
155 |
+ // Nothing to do should not return an error code |
|
156 |
+ dwError = 0; |
|
157 |
+@@ -178,7 +178,7 @@ TDNFCliPrintError( |
|
158 |
+ dwError = TDNFGetErrorString(dwErrorCode, &pszError); |
|
159 |
+ BAIL_ON_CLI_ERROR(dwError); |
|
160 |
+ } |
|
161 |
+- if(dwErrorCode == ERROR_TDNF_CLI_NOTHING_TO_DO) |
|
162 |
++ if(dwErrorCode == ERROR_TDNF_CLI_NOTHING_TO_DO || dwErrorCode == ERROR_TDNF_NO_DATA) |
|
163 |
+ { |
|
164 |
+ dwErrorCode = 0; |
|
165 |
+ } |
... | ... |
@@ -4,7 +4,7 @@ |
4 | 4 |
Summary: dnf/yum equivalent using C libs |
5 | 5 |
Name: tdnf |
6 | 6 |
Version: 1.2.3 |
7 |
-Release: 4%{?dist} |
|
7 |
+Release: 5%{?dist} |
|
8 | 8 |
Vendor: VMware, Inc. |
9 | 9 |
Distribution: Photon |
10 | 10 |
License: LGPLv2.1,GPLv2 |
... | ... |
@@ -29,6 +29,7 @@ Source3: cache-updateinfo.timer |
29 | 29 |
Source4: updateinfo.sh |
30 | 30 |
Patch0: tdnf_add_retry_to_downloads.patch |
31 | 31 |
Patch1: tdnf_fix_curl_getinfo_type.patch |
32 |
+Patch2: tdnf-updateinfo.patch |
|
32 | 33 |
|
33 | 34 |
%description |
34 | 35 |
tdnf is a yum/dnf equivalent |
... | ... |
@@ -54,6 +55,7 @@ Library providing cli libs for tdnf like clients. |
54 | 54 |
%setup -q |
55 | 55 |
%patch0 -p1 |
56 | 56 |
%patch1 -p1 |
57 |
+%patch2 -p1 |
|
57 | 58 |
|
58 | 59 |
%build |
59 | 60 |
sed -i 's/tdnf, 1.2.0/tdnf, 1.2.3/' configure.ac |
... | ... |
@@ -155,6 +157,8 @@ systemctl try-restart tdnf-cache-updateinfo.timer >/dev/null 2>&1 || : |
155 | 155 |
%{_libdir}/libtdnfcli.so.* |
156 | 156 |
|
157 | 157 |
%changelog |
158 |
+* Sat Oct 27 2018 Keerthana K <keerthanak@vmware.com> 1.2.3-5 |
|
159 |
+- Fix bug in update and updateinfo. |
|
158 | 160 |
* Fri Sep 14 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.2.3-4 |
159 | 161 |
- fix bug in download status type |
160 | 162 |
* Wed Sep 12 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.2.3-3 |