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 a118a6ecdd #14323
Closes #14463
This commit is contained in:
Viktor Szakats 2024-08-08 22:05:16 +02:00
Родитель 515440a2f2
Коммит 2edbc229cb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5ABD165E2AEF201
6 изменённых файлов: 70 добавлений и 35 удалений

Просмотреть файл

58
.github/scripts/distfiles.sh поставляемый Executable file
Просмотреть файл

@ -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

6
.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

12
.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

Просмотреть файл

@ -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"

Просмотреть файл

@ -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