summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xarchPackagesUpdate20
-rwxr-xr-xupdate-submodule13
2 files changed, 31 insertions, 2 deletions
diff --git a/archPackagesUpdate b/archPackagesUpdate
index bb59c67c5..eec2fafb0 100755
--- a/archPackagesUpdate
+++ b/archPackagesUpdate
@@ -214,6 +214,26 @@ echo '... done'
# extract git ${branch}
git -C "${pkgSrcDir}" archive --format tar "${branch}" | \
tar -x -C "${tmpDir}" -f -
+git -C "${pkgSrcDir}" diff '6dc373759d940181bcb2a742f1f37548a7c1cacc' "${branch}" -- $(
+ sed '
+ s/^\[submodule "\([^"[:space:]]\+\)"\]$/\1/
+ t
+ d
+ ' "${tmpDir}/.gitmodules"
+) \
+| sed '
+ /^+++ b/ {
+ N
+ N
+ s#^+++ b/\(\S\+\)\n@@ -0,0 +1 @@\n+Subproject commit \([0-9a-f]\{40\}\)$#\1 \2#
+ t
+ }
+ d
+' \
+| while read -r module commit; do
+ rmdir "${tmpDir}/${module}"
+ echo "${commit}" >"${tmpDir}/${module}"
+done
cd "${tmpDir}"
diff --git a/update-submodule b/update-submodule
index 101994ccd..b47bd791d 100755
--- a/update-submodule
+++ b/update-submodule
@@ -6,10 +6,18 @@ url="$3"
path="${url%% *}"
url="${url#${path} }"
-if [ -n "$(ls -A "${path}")" ]; then
+if [ -d "${path}" ] && [ -n "$(ls -A "${path}")" ]; then
git -C "${pkgSrcDir}" submodule update 2>/dev/null || true
exit
fi
+
+if [ ! -f "${path}" ]; then
+ >&2 echo 'update-submodule needs a commit'
+ exit 1
+fi
+
+commit=$(cat "${path}")
+rm "${path}"
mkdir -p "${path}"
if [ -d "${submoduleDir}" ]; then
upstream="${submoduleDir}/${path}"
@@ -20,4 +28,5 @@ else
upstream="${pkgSrcDir}/${path}"
fi
git -C "${upstream}" pull -q --ff-only
-git clone -q "${upstream}" "${path}"
+git -C "${upstream}" archive "${commit}" \
+| tar -C "${path}" -x