diff --git a/share/shpkg/repo_index b/share/shpkg/repo_index
index 85e9cb4..716ffff 100644
--- a/share/shpkg/repo_index
+++ b/share/shpkg/repo_index
@@ -1,10 +1,10 @@
# name directory git-url depends-on
-c3 c3-lang/c3 https://git.kmx.io/c3-lang/c3.git libbsd,libmd
-glfw3 glfw/glfw https://github.com/glfw/glfw.git
-help2man gnu.org/help2man https://git.kmx.io/gnu/help2man.git
-libbsd freedesktop.org/libbsd https://gitlab.freedesktop.org/libbsd/libbsd.git libmd
-libmd hadrons.org/libmd https://git.hadrons.org/git/libmd.git
-libtool gnu.org/libtool git://git.savannah.gnu.org/libtool.git help2man,texinfo
-pkg-config freedesktop.org/pkg-config https://gitlab.freedesktop.org/pkg-config/pkg-config.git
-rtbuf rtbuf/rtbuf https://git.kmx.io/rtbuf/rtbuf.git glfw3
-texinfo gnu.org/texinfo https://git.savannah.gnu.org/git/texinfo.git
\ No newline at end of file
+c3 c3-lang/c3 https://git.kmx.io/c3-lang/c3.git master libbsd,libmd
+glfw3 glfw/glfw https://github.com/glfw/glfw.git master
+help2man gnu.org/help2man https://git.kmx.io/gnu/help2man.git master
+libbsd freedesktop.org/libbsd https://gitlab.freedesktop.org/libbsd/libbsd.git main libmd
+libmd hadrons.org/libmd https://git.hadrons.org/git/libmd.git master
+libtool gnu.org/libtool git://git.savannah.gnu.org/libtool.git master help2man,texinfo
+pkg-config freedesktop.org/pkg-config https://gitlab.freedesktop.org/pkg-config/pkg-config.git master
+rtbuf rtbuf/rtbuf https://git.kmx.io/rtbuf/rtbuf.git master glfw3
+texinfo gnu.org/texinfo https://git.savannah.gnu.org/git/texinfo.git master
diff --git a/share/shpkg/shpkg.subr b/share/shpkg/shpkg.subr
index 3a5f2cd..a5e0807 100644
--- a/share/shpkg/shpkg.subr
+++ b/share/shpkg/shpkg.subr
@@ -113,24 +113,49 @@ shpkg_sha256sum () {
done
}
-
-# Source repository
+# Repo index
SHPKG_REPO_INDEX="${SHPKG_SHARE_DIR}/repo_index"
if ! [ -f "${SHPKG_REPO_INDEX}" ]; then
err 1 "${SHPKG_REPO_INDEX}: not found"
fi
+shpkg_depends_on () {
+ shpkg_repo_info "$@" | cut -d ' ' -f 5 | tr ',' ' '
+}
+
+shpkg_dir () {
+ shpkg_repo_info "$@" | cut -d ' ' -f 2
+}
+
+shpkg_git_branch () {
+ shpkg_repo_info "$@" | cut -d ' ' -f 4
+}
+
+shpkg_git_url () {
+ shpkg_repo_info "$@" | cut -d ' ' -f 3
+}
+
+shpkg_repo_info () {
+ [ "x$#" = "x1" ] || return 1
+ grep "^$1 " "${SHPKG_REPO_INDEX}"
+}
+
+shpkg_src_parent_dir () {
+ dirname "$(shpkg_dir "${REPO}")"
+}
+
+# Source repository
shpkg_clone () {
for REPO; do
SHPKG_REPO_DIR="$(shpkg_dir "${REPO}")"
SHPKG_REPO_PARENT_DIR="$(shpkg_src_parent_dir "${REPO}")"
+ SHPKG_REPO_GIT_BRANCH="$(shpkg_git_branch "${REPO}")"
SHPKG_REPO_GIT_URL="$(shpkg_git_url "${REPO}")"
SHPKG_REPO_BASENAME="$(basename "${SHPKG_REPO_DIR}")"
if ! [ -d "${SHPKG_SRC_DIR}/${SHPKG_REPO_DIR}" ]; then
verbose 1 mkdir -p "${SHPKG_SRC_DIR}/${SHPKG_REPO_PARENT_DIR}"
( verbose 1 cd "${SHPKG_SRC_DIR}/${SHPKG_REPO_PARENT_DIR}" &&
- verbose 1 git clone "${SHPKG_REPO_GIT_URL}" \
- "${SHPKG_REPO_BASENAME}" &&
+ verbose 1 git clone "${SHPKG_REPO_GIT_URL}" -b "${SHPKG_REPO_GIT_BRANCH}" "${SHPKG_REPO_BASENAME}" &&
verbose 1 cd "${SHPKG_REPO_BASENAME}" &&
verbose 1 git submodule init &&
verbose 1 git submodule update
@@ -139,10 +164,6 @@ shpkg_clone () {
done
}
-shpkg_depends_on () {
- shpkg_repo_info "$@" | cut -d ' ' -f 4 | tr ',' ' '
-}
-
shpkg_fetch () {
for REPO; do
SHPKG_REPO_DIR="$(shpkg_dir "${REPO}")"
@@ -152,15 +173,6 @@ shpkg_fetch () {
done
}
-shpkg_repo_info () {
- [ "x$#" = "x1" ] || return 1
- grep "^$1 " "${SHPKG_REPO_INDEX}"
-}
-
-shpkg_git_url () {
- shpkg_repo_info "$@" | cut -d ' ' -f 3
-}
-
shpkg_pull () {
for REPO; do
SHPKG_REPO_DIR="$(shpkg_dir "${REPO}")"
@@ -179,14 +191,6 @@ shpkg_remove () {
done
}
-shpkg_dir () {
- shpkg_repo_info "$@" | cut -d ' ' -f 2
-}
-
-shpkg_src_parent_dir () {
- dirname "$(shpkg_dir "${REPO}")"
-}
-
shpkg_version () {
SHPKG_REPO_DIR="$(shpkg_dir "$1")"
SHPKG_REPO_SRC_DIR="${SHPKG_SRC_DIR}/${SHPKG_REPO_DIR}"