On Mon, May 27, 2024 at 10:13:47PM +0200, Lucas Stach wrote:
> FTP is on its way out, so it should not be used in package URLs
> anymore. Add a lint check to ensure that.
>
> Signed-off-by: Lucas Stach <[email protected]>
> ---
> scripts/lib/ptxd_make_world_lint.sh | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/scripts/lib/ptxd_make_world_lint.sh
> b/scripts/lib/ptxd_make_world_lint.sh
> index 01a35d4801b8..94d43d6bee4f 100644
> --- a/scripts/lib/ptxd_make_world_lint.sh
> +++ b/scripts/lib/ptxd_make_world_lint.sh
> @@ -281,6 +281,23 @@ ptxd_make_world_lint_credits() {
> export -f ptxd_make_world_lint_credits
> PTXDIST_LINT_COMMANDS="${PTXDIST_LINT_COMMANDS} credits"
>
> +ptxd_make_world_lint_ftp() {
> + local filefd file
> +
> + echo "Checking for deprecated FTP protocol use in package URL ..."
> +
> + exec {filefd}< <(ptxd_make_world_lint_makefiles)
> + while read file <&${filefd}; do
> + if grep -q "URL.*ftp://" "${file}"; then
This will not detect multiline URL patterns. How about this:
if grep -qzP '_URL\b.*=(.*\\\n)*.*\bftp://' "${file}"; then
Michael
> + ptxd_lint_error "'$(ptxd_print_path "${file}")' contains
> deprecated FTP URL."
> + fi
> + done
> + exec {filefd}<&-
> + echo
> +}
> +export -f ptxd_make_world_lint_ftp
> +PTXDIST_LINT_COMMANDS="${PTXDIST_LINT_COMMANDS} ftp"
> +
> unset ptxd_make_world_lint_cross_whitelist
> # we don't care about the initmethod
> ptxd_make_world_lint_cross_whitelist+="INITMETHOD_BBINIT INITMETHOD_SYSTEMD "
> --
> 2.39.2
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |