Changeset 412


Ignore:
Timestamp:
Oct 6, 2012, 11:30:42 PM (8 years ago)
Author:
amain
Message:

openwrt: add openwrt/(un)patch/force targets and success/fail messages to ease development of patches

Location:
branches/contrib/openwrt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/contrib/openwrt/openwrt.mk

    r411 r412  
    8787        touch $@
    8888
     89openwrt/patch/force:
     90        rm -f $(TOPDIR)/openwrt/patch
     91        make -C $(TOPDIR) openwrt/patch FORCE_PATCH=1
     92
    8993openwrt/patch: openwrt/checkout
    9094        rev=$(call get_svn_revision,$(OPENWRT_BUILD_DIR)) ; \
     
    98102        while read pat ; \
    99103        do \
     104                pati=$$(echo $${pat} | sed 's!$(OPENWRT_PATCHES_DIR)/!!') ; \
    100105                if ! patch -d "$(OPENWRT_BUILD_DIR)" -p 0 -N < $${pat} ; \
    101106                then \
    102                         echo Failed applying patch: $${pat} > /dev/stderr ; \
    103                         rm -f openwrt/checkout "$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp" ; \
    104                         exit 1 ; \
     107                        echo ">> fail: $${pati}" > /dev/stderr ; \
     108                        #rm -f openwrt/checkout "$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp" ; \
     109                        [ $(FORCE_PATCH) != "1" ] && exit 1 || true ; \
     110                else \
     111                        echo ">> success: $${pati}" ; \
    105112                fi ; \
    106113        done
     114        rm -f openwrt/unpatch
    107115        touch $@
    108116
    109 openwrt/unpatch:
    110         if [ ! -f openwrt/patch ]; then exit 0; fi; \
     117openwrt/unpatch/force:
     118        rm -f $(TOPDIR)/openwrt/unpatch
     119        make -C $(TOPDIR) openwrt/unpatch FORCE_PATCH=1
     120
     121openwrt/unpatch: openwrt/patch
    111122        rev=$(call get_svn_revision,$(OPENWRT_BUILD_DIR)) ; \
    112123        find \
     
    119130        while read pat ; \
    120131        do \
     132                pati=$$(echo $${pat} | sed 's!$(OPENWRT_PATCHES_DIR)/!!') ; \
    121133                if ! patch -d "$(OPENWRT_BUILD_DIR)" -p 0 -R < $${pat} ; \
    122134                then \
    123                         echo Failed removing patch: $${pat} > /dev/stderr ; \
    124                         rm -f openwrt/checkout "$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp" ; \
    125                         exit 1 ; \
     135                        echo ">> fail: $${pati}" > /dev/stderr ; \
     136                        #rm -f openwrt/checkout "$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp" ; \
     137                        [ $(FORCE_PATCH) != "1" ] && exit 1 || true; \
     138                else \
     139                        echo ">> success: $${pati}" ; \
    126140                fi ; \
    127141        done
    128         rm openwrt/patch
     142        rm -f openwrt/patch
    129143        touch $@
    130 
    131144
    132145openwrt/files-copy: openwrt/patch
     
    173186        rm -f openwrt/files-copy
    174187
     188.PHONY: openwrt/patch/force \
     189        openwrt/unpatch/force
     190
  • branches/contrib/openwrt/patches/README

    r406 r412  
    2525<nnn>  is used to set order of application. Lower numbered patches are applied
    2626       first. The ordering is done by running the list of patches through
    27        `sort`, as a result,  "1000_foo" will be done before "200_bar".
     27       `sort`, as a result,  "1000_foo" will be done before "200_bar". Note that
     28       all patches in all patch directories are listed, sorted and then applied!
    2829
    2930<desc> contains a functional description of the patch. Usually separated by
     
    3940
    4041
    41 Make targets
    42 ------------
    43 make openwrt/patch
    44 maken openwrt/unpatch
     42Patch make targets
     43------------------
     44make openwrt/patch              - Exit when a patch fails
     45maken openwrt/unpatch           - Exit when an unpatch fails
     46make openwrt/patch/force        - Try to apply all patches
     47maken openwrt/unpatch/force     - Try to unapply all patches
     48
     49The force options are very usefull when developping.
    4550
    4651
Note: See TracChangeset for help on using the changeset viewer.