From patchwork Fri Dec 12 20:04:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 420665 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 52B22140082 for ; Sat, 13 Dec 2014 07:06:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9AB5B92B39; Fri, 12 Dec 2014 20:06:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8-xJsLqJRXRe; Fri, 12 Dec 2014 20:06:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id D30C292A57; Fri, 12 Dec 2014 20:05:42 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 5D2C61C2187 for ; Fri, 12 Dec 2014 20:05:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 59F18963BF for ; Fri, 12 Dec 2014 20:05:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Amisvq7k0C88 for ; Fri, 12 Dec 2014 20:05:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9BA3096349 for ; Fri, 12 Dec 2014 20:05:38 +0000 (UTC) Received: by mail-wi0-f174.google.com with SMTP id h11so3584891wiw.13 for ; Fri, 12 Dec 2014 12:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KrcENANd9KiXOhxWKZuHHwCJkUDqqWUBO2PQt/hUtSc=; b=kyTl24toX25+cpeiyFX/q5gj0qru54fDvOAKKm6CBaqp0X84QhnMZPssf+Zf/ZohrW x5uAigtsoia4Sbr9wWJ8BrELTcyG1zqnWSkfbslEMRgzwQNTnCirsi6DytM2xSQaO9Eg M08ni+OyddQnu9cNYBYB8E9VceeTEbdDF86LiXM5b8KkCclePDH9XINqhsCwPN83z4Yn Clnrsywtyo59UvCIkr03sahAt1uwVP8xn5toZ8bw0Fs9mxswX+t/k2TjvY+Dugh8Et9a kEL8TT1jECq+q0CfFbVr4El8hPnkXEYwCK0fD9ehuOPsu02yL+otK5kCmi7/0/R0QUCC Nv7A== X-Received: by 10.180.38.6 with SMTP id c6mr1459662wik.38.1418414737137; Fri, 12 Dec 2014 12:05:37 -0800 (PST) Received: from localhost.localdomain (alc112.alcatel.be. [195.207.101.112]) by mx.google.com with ESMTPSA id p1sm3054831wjy.22.2014.12.12.12.05.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Dec 2014 12:05:35 -0800 (PST) From: Thomas De Schampheleire To: thomas.petazzoni@free-electrons.com, buildroot@buildroot.org Date: Fri, 12 Dec 2014 21:04:50 +0100 Message-Id: <1418414696-32584-6-git-send-email-patrickdepinguin@gmail.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1418414696-32584-1-git-send-email-patrickdepinguin@gmail.com> References: <1418414696-32584-1-git-send-email-patrickdepinguin@gmail.com> Cc: Thomas De Schampheleire Subject: [Buildroot] [PATCH v5 05/11] autobuild-run: check-requirements does not need to know the login details X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas De Schampheleire check-requirements simply has to know if the results have to be sent, so it can check on some extra requirements. The username and password are irrelevant here. This commit introduces a boolean variable upload to hide these details. Signed-off-by: Thomas De Schampheleire --- scripts/autobuild-run | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/autobuild-run b/scripts/autobuild-run index 4fc883a..ab53d3f 100755 --- a/scripts/autobuild-run +++ b/scripts/autobuild-run @@ -120,12 +120,12 @@ def check_version(): print "ERROR: script version too old, please upgrade." sys.exit(1) -def check_requirements(http_login, http_password): +def check_requirements(upload=False): devnull = open(os.devnull, "w") needed_progs = ["make", "git", "gcc", "timeout"] missing_requirements = False - if http_login and http_password: + if upload: needed_progs.append("curl") for prog in needed_progs: @@ -517,7 +517,7 @@ def send_results(result, **kwargs): log_write(log, "ERROR: could not make results tarball") sys.exit(1) - if kwargs['http_login'] and kwargs['http_password']: + if kwargs['upload']: # Submit results. Yes, Python has some HTTP libraries, but # none of the ones that are part of the standard library can # upload a file without writing dozens of lines of code. @@ -612,10 +612,15 @@ def main(): # merge config/args, priority given to config args = merge(ini_config, args) - check_requirements(args['--http-login'], args['--http-password']) - if args['--http-login'] is None or args['--http-password'] is None: + # http_login/password could theoretically be allowed as empty, so check + # explicitly on None. + upload = (args['--http-login'] is not None) \ + and (args['--http-password'] is not None) + check_requirements(upload) + if not upload: print "WARN: due to the lack of http login/password details, results will not be submitted" print "WARN: tarballs of results will be kept locally only" + def sigterm_handler(signum, frame): os.killpg(os.getpgid(os.getpid()), signal.SIGTERM) sys.exit(1) @@ -628,7 +633,8 @@ def main(): http_login = args['--http-login'], http_password = args['--http-password'], submitter = args['--submitter'], - make_opts = args['--make-opts'] + make_opts = args['--make-opts'], + upload = upload )) p.start() processes.append(p)