aboutsummaryrefslogtreecommitdiffstats
path: root/build-updated-packages.bash
diff options
context:
space:
mode:
Diffstat (limited to 'build-updated-packages.bash')
-rwxr-xr-xbuild-updated-packages.bash57
1 files changed, 15 insertions, 42 deletions
diff --git a/build-updated-packages.bash b/build-updated-packages.bash
index 48edafb..4e03d3f 100755
--- a/build-updated-packages.bash
+++ b/build-updated-packages.bash
@@ -1,82 +1,55 @@
#!/usr/bin/env bash
-source "$HOME"/.makepkg.conf
-source $(dirname $0)/package-list.bash
+source $(dirname $0)/config.bash
-cd "$HOME"/packaging/pkgbuilds
+cd "$PKGBUILD_DIR"
##
-# Get commit of the laste built package from pkgver of PKGBUILD
+# Get commit sha from PKGVER of PKGBUILD
#
# Arguments:
-# $1 Path to the directory of the PKGBUILD to get te old commit from.
-get_old_commit() {
+# $1 Path to the directory containing the PKGBUILD
+# to get the sha from
+get_pkgver_sha() {
(source "$1"/PKGBUILD
printf "%s" "$(sed -r 's/.*\.r[0-9]*\.g?//' <<<$pkgver)")
}
##
-# Get newest commit of VCS repo.
-#
-# Arguments:
-# $1 Path to the directory of the VCS repo.
-# $2 Name of the ref to get the newest commit of
-get_new_commit() {
- if [[ -d "$1" ]]; then
- (cd "$1"
- if [[ -d .hg ]]; then
- hg update &>/dev/null
- printf "%s" "$(hg log -r "." --template "{node|short}")"
- elif [[ -n "$(git config --get core.bare)" ]]; then
- if [[ -n "$2" ]]; then
- local ref="$2"
- else
- local ref=HEAD
- fi
- printf "%s" "$(git rev-parse --short $ref)"
- fi)
- else
- printf "%s\n" "Repository to get commit from not found" 1>&2
- fi
-}
-
+# Rebuild the repository using repose
build_repository() {
- REPOSE_BINARY="$HOME"/packaging/vodik-repose/repose
- DATABASE=kyriasis
- ROOT="$HOME"/packaging/repo
- POOL="$HOME"/packaging/built_packages
"$REPOSE_BINARY" "$DATABASE" --root "$ROOT" --pool "$POOL" -v
}
main() {
- for package in "${!packages[@]}"; do
+ for package in "${packages[@]}"; do
+ old_version[$package]=$(get_pkgver_sha "$package")
(cd "$package"
makepkg --nobuild &>/dev/null) &
done
wait
local needs_rebuild=()
- for package in "${!packages[@]}"; do
- old_commit=$(get_old_commit $package)
- new_head=$(get_new_commit "$SRCDEST"/"${packages[$package]}" "${branches[$package]}")
+ for package in "${packages[@]}"; do
+ new_head=$(get_pkgver_sha "$package")
- if [[ "$old_commit" != "$new_head" ]]; then
+ if [[ "${old_version[$package]}" != "$new_head" ]]; then
needs_rebuild+=("$package")
fi
done
if [[ ${#needs_rebuild[@]} -eq 0 ]]; then
- printf "%s\n" "No VCS packages found that needs rebuilding."
+ printf "%s\n" "No VCS packages found that needs to be rebuilt."
else
- print "Packages that needs rebuilding:"
+ printf "Packages that needs to be rebuilt:"
printf "%s\n" "${needs_rebuild[@]}"
for package in "${needs_rebuild[@]}"; do
(cd "$package"
makepkg -src --noconfirm 2>/dev/null) &
done
+ wait
fi
- wait
build_repository
}