Hi,

Inspired by Remy Bohmer dependencies on installed files, I did the same for
patches and series files.
Adding more dependencies, especially to early build stages is always
tricky. I'd like to avoid unnecessary rebuilds. So please have a look and
tell me what you think.

Michael Olbrich

---
 rules/other/Toplevel.make              |    2 ++
 scripts/lib/ptxd_make_world_patchin.sh |   21 ++++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/rules/other/Toplevel.make b/rules/other/Toplevel.make
index 35785e0..545e0b3 100644
--- a/rules/other/Toplevel.make
+++ b/rules/other/Toplevel.make
@@ -89,6 +89,8 @@ include $(wildcard $(PROJECTPOSTRULESDIR)/*.make)
 # install_alternative and install_copy has some configuration defined
 # dependencies. include the files specifying these dependencies.
 include $(wildcard $(STATEDIR)/*.deps)
+# include the files specifying patch dependencies
+include $(wildcard $(STATEDIR)/*.patch-deps)
 
 # ----------------------------------------------------------------------------
 # just the "print" target
diff --git a/scripts/lib/ptxd_make_world_patchin.sh 
b/scripts/lib/ptxd_make_world_patchin.sh
index 158acb9..413bfb8 100644
--- a/scripts/lib/ptxd_make_world_patchin.sh
+++ b/scripts/lib/ptxd_make_world_patchin.sh
@@ -9,6 +9,16 @@
 # see the README file.
 #
 
+ptxd_make_world_patchin_add_dep()
+{
+    local dep="$(readlink -f "$1")"
+    local deprule="${ptx_state_dir}/${pkg_label}.extract: \$(wildcard ${dep})"
+    deprule=${deprule//${PTXDIST_TOPDIR}/\$(PTXDIST_TOPDIR)}
+    deprule=${deprule//${PTXDIST_WORKSPACE}/\$(PTXDIST_WORKSPACE)}
+    echo "${deprule}" >> "${pkg_patch_deps}"
+}
+export -f ptxd_make_world_patchin_add_dep
+
 #
 # ptxd_make_world_patchin_apply_init -
 # initialize variables used to apply the patches
@@ -66,6 +76,7 @@ ptxd_make_world_patchin_apply_init()
     else
        pkg_patch_tool=patch
     fi
+    export pkg_patch_deps="${ptx_state_dir}/${pkg_label}.patch-deps"
 }
 export -f ptxd_make_world_patchin_apply_init
 
@@ -233,6 +244,8 @@ ptxd_make_world_patchin_apply()
     #
     ln -s "${pkg_patch_dir}" "${pkg_patchin_dir}/.ptxdist/patches" &&
 
+    rm -f "${pkg_patch_deps}" &&
+
     # link series file - if not available create it
     if [ -z "${pkg_patch_series}" ]; then
 
@@ -266,6 +279,11 @@ ptxd_make_world_patchin_apply()
                "${pkg_patchin_dir}/.ptxdist/series" \
                "${pkg_patch_series}" &&
            unset pkg_patch_series
+       else
+           local patch
+           for patch in $(cat ${pkg_patch_series}); do
+               ptxd_make_world_patchin_add_dep "${pkg_patch_dir}/${patch}"
+           done
        fi
     else
        ln -s "${pkg_patch_series}" "${pkg_patchin_dir}/.ptxdist/series"
@@ -292,9 +310,10 @@ ptxd_make_world_patchin_apply()
            if [ \! -f "${pkg_patchin_dir}/.ptxdist/patches/${patch}" ]; then
                ptxd_bailout "cannot find patch: '${patch}' specified in series 
file '${pkg_patch_series}'"
            fi
-
+           ptxd_make_world_patchin_add_dep 
"${pkg_patchin_dir}/.ptxdist/patches/${patch}"
        done < "${pkg_patchin_dir}/.ptxdist/series" &&
        unset patch para junk
+       ptxd_make_world_patchin_add_dep "${pkg_patch_series}"
     fi || return
 
     #
-- 
1.7.1


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
[email protected]

Reply via email to