From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7030814154926587904 X-Received: by 2002:a05:6000:1869:: with SMTP id d9mr47504314wri.416.1636988985803; Mon, 15 Nov 2021 07:09:45 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:80c3:: with SMTP id b186ls7043544wmd.2.gmail; Mon, 15 Nov 2021 07:09:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzT2iPDhMt9Secs1lrF+Zy5aod7tEuA4Iz+bFzw/h7iVTpHNrfESKKQvc9H8WCSE2nsONLq X-Received: by 2002:a7b:c7cb:: with SMTP id z11mr43389576wmk.152.1636988984821; Mon, 15 Nov 2021 07:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636988984; cv=none; d=google.com; s=arc-20160816; b=vQJqSUw7bMtm4TnXjxQBTp/VA7rxn5OMziKf4cEigahNniF1I8eJgQdJtc1e50hMVI 8lCNRd3hX/KgivrG2vhcKXch+sV3hO41t0RdGuOeQGFUoqajbSMC/aUPebknqEs8nits fCjylt1lJctxTyfO/ZiN5KZn/mrVLzE1yJOyN3oFiQyOi9G5vAwdoXzfxOF5rpKUvYnj F0upzg2XhYurxGlLGCjdbfrvsw991OjiEkxXcfqvtddz2EDQRrvYg287dPFPxBbN6Vm/ yk1K6iFmdFrBCqpyHOqBBRqv4+hwD1NxL3rbOF2jfcJYOmzreQkeGLZ6IeVvCAKQHAsw 5LGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=mOJKRtJh6/QsshMhq5mIOQgUNXoExF9tt0lXafcyxZY=; b=mN/aYb7JAPq+vBqYrD7/HXfUI0tGNy1nO1b2Aa+SFXTrp/qxwllI8RgJ67JjXTs5TW fwUM8MYisChk7Rq3ZQXHSovPEPyIQ/3jyuMjzDAZlJ5x4xKXgsWdISSmfgk0JHc68btN eSFjnSpznJwFJhUubLOhZAh9J9I8YluJ+06I/oSg6r9MGxKb6szHJgtWc5Zt+GIspX/7 zl/hi631qk9Lr90ST19/urGo4bGljfnqboo4A1aAtIt3r9xi5OyP2zYOVtFIRWCbX9ah M1oM9xc7VMZkhVZo2g8/pVzyjnYwUMV7aWg9jK0LDIX/pOi8N77rHNQKmxiesdwcEe/v AaXw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id x20si1016382wrg.3.2021.11.15.07.09.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Nov 2021 07:09:44 -0800 (PST) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from localhost.localdomain (mm-96-28-214-37.mgts.dynamic.pppoe.byfly.by [37.214.28.96] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 1AFF9hZc032588 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Nov 2021 16:09:44 +0100 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Anton Mikanovich Subject: [PATCH] template: Make templates passthrough Date: Mon, 15 Nov 2021 18:09:35 +0300 Message-Id: <20211115150935.153613-1-amikan@ilbers.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: 71LysTkH/GRp There is no need to store original template files after the conversion in real scenarios. To make working folder little cleaner we can remove them. This can be disabled with TEMPLATE_FILES_KEEP variable. Moreover output file should have exactly the same flags as input one, which is usefull for the cases like debian/rules or other executables. So we should copy this part of metadata after the conversion. Signed-off-by: Anton Mikanovich --- meta/classes/template.bbclass | 7 ++++++- meta/recipes-kernel/linux/linux-custom.inc | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/meta/classes/template.bbclass b/meta/classes/template.bbclass index fb9d1186..f5760e15 100644 --- a/meta/classes/template.bbclass +++ b/meta/classes/template.bbclass @@ -4,11 +4,12 @@ # SPDX-License-Identifier: MIT TEMPLATE_FILES ?= "" +TEMPLATE_FILES_KEEP ?= "0" TEMPLATE_VARS ?= "PN PV DESCRIPTION HOMEPAGE MAINTAINER DISTRO_ARCH" do_transform_template[vardeps] = "TEMPLATE_FILES ${TEMPLATE_VARS}" python do_transform_template() { - import subprocess, contextlib + import subprocess, contextlib, shutil workdir = os.path.normpath(d.getVar('WORKDIR', True)) @@ -56,5 +57,9 @@ python do_transform_template() { stdout=output, env=env)) if process.wait() != 0: bb.fatal("processing of template failed") + + shutil.copymode(template_file, output_file) + if d.getVar('TEMPLATE_FILES_KEEP', True) != '1': + os.remove(template_file) } addtask do_transform_template after do_unpack diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc index ed89aa09..57740860 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc +++ b/meta/recipes-kernel/linux/linux-custom.inc @@ -122,9 +122,6 @@ do_prepare_build_prepend() { rm -rf ${S}/debian cp -r ${WORKDIR}/debian ${S}/ - # remove templates from the source tree - find ${S}/debian -name *.tmpl | xargs rm -f - # rename install/remove hooks to match user-specified name for our linux-image package mv ${S}/debian/linux-image.postinst ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.postinst mv ${S}/debian/linux-image.postrm ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.postrm -- 2.20.1