[PATCH] glsa-check: add --reverse option (bug 235970)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] glsa-check: add --reverse option (bug 235970)

Zac Medico-2
Add --reverse option which causes GLSAs to be listed in reverse order,
so that the most recent GLSAs are listed earlier.

Suggested-by: Pavel Sanda <[hidden email]>
Bug: https://bugs.gentoo.org/235970
Signed-off-by: Zac Medico <[hidden email]>
---
 bin/glsa-check | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/glsa-check b/bin/glsa-check
index 95ef16fde..6dbb7513c 100755
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@ -67,6 +67,8 @@ parser.add_argument("-e", "--emergelike", action="store_false", dest="least_chan
  help="Upgrade to latest version (not least-change)")
 parser.add_argument("-c", "--cve", action="store_true", dest="list_cve",
  help="Show CVE IDs in listing mode")
+parser.add_argument("-r", "--reverse", action="store_true", dest="reverse",
+ help="List GLSAs in reverse order")
 
 options, params = parser.parse_known_args()
 
@@ -162,8 +164,7 @@ def summarylist(myglsalist, fd1=sys.stdout, fd2=sys.stderr, encoding="utf-8"):
  fd2.write(green("[U]")+" means the system is not affected and\n")
  fd2.write(red("[N]")+" indicates that the system might be affected.\n\n")
 
- myglsalist.sort()
- for myid in myglsalist:
+ for myid in sorted(myglsalist, reverse=options.reverse):
  try:
  myglsa = Glsa(myid, portage.settings, vardb, portdb)
  except (GlsaTypeException, GlsaFormatException) as e:
--
2.21.0


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] glsa-check: add --reverse option (bug 235970)

Aaron Bauman-2
On Sat, Aug 31, 2019 at 09:41:55PM -0700, Zac Medico wrote:

> Add --reverse option which causes GLSAs to be listed in reverse order,
> so that the most recent GLSAs are listed earlier.
>
> Suggested-by: Pavel Sanda <[hidden email]>
> Bug: https://bugs.gentoo.org/235970
> Signed-off-by: Zac Medico <[hidden email]>
> ---
>  bin/glsa-check | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/bin/glsa-check b/bin/glsa-check
> index 95ef16fde..6dbb7513c 100755
> --- a/bin/glsa-check
> +++ b/bin/glsa-check
> @@ -67,6 +67,8 @@ parser.add_argument("-e", "--emergelike", action="store_false", dest="least_chan
>   help="Upgrade to latest version (not least-change)")
>  parser.add_argument("-c", "--cve", action="store_true", dest="list_cve",
>   help="Show CVE IDs in listing mode")
> +parser.add_argument("-r", "--reverse", action="store_true", dest="reverse",
> + help="List GLSAs in reverse order")
>  
>  options, params = parser.parse_known_args()
>  
> @@ -162,8 +164,7 @@ def summarylist(myglsalist, fd1=sys.stdout, fd2=sys.stderr, encoding="utf-8"):
>   fd2.write(green("[U]")+" means the system is not affected and\n")
>   fd2.write(red("[N]")+" indicates that the system might be affected.\n\n")
>  
> - myglsalist.sort()
> - for myid in myglsalist:
> + for myid in sorted(myglsalist, reverse=options.reverse):
>   try:
>   myglsa = Glsa(myid, portage.settings, vardb, portdb)
>   except (GlsaTypeException, GlsaFormatException) as e:
> --
> 2.21.0
>
>
Applied and works great here on multiple combinations.

Acked-by: Aaron Bauman <[hidden email]>

--
Cheers,
Aaron

signature.asc (499 bytes) Download Attachment