]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
dist: add CI job to detect files missing from distro
authorViktor Szakats <commit@vsz.me>
Thu, 8 Aug 2024 20:05:16 +0000 (22:05 +0200)
committerViktor Szakats <commit@vsz.me>
Sat, 10 Aug 2024 08:02:49 +0000 (10:02 +0200)
Also:
- delete previous, cmake-specific solution.
- move a CI script under `.github`.

Follow-up to a118a6ecddb0322a6da07815aabf9e36cd5f44bc #14323
Closes #14463

.github/scripts/cmp-config.pl [moved from scripts/cmp-config.pl with 100% similarity]
.github/scripts/distfiles.sh [new file with mode: 0755]
.github/workflows/configure-vs-cmake.yml
.github/workflows/distcheck.yml
CMakeLists.txt
Makefile.am

diff --git a/.github/scripts/distfiles.sh b/.github/scripts/distfiles.sh
new file mode 100755 (executable)
index 0000000..31b5a11
--- /dev/null
@@ -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
index 231e76918ee0fc3ecf1061a1dd5bc1caa6c8baf7..4d8722bb0a2c75bdcdccd3dcd67e9a4db3d5add0 100644 (file)
@@ -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
index 761e02c7dbf8e01a66e9daebafe0f4f1eef9b849..2e53f23dfd3ea26e81ca0b1717f4b0405e35025f 100644 (file)
@@ -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
index f0c744dd8a0fd766801aa7967ebea62dfc4062a0..e0035a4aaf4092fb11df0d953172aea64079627a 100644 (file)
@@ -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"
index 224a7f7124bdd4056c4557c977ee1ace1bc8ac4c..0a25f213b89c9603e57d95a6f1f6b37b92425b7a 100644 (file)
@@ -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