You are not logged in.
The package maintainers among us may have noticed that it is slightly tedious (<- understatement of the year) to manage projects from git sources that have submodules.
I am referring to this and that.
I have written a small bash script to be run in a (recursive) clone of the git repository of interest. It will generate a skeleton of PKGBUILD with sources, checksums, and prepare() to manage the submodules. Nested submodules are supported as well.
The script is here: https://gist.github.com/nlgranger/9ecc0 … bmodule-sh
For example, with a project such as edk2 which has many submodules, it produces the following output:
# example of generate output using https://github.com/tianocore/edk2
sources=(
"berkeley-softfloat-3::git+file:///home/ngranger/Downloads/edk2/src/berkeley-softfloat-3"
"brotli::git+file:///home/ngranger/Downloads/edk2/src/brotli"
"cmocka::git+file:///home/ngranger/Downloads/edk2/src/cmocka"
"cryptography::git+file:///home/ngranger/Downloads/edk2/src/cryptography"
"edk2-cmocka::git+file:///home/ngranger/Downloads/edk2/src/edk2-cmocka"
"engine::git+file:///home/ngranger/Downloads/edk2/src/engine"
"googletest::git+file:///home/ngranger/Downloads/edk2/src/googletest"
"jansson::git+file:///home/ngranger/Downloads/edk2/src/jansson"
"krb5::git+file:///home/ngranger/Downloads/edk2/src/krb5"
"libprov::git+file:///home/ngranger/Downloads/edk2/src/libprov"
"libspdm::git+file:///home/ngranger/Downloads/edk2/src/libspdm"
"mbedtls::git+file:///home/ngranger/Downloads/edk2/src/mbedtls"
"oniguruma::git+file:///home/ngranger/Downloads/edk2/src/oniguruma"
"openssl::git+file:///home/ngranger/Downloads/edk2/src/openssl"
"public-mipi-sys-t::git+file:///home/ngranger/Downloads/edk2/src/public-mipi-sys-t"
"pugixml::git+file:///home/ngranger/Downloads/edk2/src/pugixml"
"pylibfdt::git+file:///home/ngranger/Downloads/edk2/src/pylibfdt"
"subhook::git+file:///home/ngranger/Downloads/edk2/src/subhook"
"wycheproof::git+file:///home/ngranger/Downloads/edk2/src/wycheproof"
)
checksums=(
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
"SKIP"
)
prepare() {
repo="."
git -C $repo submodule init
git -C $repo config submodule.SoftFloat.url "file://$srcdir/berkeley-softfloat-3"
git -C $repo config submodule.BaseTools/Source/C/BrotliCompress/brotli.url "file://$srcdir/brotli"
git -C $repo config submodule.CryptoPkg/Library/MbedTlsLib/mbedtls.url "file://$srcdir/mbedtls"
git -C $repo config submodule.CryptoPkg/Library/OpensslLib/openssl.url "file://$srcdir/openssl"
git -C $repo config submodule.MdeModulePkg/Library/BrotliCustomDecompressLib/brotli.url "file://$srcdir/brotli"
git -C $repo config submodule.MdeModulePkg/Universal/RegularExpressionDxe/oniguruma.url "file://$srcdir/oniguruma"
git -C $repo config submodule.MdePkg/Library/BaseFdtLib/libfdt.url "file://$srcdir/pylibfdt"
git -C $repo config submodule.MdePkg/Library/MipiSysTLib/mipisyst.url "file://$srcdir/public-mipi-sys-t"
git -C $repo config submodule.RedfishPkg/Library/JsonLib/jansson.url "file://$srcdir/jansson"
git -C $repo config submodule.SecurityPkg/DeviceSecurity/SpdmLib/libspdm.url "file://$srcdir/libspdm"
git -C $repo config submodule.UnitTestFrameworkPkg/Library/CmockaLib/cmocka.url "file://$srcdir/edk2-cmocka"
git -C $repo config submodule.UnitTestFrameworkPkg/Library/GoogleTestLib/googletest.url "file://$srcdir/googletest"
git -C $repo config submodule.UnitTestFrameworkPkg/Library/SubhookLib/subhook.url "file://$srcdir/subhook"
git -C $repo -c protocol.file.allow=always submodule update
repo="./CryptoPkg/Library/OpensslLib/openssl"
git -C $repo submodule init
git -C $repo config submodule.gost-engine.url "file://$srcdir/engine"
git -C $repo config submodule.krb5.url "file://$srcdir/krb5"
git -C $repo config submodule.pyca.cryptography.url "file://$srcdir/cryptography"
git -C $repo config submodule.wycheproof.url "file://$srcdir/wycheproof"
git -C $repo -c protocol.file.allow=always submodule update
repo="./CryptoPkg/Library/OpensslLib/openssl/gost-engine"
git -C $repo submodule init
git -C $repo config submodule.libprov.url "file://$srcdir/libprov"
git -C $repo -c protocol.file.allow=always submodule update
repo="./MdePkg/Library/MipiSysTLib/mipisyst"
git -C $repo submodule init
git -C $repo config submodule.external/googletest.url "file://$srcdir/googletest"
git -C $repo config submodule.external/pugixml.url "file://$srcdir/pugixml"
git -C $repo -c protocol.file.allow=always submodule update
repo="./SecurityPkg/DeviceSecurity/SpdmLib/libspdm"
git -C $repo submodule init
git -C $repo config submodule.os_stub/mbedtlslib/mbedtls.url "file://$srcdir/mbedtls"
git -C $repo config submodule.os_stub/openssllib/openssl.url "file://$srcdir/openssl"
git -C $repo config submodule.unit_test/cmockalib/cmocka.url "file://$srcdir/cmocka"
git -C $repo -c protocol.file.allow=always submodule update
repo="./SecurityPkg/DeviceSecurity/SpdmLib/libspdm/os_stub/openssllib/openssl"
git -C $repo submodule init
git -C $repo config submodule.gost-engine.url "file://$srcdir/engine"
git -C $repo config submodule.krb5.url "file://$srcdir/krb5"
git -C $repo config submodule.pyca.cryptography.url "file://$srcdir/cryptography"
git -C $repo config submodule.wycheproof.url "file://$srcdir/wycheproof"
git -C $repo -c protocol.file.allow=always submodule update
repo="./SecurityPkg/DeviceSecurity/SpdmLib/libspdm/os_stub/openssllib/openssl/gost-engine"
git -C $repo submodule init
git -C $repo config submodule.libprov.url "file://$srcdir/libprov"
git -C $repo -c protocol.file.allow=always submodule update
}
Happy packaging everyone!
Offline