Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/emulators/dolphin-emu/files/gen_gh_tuple.sh
16461 views
1
#!/bin/sh
2
3
echo "GH_TUPLE= \\"
4
for _sm_root in $(find . -type f -name .gitmodules | sed 's/\.gitmodules$//' | sort)
5
do
6
(
7
cd "${_sm_root}"
8
9
# Crawl name|path|url list of submodules within _sm_root
10
grep -e '^\[submodule "' -e 'path = ' -e 'url = ' .gitmodules | \
11
sed -E -e 's|.*"([^"]+)".*|\1|' -e 's|.*= ||' | \
12
paste - - - | \
13
sed -E 's/[[:space:]]+/|/g' | \
14
while read _sm
15
do
16
_sm_name=$(echo "${_sm}" | cut -d '|' -f 1)
17
_sm_path=$(echo "${_sm}" | cut -d '|' -f 2)
18
_sm_url=$(echo "${_sm}" | cut -d '|' -f 3)
19
20
_sm_prefix=$(echo "${_sm_root}" | sed 's|^\./||')
21
22
_account_project=$(echo "${_sm_url}" | sed -e 's|^https://github.com/||' -e 's|/|:|g' -e 's|\.git$||')
23
_group=$(echo "${_account_project}" | cut -d ':' -f 2 | tr -cd 'a-zA-Z0-9_')
24
_tagname_group_subdir=$(git submodule status "${_sm_path}" | sed -E -e 's|^.||' -e "s|[[:space:]]+|:${_group}/${_sm_prefix}|" -e 's|[[:space:]]+.*$||')
25
echo -e "\t${_account_project}:${_tagname_group_subdir} \\"
26
done
27
)
28
done
29
echo ""
30
31