summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-08 03:01:05 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-08 05:44:53 +0100
commitb0d1ad32fa87e9042e2e7f86469e746f451daafb (patch)
tree2203f323ef26cc3b757d3537f3043adc91f8809c
parent1a44fcfacfb774eeed387732ed5bf6168757cac1 (diff)
git.sh: support downloading *files* as submodules
when we download coreboot, we currently don't have a way to download crossgcc tarballs, so we rely on coreboot to do it, which means running the coreboot build system to do it; which means we don't get them in release archives, unless we add very hacky logic (which did exist and was removed). the problem with coreboot's build system is that it does not define backup links for each given tarball, instead relying on gnu.org exclusively, which seems OK at first because the gnu.org links actually return an HTTP 302 response leading to a random mirror, HOWEVER: the gnu.org 302 redirect often fails, and the download fails, causing an error. a mitigation for this has been to patch the coreboot build system to download directly from a single mirror that is reliable (in our case mirrorservice.org). while this mitigation mostly works, it's not redundant; the kent mirror is occasionally down too, and again we still have the problem of not being able to cleanly provide crossgcc tarballs inside release archives. do it in config/submodules, like so: module.list shall say the relative path of a given file, once downloaded, relative to the given source tree. module.cfg shall be re-used, in the same way as for git submodules, but: subfile="url" subfile_bkup="backup url" do this, instead of: subrepo="url" subrepo_bkup="backup url" example entries in module.list: util/crossgcc/tarballs/binutils-2.41.tar.xz util/crossgcc/tarballs/gcc-13.2.0.tar.xz util/crossgcc/tarballs/gmp-6.3.0.tar.xz util/crossgcc/tarballs/mpc-1.3.1.tar.gz util/crossgcc/tarballs/mpfr-4.2.1.tar.xz util/crossgcc/tarballs/nasm-2.16.01.tar.bz2 util/crossgcc/tarballs/R06_28_23.tar.gz the "subrev" variable (in module.cfg) has been renamed to "subhash", so that this makes sense, and that name is common to both subfile/subrepo. the download logic from the vendor scripts has been re-used for this purpose, and it verifies files using sha512sum. therefore: when specifying subrepo(git submodule), subhash will still be a sha1 checksum, but: when specifying subfile(file, e.g. tarball), subhash will be a sha512 checksum the logic for both (subrepo and subfile) is unified, and has this rule: subrepo* and subfile* must never *both* be declared. the actual configuration of coreboot crossgcc tarballs will be done in a follow-up commit. this commit simply modifies the code to accomodate this. over time, this feature could be used for many other files within source trees, and could perhaps be expanded to allow extracting source tarballs in leiu of git repositories, but the latter is not yet required and thus not implemented. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--config/submodule/coreboot/coreboot413/vboot/module.cfg2
-rw-r--r--config/submodule/coreboot/default/arm-trusted-firmware/module.cfg2
-rw-r--r--config/submodule/coreboot/default/intel-microcode/module.cfg2
-rw-r--r--config/submodule/coreboot/default/libgfxinit/module.cfg2
-rw-r--r--config/submodule/coreboot/default/libhwbase/module.cfg2
-rw-r--r--config/submodule/coreboot/default/vboot/module.cfg2
-rw-r--r--config/submodule/coreboot/dell/intel-microcode/module.cfg2
-rw-r--r--config/submodule/coreboot/dell/libgfxinit/module.cfg2
-rw-r--r--config/submodule/coreboot/dell/libhwbase/module.cfg2
-rw-r--r--config/submodule/coreboot/dell/vboot/module.cfg2
-rw-r--r--config/submodule/coreboot/fam15h_rdimm/blobs/module.cfg2
-rw-r--r--config/submodule/coreboot/fam15h_rdimm/vboot/module.cfg2
-rw-r--r--config/submodule/coreboot/fam15h_udimm/blobs/module.cfg2
-rw-r--r--config/submodule/coreboot/fam15h_udimm/vboot/module.cfg2
-rw-r--r--config/submodule/coreboot/haswell/intel-microcode/module.cfg2
-rw-r--r--config/submodule/coreboot/haswell/libgfxinit/module.cfg2
-rw-r--r--config/submodule/coreboot/haswell/libhwbase/module.cfg2
-rw-r--r--config/submodule/coreboot/haswell/vboot/module.cfg2
-rw-r--r--config/submodule/coreboot/i945/intel-microcode/module.cfg2
-rw-r--r--config/submodule/coreboot/i945/libgfxinit/module.cfg2
-rw-r--r--config/submodule/coreboot/i945/libhwbase/module.cfg2
-rw-r--r--config/submodule/coreboot/i945/vboot/module.cfg2
-rw-r--r--config/submodule/docs/html/module.cfg2
-rw-r--r--config/submodule/docs/img/module.cfg2
-rw-r--r--config/submodule/docs/untitled/module.cfg2
-rw-r--r--config/submodule/grub/default/gnulib/module.cfg2
-rw-r--r--config/submodule/grub/xhci/gnulib/module.cfg2
-rw-r--r--config/submodule/pico-sdk/tinyusb/module.cfg2
-rw-r--r--config/submodule/stm32-vserprog/libopencm3/module.cfg2
-rwxr-xr-xinclude/git.sh27
30 files changed, 49 insertions, 36 deletions
diff --git a/config/submodule/coreboot/coreboot413/vboot/module.cfg b/config/submodule/coreboot/coreboot413/vboot/module.cfg
index 42e3835d..34656ba9 100644
--- a/config/submodule/coreboot/coreboot413/vboot/module.cfg
+++ b/config/submodule/coreboot/coreboot413/vboot/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/vboot.git"
subrepo_bkup="https://github.com/coreboot/vboot"
-subrev="4c523ed10f25de872ac0513ebd6ca53d3970b9de"
+subhash="4c523ed10f25de872ac0513ebd6ca53d3970b9de"
diff --git a/config/submodule/coreboot/default/arm-trusted-firmware/module.cfg b/config/submodule/coreboot/default/arm-trusted-firmware/module.cfg
index ccf35b1b..3fb78c02 100644
--- a/config/submodule/coreboot/default/arm-trusted-firmware/module.cfg
+++ b/config/submodule/coreboot/default/arm-trusted-firmware/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/arm-trusted-firmware.git"
subrepo_bkup="https://github.com/coreboot/arm-trusted-firmware"
-subrev="23d6774ab53ded09d8065a184b4763504e9c8d9e"
+subhash="23d6774ab53ded09d8065a184b4763504e9c8d9e"
diff --git a/config/submodule/coreboot/default/intel-microcode/module.cfg b/config/submodule/coreboot/default/intel-microcode/module.cfg
index a115badf..05a174b0 100644
--- a/config/submodule/coreboot/default/intel-microcode/module.cfg
+++ b/config/submodule/coreboot/default/intel-microcode/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/intel-microcode.git"
subrepo_bkup="https://github.com/coreboot/intel-microcode"
-subrev="ece0d294a29a1375397941a4e6f2f7217910bc89"
+subhash="ece0d294a29a1375397941a4e6f2f7217910bc89"
diff --git a/config/submodule/coreboot/default/libgfxinit/module.cfg b/config/submodule/coreboot/default/libgfxinit/module.cfg
index c3db628b..7e2536f9 100644
--- a/config/submodule/coreboot/default/libgfxinit/module.cfg
+++ b/config/submodule/coreboot/default/libgfxinit/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/libgfxinit.git"
subrepo_bkup="https://github.com/coreboot/libgfxinit"
-subrev="a4be8a21b0e2c752da0042c79aae5942418f53e2"
+subhash="a4be8a21b0e2c752da0042c79aae5942418f53e2"
diff --git a/config/submodule/coreboot/default/libhwbase/module.cfg b/config/submodule/coreboot/default/libhwbase/module.cfg
index 7996007e..2937b8b7 100644
--- a/config/submodule/coreboot/default/libhwbase/module.cfg
+++ b/config/submodule/coreboot/default/libhwbase/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/libhwbase.git"
subrepo_bkup="https://github.com/coreboot/libhwbase"
-subrev="584629b9f4771b7618951cec57df2ca3af9c6981"
+subhash="584629b9f4771b7618951cec57df2ca3af9c6981"
diff --git a/config/submodule/coreboot/default/vboot/module.cfg b/config/submodule/coreboot/default/vboot/module.cfg
index 53306d64..9a23ee96 100644
--- a/config/submodule/coreboot/default/vboot/module.cfg
+++ b/config/submodule/coreboot/default/vboot/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/vboot.git"
subrepo_bkup="https://github.com/coreboot/vboot"
-subrev="3d37d2aafe1f941c532def2a1fbbb58c8dd84182"
+subhash="3d37d2aafe1f941c532def2a1fbbb58c8dd84182"
diff --git a/config/submodule/coreboot/dell/intel-microcode/module.cfg b/config/submodule/coreboot/dell/intel-microcode/module.cfg
index a115badf..05a174b0 100644
--- a/config/submodule/coreboot/dell/intel-microcode/module.cfg
+++ b/config/submodule/coreboot/dell/intel-microcode/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/intel-microcode.git"
subrepo_bkup="https://github.com/coreboot/intel-microcode"
-subrev="ece0d294a29a1375397941a4e6f2f7217910bc89"
+subhash="ece0d294a29a1375397941a4e6f2f7217910bc89"
diff --git a/config/submodule/coreboot/dell/libgfxinit/module.cfg b/config/submodule/coreboot/dell/libgfxinit/module.cfg
index c3db628b..7e2536f9 100644
--- a/config/submodule/coreboot/dell/libgfxinit/module.cfg
+++ b/config/submodule/coreboot/dell/libgfxinit/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/libgfxinit.git"
subrepo_bkup="https://github.com/coreboot/libgfxinit"
-subrev="a4be8a21b0e2c752da0042c79aae5942418f53e2"
+subhash="a4be8a21b0e2c752da0042c79aae5942418f53e2"
diff --git a/config/submodule/coreboot/dell/libhwbase/module.cfg b/config/submodule/coreboot/dell/libhwbase/module.cfg
index 7996007e..2937b8b7 100644
--- a/config/submodule/coreboot/dell/libhwbase/module.cfg
+++ b/config/submodule/coreboot/dell/libhwbase/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/libhwbase.git"
subrepo_bkup="https://github.com/coreboot/libhwbase"
-subrev="584629b9f4771b7618951cec57df2ca3af9c6981"
+subhash="584629b9f4771b7618951cec57df2ca3af9c6981"
diff --git a/config/submodule/coreboot/dell/vboot/module.cfg b/config/submodule/coreboot/dell/vboot/module.cfg
index 53306d64..9a23ee96 100644
--- a/config/submodule/coreboot/dell/vboot/module.cfg
+++ b/config/submodule/coreboot/dell/vboot/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/vboot.git"
subrepo_bkup="https://github.com/coreboot/vboot"
-subrev="3d37d2aafe1f941c532def2a1fbbb58c8dd84182"
+subhash="3d37d2aafe1f941c532def2a1fbbb58c8dd84182"
diff --git a/config/submodule/coreboot/fam15h_rdimm/blobs/module.cfg b/config/submodule/coreboot/fam15h_rdimm/blobs/module.cfg
index c7ae4683..215caf4d 100644
--- a/config/submodule/coreboot/fam15h_rdimm/blobs/module.cfg
+++ b/config/submodule/coreboot/fam15h_rdimm/blobs/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/blobs.git"
subrepo_bkup="https://github.com/coreboot/blobs"
-subrev="034b27818450428f70aa9316c8bd0d65bacd8ee8"
+subhash="034b27818450428f70aa9316c8bd0d65bacd8ee8"
diff --git a/config/submodule/coreboot/fam15h_rdimm/vboot/module.cfg b/config/submodule/coreboot/fam15h_rdimm/vboot/module.cfg
index 7a7ad3c6..5fac75c3 100644
--- a/config/submodule/coreboot/fam15h_rdimm/vboot/module.cfg
+++ b/config/submodule/coreboot/fam15h_rdimm/vboot/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/vboot.git"
subrepo_bkup="https://github.com/coreboot/vboot"
-subrev="ecdca931ae0637d1a9498f64862939bd5bb99e0b"
+subhash="ecdca931ae0637d1a9498f64862939bd5bb99e0b"
diff --git a/config/submodule/coreboot/fam15h_udimm/blobs/module.cfg b/config/submodule/coreboot/fam15h_udimm/blobs/module.cfg
index c7ae4683..215caf4d 100644
--- a/config/submodule/coreboot/fam15h_udimm/blobs/module.cfg
+++ b/config/submodule/coreboot/fam15h_udimm/blobs/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/blobs.git"
subrepo_bkup="https://github.com/coreboot/blobs"
-subrev="034b27818450428f70aa9316c8bd0d65bacd8ee8"
+subhash="034b27818450428f70aa9316c8bd0d65bacd8ee8"
diff --git a/config/submodule/coreboot/fam15h_udimm/vboot/module.cfg b/config/submodule/coreboot/fam15h_udimm/vboot/module.cfg
index 7a7ad3c6..5fac75c3 100644
--- a/config/submodule/coreboot/fam15h_udimm/vboot/module.cfg
+++ b/config/submodule/coreboot/fam15h_udimm/vboot/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/vboot.git"
subrepo_bkup="https://github.com/coreboot/vboot"
-subrev="ecdca931ae0637d1a9498f64862939bd5bb99e0b"
+subhash="ecdca931ae0637d1a9498f64862939bd5bb99e0b"
diff --git a/config/submodule/coreboot/haswell/intel-microcode/module.cfg b/config/submodule/coreboot/haswell/intel-microcode/module.cfg
index 12b01372..90f7d273 100644
--- a/config/submodule/coreboot/haswell/intel-microcode/module.cfg
+++ b/config/submodule/coreboot/haswell/intel-microcode/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/intel-microcode.git"
subrepo_bkup="https://github.com/coreboot/intel-microcode"
-subrev="41af34500598418150aa298bb04e7edacc547897"
+subhash="41af34500598418150aa298bb04e7edacc547897"
diff --git a/config/submodule/coreboot/haswell/libgfxinit/module.cfg b/config/submodule/coreboot/haswell/libgfxinit/module.cfg
index c3db628b..7e2536f9 100644
--- a/config/submodule/coreboot/haswell/libgfxinit/module.cfg
+++ b/config/submodule/coreboot/haswell/libgfxinit/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/libgfxinit.git"
subrepo_bkup="https://github.com/coreboot/libgfxinit"
-subrev="a4be8a21b0e2c752da0042c79aae5942418f53e2"
+subhash="a4be8a21b0e2c752da0042c79aae5942418f53e2"
diff --git a/config/submodule/coreboot/haswell/libhwbase/module.cfg b/config/submodule/coreboot/haswell/libhwbase/module.cfg
index 7996007e..2937b8b7 100644
--- a/config/submodule/coreboot/haswell/libhwbase/module.cfg
+++ b/config/submodule/coreboot/haswell/libhwbase/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/libhwbase.git"
subrepo_bkup="https://github.com/coreboot/libhwbase"
-subrev="584629b9f4771b7618951cec57df2ca3af9c6981"
+subhash="584629b9f4771b7618951cec57df2ca3af9c6981"
diff --git a/config/submodule/coreboot/haswell/vboot/module.cfg b/config/submodule/coreboot/haswell/vboot/module.cfg
index a30a1cee..5ef2153c 100644
--- a/config/submodule/coreboot/haswell/vboot/module.cfg
+++ b/config/submodule/coreboot/haswell/vboot/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/vboot.git"
subrepo_bkup="https://github.com/coreboot/vboot"
-subrev="09fcd2184f9c714829503e84b8a7dfe7f2584e00"
+subhash="09fcd2184f9c714829503e84b8a7dfe7f2584e00"
diff --git a/config/submodule/coreboot/i945/intel-microcode/module.cfg b/config/submodule/coreboot/i945/intel-microcode/module.cfg
index 07b2995a..6edc2d9f 100644
--- a/config/submodule/coreboot/i945/intel-microcode/module.cfg
+++ b/config/submodule/coreboot/i945/intel-microcode/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/intel-microcode.git"
subrepo_bkup="https://github.com/coreboot/intel-microcode"
-subrev="262f0c97f2fbc3839a59523cc6c6bcf500e2850b"
+subhash="262f0c97f2fbc3839a59523cc6c6bcf500e2850b"
diff --git a/config/submodule/coreboot/i945/libgfxinit/module.cfg b/config/submodule/coreboot/i945/libgfxinit/module.cfg
index d8838af8..50153822 100644
--- a/config/submodule/coreboot/i945/libgfxinit/module.cfg
+++ b/config/submodule/coreboot/i945/libgfxinit/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/libgfxinit.git"
subrepo_bkup="https://github.com/coreboot/libgfxinit"
-subrev="066e52eeaa329d782ccee96265a6a351fc395bf1"
+subhash="066e52eeaa329d782ccee96265a6a351fc395bf1"
diff --git a/config/submodule/coreboot/i945/libhwbase/module.cfg b/config/submodule/coreboot/i945/libhwbase/module.cfg
index 56fefb40..cd975dcb 100644
--- a/config/submodule/coreboot/i945/libhwbase/module.cfg
+++ b/config/submodule/coreboot/i945/libhwbase/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/libhwbase.git"
subrepo_bkup="https://github.com/coreboot/libhwbase"
-subrev="8be5a82b85ceb3ee8a1c4fbf36c75a4bfbda8900"
+subhash="8be5a82b85ceb3ee8a1c4fbf36c75a4bfbda8900"
diff --git a/config/submodule/coreboot/i945/vboot/module.cfg b/config/submodule/coreboot/i945/vboot/module.cfg
index 75ce2cf2..352e4222 100644
--- a/config/submodule/coreboot/i945/vboot/module.cfg
+++ b/config/submodule/coreboot/i945/vboot/module.cfg
@@ -1,3 +1,3 @@
subrepo="https://review.coreboot.org/vboot.git"
subrepo_bkup="https://github.com/coreboot/vboot"
-subrev="5b8596cefd1a61252501943f2534323708338732"
+subhash="5b8596cefd1a61252501943f2534323708338732"
diff --git a/config/submodule/docs/html/module.cfg b/config/submodule/docs/html/module.cfg
index 0c5ee4cd..6f5f0773 100644
--- a/config/submodule/docs/html/module.cfg
+++ b/config/submodule/docs/html/module.cfg
@@ -1,3 +1,3 @@
-subrev="20fd775c855428ecff647a42823746863fd57efe"
+subhash="20fd775c855428ecff647a42823746863fd57efe"
subrepo="https://codeberg.org/libreboot/lbwww"
subrepo_bkup="https://git.disroot.org/libreboot/lbwww"
diff --git a/config/submodule/docs/img/module.cfg b/config/submodule/docs/img/module.cfg
index 82bcf8b1..07c4ab89 100644
--- a/config/submodule/docs/img/module.cfg
+++ b/config/submodule/docs/img/module.cfg
@@ -1,3 +1,3 @@
-subrev="625bb7535d388a235bec47a8ce822cda10b53692"
+subhash="625bb7535d388a235bec47a8ce822cda10b53692"
subrepo="https://codeberg.org/libreboot/lbwww-img"
subrepo_bkup="https://git.disroot.org/libreboot/lbwww-img"
diff --git a/config/submodule/docs/untitled/module.cfg b/config/submodule/docs/untitled/module.cfg
index 5608c457..35e950e7 100644
--- a/config/submodule/docs/untitled/module.cfg
+++ b/config/submodule/docs/untitled/module.cfg
@@ -1,3 +1,3 @@
-subrev="d8e2043c1512eb1171c274559ce82e8093ef393f"
+subhash="d8e2043c1512eb1171c274559ce82e8093ef393f"
subrepo="https://codeberg.org/vimuser/untitled-website"
subrepo_bkup="https://notabug.org/untitled/untitled-website"
diff --git a/config/submodule/grub/default/gnulib/module.cfg b/config/submodule/grub/default/gnulib/module.cfg
index 26c28561..6fd77871 100644
--- a/config/submodule/grub/default/gnulib/module.cfg
+++ b/config/submodule/grub/default/gnulib/module.cfg
@@ -1,3 +1,3 @@
subrepo="git://git.sv.gnu.org/gnulib"
subrepo_bkup="https://codeberg.org/libreboot/gnulib"
-subrev="9f48fb992a3d7e96610c4ce8be969cff2d61a01b"
+subhash="9f48fb992a3d7e96610c4ce8be969cff2d61a01b"
diff --git a/config/submodule/grub/xhci/gnulib/module.cfg b/config/submodule/grub/xhci/gnulib/module.cfg
index 26c28561..6fd77871 100644
--- a/config/submodule/grub/xhci/gnulib/module.cfg
+++ b/config/submodule/grub/xhci/gnulib/module.cfg
@@ -1,3 +1,3 @@
subrepo="git://git.sv.gnu.org/gnulib"
subrepo_bkup="https://codeberg.org/libreboot/gnulib"
-subrev="9f48fb992a3d7e96610c4ce8be969cff2d61a01b"
+subhash="9f48fb992a3d7e96610c4ce8be969cff2d61a01b"
diff --git a/config/submodule/pico-sdk/tinyusb/module.cfg b/config/submodule/pico-sdk/tinyusb/module.cfg
index 68798daa..43b71534 100644
--- a/config/submodule/pico-sdk/tinyusb/module.cfg
+++ b/config/submodule/pico-sdk/tinyusb/module.cfg
@@ -1,3 +1,3 @@
-subrev="86c416d4c0fb38432460b3e11b08b9de76941bf5"
+subhash="86c416d4c0fb38432460b3e11b08b9de76941bf5"
subrepo="https://codeberg.org/libreboot/tinyusb"
subrepo_bkup="https://github.com/hathach/tinyusb.git"
diff --git a/config/submodule/stm32-vserprog/libopencm3/module.cfg b/config/submodule/stm32-vserprog/libopencm3/module.cfg
index b8c46854..9fb3460b 100644
--- a/config/submodule/stm32-vserprog/libopencm3/module.cfg
+++ b/config/submodule/stm32-vserprog/libopencm3/module.cfg
@@ -1,3 +1,3 @@
-subrev="458250dc6147dc807eec9e4d5a6caf38a699ecb1"
+subhash="458250dc6147dc807eec9e4d5a6caf38a699ecb1"
subrepo="https://codeberg.org/libreboot/libopencm3"
subrepo_bkup="https://github.com/libopencm3/libopencm3"
diff --git a/include/git.sh b/include/git.sh
index 1573c7d2..5fe41fb3 100755
--- a/include/git.sh
+++ b/include/git.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
eval "$(setvars "" _target rev _xm loc url bkup_url depend tree_depend xtree \
- mdir subrev subrepo subrepo_bkup)"
+ mdir subhash subrepo subrepo_bkup subfile subfile_bkup)"
fetch_project_trees()
{
@@ -114,18 +114,31 @@ prep_submodules()
fetch_submodule()
{
mcfgdir="$mdir/${1##*/}"
- eval "$(setvars "" subrev subrepo subrepo_bkup)"
+ eval "$(setvars "" subhash subrepo subrepo_bkup subfile subfile_bkup)"
[ ! -f "$mcfgdir/module.cfg" ] || . "$mcfgdir/module.cfg" || \
$err "! . $mcfgdir/module.cfg"
- [ -z "$subrepo" ] && [ -z "$subrepo_bkup" ] && return 0
- for mvar in subrepo subrepo_bkup subrev; do
+ st=""
+ for _st in repo file; do
+ _seval="if [ -n \"\$sub$_st\" ] || [ -n \"\$sub${_st}_bkup\" ]"
+ eval "$_seval; then st=\"\$st \$_st\"; fi"
+ done
+ st="${st# }"
+ [ "$st" = "repo file" ] && $err "$mdir: repo/file both defined"
+
+ [ -z "$st" ] && return 0 # subrepo/subfile not defined
+
+ for mvar in "sub${st}" "sub${st}_bkup" "subhash"; do
eval "[ -n \"\$$mvar\" ] || $err \"$1, $mdir: $mvar unset\""
done
- rm -Rf "$tmpgit/$1" || $err "!rm '$mdir' '$1'"
- tmpclone "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subrev" \
- "$mdir/${1##*/}/patches"
+ if [ "$st" = "repo" ]; then
+ rm -Rf "$tmpgit/$1" || $err "!rm '$mdir' '$1'"
+ tmpclone "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subhash" \
+ "$mdir/${1##*/}/patches"
+ else
+ download "$subfile" "$subfile_bkup" "$tmpgit/$1" "$subhash"
+ fi
}
tmpclone()