summaryrefslogtreecommitdiff
path: root/src/fullpkg/fullpkg-build
diff options
context:
space:
mode:
Diffstat (limited to 'src/fullpkg/fullpkg-build')
-rwxr-xr-xsrc/fullpkg/fullpkg-build206
1 files changed, 0 insertions, 206 deletions
diff --git a/src/fullpkg/fullpkg-build b/src/fullpkg/fullpkg-build
deleted file mode 100755
index 97da33f..0000000
--- a/src/fullpkg/fullpkg-build
+++ /dev/null
@@ -1,206 +0,0 @@
-#!/usr/bin/env bash
-# set -x # uncomment for debug
-# Builds packages from ABS recursively. It tries to find dependencies that
-# aren't built or need update and then makepkg them in order.
-
-# Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
-# Copyright (C) 2011 Nicolás Reynolds <fauno@parabola.nu>
-# Copyright (C) 2013 Luke Shumaker <lukeshu@sbcglobal.net>
-#
-# License: GNU GPLv3+
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# TODO move __build to chroot
-
-. libremessages
-. "$(librelib conf.sh)"
-load_files makepkg
-load_files libretools
-check_vars libretools FULLBUILDCMD || exit 1
-# The following variables are actually optional
-#check_vars libretools HOOKPKGBUILDMOD HOOKLOCALRELEASE || exit 1
-
-## List packages on log that are on status
-## usage: list_pkgs <status> <message>
-#
-## status: nonfree, built, failed, unstaged
-list_pkgs() {
- msg="$2"
- local pkgs=($(grep "$1:" $build_dir/log)) && {
- msg "$2"
- printf '%s\n' "${pkgs[@]}" | cut -d: -f2
- }
-}
-
-## Check all build_dir, fails if one PKGBUILD is nonfree
-check_nonfree() {
- find "$build_dir" -name PKGBUILD \
- -exec pkgbuild-check-nonfree {} +
- local s=$?
- pkgbuild-summarize-nonfree -q $s || return $s
-}
-
-# Removes a package from the buildorder
-# $1 package name
-# $2 buildorder file
-remove_buildorder() {
- grep -Evw "${1}" ${2} > ${2}2
- mv -f ${2}2 ${2}
-
- return $?
-}
-
-successful_build() {
-
- if [[ "$RUN" != "$FULLBUILDCMD" ]]; then
- return 0 # Custom command or download sources
- fi
-
- if source .INFO && [[ -n "$repo" ]]; then
-
- if [[ ! -z "$HOOKLOCALRELEASE" ]]; then
- "$HOOKLOCALRELEASE" "$repo"
- fi
-
- msg "Updating pacman db and packages"
- sudo pacman -Sy || true
-
- fi
-
- echo "built:$(basename $PWD)" >>$build_dir/log
-}
-
-build_description() {
- list_pkgs "nonfree" "Those packages contain nonfree deps:"
- list_pkgs "built" "Those packages were built and staged:"
- list_pkgs "failed" "Those packages failed to build:"
- list_pkgs "unstaged" "Those packages couldn't be staged (missing reponame):"
-}
-
-__build() {
- pushd ${build_dir} >/dev/null
-
- build_packages=($(sort -gr $buildorder | cut -d: -f2)) # greater levels must be built first
-
- while [[ ${#build_packages[@]} -ge 1 ]]; do
-
- pushd "$build_dir/${build_packages[0]}" >/dev/null
-
- if [[ -n "${HOOKPKGBUILDMOD}" ]]; then
- ${HOOKPKGBUILDMOD} || true
- fi
-
- eval "$RUN"; r=$?
-
- case $r in
-
- 0) successful_build ;;
-
- *) error "There were errors while trying to build the package."
- echo "failed:$(basename $PWD)" >>$build_dir/log
- ;;
- esac
-
- remove_buildorder "${build_packages[0]}" $buildorder || true
-
- # which is next package?
- build_packages=($(sort -gr $buildorder | cut -d: -f2))
- popd > /dev/null
- done
-
- popd >/dev/null
-}
-
-# End inmediately but print a useful message
-trap_exit() {
- error "$@"
- warning "Leftover files left on $build_dir"
- mv .BUILDORDER BUILDORDER
- exit 1
-}
-
-# Trap signals from makepkg
-set -E
-trap 'trap_exit "(fullpkg-build) TERM signal caught. Exiting..."' TERM HUP QUIT
-trap 'trap_exit "(fullpkg-build) Aborted by user! Exiting..."' INT
-trap 'trap_exit "(fullpkg-build) An unknown error has occurred. Exiting..."' ERR
-
-CLEANUP="false"
-CHECKNONFREE="true"
-RUN="$FULLBUILDCMD"
-MESSAGE="$(_ 'Building packages')"
-
-usage() {
- print "Usage: %s [OPTIONS] [BUILD_DIR]" "${0##*/}"
- print "Builds packages in BUILD_DIR, as set up by fullpkg-find"
- echo
- prose "Builds packages from BUILD_DIR; create BUILD_DIR using:"
- print ' $ fullpkg-find BUILD_DIR'
- echo
- prose "If no BUILD_DIR is specified, it uses the current directory."
- echo
- print "Options:"
- flag "-c" "Clean BUILD_DIR on successful build"
- flag "-N" "Don't check for freedom issues." #Also made by fullpkg-find
- flag "-r $(_ CMD)" "Use CMD instead of \${FULLBUILDCMD}"
- flag "-g" "Get sources for building packages on BUILD_DIR"
- flag "-h" "Show this message"
-}
-
-while getopts 'hNr:g' arg; do
- case $arg in
- h) usage; exit 0 ;;
- c) CLEAN ;;
- N) CHECKNONFREE="false" ;;
- r) RUN="$OPTARG"
- MESSAGE="$(_ 'Executing custom action')";;
- g) RUN='makepkg -g > /dev/null'
- MESSAGE="$(_ 'Downloading packages')";;
- esac
-done
-
-shift $(( OPTIND - 1 ))
-build_dir="${1:-`pwd`}"
-buildorder="${build_dir}/BUILDORDER"
-
-if [[ ! -e "$buildorder" ]]; then
- error "This is not a build_dir. Make one using fullpkg."
- usage
- exit 1
-else
- # backup BUILDORDER
- cp "$buildorder" "$build_dir/.BUILDORDER"
-fi
-
-if "$CHECKNONFREE"; then
- check_nonfree
-fi
-
-msg "$MESSAGE"
-__build
-
-if [[ "$RUN" != "$FULLBUILDCMD" ]]; then
- # Used for downloading or custom command
- mv "$build_dir/.BUILDORDER" "$buildorder"
- exit 0
-elif "$CLEANUP"; then
- find "$build_dir" -mindepth 1 -delete
-fi
-
-build_description
-
-plain "Test packages on and if they work fine librerelease."
-
-exit 0