summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfullpkg16
-rwxr-xr-xis_built6
2 files changed, 13 insertions, 9 deletions
diff --git a/fullpkg b/fullpkg
index ac5b005..c3c44a8 100755
--- a/fullpkg
+++ b/fullpkg
@@ -1,8 +1,8 @@
#!/bin/bash
# TODO
-# * Do version checking
# * Detect circular builds
# * Detect pkgnames by provides, replaces, etc. instead of dir tree
+# * Detect package repo
[[ ! -r PKGBUILD ]] && {
echo "This isn't a build directory"
@@ -102,9 +102,7 @@ quit() {
source PKGBUILD
msg ":: Building ${pkgbase:-${pkgname[@]}}"
-# is_built doesn't support version checking
-#is_built ${pkgbase:-${pkgname[0]}}=${pkgver} && exit 0
-is_built ${pkgbase:-${pkgname[0]}} && exit 0
+is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}" && exit 0
#sudo pacman -Sy
@@ -142,16 +140,20 @@ plain "${deps[@]}"
#sudo pacman -Sy
for _dep in ${deps[@]}; do
- is_built $_dep && continue
is_banned $_dep && continue
for _repo in ${REPOS[@]}; do
# TODO find split packages
[[ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]] && {
-# source "$ABSROOT/${_repo}/$_dep/PKGBUILD"
+ source "$ABSROOT/${_repo}/$_dep/PKGBUILD"
+ msg "Checking for $_dep>=$pkgver"
# If this version is built, continue with the next dep
-# is_built $_dep=$pkgver && continue 2
+
+ if is_built "$_dep>=$pkgver"; then
+ msg "No need to build this one"
+ break
+ fi
cp -r "$ABSROOT/$_repo/$_dep" $tmp_dir/ || {
error "Can't copy $_dep to the work dir."
diff --git a/is_built b/is_built
index 9dc5d1c..52888ce 100755
--- a/is_built
+++ b/is_built
@@ -1,7 +1,9 @@
#!/bin/bash
# Detect is a package is installed or in a database
-pacman -Qqi $1 >/dev/null 2>&1 || \
-pacman -Sqi $1 >/dev/null 2>&1
+# Checks for package, if -T returns non-zero output, egrep will return 0
+# because it finds it, so we negate the value to say it's not built.
+# Example usage: is_built "pcre>=20"
+!(sudo pacman -T "$1" | egrep "*" >/dev/null)
exit $?