From patchwork Mon Oct 20 19:39:24 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: 401230 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 6380214008C for ; Tue, 21 Oct 2014 06:40:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A2ED333443; Mon, 20 Oct 2014 19:40:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id STeYiJYL-NaP; Mon, 20 Oct 2014 19:39:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id AA32033441; Mon, 20 Oct 2014 19:39:50 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 38DE51C2250 for ; Mon, 20 Oct 2014 19:39:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 33932A1BD1 for ; Mon, 20 Oct 2014 19:39:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EyztSEQI9i76 for ; Mon, 20 Oct 2014 19:39:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 17CF0A1BC4 for ; Mon, 20 Oct 2014 19:39:43 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id gm9so4515191lab.41 for ; Mon, 20 Oct 2014 12:39:42 -0700 (PDT) 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=LREdOxWV95G/ZTZYJkcUt9OIxTQOCsLPlxDjCbVPLNw=; b=Ly8gzD4b0kUU8sZ42/c2dD/PB8ZqEMmtKhYHyJSLT4Of0yy6NRIRY4neaUe65y9/Y7 y2Paz/6SAeHq6P3Jltksuuqew034ayRO9xxNxfkn5HfR9sChaKsPuVGW7o3DaNxgV+P4 HVGdYcKsp6mrTkOHzewYJExRPsRTvmGgc0M+oPSms8JjGWjMYUSgFFK59f3+ttM1iOvG CrQxrsbO0h7Sh5itkjrhj6BF1Q6ugZBy/WJM0j4ULdQTKquNQYHqLoovtkzOmEfJdX/R /DqYuXbJ4TvCi+Avm6pKXQKbNuSAM3JJCvyLK/jcRlQFCslnxLkMpji2soMiYWIeaecd 8PkA== X-Received: by 10.152.228.140 with SMTP id si12mr29684893lac.66.1413833982353; Mon, 20 Oct 2014 12:39:42 -0700 (PDT) Received: from localhost.localdomain (d54C62EEB.access.telenet.be. [84.198.46.235]) by mx.google.com with ESMTPSA id nx6sm2663061lbb.20.2014.10.20.12.39.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Oct 2014 12:39:41 -0700 (PDT) From: Thomas De Schampheleire To: thomas.petazzoni@free-electrons.com Date: Mon, 20 Oct 2014 21:39:24 +0200 Message-Id: <1413833968-11808-6-git-send-email-patrickdepinguin@gmail.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1413833968-11808-1-git-send-email-patrickdepinguin@gmail.com> References: <1413833968-11808-1-git-send-email-patrickdepinguin@gmail.com> Cc: Thomas De Schampheleire , buildroot@buildroot.org Subject: [Buildroot] [PATCHv3 buildroot-test 5/9] 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 do_send_results 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 d500824..e2d2eb5 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(do_send_results=False): devnull = open(os.devnull, "w") needed_progs = ["make", "git", "gcc", "timeout"] missing_requirements = False - if http_login and http_password: + if do_send_results: needed_progs.append("curl") for prog in needed_progs: @@ -511,7 +511,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['do_send_results']: # 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. @@ -606,10 +606,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. + do_send_results = (args['--http-login'] is not None) \ + and (args['--http-password'] is not None) + check_requirements(do_send_results) + if not do_send_results: 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) @@ -619,7 +624,8 @@ def main(): 'instance': i, 'njobs': args['--njobs'], 'sysinfo': sysinfo, 'http_login': args['--http-login'], 'http_password': args['--http-password'], - 'submitter': args['--submitter'], 'make_opts': args['--make-opts']}) + 'submitter': args['--submitter'], 'make_opts': args['--make-opts'], + 'do_send_results': do_send_results}) p.start() processes.append(p) signal.signal(signal.SIGTERM, sigterm_handler)