From: Viktor Szakats Date: Thu, 8 Aug 2024 20:05:16 +0000 (+0200) Subject: dist: add CI job to detect files missing from distro X-Git-Tag: curl-8_10_0~307 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2edbc229cbf52b3cdd2505ef150c67d3690b0ab7;p=thirdparty%2Fcurl.git dist: add CI job to detect files missing from distro Also: - delete previous, cmake-specific solution. - move a CI script under `.github`. Follow-up to a118a6ecddb0322a6da07815aabf9e36cd5f44bc #14323 Closes #14463 --- diff --git a/scripts/cmp-config.pl b/.github/scripts/cmp-config.pl similarity index 100% rename from scripts/cmp-config.pl rename to .github/scripts/cmp-config.pl diff --git a/.github/scripts/distfiles.sh b/.github/scripts/distfiles.sh new file mode 100755 index 0000000000..31b5a11896 --- /dev/null +++ b/.github/scripts/distfiles.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# Copyright (C) Viktor Szakats +# +# SPDX-License-Identifier: curl + +# Compare git repo files with tarball files and report a mismatch +# after excluding exceptions. + +set -eu + +gitonly=".git* +^.* +^appveyor.* +^buildconf +^GIT-INFO.md +^README.md +^renovate.json +^REUSE.toml +^SECURITY.md +^LICENSES/* +^docs/examples/adddocsref.pl +^docs/THANKS-filter +^projects/Windows/* +^scripts/ciconfig.pl +^scripts/cijobs.pl +^scripts/contributors.sh +^scripts/contrithanks.sh +^scripts/delta +^scripts/installcheck.sh +^scripts/release-notes.pl +^scripts/singleuse.pl +^src/tool_hugehelp.c.cvs +^tests/CI.md" + +tarfiles="$(mktemp)" +gitfiles="$(mktemp)" + +tar -tf "$1" \ + | sed -E 's|^[^/]+/||g' \ + | grep -v -E '(/|^)$' \ + | sort > "${tarfiles}" + +git -C "${2:-.}" ls-files \ + | grep -v -E "($(printf '%s' "${gitonly}" | tr $'\n' '|' | sed -e 's|\.|\\.|g' -e 's|\*|.+|g'))$" \ + | sort > "${gitfiles}" + +dif="$(diff -u "${tarfiles}" "${gitfiles}" | tail -n +3 || true)" + +rm -rf "${tarfiles:?}" "${gitfiles:?}" + +echo 'Only in tarball:' +echo "${dif}" | grep '^-' || true +echo + +echo 'Missing from tarball:' +if echo "${dif}" | grep '^+'; then + exit 1 +fi diff --git a/.github/workflows/configure-vs-cmake.yml b/.github/workflows/configure-vs-cmake.yml index 231e76918e..4d8722bb0a 100644 --- a/.github/workflows/configure-vs-cmake.yml +++ b/.github/workflows/configure-vs-cmake.yml @@ -12,7 +12,7 @@ on: - '**/*.m4' - '**/CMakeLists.txt' - 'lib/curl_config.h.cmake' - - 'scripts/cmp-config.pl' + - '.github/scripts/cmp-config.pl' pull_request: branches: @@ -22,7 +22,7 @@ on: - '**/*.m4' - '**/CMakeLists.txt' - 'lib/curl_config.h.cmake' - - 'scripts/cmp-config.pl' + - '.github/scripts/cmp-config.pl' permissions: {} @@ -42,4 +42,4 @@ jobs: mkdir build && cd build && cmake .. - name: compare generated curl_config.h files - run: ./scripts/cmp-config.pl lib/curl_config.h build/lib/curl_config.h + run: ./.github/scripts/cmp-config.pl lib/curl_config.h build/lib/curl_config.h diff --git a/.github/workflows/distcheck.yml b/.github/workflows/distcheck.yml index 761e02c7db..2e53f23dfd 100644 --- a/.github/workflows/distcheck.yml +++ b/.github/workflows/distcheck.yml @@ -122,15 +122,19 @@ jobs: make -C build -j5 name: 'verify out-of-tree cmake build' - verify-cmake-test-dist: + missing-files: runs-on: ubuntu-latest timeout-minutes: 5 + needs: maketgz-and-verify-in-tree steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - name: 'cmake test dist' - run: | - cmake -B build -DENABLE_DIST_TEST=ON + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 + with: + name: 'release-tgz' + + - name: 'detect files missing from release tarball' + run: .github/scripts/distfiles.sh curl-99.98.97.tar.gz reproducible-releases: runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index f0c744dd8a..e0035a4aaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1665,15 +1665,7 @@ endif() # Ugly (but functional) way to include "Makefile.inc" by transforming it # (= regenerate it). function(transform_makefile_inc _input_file _output_file) - file(STRINGS "${_input_file}" _makefile_inc_lines) - set(_makefile_inc_text "") - foreach(_line IN LISTS _makefile_inc_lines) - if(_line MATCHES "### USE SIMPLE LIST ASSIGMENTS ABOVE THIS LINE ###") - break() - endif() - set(_makefile_inc_text "${_makefile_inc_text}${_line}\n") - endforeach() - + file(READ ${_input_file} _makefile_inc_text) string(REPLACE "$(top_srcdir)" "\${CURL_SOURCE_DIR}" _makefile_inc_text ${_makefile_inc_text}) string(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" _makefile_inc_text ${_makefile_inc_text}) @@ -1718,23 +1710,6 @@ if(BUILD_TESTING) add_subdirectory(tests) endif() -# Verify if all CMake include/input files are listed as distributable -if(ENABLE_DIST_TEST) - # Get 'CMAKE_DIST' variable - transform_makefile_inc("Makefile.am" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake") - include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake") - - file(GLOB_RECURSE _curl_cmake_files_found RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}/CMake/*.cmake" - "${CMAKE_CURRENT_SOURCE_DIR}/CMake/*.in") - - foreach(_item IN LISTS _curl_cmake_files_found) - if(NOT _item IN_LIST CMAKE_DIST) - message(FATAL_ERROR "Source file missing from the Makefile.am CMAKE_DIST list: ${_item}") - endif() - endforeach() -endif() - if(NOT CURL_DISABLE_INSTALL) install(FILES "${PROJECT_SOURCE_DIR}/scripts/mk-ca-bundle.pl" diff --git a/Makefile.am b/Makefile.am index 224a7f7124..0a25f213b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -92,8 +92,6 @@ DIST_SUBDIRS = $(SUBDIRS) tests packages include docs pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libcurl.pc -### USE SIMPLE LIST ASSIGMENTS ABOVE THIS LINE ### DO NOT DELETE - # List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files include lib/Makefile.inc include src/Makefile.inc