From patchwork Sat Sep 5 08:40:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 3428 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Bk7KL5jHSz3x3L for ; Sat, 5 Sep 2020 08:40:22 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Bk7KK3CPyzmB; Sat, 5 Sep 2020 08:40:21 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Bk7KK0v38z2yWh; Sat, 5 Sep 2020 08:40:21 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Bk7KJ10bnz2y3S for ; Sat, 5 Sep 2020 08:40:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 4Bk7KH3Fp8zmB; Sat, 5 Sep 2020 08:40:19 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1599295219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QsGnIWcxSLLP1IxU95H6dq6zNAuSQ8oOZdAb9uwLI/I=; b=6d39Wszvjd+UF86XAp85Se+cPmKac8JEUadxJuGZlfdrI5i4GqmYdEnmqjPITX8eCIBe1m Svom7FzkPoHJ39Cg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1599295219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QsGnIWcxSLLP1IxU95H6dq6zNAuSQ8oOZdAb9uwLI/I=; b=Kzk5ssfmSk6M4bFSfsl4t5yLLFxbX2tatoohsB44krTMoJ9hMCICOt2mQ3EhnjB2nbARX3 L+/nhzpgHq+jdRiWSm+GZXKibjRopiJtzHufGQ7spPdWkZffHtG2x3kblzmSyah7Db9C6Y jOJF4LctDCD64XQBOhrERJV1VkDp08CphUQ23X75ISyynEdReUNDec2ih0K6eZhhzI3hzu WFVeDnhZFcfAau5EQ4r5uirySKY2Dig+21Vva2Dq5J5zhoeEwXjLjH9fILb3nIZQ6Arisg xPa+DcjAY1ODLp5Z1zNpj+YOmb3E6H4hFNQHW4nSjTdAVI19mmX9qZOGQRxPgQ== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [PATCH] Add tool to format rootfiles Date: Sat, 5 Sep 2020 08:40:08 +0000 Message-Id: <20200905084008.29873-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" There are some rules which files should be definitely not included in a rootfile. Applying these rules by hand is error prone and annoying. So I wrote these simple command, because computer can apply these rules faster and better than humans :-; It removes all lines starting with '-' and comment out all lines which point to files which should not be included in the distribution. This list needs to be extended, but I think this is a good starting point to make the creating of rootfiles easier. Signed-off-by: Jonatan Schlag --- make.sh | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/make.sh b/make.sh index 4a9dd3cb6..909d4a4de 100755 --- a/make.sh +++ b/make.sh @@ -1895,6 +1895,41 @@ downloadsrc) fi cd - >/dev/null 2>&1 ;; +format-rootfile) + if [ ! -f $2 ]; then + echo -n "'$2' is not a regular file" + beautify message FAIL + exit 1 + fi + + ROOTFILE_TO_FORMAT="$2" + + # Remove all .so files in /usr/lib + sed -i '/^\+usr\/lib\/.*\.so$/s/+/#/g' "$ROOTFILE_TO_FORMAT" + + # Remove all .a files in /usr/lib + sed -i '/^\+usr\/lib\/.*\.a$/s/+/#/g' "$ROOTFILE_TO_FORMAT" + + + # Remove all .la files in /usr/lib + sed -i '/^\+usr\/lib\/.*\.la$/s/+/#/g' "$ROOTFILE_TO_FORMAT" + + # Remove all .hpp files in /usr/include + sed -i '/^\+usr\/include\/.*\.hpp$/s/+/#/g' "$ROOTFILE_TO_FORMAT" + + # Remove all .h files in /usr/include + sed -i '/^\+usr\/include\/.*\.h$/s/+/#/g' "$ROOTFILE_TO_FORMAT" + + # Remove all .ipp files in /usr/include + sed -i '/^\+usr\/include\/.*\.ipp$/s/+/#/g' "$ROOTFILE_TO_FORMAT" + + # Remove all .m4 files in /usr/share/aclocal + sed -i '/^\+usr\/share\/aclocal\/.*\.h$/s/+/#/g' "$ROOTFILE_TO_FORMAT" + + # Remove all lines starting with - + sed -i '/^-.*$/d' "$ROOTFILE_TO_FORMAT" + +;; toolchain) # Clear screen ${INTERACTIVE} && clear @@ -1990,7 +2025,7 @@ find-dependencies) exec "${BASEDIR}/tools/find-dependencies" "${BASEDIR}/build" "$@" ;; *) - echo "Usage: $0 {build|changelog|clean|gettoolchain|downloadsrc|shell|sync|toolchain|update-contributors|find-dependencies}" + echo "Usage: $0 {build|changelog|clean|format-rootfile|gettoolchain|downloadsrc|shell|sync|toolchain|update-contributors|find-dependencies}" cat doc/make.sh-usage ;; esac