summaryrefslogtreecommitdiff
path: root/src/dagpkg
diff options
context:
space:
mode:
Diffstat (limited to 'src/dagpkg')
-rwxr-xr-xsrc/dagpkg202
1 files changed, 101 insertions, 101 deletions
diff --git a/src/dagpkg b/src/dagpkg
index 49d6ef1..090d45d 100755
--- a/src/dagpkg
+++ b/src/dagpkg
@@ -30,10 +30,10 @@ source $XDG_CONFIG_HOME/.makepkg.conf &>/dev/null || true
# End inmediately but print an useful message
trap_exit() {
- term_title "error!"
- error "(%s) %s (leftovers on %s)" \
- "${0##*/}" "$@" "${temp_dir}"
- exit 1
+ term_title "error!"
+ error "(%s) %s (leftovers on %s)" \
+ "${0##*/}" "$@" "${temp_dir}"
+ exit 1
}
# Trap signals from makepkg
@@ -42,26 +42,26 @@ trap 'trap_exit "Aborted by user! Exiting..."' INT
trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR
source_pkgbuild() {
- # Source this PKGBUILD, if it doesn't exist, exit
- unset pkgbase pkgname depends makedepends
- unset pkgrel pkgver epoch
- if ! source ./PKGBUILD &>/dev/null ; then
- error "No PKGBUILD in %s" "$PWD"
- exit 1
- fi
-
- # Save resources
- unset pkgdesc license groups backup install md5sums sha1sums \
- sha256sums source options &>/dev/null
-
- unset build package &>/dev/null
-
- for _pkg in ${pkgname[@]}; do
- unset package_${_pkg} &>/dev/null || true
- done
-
- # This is the name of the package
- name="${pkgbase:-${pkgname[0]}}"
+ # Source this PKGBUILD, if it doesn't exist, exit
+ unset pkgbase pkgname depends makedepends
+ unset pkgrel pkgver epoch
+ if ! source ./PKGBUILD &>/dev/null ; then
+ error "No PKGBUILD in %s" "$PWD"
+ exit 1
+ fi
+
+ # Save resources
+ unset pkgdesc license groups backup install md5sums sha1sums \
+ sha256sums source options &>/dev/null
+
+ unset build package &>/dev/null
+
+ for _pkg in ${pkgname[@]}; do
+ unset package_${_pkg} &>/dev/null || true
+ done
+
+ # This is the name of the package
+ name="${pkgbase:-${pkgname[0]}}"
}
source_pkgbuild
@@ -72,12 +72,12 @@ log="${temp_dir}/buildorder"
# Generate the full version with epoch
get_fullver() {
- if [ $1 -eq 0 ]; then
-# zero epoch case, don't include it in version
- echo $2-$3
- else
- echo $1:$2-$3
- fi
+ if [ $1 -eq 0 ]; then
+ # zero epoch case, don't include it in version
+ echo $2-$3
+ else
+ echo $1:$2-$3
+ fi
}
@@ -89,112 +89,112 @@ declare -A marks
# Visit a PKGBUILD for graph building.
visit_pkgbuild() {
- # The name of the previous package
- prev="${1}"
+ # The name of the previous package
+ prev="${1}"
- local name
- source_pkgbuild
+ local name
+ source_pkgbuild
- # If it's already built we don't bother
- is_built ${pkgname[0]} $(get_fullver ${epoch:-0} ${pkgver} ${pkgrel}) &&
- return
+ # If it's already built we don't bother
+ is_built ${pkgname[0]} $(get_fullver ${epoch:-0} ${pkgver} ${pkgrel}) &&
+ return
- # Detect cycle or already visited package
- case "${marks[$name]:-0}" in
- 1) msg2 "cycle found with %s depending on %s" $prev $name
- exit 1;;
- 2) return;;
- esac
+ # Detect cycle or already visited package
+ case "${marks[$name]:-0}" in
+ 1) msg2 "cycle found with %s depending on %s" $prev $name
+ exit 1;;
+ 2) return;;
+ esac
- msg "%s (%s)" ${name} ${prev}
+ msg "%s (%s)" ${name} ${prev}
- echo "${arch[@]}" | grep -qw "$CARCH" ||
- warning "%s isn't ported to %s yet" ${name} ${CARCH}
+ echo "${arch[@]}" | grep -qw "$CARCH" ||
+ warning "%s isn't ported to %s yet" ${name} ${CARCH}
- # If the envvar I contains this package, ignore it and exit
- echo "$I" | grep -qw "$name" &&
- msg2 "%s ignored" ${name} &&
- return
+ # If the envvar I contains this package, ignore it and exit
+ echo "$I" | grep -qw "$name" &&
+ msg2 "%s ignored" ${name} &&
+ return
- # Mark the package as being visited
- marks[$name]=1
+ # Mark the package as being visited
+ marks[$name]=1
- # Recurse into dependencies
- for d in ${depends[@]} ${makedepends[@]}; do
- # Cleanup dependency versions
- d=$(echo $d | sed "s/[<>=].*//")
+ # Recurse into dependencies
+ for d in ${depends[@]} ${makedepends[@]}; do
+ # Cleanup dependency versions
+ d=$(echo $d | sed "s/[<>=].*//")
- # Where's the pkgbuild?
- w=$(toru-where $d)
+ # Where's the pkgbuild?
+ w=$(toru-where $d)
- # Skip if not available
- test -z "$w" && continue
+ # Skip if not available
+ test -z "$w" && continue
- # Go to this dir
- pushd $w &>/dev/null
+ # Go to this dir
+ pushd $w &>/dev/null
- visit_pkgbuild "$name"
+ visit_pkgbuild "$name"
- popd &>/dev/null
- done
+ popd &>/dev/null
+ done
- # Mark the package as finished
- marks[$name]=2
- # Append it to the reversed list of packages to build.
- echo "$name" >> "${log}"
+ # Mark the package as finished
+ marks[$name]=2
+ # Append it to the reversed list of packages to build.
+ echo "$name" >> "${log}"
}
# If we specified a work dir on the cli it means we want to skip
# dependency graph creation and jump to build whatever is there
if [ -z "${1}" ]; then
- # Visit the root PKGBUILD to make the graph.
- visit_pkgbuild ""
+ # Visit the root PKGBUILD to make the graph.
+ visit_pkgbuild ""
else
- msg "Resuming build..."
+ msg "Resuming build..."
fi
# enter work dir
pushd "${temp_dir}" &>/dev/null
nl ${log} | while read order pkg; do
- # skip if already built
- if test -f "${pkg}/built_ok"; then
- warning "tried to build %s twice" "%{pkg}"
- continue
- fi
+ # skip if already built
+ if test -f "${pkg}/built_ok"; then
+ warning "tried to build %s twice" "%{pkg}"
+ continue
+ fi
- # where's this package?
- w="$(toru-where "$pkg")"
- test -z "$w" && continue
+ # where's this package?
+ w="$(toru-where "$pkg")"
+ test -z "$w" && continue
- # copy to work dir if not already
- # this means you can make modifications to the pkgbuild during the
- # graph build or remove the dir after a build failure and let dagpkg
- # copy a new version
- test -d "$pkg" || cp -r "$w" "$pkg"
- pushd "$pkg" &>/dev/null
+ # copy to work dir if not already
+ # this means you can make modifications to the pkgbuild during the
+ # graph build or remove the dir after a build failure and let dagpkg
+ # copy a new version
+ test -d "$pkg" || cp -r "$w" "$pkg"
+ pushd "$pkg" &>/dev/null
- term_title "$pkg($order)"
+ term_title "$pkg($order)"
- msg "Building %s" ${pkg}
+ msg "Building %s" ${pkg}
- # upgrade the system
- # this would probably have to go on HOOKPREBUILD if you're working
- # outside chroots
- sudo -E pacman -Syu --noconfirm
+ # upgrade the system
+ # this would probably have to go on HOOKPREBUILD if you're working
+ # outside chroots
+ sudo -E pacman -Syu --noconfirm
- # run the pre build command from libretools.conf
- ${HOOKPREBUILD}
+ # run the pre build command from libretools.conf
+ ${HOOKPREBUILD}
- # run the build command
- ${FULLBUILDCMD}
+ # run the build command
+ ${FULLBUILDCMD}
- # Run local release hook with $1 = $repo
- ${HOOKLOCALRELEASE} "$(basename "$(dirname "$w")")"
+ # Run local release hook with $1 = $repo
+ ${HOOKLOCALRELEASE} "$(basename "$(dirname "$w")")"
- # it's built!
- touch built_ok
+ # it's built!
+ touch built_ok
- popd &>/dev/null
+ popd &>/dev/null
done
popd &>/dev/null