-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add more checks to ci_verify_version.sh; refactor
In addition to png.h, configure.ac and CMakeLists.txt, the script ci_verify_version.sh is now able to verify libpng-config-head.in also. For the benefit of readability, the old script ci_shellify.sh has been split into smaller, independent scriptlets: libexec/ci_shellify_*.sh. The linting script ci_lint.sh has been updated as needed.
- Loading branch information
Showing
7 changed files
with
249 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
set -o errexit -o pipefail -o posix | ||
|
||
# Copyright (c) 2019-2025 Cosmin Truta. | ||
# | ||
# Use, modification and distribution are subject to the MIT License. | ||
# Please see the accompanying file LICENSE_MIT.txt | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
# shellcheck source=ci/lib/ci.lib.sh | ||
source "$(dirname "$0")/../lib/ci.lib.sh" | ||
|
||
function ci_shellify_autoconf { | ||
# Convert autoconf (M4) text, specifically originating | ||
# from configure.ac, to shell scripting text. | ||
# Select only the easy-to-parse definitions of PNGLIB_*. | ||
sed -n -e '/^ *PNGLIB_[^ ]*=[$"0-9A-Za-z_]/ p' | | ||
sed -e 's/^ *PNG\([0-9A-Za-z_]*\)=\([^# ]*\).*$/PNG\1=\2/' \ | ||
-e 's/^\([^ ]*=[^ ]*\).*$/export \1;/' | ||
} | ||
|
||
function usage { | ||
echo "usage: $CI_SCRIPT_NAME [<options>] configure.ac" | ||
echo "options: -?|-h|--help" | ||
exit "${@:-0}" | ||
} | ||
|
||
function main { | ||
local opt | ||
while getopts ":" opt | ||
do | ||
# This ain't a while-loop. It only pretends to be. | ||
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0 | ||
ci_err "unknown option: '$1'" | ||
done | ||
shift $((OPTIND - 1)) | ||
[[ $# -eq 0 ]] && usage 2 | ||
[[ $# -eq 1 ]] || ci_err "too many operands" | ||
# And... go! | ||
test -e "$1" || ci_err "no such file: '$1'" | ||
[[ $(basename -- "$1") == configure.ac ]] || { | ||
ci_err "incorrect operand: '$1' (expecting: 'configure.ac')" | ||
} | ||
ci_shellify_autoconf <"$1" | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
set -o errexit -o pipefail -o posix | ||
|
||
# Copyright (c) 2019-2025 Cosmin Truta. | ||
# | ||
# Use, modification and distribution are subject to the MIT License. | ||
# Please see the accompanying file LICENSE_MIT.txt | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
# shellcheck source=ci/lib/ci.lib.sh | ||
source "$(dirname "$0")/../lib/ci.lib.sh" | ||
|
||
function ci_shellify_c { | ||
# Convert C preprocessor text, specifically originating | ||
# from png.h, to shell scripting text. | ||
# Select only the easy-to-parse definitions of PNG_LIBPNG_*. | ||
sed -n -e '/^\# *define * PNG_LIBPNG_[^ ]* * ["0-9A-Za-z_]/ p' | | ||
sed -e 's/^\# *define * PNG\([^ ]*\) * \([^ ]*\)/PNG\1=\2/' \ | ||
-e 's/=PNG\([0-9A-Za-z_]*\)/=\${PNG\1}/' \ | ||
-e 's/^\([^ ]*=[^ ]*\).*$/export \1;/' | ||
} | ||
|
||
function usage { | ||
echo "usage: $CI_SCRIPT_NAME [<options>] png.h" | ||
echo "options: -?|-h|--help" | ||
exit "${@:-0}" | ||
} | ||
|
||
function main { | ||
local opt | ||
while getopts ":" opt | ||
do | ||
# This ain't a while-loop. It only pretends to be. | ||
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0 | ||
ci_err "unknown option: '$1'" | ||
done | ||
shift $((OPTIND - 1)) | ||
[[ $# -eq 0 ]] && usage 2 | ||
[[ $# -eq 1 ]] || ci_err "too many operands" | ||
# And... go! | ||
test -e "$1" || ci_err "no such file: '$1'" | ||
[[ $(basename -- "$1") == png.h ]] || { | ||
ci_err "incorrect operand: '$1' (expecting: 'png.h')" | ||
} | ||
ci_shellify_c <"$1" | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
set -o errexit -o pipefail -o posix | ||
|
||
# Copyright (c) 2019-2025 Cosmin Truta. | ||
# | ||
# Use, modification and distribution are subject to the MIT License. | ||
# Please see the accompanying file LICENSE_MIT.txt | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
# shellcheck source=ci/lib/ci.lib.sh | ||
source "$(dirname "$0")/../lib/ci.lib.sh" | ||
|
||
function ci_shellify_cmake { | ||
# Convert CMake lists text, specifically originating | ||
# from CMakeLists.txt, to shell scripting text. | ||
# Select only the easy-to-parse definitions of PNGLIB_*. | ||
sed -n -e '/^ *set *(PNGLIB_[^ ]* * [$"0-9A-Za-z_].*)/ p' | | ||
sed -e 's/^ *set *(PNG\([^ ]*\) * \([^() ]*\)).*$/PNG\1=\2/' \ | ||
-e 's/^\([^ ]*=[^ ]*\).*$/export \1;/' | ||
} | ||
|
||
function usage { | ||
echo "usage: $CI_SCRIPT_NAME [<options>] CMakeLists.txt" | ||
echo "options: -?|-h|--help" | ||
exit "${@:-0}" | ||
} | ||
|
||
function main { | ||
local opt | ||
while getopts ":" opt | ||
do | ||
# This ain't a while-loop. It only pretends to be. | ||
[[ $1 == -[?h]* || $1 == --help || $1 == --help=* ]] && usage 0 | ||
ci_err "unknown option: '$1'" | ||
done | ||
shift $((OPTIND - 1)) | ||
[[ $# -eq 0 ]] && usage 2 | ||
[[ $# -eq 1 ]] || ci_err "too many operands" | ||
# And... go! | ||
test -e "$1" || ci_err "no such file: '$1'" | ||
filename="$(basename -- "$1")" | ||
[[ $filename == [Cc][Mm]ake[Ll]ists.txt ]] || { | ||
ci_err "incorrect operand: '$1' (expecting: 'CMakeLists.txt')" | ||
} | ||
ci_shellify_cmake <"$1" | ||
} | ||
|
||
main "$@" |
Oops, something went wrong.