Ignore:
Timestamp:
Jun 26, 2013, 11:25:44 PM (6 years ago)
Author:
amain
Message:

Merge contrib branch 340:516. Main features added:

  • updated plugin architecture
  • improved patch system
  • bitten continous integration support
  • sever build fixed over time to remain in sync with OpenWrt
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/openwrt

    • Property svn:ignore
      •  

        old new  
        77prepare
        88files-copy
         9unpatch
  • trunk/openwrt/openwrt.mk

    r336 r517  
    22#
    33# Copyright (C) 2010 Johan van Zoomeren <amain@debwrt.net>
     4#
     5# Copyright (C) 2012 Elliott Mitchell <ehem+debwrt@m5p.com>
     6#       2012-09-27  fixes to files-copy, rework checkout/update
     7#       2012-09-28  complete rewrite of patch/unpatch targets, new capabilities
     8#       2012-09-30  tweaking of patch/unpatch, now handles differing dir levels
    49#
    510# This program is free software: you can redistribute it and/or modify
     
    1722
    1823OPENWRT_PATCHES_DIR=$(TOPDIR)/openwrt/patches
     24OPENWRT_PATCH_DIRS:= "$(OPENWRT_PATCHES_DIR)/all" \
     25        "$(OPENWRT_PATCHES_DIR)/$(OPENWRT_BRANCH)"
     26
     27get_patches = \
     28        if [ ! -d "$(OPENWRT_BUILD_DIR)" ]; then exit 1; fi ; \
     29        rev=$(call get_svn_revision,$(OPENWRT_BUILD_DIR)) ; \
     30        find \
     31          $(OPENWRT_PATCH_DIRS) \
     32          -name .svn -prune -o \! -type d -printf %f/%p\\n | \
     33        gawk -F / '\
     34          BEGIN { OFS=FS } \
     35          match($$1, "^([[:digit:]]+)((-$(OPENWRT_BRANCH))|(-all))?(-([[:digit:]]*):([[:digit:]]*))?(_[^/]*)", revs) \
     36            { if(revs[6] <= '$${rev}' && (!length(revs[7]) || revs[7] >= '$${rev}')) \
     37              { $$1=revs[1] revs[8]; print } \
     38            }' | \
     39        sort $(1) | sed -e's/^[^/]\+\///'
     40
     41do_patches = \
     42        if [ ! -d "$(OPENWRT_BUILD_DIR)" ]; then exit 1; fi ; \
     43        $(call get_patches,$(1)) | while read patch ; \
     44        do \
     45                patchi=$$(echo $${patch} | sed -e's!$(TOPDIR)/!!') ; \
     46                if ! patch -b -d "$(OPENWRT_BUILD_DIR)" -p1 $(2) < "$${patch}" ; \
     47                then \
     48                        echo ">> fail: $${patchi}" > /dev/stderr ; \
     49                        $(if $(FORCE_PATCH),retval=1,exit 1) ; \
     50                else \
     51                        echo ">> success: $${patchi}" ; \
     52                fi ; \
     53        done
    1954
    2055openwrt/all: openwrt/build
     
    4277  openwrt/patch \
    4378  openwrt/files-copy \
    44   plugins/apply-openwrt \
    4579  openwrt/merge-config \
    46   openwrt/download-link \
    47   # end openwrt/prepare:
     80  openwrt/download-link
    4881        touch $@
    4982
     
    5386        cp $(CONFIG_DIR)/openwrt.defconfig $(TMP_DIR)/.config_openwrt
    5487        # Merge default OpenWrt settings with DebWrt menu config settings
    55         #cat .config | grep -v -e CONFIG_TARGET_BOARD -e "^#" >> $(TMP_DIR)/.config_openwrt
    56         cat .config | grep -v -e CONFIG_TARGET_BOARD >> $(TMP_DIR)/.config_openwrt
     88        grep -v -e CONFIG_TARGET_BOARD .config >> $(TMP_DIR)/.config_openwrt
    5789        # Merge default and menu settings with possibly altered settings in make menuconfig in OpenWrt
    5890        # note: settings manually made in OpenWrt menu config will be included!
     
    77109        touch $@
    78110
     111openwrt/patch/show: openwrt/checkout
     112        @$(call get_patches) | while read patch ;\
     113        do \
     114           echo $${patch}; \
     115        done
     116
     117openwrt/patch/force:
     118        rm -f $(TOPDIR)/openwrt/patch ; \
     119        $(MAKE) -C $(TOPDIR) openwrt/patch FORCE_PATCH=1 ; \
     120
    79121openwrt/patch: openwrt/checkout
    80         patch -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    81           < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages
    82 ifeq ($(IS_OPENWRT_TRUNK),y)
    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 1 -N  < $(PATCHES_DIR_OPENWRT)/trunk/006_reverse-changeset27849-changes.patch
    88 else ifeq ($(IS_OPENWRT_BACKFIRE),y)
    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
     122        @$(call do_patches,,-N)
     123        rm -f openwrt/unpatch
    98124        touch $@
    99125
    100 openwrt/unpatch: openwrt/checkout
    101         -patch -R -d $(OPENWRT_BUILD_DIR) -p 0 -N \
    102           < $(PATCHES_DIR_OPENWRT)/001_disable_all_openwrt_packages
    103 ifeq ($(IS_OPENWRT_TRUNK),y)
    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 1 -N  < $(PATCHES_DIR_OPENWRT)/trunk/006_reverse-changeset27849-changes.patch
    109 else ifeq ($(IS_OPENWRT_BACKFIRE),y)
    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
     126openwrt/unpatch/show: openwrt/checkout
     127        @$(call get_patches,-r) | while read patch ;\
     128        do \
     129           echo $${patch}; \
     130        done
     131openwrt/unpatch/force:
     132        rm -f $(TOPDIR)/openwrt/unpatch ; \
     133        $(MAKE) -C $(TOPDIR) openwrt/unpatch FORCE_PATCH=1 ; \
     134
     135openwrt/unpatch:
     136        @if [ ! -f $(TOPDIR)/openwrt/patch ]; then \
     137           echo "E: can't unpatch if patches have not previously been applied"; \
     138           exit 1; \
     139        fi
     140        @$(call do_patches,-r,-R)
     141        rm -f openwrt/patch
    119142        touch $@
    120        
    121143
    122144openwrt/files-copy: openwrt/patch
    123         cd $(FILES_DIR_OPENWRT) && find -type f | while read f; do \
    124            mkdir -p $(OPENWRT_BUILD_DIR)/$$(dirname $$f); \
    125            cp -v $$f $(OPENWRT_BUILD_DIR)/$$(dirname $$f) ;\
    126         done
     145        tar -C $(FILES_DIR_OPENWRT) --exclude-vcs -cpf - . | \
     146          tar -C $(OPENWRT_BUILD_DIR) -xpf - && \
    127147        touch $@
     148
     149ifeq ($(OPENWRT_BRANCH),trunk)
     150OPENWRT_SUBVERSION:=$(call qstrip,$(CONFIG_OPENWRT_SVN_REPO_URL))/trunk/
     151else ifeq ($(OPENWRT_TAG),)
     152OPENWRT_SUBVERSION:=$(call qstrip,$(CONFIG_OPENWRT_SVN_REPO_URL))/branches/$(OPENWRT_BRANCH)/
     153else
     154OPENWRT_SUBVERSION:=$(call qstrip,$(CONFIG_OPENWRT_SVN_REPO_URL))/tags/$(OPENWRT_TAG)
     155endif
    128156
    129157$(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp:
    130158openwrt/checkout: $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp
    131         rm -rf $(OPENWRT_BUILD_DIR)
     159        if [ ! -f $(TOPDIR)/.config ]; then echo "Please type menuconfig first"; exit 1; fi
    132160        mkdir -p $(OPENWRT_BUILD_DIR)
    133 ifeq ($(IS_OPENWRT_TRUNK),y)
    134         cd $(OPENWRT_BUILD_DIR) && \
    135           svn co svn://svn.openwrt.org/openwrt/trunk/ .
    136 else ifeq ($(IS_OPENWRT_BACKFIRE),y)
    137         cd $(OPENWRT_BUILD_DIR) && \
    138           svn co svn://svn.openwrt.org/openwrt/branches/backfire/ .
    139 else
    140         cd $(OPENWRT_BUILD_DIR) && \
    141           svn co -r $(OPENWRT_REVISION) svn://svn.openwrt.org/openwrt/trunk/ .
    142 endif
     161        svn co -r $(OPENWRT_REVISION) $(OPENWRT_SUBVERSION) $(OPENWRT_BUILD_DIR)
    143162        touch $(OPENWRT_BUILD_DIR)/.debwrt.checkout.stamp
    144163        touch $@
    145164
    146165openwrt/update: openwrt/checkout
    147         cd $(OPENWRT_BUILD_DIR) && svn update
     166        svn up -r $(OPENWRT_REVISION) $(OPENWRT_BUILD_DIR)
    148167
    149168openwrt/menuconfig: openwrt/prepare
     
    155174        rm -f openwrt/build
    156175
    157 openwrt/clean:
     176openwrt/wrtclean:
    158177        -$(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) clean V=$(V)
    159178
     
    164183        -$(SCRIPT_CLEAN_EXEC) $(MAKE) -C $(OPENWRT_BUILD_DIR) distclean V=$(V)
    165184
    166 openwrt/debwrt-clean:
     185openwrt/clean:
    167186        rm -rf $(OPENWRT_BUILD_DIR)
    168187        rm -f openwrt/checkout
    169188        rm -f openwrt/patch
    170         rm -f openwrt/copy-files
     189        rm -f openwrt/files-copy
     190
     191.PHONY: openwrt/patch/force \
     192        openwrt/unpatch/force \
     193        openwrt/clean \
     194
Note: See TracChangeset for help on using the changeset viewer.