Skip to content

Commit 5330e7f

Browse files
authored
Verify bundled sources using CI - boost.context & uriparser (php#20438)
1 parent 66d908f commit 5330e7f

File tree

9 files changed

+123
-58
lines changed

9 files changed

+123
-58
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!*.patch
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
set -ex
3+
cd "$(dirname "$0")/../../.."
4+
5+
tmp_dir=/tmp/php-src-download-bundled/boost-context
6+
rm -rf "$tmp_dir"
7+
8+
revision=refs/tags/boost-1.86.0
9+
10+
git clone --depth 1 --revision="$revision" https://github.com/boostorg/context.git "$tmp_dir"
11+
12+
rm -rf Zend/asm
13+
cp -R "$tmp_dir"/src/asm Zend/asm
14+
15+
cd Zend/asm
16+
17+
# remove unneeded files
18+
rm jump_arm_aapcs_pe_armasm.asm
19+
rm jump_i386_ms_pe_clang_gas.S
20+
rm jump_i386_ms_pe_gas.asm
21+
rm jump_i386_x86_64_sysv_macho_gas.S
22+
rm jump_ppc32_ppc64_sysv_macho_gas.S
23+
rm jump_x86_64_ms_pe_clang_gas.S
24+
rm make_arm_aapcs_pe_armasm.asm
25+
rm make_i386_ms_pe_clang_gas.S
26+
rm make_i386_ms_pe_gas.asm
27+
rm make_i386_x86_64_sysv_macho_gas.S
28+
rm make_ppc32_ppc64_sysv_macho_gas.S
29+
rm make_x86_64_ms_pe_clang_gas.S
30+
rm ontop_*.S
31+
rm ontop_*.asm
32+
rm tail_ontop_ppc32_sysv.cpp
33+
34+
# move renamed files
35+
# GH-13896 introduced these 2 files named as .S but since https://github.com/boostorg/context/pull/265 they are named as .asm
36+
mv jump_x86_64_ms_pe_gas.asm jump_x86_64_ms_pe_gas.S
37+
mv make_x86_64_ms_pe_gas.asm make_x86_64_ms_pe_gas.S
38+
39+
# add extra files
40+
git restore LICENSE
41+
git restore save_xmm_x86_64_ms_masm.asm # added in GH-18352, not an upstream boost.context file

.github/scripts/download-bundled/pcre2.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
set -ex
33
cd "$(dirname "$0")/../../.."
44

5+
tmp_dir=/tmp/php-src-download-bundled/pcre2
6+
rm -rf "$tmp_dir"
7+
58
revision=refs/tags/pcre2-10.44
69

7-
git clone --depth 1 --recurse-submodules --revision="$revision" https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2
10+
git clone --depth 1 --recurse-submodules --revision="$revision" https://github.com/PCRE2Project/pcre2.git "$tmp_dir"
811

912
rm -rf ext/pcre/pcre2lib
10-
cp -R /tmp/php-src-bundled/pcre2/src ext/pcre/pcre2lib
13+
cp -R "$tmp_dir"/src ext/pcre/pcre2lib
1114

1215
cd ext/pcre/pcre2lib
1316

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/ext/uri/uriparser/src/UriConfig.h b/ext/uri/uriparser/src/UriConfig.h
2+
index b9a85a8..ab78b96 100644
3+
--- a/ext/uri/uriparser/src/UriConfig.h
4+
+++ b/ext/uri/uriparser/src/UriConfig.h
5+
@@ -41,7 +41,9 @@
6+
7+
# define PACKAGE_VERSION "@PROJECT_VERSION@"
8+
9+
+/*
10+
#cmakedefine HAVE_WPRINTF
11+
#cmakedefine HAVE_REALLOCARRAY
12+
+*/
13+
14+
#endif /* !defined(URI_CONFIG_H) */
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
set -ex
3+
cd "$(dirname "$0")/../../.."
4+
5+
tmp_dir=/tmp/php-src-download-bundled/uriparser
6+
rm -rf "$tmp_dir"
7+
8+
revision=refs/tags/uriparser-1.0.0
9+
10+
git clone --depth 1 --revision="$revision" https://github.com/uriparser/uriparser.git "$tmp_dir"
11+
12+
rm -rf ext/uri/uriparser
13+
mkdir ext/uri/uriparser
14+
cp -R "$tmp_dir"/src ext/uri/uriparser
15+
cp -R "$tmp_dir"/include ext/uri/uriparser
16+
cp "$tmp_dir"/COPYING.BSD-3-Clause ext/uri/uriparser
17+
18+
cd ext/uri/uriparser
19+
20+
# move renamed files
21+
mv src/UriConfig.h.in src/UriConfig.h
22+
23+
# patch customized files
24+
git apply -v ../../../.github/scripts/download-bundled/uriparser.config.patch
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#!/bin/sh
22
set -ex
33

4-
cd "$(dirname "$0")/../../$1"
4+
# use the repo root directory as "--git-dir"
5+
cd "$(dirname "$0")/../.."
6+
7+
dir="$1"
58

69
# notify git about untracked (except ignored) files
7-
git add -N .
10+
git add -N "$dir"
811

912
# display overview of changed files
10-
git status .
13+
git status "$dir"
1114

1215
# display diff of working directory vs HEAD commit and set exit code
13-
git diff -a --exit-code HEAD .
16+
git diff -a --exit-code HEAD "$dir"

.github/workflows/verify-bundled-files.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ name: Verify Bundled Files
33
on:
44
push:
55
paths: &paths
6-
- '.github/scripts/download-bundled/pcre2.sh'
6+
- '.github/scripts/download-bundled/**'
7+
- 'Zend/asm/**'
78
- 'ext/pcre/pcre2lib/**'
9+
- 'ext/uri/uriparser/**'
810
pull_request:
911
paths: *paths
1012
schedule:
@@ -24,15 +26,30 @@ jobs:
2426
uses: actions/checkout@v6
2527

2628
- name: Detect changed files
29+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
2730
uses: dorny/paths-filter@v3
2831
id: changes
2932
with:
30-
base: master
3133
filters: |
34+
'boost-context':
35+
- '.github/scripts/download-bundled/boost-context.*'
36+
- 'Zend/asm/**'
3237
pcre2:
33-
- '.github/scripts/download-bundled/pcre2.sh'
38+
- '.github/scripts/download-bundled/pcre2.*'
3439
- 'ext/pcre/pcre2lib/**'
40+
uriparser:
41+
- '.github/scripts/download-bundled/uriparser.*'
42+
- 'ext/uri/uriparser/**'
3543
44+
- name: 'boost.context'
45+
if: ${{ !cancelled() && (steps.changes.outputs.boost-context == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
46+
run: |
47+
echo "::group::Download"
48+
.github/scripts/download-bundled/boost-context.sh
49+
echo "::endgroup::"
50+
echo "::group::Verify files"
51+
.github/scripts/test-directory-unchanged.sh Zend/asm
52+
echo "::endgroup::"
3653
- name: PCRE2
3754
if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
3855
run: |
@@ -42,3 +59,12 @@ jobs:
4259
echo "::group::Verify files"
4360
.github/scripts/test-directory-unchanged.sh ext/pcre/pcre2lib
4461
echo "::endgroup::"
62+
- name: uriparser
63+
if: ${{ !cancelled() && (steps.changes.outputs.uriparser == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
64+
run: |
65+
echo "::group::Download"
66+
.github/scripts/download-bundled/uriparser.sh
67+
echo "::endgroup::"
68+
echo "::group::Verify files"
69+
.github/scripts/test-directory-unchanged.sh ext/uri/uriparser
70+
echo "::endgroup::"

ext/uri/uriparser/src/UriConfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
# define PACKAGE_VERSION "@PROJECT_VERSION@"
4343

4444
/*
45-
#define HAVE_WPRINTF
46-
#define HAVE_REALLOCARRAY
45+
#cmakedefine HAVE_WPRINTF
46+
#cmakedefine HAVE_REALLOCARRAY
4747
*/
4848

4949
#endif /* !defined(URI_CONFIG_H) */

ext/uri/uriparser/src/UriConfig.h.in

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)