From patchwork Sun Oct 21 15:27:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Diorcet X-Patchwork-Id: 193009 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 [130.225.254.102]) by ozlabs.org (Postfix) with ESMTP id 86AEA2C00EC for ; Mon, 22 Oct 2012 02:27:56 +1100 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id F1F313FBAE for ; Sun, 21 Oct 2012 17:27:54 +0200 (CEST) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail-we0-f179.google.com (mail-we0-f179.google.com [74.125.82.179]) by hugin.dotsrc.org (Postfix) with ESMTPS id 8E8B43FBAE for ; Sun, 21 Oct 2012 17:27:51 +0200 (CEST) Received: by mail-we0-f179.google.com with SMTP id z49so956617wey.10 for ; Sun, 21 Oct 2012 08:27:51 -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:x-mailer:in-reply-to:references; bh=YA0LYvYfT0TAVfjJV6x/+tXhxgxZLe1EKBe4lMMdOpQ=; b=hud/eqrnnbf3hwRHDvFz5cNUmQvx0Jxz1jabnk3LWrb7Vx2+zipjSEfW4augLiPnx7 1XU5SjQegk+UuUK8U21cSgXvTKxkUFm85jflEM6T2yqAbE4ekBZjcbtkeQO4rT0TLV4Q 8tVLiMDJP6TLgDRwvQ7QewStfnS4yAWERTtKRV+95nGhq4QeLqEihyc9hMZ3GeO6EU8S 7aVrYzfx30Q2Xs53EZyOsbO4ZqPlXEEnP52Tfo7twUrKqDnCde3ZoIm7szEpm+5G8eyW qnVVvtMgE1dD1rzloIKry9Oc0Xyra96G64quWFG5Npxl3CE2uufHJnlbTtpPZeq6OrKg 8jEQ== Received: by 10.180.82.35 with SMTP id f3mr15376571wiy.6.1350833270837; Sun, 21 Oct 2012 08:27:50 -0700 (PDT) Received: from localhost.localdomain (dom38-1-82-236-154-183.fbx.proxad.net. [82.236.154.183]) by mx.google.com with ESMTPS id gg4sm16470282wib.6.2012.10.21.08.27.49 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 21 Oct 2012 08:27:50 -0700 (PDT) From: Yann Diorcet To: dev@oe-lite.org Subject: [PATCH 02/18] Add negative instruction for packaging using (!) Date: Sun, 21 Oct 2012 17:27:25 +0200 Message-Id: <1350833261-8401-2-git-send-email-diorcet.yann@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1350833261-8401-1-git-send-email-diorcet.yann@gmail.com> References: <1350833261-8401-1-git-send-email-diorcet.yann@gmail.com> Cc: Yann Diorcet 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 From: Yann Diorcet It is usefull to use a negative instruction in order to remove few files from previously selected file list due to a joker Ex: /lib/* !/lib/not_this_file --- classes/package.oeclass | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/classes/package.oeclass b/classes/package.oeclass index c3c89e3..c6bfc20 100644 --- a/classes/package.oeclass +++ b/classes/package.oeclass @@ -38,9 +38,14 @@ def do_split(d): for pkg in package_list: root = os.path.join(pkgd, pkg) bb.utils.mkdirhier(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): @@ -53,15 +58,32 @@ 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): bb.utils.mkdirhier(os.path.join(root,file))