[Buildroot] [PATCH] apply-patches.sh: handle any file name as *.patch

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Thu Mar 10 13:37:25 UTC 2016


Hello,

On Thu, 10 Mar 2016 12:19:49 +0100, yegorslists at googlemail.com wrote:
> From: Yegor Yefremov <yegorslists at googlemail.com>
> 
> Handle both *.patch and default cases as *.patch. This is needed
> in order to handle downloaded patches generated by for example
> cgit, that have no file name extension.
> 
> Signed-off-by: Yegor Yefremov <yegorslists at googlemail.com>
> ---
>  support/scripts/apply-patches.sh | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
> index 201278d..e4cccf5 100755
> --- a/support/scripts/apply-patches.sh
> +++ b/support/scripts/apply-patches.sh
> @@ -83,12 +83,8 @@ function apply_patch {
>              type="compress"; uncomp="uncompress -c"; ;;
>              *.diff*)
>              type="diff"; uncomp="cat"; ;;
> -            *.patch*)
> +            *.patch*|*)
>              type="patch"; uncomp="cat"; ;;
> -            *)
> -            echo "Unsupported file type for ${path}/${patch}, skipping";
> -            return 0
> -            ;;

Unfortunately, this might break some existing use cases. Today, you can
point to a directory of patches, and only the *.patch* or *.diff* files
will be applied, other files will be ignored and not applied.

With your change, if there is any other file in the directory, it will
also attempt to apply it.

Maybe we need to have a different behavior depending on whether we pass
a directory to apply-patches.sh, or a file. If we specify a file, then
we really want that file to be applied, regardless of its extension.
However, if it's a directory, then we don't want to apply all files.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com



More information about the buildroot mailing list