diff --git a/include/quilt.mk b/include/quilt.mk index 140d3905283..a58390f6c54 100644 --- a/include/quilt.mk +++ b/include/quilt.mk @@ -106,13 +106,14 @@ define Kernel/Patch/Default endef define Quilt/RefreshDir - mkdir -p $(2) - -rm -f $(2)/* 2>/dev/null >/dev/null - @( \ + -rm -rf $(2) 2>/dev/null >/dev/null + [ -f $(1)/.quilt_no_patch ] || mkdir -p $(2) + @[ -f $(1)/.quilt_no_patch ] || { \ for patch in $$$$($(if $(3),grep "^$(3)",cat) $(1)/patches/series | awk '{print $$$$1}'); do \ $(CP) -v "$(1)/patches/$$$$patch" $(2); \ done; \ - ) + } + @-rm -f $(1)/.quilt_no_patch 2>/dev/null >/dev/null; endef define Quilt/Refresh/Host @@ -156,7 +157,7 @@ define Quilt/Template } @[ -f "$(1)/patches/series" ] || { \ echo "The source directory contains no quilt patches."; \ - false; \ + touch $(1)/patches/series $(1)/.quilt_no_patch; \ } @[ -n "$$$$(ls $(1)/patches/series)" -o \ "$$$$(cat $(1)/patches/series | $(MKHASH) md5)" = "$$(sort $(1)/patches/series | $(MKHASH) md5)" ] || { \ @@ -165,10 +166,12 @@ define Quilt/Template } $(3)refresh: $(3)quilt-check - @cd "$(1)"; $(QUILT_CMD) pop -a -f >/dev/null 2>/dev/null - @cd "$(1)"; while $(QUILT_CMD) next 2>/dev/null >/dev/null && $(QUILT_CMD) push; do \ - QUILT_DIFF_OPTS="-p" $(QUILT_CMD) refresh -p ab --no-index --no-timestamps; \ - done; ! $(QUILT_CMD) next 2>/dev/null >/dev/null + @[ -f $(1)/.quilt_no_patch ] || { \ + cd "$(1)"; $(QUILT_CMD) pop -a -f >/dev/null 2>/dev/null; \ + while $(QUILT_CMD) next 2>/dev/null >/dev/null && $(QUILT_CMD) push; do \ + QUILT_DIFF_OPTS="-p" $(QUILT_CMD) refresh -p ab --no-index --no-timestamps; \ + done; ! $(QUILT_CMD) next 2>/dev/null >/dev/null; \ + } $(Quilt/Refresh/$(4)) $(3)update: $(3)quilt-check