From patchwork Wed Aug 6 19:16:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Diorcet X-Patchwork-Id: 377347 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 CB9E51400D6 for ; Thu, 7 Aug 2014 05:17:06 +1000 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id D85943F9B1 for ; Wed, 6 Aug 2014 21:17:01 +0200 (CEST) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by hugin.dotsrc.org (Postfix) with ESMTPS id 096C13F9B1 for ; Wed, 6 Aug 2014 21:16:59 +0200 (CEST) Received: by mail-wi0-f175.google.com with SMTP id ho1so9420206wib.8 for ; Wed, 06 Aug 2014 12:16:59 -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=476HCaDRNl6AWjtcyhFCklNy2wG3zQ7Rp9MRMnbhVmQ=; b=GbTyz7v45MUJnjYmOQf0ZyXlKp67/D+75uhWPEus0jSJtYM0PAZXOK9XoAUG+y/8IB ondoHBaSvTSSAkMCRJfud+QipKoFePKYBuzAEqzKbDerrFer3O/SVIjQflk8taRdWBx7 RaZZ4Cl9rqkyzk/yuYHCuseUvYKf5xp7zIk0OrD+GmKncXky3N+00wwnZB0F0sXOAMxf kvZ/g88QcUPobRzvLFl6qtNAzO+Gf1TX74aCQ4VAb62s0rG8G3O7aa6I6O2tUAAW43TU NJq6s5NE0bQ97BeydWN3hk+app6UPwGRodEf5uprnWb+4KwI58FWE0DnuHevH0QCn6wz LxOw== X-Received: by 10.194.63.37 with SMTP id d5mr18646468wjs.92.1407352619140; Wed, 06 Aug 2014 12:16:59 -0700 (PDT) Received: from localhost.localdomain (mut38-h01-31-33-249-220.dsl.sta.abo.bbox.fr. [31.33.249.220]) by mx.google.com with ESMTPSA id ej10sm21057792wib.12.2014.08.06.12.16.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Aug 2014 12:16:58 -0700 (PDT) From: Yann Diorcet To: dev@oe-lite.org Subject: [PATCH 01/20] Add ability to remove files from packages by prefixing by an exclamation mark Date: Wed, 6 Aug 2014 21:16:32 +0200 Message-Id: <1407352611-7652-1-git-send-email-diorcet.yann@gmail.com> X-Mailer: git-send-email 2.0.1 In-Reply-To: References: 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: , MIME-Version: 1.0 Sender: dev-bounces@oe-lite.org Errors-To: dev-bounces@oe-lite.org --- classes/package.oeclass | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/classes/package.oeclass b/classes/package.oeclass index 9486479..c363e84 100644 --- a/classes/package.oeclass +++ b/classes/package.oeclass @@ -48,7 +48,13 @@ def do_split(d): oelite.util.makedirs(root) files = (d.get("FILES_" + pkg) or "").split() - for file in files: + resolved_files = [] + removed_files = [] + while len(files): + file = files.pop(0) + remove = file.startswith("!") + if remove: + file = file[1:] if os.path.isabs(file): file = "." + file if not os.path.islink(file): @@ -61,15 +67,31 @@ def do_split(d): if globbed: if [ file ] != globbed: if not file in globbed: - files += globbed + if remove: + files += ["!"+ x for x in globbed] + else: + files += globbed continue else: globbed.remove(file) - files += globbed + if remove: + files += ["!"+ x for x in globbed] + else: + files += globbed + continue if (not os.path.islink(file)) and (not os.path.exists(file)): continue - if file in seen: + if remove: + removed_files.append(file) continue + if not file in seen: + resolved_files.append(file) + + for file in removed_files: + if file in resolved_files: + resolved_files.remove(file) + + for file in resolved_files: seen.append(file) if os.path.isdir(file) and not os.path.islink(file): oelite.util.makedirs(os.path.join(root,file))