From: Karel Zak Date: Thu, 13 Mar 2025 09:12:26 +0000 (+0100) Subject: tools: add checktarball-meson.sh X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b674e9f517358537dab0132c6f9311dc0c47fee2;p=thirdparty%2Futil-linux.git tools: add checktarball-meson.sh Simple script to check for missing meson.build files in the release tarball. Addresses: https://github.com/util-linux/util-linux/issues/3460 Signed-off-by: Karel Zak --- diff --git a/tools/checktarball-meson.sh b/tools/checktarball-meson.sh new file mode 100755 index 000000000..5c6d14e0a --- /dev/null +++ b/tools/checktarball-meson.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2025 Karel Zak +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +if [[ "$1" == "-h" || "$1" == "--help" ]]; then + echo "Usage: $0 TARBALL" + echo "Compare meson.build files in the current Git with those in the specified tarball." + exit 0 +fi + +TARBALL="$1" + +if [ -z "$TARBALL" ]; then + echo "Error: No tarball specified." + exit 1 +elif [ ! -f "$TARBALL" ]; then + echo "Error: Tarball '$TARBALL' not found." + exit 1 +fi + +TAR_DIRNAME=$(tar -tf "$TARBALL" | head -1 | cut -d'/' -f1) +TAR_MESON_FILES=$(tar -tf "$TARBALL" | grep 'meson.build$' | sed "s|^$TAR_DIRNAME/||") +GIT_MESON_FILES=$(git ls-files | grep 'meson.build$') + +MISSING_FILES=() +for file in $GIT_MESON_FILES; do + if ! grep -qx "$file" <<< "$TAR_MESON_FILES"; then + MISSING_FILES+=("$file") + fi +done + +if [ ${#MISSING_FILES[@]} -gt 0 ]; then + echo "The following meson.build files are missing in the tarball:" + for file in "${MISSING_FILES[@]}"; do + echo "$file" + done + exit 1 +fi