diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ob-applypatches.sh | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ob-applypatches.sh b/src/ob-applypatches.sh index 999b0cd..28d667c 100644 --- a/src/ob-applypatches.sh +++ b/src/ob-applypatches.sh @@ -1,6 +1,6 @@ # Apply patches to source code # -# Copyright (C) 2012 Patrick McDermott +# Copyright (C) 2012, 2019 Patrick McDermott # # This file is part of opkbuild. # @@ -28,6 +28,10 @@ apply_patches() applied='false' if [ -d '../patches' ] && [ -d 'src' ]; then + mkdir -p '.opkbuild' + patches="${OB_LF}$(cat '.opkbuild/patches' 2>/dev/null || \ + :)${OB_LF}" + exec 3>>'.opkbuild/patches' cd 'src/' # Iterate over patches ordered alphabetically by name. # POSIX.1-2008 says that the results of a pathname expansion @@ -40,16 +44,23 @@ apply_patches() [ -f "${patch}" ] || continue LANG="${orig_lang}" patch="${patch#../../patches/}" + case "${patches}" in *"${OB_LF}${patch}${OB_LF}"*) + ob_info "$(ob_get_msg 'skipping_patch')" \ + "${patch}" + continue + esac ob_info "$(ob_get_msg 'applying_patch')" "${patch}" if ! patch -N -p 1 -u -i "../../patches/${patch}"; then ob_error "$(ob_get_msg 'cant_apply_patch')" \ "${patch}" return 1 fi + printf '%s\n' "${patch}" >&3 applied='true' done LANG="${orig_lang}" cd '../' + exec 3>&- fi ${applied} || ob_info "$(ob_get_msg 'no_patches')" |