Changeset 349


Ignore:
Timestamp:
Sep 29, 2012, 2:46:30 AM (8 years ago)
Author:
ehem
Message:

Rework the openwrt/patch target. Instead of patching with a hand-rolled
list of patches, scan the appropriate directories for patch files. Patch
filenames now MUST match the pattern [0-9]+(-[0-9]*:[0-9]*)_<name>. The
lead digits specify order of application, lower numbers are applied
first. If present, the two subsequent numbers indicate a range of
Subversion revisions that a given patch applies to. If a number is
absent, the range is interpreted to include all older revisions or all
newer revisions as appropriate.

Adjust openwrt/unpatch target to match (patches are now removed in
reverse order). Adjust the generate script to match.

Location:
branches/contrib/openwrt
Files:
1 added
2 edited
9 moved

Legend:

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

    r348 r349  
    7878
    7979openwrt/patch: openwrt/checkout
    80         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    81           < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages
    82 ifeq ($(OPENWRT_BRANCH),trunk)
    83         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    84           < $(PATCHES_DIR_OPENWRT)/trunk/002_install_kernel_modules_and_merge_debwrt_config
    85         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    86           < $(PATCHES_DIR_OPENWRT)/trunk/005_make_empty_rootfs
    87         #patch -d $(OPENWRT_BUILD_DIR) -p 0 -N  < $(PATCHES_DIR_OPENWRT)/trunk/006_reverse-changeset27849-changes.patch
    88 else ifeq ($(OPENWRT_BRANCH),backfire)
    89         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    90           < $(PATCHES_DIR_OPENWRT)/backfire/002_install_kernel_modules_and_merge_debwrt_config
    91         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    92           < $(PATCHES_DIR_OPENWRT)/backfire/005_make_empty_rootfs
    93 endif
    94         #patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    95           < $(PATCHES_DIR_OPENWRT)/003_set_kernel_version
    96         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    97           < $(PATCHES_DIR_OPENWRT)/004_save_environment_variables
     80        rev=$(call get_svn_revision,$(OPENWRT_BUILD_DIR)) ; \
     81        field=`echo "$(OPENWRT_PATCHES_DIR)" | awk -F / '{print NF+2}'` ; \
     82        find "$(OPENWRT_PATCHES_DIR)/all" "$(OPENWRT_PATCHES_DIR)/$(OPENWRT_BRANCH)" -name .svn -prune -o -print | \
     83        awk -F / \
     84          'match($$'$${field}', "^[[:digit:]]+(-([[:digit:]]*):([[:digit:]]*))?_", revs) \
     85          { if(revs[2] <= "'$${rev}'" && (!length(revs[3]) || revs[3] >= "'$${rev}'")) print }' | \
     86        sort -t / -k $${field} | \
     87        while read pat ; \
     88        do \
     89                if ! patch -d "$(OPENWRT_BUILD_DIR)" -p 0 -N < $${pat} ; \
     90                then \
     91                        echo Failed applying patch: $${pat} > /dev/stderr ; \
     92                        rm -f openwrt/checkout "$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp" ; \
     93                        exit 1 ; \
     94                fi ; \
     95        done ; \
    9896        touch $@
    9997
    10098openwrt/unpatch: openwrt/checkout
    101         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    102           < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages
    103 ifeq ($(OPENWRT_BRANCH),trunk)
    104         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    105           < $(PATCHES_DIR_OPENWRT)/trunk/002_install_kernel_modules_and_merge_debwrt_config
    106         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    107           < $(PATCHES_DIR_OPENWRT)/trunk/005_make_empty_rootfs
    108         #-patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N  < $(PATCHES_DIR_OPENWRT)/trunk/006_reverse-changeset27849-changes.patch
    109 else ifeq ($(OPENWRT_BRANCH),backfire)
    110         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    111           < $(PATCHES_DIR_OPENWRT)/backfire/002_install_kernel_modules_and_merge_debwrt_config
    112         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    113           < $(PATCHES_DIR_OPENWRT)/backfire/005_make_empty_rootfs
    114 endif
    115         #-patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    116           < $(PATCHES_DIR_OPENWRT)/003_set_kernel_version
    117         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    118           < $(PATCHES_DIR_OPENWRT)/004_save_environment_variables
     99        rev=$(call get_svn_revision,$(OPENWRT_BUILD_DIR)) ; \
     100        field=`echo "$(OPENWRT_PATCHES_DIR)" | awk -F / '{print NF+2}'` ; \
     101        find "$(OPENWRT_PATCHES_DIR)/all" "$(OPENWRT_PATCHES_DIR)/$(OPENWRT_BRANCH)" -name .svn -prune -o -print | \
     102        awk -F / \
     103          'match($$'$${field}', "^[[:digit:]]+(-([[:digit:]]*):([[:digit:]]*))?_", revs) \
     104          { if(revs[2] <= "'$${rev}'" && (!length(revs[3]) || revs[3] >= "'$${rev}'")) print }' | \
     105        sort -t / -k $${field} -r | \
     106        while read pat ; \
     107        do \
     108                if ! patch -d "$(OPENWRT_BUILD_DIR)" -p 0 -R < $${pat} ; \
     109                then \
     110                        echo Failed removing patch: $${pat} > /dev/stderr ; \
     111                        rm -f openwrt/checkout "$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp" ; \
     112                        exit 1 ; \
     113                fi ; \
     114        done ; \
     115        rm openwrt/patch
    119116        touch $@
    120        
     117
    121118
    122119openwrt/files-copy: openwrt/patch
  • branches/contrib/openwrt/patches/generate

    r302 r349  
    2020}
    2121
    22 P=001_disable_all_openwrt_packages
    23 cat ${TD}/${P}.in > ${TD}/${P}
     22P=011_disable_all_openwrt_packages
     23cat ${TD}/all/in.${P} > ${TD}/all/${P}
    2424file2diff debwrt_disables_packages.sed ./scripts/ >> ${TD}/${P}
Note: See TracChangeset for help on using the changeset viewer.