From: "João Henrique Ferreira de Freitas" <joaohf@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 2/2] report-error: send report error with username and email
Date: Wed, 12 Nov 2014 21:08:39 -0200 [thread overview]
Message-ID: <1415833719-6255-3-git-send-email-joaohf@gmail.com> (raw)
In-Reply-To: <1415833719-6255-1-git-send-email-joaohf@gmail.com>
Two variables ERR_REPORT_USER and ERR_REPORT_EMAIL were created
to instruct send-report-error to use 'user' and 'email' from command
line parameters instead of checking '~/.oe-send-error' file.
Two new positional arguments were added to send-report-error.
If 'username' (third argument) is passed, then send-error-report will
not check userfile. As 'email' (forth argument) is an optional,
it will used only if passed.
Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
---
meta/classes/report-error.bbclass | 6 +++++-
scripts/send-error-report | 45 ++++++++++++++++++++++++---------------
2 files changed, 33 insertions(+), 18 deletions(-)
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index f9e821f..253a659 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -8,6 +8,8 @@
ERR_REPORT_DIR ?= "${LOG_DIR}/error-report"
ERR_REPORT_SERVER ?= ""
+ERR_REPORT_USER ?= ""
+ERR_REPORT_EMAIL ?= ""
def errorreport_getdata(e):
logpath = e.data.getVar('ERR_REPORT_DIR', True)
@@ -29,7 +31,9 @@ def errorreport_senddata(e, datafile):
import subprocess
server = e.data.getVar('ERR_REPORT_SERVER', True)
if server:
- cmd = 'send-error-report %s %s' % (datafile, server)
+ user = e.data.getVar('ERR_REPORT_USER', True)
+ email = e.data.getVar('ERR_REPORT_EMAIL', True)
+ cmd = 'send-error-report %s %s %s %s' % (datafile, server, user, email)
subprocess.call(cmd, shell=True)
else:
bb.note("The errors for this build are stored in %s\nYou can send the errors to an upstream server by running:\n send-error-report %s [server]" % (datafile, datafile))
diff --git a/scripts/send-error-report b/scripts/send-error-report
index c99d387..b5c4972 100755
--- a/scripts/send-error-report
+++ b/scripts/send-error-report
@@ -42,27 +42,35 @@ def handle_connection(server, data):
return conn
-def sendData(json_file, server):
+def sendData(json_file, server, username = '', email = ''):
if os.path.isfile(json_file):
- home = os.path.expanduser("~")
- userfile = os.path.join(home, ".oe-send-error")
- if os.path.isfile(userfile):
- with open(userfile) as g:
- username = g.readline()
- email = g.readline()
+ if username:
+ if len(username) > 0 and len(username) > 50:
+ print("Invalid username input, try again.")
+ return
+ if len(email) > 0 and len(email) > 50:
+ print("Invalid username input, try again.")
+ return
else:
- print("Please enter your name and your email (optionally), they'll be saved in the file you send.")
- username = raw_input("Name: ")
- email = raw_input("E-mail (not required): ")
- if len(username) > 0 and len(username) < 50:
- with open(userfile, "w") as g:
- g.write(username + "\n")
- g.write(email + "\n")
+ home = os.path.expanduser("~")
+ userfile = os.path.join(home, ".oe-send-error")
+ if os.path.isfile(userfile):
+ with open(userfile) as g:
+ username = g.readline()
+ email = g.readline()
else:
- print("Invalid inputs, try again.")
- return
+ print("Please enter your name and your email (optionally), they'll be saved in the file you send.")
+ username = raw_input("Name: ")
+ email = raw_input("E-mail (not required): ")
+ if len(username) > 0 and len(username) < 50:
+ with open(userfile, "w") as g:
+ g.write(username + "\n")
+ g.write(email + "\n")
+ else:
+ print("Invalid inputs, try again.")
+ return
with open(json_file) as f:
data = f.read()
@@ -103,8 +111,11 @@ if __name__ == '__main__':
print("\nUsage: send-error-report <error_fileName> [server]")
print("\nIf this is the first when sending a report you'll be asked for your name and optionally your email address.")
print("They will be associated with your report.\n")
-
elif len(sys.argv) == 3:
sendData(sys.argv[1], sys.argv[2])
+ elif len(sys.argv) == 4:
+ sendData(sys.argv[1], sys.argv[2], sys.argv[3])
+ elif len(sys.argv) == 5:
+ sendData(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
else:
sendData(sys.argv[1], "errors.yoctoproject.org")
--
1.9.1
next prev parent reply other threads:[~2014-11-12 23:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 23:08 [PATCH 0/2] reporter-error sending report João Henrique Ferreira de Freitas
2014-11-12 23:08 ` [PATCH 1/2] report-error: sending error report to server without user intervention João Henrique Ferreira de Freitas
2014-11-12 23:08 ` João Henrique Ferreira de Freitas [this message]
2014-11-13 12:58 ` [PATCH 0/2] reporter-error sending report Martin Jansa
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=1415833719-6255-3-git-send-email-joaohf@gmail.com \
--to=joaohf@gmail.com \
--cc=openembedded-core@lists.openembedded.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.