aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild-updated-packages.bash89
1 files changed, 42 insertions, 47 deletions
diff --git a/build-updated-packages.bash b/build-updated-packages.bash
index 3c0aae8..48edafb 100755
--- a/build-updated-packages.bash
+++ b/build-updated-packages.bash
@@ -1,31 +1,18 @@
#!/usr/bin/env bash
-. "$HOME"/.makepkg.conf
-
-cd "$HOME"/packaging/pkgbuilds
-
+source "$HOME"/.makepkg.conf
source $(dirname $0)/package-list.bash
-need_rebuild=()
-
-#for package in "${!packages[@]}"; do
-# if [[ -d "$package" ]]; then
-# cd "$package"
-# (makepkg -src --noconfirm) &
-# cd -
-#done
+cd "$HOME"/packaging/pkgbuilds
##
-# Buils the given package
+# Get commit of the laste built package from pkgver of PKGBUILD
#
# Arguments:
-# $1: Directory that contains the PKGBUILD of the
-# package to build.
-build_package() {
- if [[ -d "$1" ]]; then
- (cd "$1"
- makepkg -src --noconfirm 2>/dev/null)
- fi
+# $1 Path to the directory of the PKGBUILD to get te old commit from.
+get_old_commit() {
+ (source "$1"/PKGBUILD
+ printf "%s" "$(sed -r 's/.*\.r[0-9]*\.g?//' <<<$pkgver)")
}
##
@@ -53,37 +40,45 @@ get_new_commit() {
fi
}
-##
-# Get commit of the laste built package from pkgver of PKGBUILD
-#
-# Arguments:
-# $1 Path to the directory of the PKGBUILD to get te old commit from.
-get_old_commit() {
- (source "$1"/PKGBUILD
- printf "%s" "$(sed -r 's/.*\.r[0-9]*\.g?//' <<<$pkgver)")
+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
}
-for package in "${!packages[@]}"; do
- new_head=$(get_new_commit "$SRCDEST"/"${packages[$package]}" "${branches[$package]}")
+main() {
+ for package in "${!packages[@]}"; do
+ (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]}")
- old_commit=$(get_old_commit $package)
+ if [[ "$old_commit" != "$new_head" ]]; then
+ needs_rebuild+=("$package")
+ fi
+ done
-# printf "%-30s\t\t%s\t\t%s\n" $package $old_commit $new_head
- if [[ "$old_commit" != "$new_head" ]]; then
- need_rebuild+=("$package")
+ if [[ ${#needs_rebuild[@]} -eq 0 ]]; then
+ printf "%s\n" "No VCS packages found that needs rebuilding."
+ else
+ print "Packages that needs rebuilding:"
+ printf "%s\n" "${needs_rebuild[@]}"
+
+ for package in "${needs_rebuild[@]}"; do
+ (cd "$package"
+ makepkg -src --noconfirm 2>/dev/null) &
+ done
fi
-done
+ wait
-if [ ${#need_rebuild[@]} -eq 0 ]; then
- printf "%s" "No VCS packages needing rebuilding."
-else
- printf "%s" "Packages needing rebuilding: "
- for package in "${need_rebuild[@]}"; do
- printf "%s" "$package"
- build_package "$package" &>/dev/null &
- done
-fi
-wait
+ build_repository
+}
-printf "\n"
-"$HOME"/packaging/vodik-repose/repose kyriasis -r "$HOME"/packaging/repo -p "$HOME"/packaging/built_packages -v
+main "$@"