From patchwork Mon Jan 21 11:54:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Rasmussen X-Patchwork-Id: 214109 X-Patchwork-Delegate: esben@haabendal.dk Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hugin.dotsrc.org (hugin.dotsrc.org [IPv6:2001:878:346::102]) by ozlabs.org (Postfix) with ESMTP id 318212C0080 for ; Mon, 21 Jan 2013 22:58:01 +1100 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id F102C3F854 for ; Mon, 21 Jan 2013 12:57:54 +0100 (CET) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail02.prevas.se (mail02.prevas.se [62.95.78.10]) by hugin.dotsrc.org (Postfix) with ESMTPS id F2BAC3F854 for ; Mon, 21 Jan 2013 12:54:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=2277; q=dns/txt; s=ironport2; t=1358769257; x=1390305257; h=from:to:subject:date:message-id: content-transfer-encoding:mime-version; bh=wCABX0t0q2EdUrDuiJMbAFb1JZNcOj3lwuWR927jMT0=; b=YMQSJYvCaxBiHas6s+Twe++i68JA/fJ6BIXDIlaEDmj+tHVc53iXvjfY 7BddABFMmdFeLsehe9Trgf007v6PkW3vBZ7SB+oDLOxpuqLAbin3sO8eI VaPnyvaWBC1Z8GCgk6cnJ/o0rFT5L3o+3ek0uwOUchPFPWnRKUF9z5kB9 0=; X-IronPort-AV: E=Sophos;i="4.84,506,1355094000"; d="scan'208";a="2045795" Received: from vmprevas4.prevas.se (HELO smtp.prevas.se) ([172.16.8.104]) by ironport2.prevas.se with ESMTP/TLS/AES128-SHA; 21 Jan 2013 12:54:11 +0100 Received: from VMPREVAS1.prevas.se ([::1]) by VMPREVAS4.prevas.se ([172.16.8.104]) with mapi id 14.02.0318.004; Mon, 21 Jan 2013 12:54:10 +0100 From: Christian Rasmussen To: "dev@oe-lite.org" Subject: Patches for bakery fixing potential use of non-existing indices in two if-conditions Thread-Topic: Patches for bakery fixing potential use of non-existing indices in two if-conditions Thread-Index: Ac33zgZEdBf4MLpAQTi4bp6S35RApw== Date: Mon, 21 Jan 2013 11:54:10 +0000 Message-ID: <1AF0AD83BEC32F489C74B5B223C246C22578B36B@VMPREVAS1.prevas.se> Accept-Language: da-DK, sv-SE, en-US Content-Language: da-DK X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.6.108] MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 21 Jan 2013 12:57:52 +0100 X-BeenThere: dev@oe-lite.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: OE-lite development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dev-bounces@oe-lite.org Errors-To: dev-bounces@oe-lite.org Hello dev-oelite Patches for bakery, fixing potential use of non-existing indices in two if-conditions Best regards Christian Rasmussen diff --git a/oebakery/cmd_update.py b/oebakery/cmd_update.py index 735034c..aba36d2 100644 --- a/oebakery/cmd_update.py +++ b/oebakery/cmd_update.py @@ -94,8 +94,13 @@ def update_submodule(path, fetch_url, params): err("Failed to synchronize git submodule") status = git_submodule_status(path) + if status[0] == "-": + cmd = "git submodule update --init --recursive" + if not oebakery.call("%s %s"%(cmd, path)): + err("Failed to add submodule: %s"%(path)) + return False - if status is None: + elif status is None: cmd = "git submodule add -f" if "branch" in params: branch = params["branch"] @@ -109,12 +114,6 @@ def update_submodule(path, fetch_url, params): err("Failed to initialize submodule: %s"%(path)) return False - elif status[0] == "-": - cmd = "git submodule update --init --recursive" - if not oebakery.call("%s %s"%(cmd, path)): - err("Failed to add submodule: %s"%(path)) - return False - # set push_default to 'tracking' if unset push_default = oebakery.call('git config --get push.default', dir=path, quiet=True) diff --git a/oebakery/oe.py b/oebakery/oe.py index cea5171..eff854d 100755 --- a/oebakery/oe.py +++ b/oebakery/oe.py @@ -198,7 +198,7 @@ def config_defaults(config, debug=False): if not "protocol" in params: params["protocol"] = "git" config["__oestack"].append((path, params)) - if params["srcuri"].startswith("git://"): + if "srcuri" in params and params["srcuri"].startswith("git://"): url = "%s%s"%(params["protocol"], params["srcuri"][3:]) config["__submodules"].append((path, url, params)) if "oepath" in params: