aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild-updated-packages.bash57
-rw-r--r--package-list.bash35
2 files changed, 31 insertions, 61 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
}
diff --git a/package-list.bash b/package-list.bash
index 590224b..9daf598 100644
--- a/package-list.bash
+++ b/package-list.bash
@@ -1,21 +1,18 @@
-declare -A packages=(
- [cower-git]="cower"
- [elementary-xfce-icons-git]="elementary-xfce"
- [goobook-git]="goobook"
- [gvim-hg]="vim"
- [i3pystatus-git]="i3pystatus"
- [isync-sasl-git]="isync"
- [j4-dmenu-desktop-git]="j4-dmenu-desktop"
- [kittypack-git]="kittypack"
- [mpv-git]="mpv"
- [mutt-kz-git]="mutt-kz"
- [termite-git]="termite"
- [termite-terminfo-git]="termite"
- [vte3-select-text-git]="vte"
- [weechat-git]="weechat"
+declare packages=(
+ "cower-git"
+ "elementary-xfce-icons-git"
+ "goobook-git"
+ "gvim-hg"
+ "i3pystatus-git"
+ "isync-sasl-git"
+ "j4-dmenu-desktop-git"
+ "kittypack-git"
+ "mpv-git"
+ "mutt-kz-git"
+ "termite-git"
+ "termite-terminfo-git"
+ "vte3-select-text-git"
+ "weechat-git"
)
-declare -A branches=(
- [vte3-select-text-git]="vte-0-36"
- [isync-sasl-git]="sasl"
-)
+declare -A old_version