public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: man/, bin/
Date: Fri, 30 Aug 2019 17:05:26 +0000 (UTC)	[thread overview]
Message-ID: <1567106839.57e5ea479030de69e43252bd8dc6c93e6a87369a.zmedico@gentoo> (raw)

commit:     57e5ea479030de69e43252bd8dc6c93e6a87369a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 29 17:49:54 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug 29 19:27:19 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=57e5ea47

glsa-check: Add --quiet option

This patch is a forward port of the following commit:

https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=cd5a8e80f949f649b6d2b174bc899f1f092684fd

commit cd5a8e80f949f649b6d2b174bc899f1f092684fd
Author:     fuzzyray <fuzzyray <AT> gentoo.org>
AuthorDate: 2009-05-07 22:15:50 +0000
Commit:     fuzzyray <fuzzyray <AT> gentoo.org>
CommitDate: 2009-05-07 22:15:50 +0000

    Add patch from Robert Buchholz: Add quiet option
    Incorporate option to quiet down glsa-check, based on a patch by Thilo
    Bangert <bangert <AT> gentoo.org> in bug #170784.
    This option will also suppress sending of empty mail, based on a patch
    by Christian Gut <cycloon <AT> is-root.org> in bug #182990.

    svn path=/trunk/gentoolkit/; revision=633

Bug: https://bugs.gentoo.org/692872
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/glsa-check   | 17 +++++++++++------
 man/glsa-check.1 |  3 +++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/bin/glsa-check b/bin/glsa-check
index 83ea6b7c3..bfcbaa61f 100755
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@ -57,6 +57,8 @@ modes.add_argument("-m", "--mail", action="store_const",
 		help="Send a mail with the given GLSAs to the administrator")
 parser.add_argument("-V", "--version", action="store_true",
 		help="Show information about glsa-check")
+parser.add_argument("-q", "--quiet", action="store_true", dest="quiet",
+		help="Be less verbose and do not send empty mail")
 parser.add_argument("-v", "--verbose", action="store_true", dest="verbose",
 		help="Print more messages")
 parser.add_argument("-n", "--nocolor", action="store_true",
@@ -80,6 +82,7 @@ if options.version:
 mode = options.mode
 least_change = options.least_change
 list_cve = options.list_cve
+quiet = options.quiet
 verbose = options.verbose
 
 # Sanity checking
@@ -153,9 +156,10 @@ def summarylist(myglsalist, fd1=sys.stdout, fd2=sys.stderr, encoding="utf-8"):
 		fd2 = fd2.buffer
 	fd1 = codecs.getwriter(encoding)(fd1)
 	fd2 = codecs.getwriter(encoding)(fd2)
-	fd2.write(white("[A]")+" means this GLSA was marked as applied (injected),\n")
-	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")
+	if not quiet:
+		fd2.write(white("[A]")+" means this GLSA was marked as applied (injected),\n")
+		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:
@@ -231,7 +235,7 @@ if mode in ["dump", "fix", "inject", "pretend"]:
 					# using emerge for the actual merging as it contains the dependency
 					# code and we want to be consistent in behaviour. Also this functionality
 					# will be integrated in emerge later, so it shouldn't hurt much.
-					emergecmd = "emerge --oneshot " + " =" + pkg
+					emergecmd = "emerge --oneshot" + (" --quiet" if quiet else "") + " =" + pkg
 					if verbose:
 						sys.stderr.write(emergecmd+"\n")
 					exitcode = os.system(emergecmd)
@@ -331,8 +335,9 @@ if mode == "mail":
 		myattachments.append(MIMEText(attachment, _charset="utf8"))
 		myfd.close()
 
-	mymessage = portage.mail.create_message(myfrom, myrecipient, mysubject, summary, myattachments)
-	portage.mail.send_mail(portage.settings, mymessage)
+	if glsalist or not quiet:
+		mymessage = portage.mail.create_message(myfrom, myrecipient, mysubject, summary, myattachments)
+		portage.mail.send_mail(portage.settings, mymessage)
 
 	sys.exit(0)
 

diff --git a/man/glsa-check.1 b/man/glsa-check.1
index a0d49d4dd..f1041737f 100644
--- a/man/glsa-check.1
+++ b/man/glsa-check.1
@@ -37,6 +37,9 @@
 \fBV\fR, \fB\-\-version\fR Show information about \fBglsa\-check\fR\.
 .
 .P
+\fB\-q\fR, \fB\-\-quiet\fR Be less verbose and do not send empty mail\.
+.
+.P
 \fB\-v\fR, \fB\-\-verbose\fR Print more messages\.
 .
 .P


             reply	other threads:[~2019-08-30 17:05 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30 17:05 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-08-22  4:06 [gentoo-commits] proj/portage:master commit in: man/, bin/ Zac Medico
2013-08-22  2:01 Zac Medico
2013-08-04 20:51 Zac Medico
2013-07-23 20:42 Arfrever Frehtes Taifersar Arahesis
2013-07-13  9:35 Arfrever Frehtes Taifersar Arahesis
2013-05-18 18:47 Zac Medico
2013-04-28 22:06 Zac Medico
2012-10-31 21:32 Zac Medico
2012-10-11  3:10 Zac Medico
2012-09-24 20:26 Zac Medico
2012-09-24  3:47 Mike Frysinger
2012-06-17 15:46 Zac Medico
2012-03-17 21:33 Zac Medico
2012-03-11  2:56 Mike Frysinger
2012-03-11  2:44 Mike Frysinger
2012-01-02  7:48 Zac Medico
2011-12-22 23:43 Zac Medico
2011-12-21 20:08 Zac Medico
2011-12-21 20:04 Zac Medico
2011-10-17  4:22 Zac Medico
2011-10-14 18:06 Zac Medico
2011-08-31  3:05 Zac Medico
2011-08-13 13:52 Zac Medico
2011-08-11  3:00 Zac Medico
2011-06-24 10:23 Zac Medico
2011-05-01 15:58 Zac Medico
2011-05-01 14:52 Arfrever Frehtes Taifersar Arahesis
2011-05-01  1:23 Arfrever Frehtes Taifersar Arahesis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1567106839.57e5ea479030de69e43252bd8dc6c93e6a87369a.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox