summaryrefslogtreecommitdiffstats
path: root/scripts/lib/ptxd_make_world_patchin.sh
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2010-03-21 17:34:29 +0100
committerMarc Kleine-Budde <mkl@pengutronix.de>2010-04-01 10:23:14 +0200
commitec601f5f9b7a07e0a1bcae5439e9be88a782c850 (patch)
tree7b0b5d4099b691df68e70a5719960a655c1768b8 /scripts/lib/ptxd_make_world_patchin.sh
parent4a2ba6eee29d92413b3c0985d863fe7ff4bb7a04 (diff)
downloadptxdist-ec601f5f9b7a07e0a1bcae5439e9be88a782c850.tar.gz
ptxdist-ec601f5f9b7a07e0a1bcae5439e9be88a782c850.tar.xz
[ptxd_make_world_patchin] add option to apply patches with git
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'scripts/lib/ptxd_make_world_patchin.sh')
-rw-r--r--scripts/lib/ptxd_make_world_patchin.sh72
1 files changed, 71 insertions, 1 deletions
diff --git a/scripts/lib/ptxd_make_world_patchin.sh b/scripts/lib/ptxd_make_world_patchin.sh
index a1356075e..d9453b826 100644
--- a/scripts/lib/ptxd_make_world_patchin.sh
+++ b/scripts/lib/ptxd_make_world_patchin.sh
@@ -59,7 +59,9 @@ ptxd_make_world_patchin_apply_init()
fi
# decide which tool to use
- if which quilt > /dev/null 2>&1; then
+ if [ "${PTXCONF_SETUP_PATCHIN_GIT}" ] && which git > /dev/null 2>&1; then
+ pkg_patch_tool=git
+ elif which quilt > /dev/null 2>&1; then
pkg_patch_tool=quilt
else
pkg_patch_tool=patch
@@ -69,6 +71,70 @@ export -f ptxd_make_world_patchin_apply_init
#
+# initialize git database in $pkg_patchin_dir and do initial commit
+#
+ptxd_make_world_patchin_apply_git_init()
+{
+ local git_dir
+ git_dir="$(git rev-parse --git-dir 2> /dev/null)" || true
+
+ # is already git repo?
+ if [ "${git_dir}" != ".git" ]; then
+ git init -q "${pkg_patchin_dir}" &&
+ git add -f . &&
+ git commit -q -m "initial commit" --author="ptxdist-${PTXDIST_VERSION_FULL} <ptxdist@pengutronix.de>" &&
+ git tag "${pkg_pkg}"
+ git tag base
+ fi
+}
+export -f ptxd_make_world_patchin_apply_git_init
+
+
+#
+# create a directory containing the patches and the selected series
+# file. name that file "series"
+#
+ptxd_make_world_patchin_apply_git_compat()
+{
+ mv "${pkg_patchin_dir}/.ptxdist/patches" "${pkg_patchin_dir}/.ptxdist/patches.orig" &&
+ mkdir "${pkg_patchin_dir}/.ptxdist/patches" &&
+
+ # FIXME use lndir?
+
+ while read patch para; do
+ case "${patch}" in
+ ""|"#"*) continue ;; # skip empty lines and comments
+ *)
+ # FIXME take care about subdirs
+ ln -s "../patches.orig/${patch}" "${pkg_patchin_dir}/.ptxdist/patches" || return
+ ;;
+ esac
+ done < "${pkg_patchin_dir}/.ptxdist/series" &&
+
+ ln -sf "../series" "${pkg_patchin_dir}/.ptxdist/patches"
+}
+export -f ptxd_make_world_patchin_apply_git_compat
+
+
+#
+# apply patch series with git
+#
+ptxd_make_world_patchin_apply_git()
+{
+ #
+ # git quiltimport has uses a hardcoded "series"
+ # for now we cannot use git with series files not names "series"
+ #
+ if [ -n "${pkg_patch_series}" -a "${pkg_patch_series##*/}" != "series" ]; then
+ ptxd_make_world_patchin_apply_git_compat || return
+ fi
+
+ git quiltimport --patches "${pkg_patchin_dir}/.ptxdist/patches" --author "unknown author <unknown.author@example.com>"
+}
+export -f ptxd_make_world_patchin_apply_git
+
+
+#
# apply patch series with quilt
#
ptxd_make_world_patchin_apply_quilt()
@@ -127,6 +193,10 @@ ptxd_make_world_patchin_apply()
return
fi &&
+ if [ "${pkg_patch_tool}" = "git" ]; then
+ ptxd_make_world_patchin_apply_git_init || return
+ fi &&
+
#
# the primary reference is the ".ptxdist" folder in the pkg_patchin_dir:
# these files might be existent: