summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--doc/fullpkg.md9
-rw-r--r--doc/treepkg.md129
-rw-r--r--doc/workflows.md4
-rw-r--r--src/fullpkg/Makefile3
-rwxr-xr-xsrc/fullpkg/fullpkg54
-rwxr-xr-xsrc/fullpkg/fullpkg-build206
-rwxr-xr-xsrc/fullpkg/fullpkg-find234
-rw-r--r--src/libretools.conf16
-rwxr-xr-xsrc/treepkg241
10 files changed, 8 insertions, 889 deletions
diff --git a/Makefile b/Makefile
index bba0d46..cd12f75 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,6 @@ libretools=\
src/abslibre-tools \
src/chroot-tools \
src/devtools \
- src/fullpkg \
src/librefetch \
src/toru
libretools-mips64el=src/mips64el-tools
diff --git a/doc/fullpkg.md b/doc/fullpkg.md
deleted file mode 100644
index c870a3f..0000000
--- a/doc/fullpkg.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# FullPKG
-
-FullPKG is a tool to build a package from ABS, find all needed dependencies
-along the way and build them too if necessary.
-
-## Before running fullpkg
-
-Update PKGBUILD path cache by running `toru -u <repo>` on your ABS root. Once
-for each repo you'll be using.
diff --git a/doc/treepkg.md b/doc/treepkg.md
deleted file mode 100644
index b701aa1..0000000
--- a/doc/treepkg.md
+++ /dev/null
@@ -1,129 +0,0 @@
-# TreePKG
-
-`treepkg` is a tool for recursively building packages from an ABS tree. It has
-been tested while building packages for the mips64el port and it has proven to
-be useful.
-
-It was written having in mind the experience of `fullpkg`, which converted to
-`fullpkg-ng` and then splitted into `fullpkg-build` and `fullpkg-find`. It's
-aim is to simplify algorithms implemented on the fullpkg family, while solving
-some design issues that made fullpkg miss some packages sometimes.
-
-
-## Requirements
-
-`treepkg` needs the help of `toru-path` for "indexing" an ABS tree. `toru-path`
-stores a tokyocabinet database of "pkgname" => "path" pairs, where pkgname is
-replaced by the "pkgbase", "pkgname", and "provides" fields of a PKGBUILD,
-followed by the path of the current PKGBUILD.
-
-This information is then used by `treepkg` to know where to find the PKGBUILD of
-a package. The fullpkg family needed to guess this by traversing the full ABS
-tree, and therefore it was unable to find pkgnames that differ from pkgbase.
-
-So, to use `treepkg` you need to run `toru-path` after the ABS tree update.
-
-> Split PKGBUILDs make it difficult to extract metadata if it's stored inside
-> package() functions. This will happen with the provides field and `treepkg`
-> won't find that linux-libre-headers provides linux-headers, for instance.
-
-## How does it work
-
-`treepkg` must be run from the path of the PKGBUILD you're going to build (this
-may change over time). This will be DEPTH=0 and it will create a temporary
-directory to work on in the format /tmp/pkgbase-treepkg-random-string. Inside
-this directory, it will copy the needed PKGBUILDs prefixed with their depth
-number. The first package will always be copied to 000\_pkgbase.
-
-From then on, treepkg sources the PKGBUILD and runs itself over all pkgnames on
-the depends and makedepends array, only if it detects their versions aren't
-already built or deprecated by newer ones, using the `is_built` utility.
-
-While processing this info, it will increase the depth of the packages. It'll
-also write a CSV file with the knowledge it acquires from the ABS tree (useful
-for debugging). This file is called BUILDORDER.
-
-When this process ends (no more needed dependencies are found), the temporary
-work dir is traversed in inverse order (from higher depths to 0) running the
-FULLBUILDCMD from libretools.conf and then the HOOKLOCALRELEASE variable, which
-*must* provide a way to `repo-add` the packages to an available repository, so
-the next build will find and install the newer version using pacman.
-
-For instance, having this as the first pacman repository (on /etc/pacman.conf):
-
- [stage3]
- Server = /var/cache/pacman/pkg
-
-And this on /etc/makepkg.conf:
-
- PKGDEST=/var/cache/pacman/pkg
-
-Your HOOKLOCALRELEASE script should look like this:
-
- # Get needed vars
- source /etc/makepkg.conf
- source /etc/libretools.conf
- source ./PKGBUILD
-
- unset build package check
-
- fullver=$(full_version ${epoch:-0} ${pkgver} ${pkgrel})
- pkgs=()
-
- # Generate canonical package paths
- msg "Adding packages to [stage3]..."
- for name in ${pkgname[@]}; do
- msg2 "${name} ${fullver}"
- pkgs+=("${PKGDEST}/${name}-${fullver}-*.pkg.tar.*")
- done
-
- # Add the packages to a local
- repo-add ${PKGDEST}/stage3.db.tar.gz ${pkgs[@]}
-
- # Stage the packages for later releasing
- librestage $1
-
-> Note the first HOOKLOCALRELEASE argument is the remote repository name (core,
-> extra, etc.)
-
-There's a special case when a dependency depends on another that was put on a
-depth level lower than itself. In this case the build order will be wrongly
-assumed and you may end up with broken packages.
-
-To explain it with an example:
-
- ghostscript (0) - fontconfig (1)
- \ cups (1) - fontconfig (ignored)
-
-The second time fontconfig appears, it will be ignored. In this case cups will
-build against an fontconfig version that will be outdated by the fontconfig
-version at depth 1. In this cases, `treepkg` will detect it cached the
-dependency on a lower depth, and will "bury" it to a depth higher than the
-current one. Thus this will become the build path:
-
- ghostscript (0) - fontconfig (buried)
- \ cups (1) - fontconfig (2)
-
-> Note: currently, `treepkg` doesn't perform recursive burying, so if you hit a
-> really long build tree with some circular dependencies you may find packages
-> buried several times and queued to build before their actuals deps.
-
-## Tips
-
-`treepkg` accepts two arguments: 1) the temporary work dir and 2) the next depth
-level it should use (if current equals 0, it'll pass 1). You don't need to pass
-this arguments when running it manually, they're used internally to
-automatically construct the build path.
-
-But if a build failed, `treepkg` will cancel itself immediately informing you
-where the leftovers files were left. If you pass this path to `treepkg` as the
-first argument, it will resume the build, skipping to the last package being
-packaged.
-
-You can take the opportunity given by this to modify the build path or the
-PKGBUILDs, without having to run `treepkg` twice. For instance you can remove a
-package from the build order, or move it manually, or update the PKGBUILD that
-made `treepkg` fail in the first place. You can force a skipped package (after
-building it manually) by using `touch built_ok` on the PKGBUILD dir.
-
-You don't probably want to mess with the second argument though.
diff --git a/doc/workflows.md b/doc/workflows.md
index 9a8c1a6..03dca4f 100644
--- a/doc/workflows.md
+++ b/doc/workflows.md
@@ -42,7 +42,9 @@ Workflow:
`git log --no-merges --numstat`.
* Pick a package and run `treepkg` from its dir on the chroot, or retake a build
- with `treepkg /tmp/package-treepkg-xxxx`. (Refer to `doc/treepkg` here).
+ with `treepkg /tmp/package-treepkg-xxxx`.
+
+ > Note: `treepkg` has been deprecated in favor of `dagpkg`.
What this allows:
diff --git a/src/fullpkg/Makefile b/src/fullpkg/Makefile
deleted file mode 100644
index 8860e93..0000000
--- a/src/fullpkg/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-include ../../common.mk
-
-fullpkg-build.pot: LIBREXGETTEXT_FLAGS+=--simple=list_pkgs:2
diff --git a/src/fullpkg/fullpkg b/src/fullpkg/fullpkg
deleted file mode 100755
index e053c6e..0000000
--- a/src/fullpkg/fullpkg
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env bash
-# 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 Nicolás Reynolds <fauno@parabola.nu>
-# Copyright (C) 2011-2012 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
-#
-# 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/>.
-
-. libremessages
-
-usage() {
- print "Usage: %s [OPTIONS] [BUILD_DIR]" "${0##*/}"
- print "A (libre)makepkg wrapper that will also build dependencies"
- echo
- prose "More directly, it wraps fullpkg-find and fullpkg-build;
- fullpkg-find finds the dependencies, and sets them up in
- BUILD_DIR; then fullpkg-build builds them."
- echo
- prose "This script will check dependencies, build them if possible and
- stage the packages on its repo."
- echo
- prose "If no BUILD_DIR is specified, it will create a temporary
- directory."
- echo
- print "Options:"
- flag '-h' "Show this message"
-}
-
-while getopts 'h' arg; do
- case "$arg" in
- h) usage; exit 0 ;;
- esac
-done
-
-shift $(( OPTIND - 1 ))
-
-build_dir="${1:-$(mktemp --tmpdir -d fullpkg.XXXXXXXXXX)}"
-fullpkg-find "$build_dir" && fullpkg-build -N "$build_dir"
-
-exit 0
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
diff --git a/src/fullpkg/fullpkg-find b/src/fullpkg/fullpkg-find
deleted file mode 100755
index ac2099f..0000000
--- a/src/fullpkg/fullpkg-find
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/usr/bin/env bash
-# set -x # uncomment for debug
-
-# Copyright (C) 2011-2012 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
-# Copyright (C) 2011-2012 Nicolás Reynolds <fauno@parabola.nu>
-# Copyright (C) 2012 Michał Masłowski <mtjm@mtjm.eu>
-# Copyright (C) 2013-2014 Luke Shumaker <lukeshu@sbcglobal.net>
-#
-# The copy_files() function is taken from makechrootpkg:
-# Copyright (C) 2007 Armin Luntzer <armin@archlinuxppc.org>
-# Copyright (C) 2007 Jason Chu <jchu@xentac.net>
-# Copyright (C) 2007, 2011 Dan McGee <dan@archlinux.org>
-# Copyright (C) 2007-2008 Travis Willard <travis@archlinux.org>
-# Copyright (C) 2007-2009 Aaron Griffin <aaronmgriffin@gmail.com>
-# Copyright (C) 2008 Simo Leone <simo@archlinux.org>
-# Copyright (C) 2009 Biru Ionut <ibiru@archlinux.org>
-# Copyright (C) 2009 Evangelos Foutras <foutrelis@gmail.com>
-# Copyright (C) 2009 Francois Charette <francois@samarqand.localdomain>
-# Copyright (C) 2009 Nezmer <Nezmer@allurelinux.org>
-# Copyright (C) 2009 Ronald van Haren <pressh@gmail.com>
-# Copyright (C) 2009-2011 Andrea Scarpino <andrea@archlinux.org>
-# Copyright (C) 2009-2012 Allan McRae <allan@archlinux.org>
-# Copyright (C) 2009-2012 Eric Bélanger <snowmaniscool@gmail.com>
-# Copyright (C) 2009-2012 Pierre Schmitz <pierre@archlinux.de>
-# Copyright (C) 2010 Byron Clark <byron@theclarkfamily.name>
-# Copyright (C) 2011 Ionut Biru <ibiru@archlinux.org>
-# Copyright (C) 2011 Lukas Fleischer <archlinux@cryptocrack.de>
-# Copyright (C) 2011-2012 Florian Pritz <bluewind@xinu.at>
-# Copyright (C) 2011-2013 Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
-# Copyright (C) 2013 Sébastien Luttringer <seblu@seblu.net>
-#
-# Because of the code from makechrootpkg, this file is GPLv2, instead of GPLv3
-# like most of libretools.
-#
-# License: GNU GPLv2
-#
-# 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; version 2 of the License.
-#
-# 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 General Public License for more details.
-
-
-# Builds packages from ABS recursively. It tries to find dependencies that
-# aren't built or need update and then makepkg them in order.
-
-# TODO: fullpkg-find should find packages wich depend on the
-# package to be build, so we can avoid "missing $name.so errors"
-
-# Get repo name. Asumes ${ABSROOT}/repo/package/PKGBUILD
-guess_repo() {
- basename "$(dirname "$(pwd)")"
-}
-
-# This function is stolen from makechrootpkg.
-copy_files() {
-
- local copydir="$build_dir/${pkgbase:-${pkgname[0]}}"
- mkdir -p "$copydir"
-
- # Copy PKGBUILD and sources
- cp PKGBUILD "$copydir"
- (
- load_PKGBUILD
- for file in "${source[@]}"; do
- file="${file%%::*}"
- file="${file##*://*/}"
- if [[ -f $file ]]; then
- cp "$file" "$copydir/"
- elif [[ -f $SRCDEST/$file ]]; then
- cp "$SRCDEST/$file" "$copydir/"
- fi
- done
-
- # Find all changelog and install files, even inside functions
- for i in 'changelog' 'install'; do
- while read -r file; do
- # evaluate any bash variables used
- eval file=\"$(sed "s/^\\(['\"]\\)\\(.*\\)\\1\$/\\2/" <<< "$file")\"
- [[ -f $file ]] && cp "$file" "$copydir"
- done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
- done
- )
-}
-
-# Checks ABSROOT and look for target pkg deps. Adds them if not built or outdated.
-find_deps() {
- # Check this level
- load_PKGBUILD
-
- local repo="${repo:-$(guess_repo)}"
- local pkgbase="${pkgbase:-${pkgname[0]}}"
-
- # Checking any package built, since otherwise e.g. kdebase would
- # be always considered outdated: there is no package built named kdebase.
- # TODO: maybe check for the package requested in case of recursive calls,
- # instead of the first one listed?
- if is_built "${pkgname[0]}" "$(get_full_version "${pkgname[0]}")"; then
- exit 0 # pkg is built and updated
- fi
-
- # greater levels are built first
- echo "${LEVEL}:${pkgbase}" >>"$build_dir/BUILDORDER"
- # PKGBUILD is already there
- if [[ -d "${build_dir}/${pkgbase}" ]]; then
- exit 0
- # Copy dir to build_dir
- else
- copy_files
-
- # to identify repo later
- echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO"
- fi
-
- # current package plus a space for every level
- msg2 "%${LEVEL}s%s" '' "${pkgbase}-$(get_full_version)"
-
- ## Check next levels
- declare -i next_level=$LEVEL+1
-
- # All deps
- local deps=("${depends[@]}" "${makedepends[@]}" "${checkdepends[@]}")
- # Strip version specifiers
- deps=("${deps[@]%%[=<>]*}")
- # Filter out duplicates
- read -d $'\n' -a deps <<<"$(printf '%s\n' "${deps[@]}"|sort -u)"
-
- local _dep
- for _dep in "${deps[@]}"; do
-
- local found=false
- # May fail, e.g. since abslibre-mips64el doesn't include
- # arch=any packages.
- local pkgdir=$(toru -p ${_dep}) || true
-
- if [[ -n "$pkgdir" ]] && [[ -d "${pkgdir}" ]; then
- found=true
-
- pushd "${pkgdir}" > /dev/null
- # runs itself on dep's PKGBUILD dir
- "$0" -l "${next_level}" "${build_dir}" || return $?
- popd > /dev/null
- fi
-
- if ! (( found )); then
- echo "dep_not_found:$_dep" >>$build_dir/log
- fi
-
- done
-
- ## End variable block
-
- unset next_level dir
-}
-
-. libremessages
-. "$(librelib conf.sh)"
-load_files makepkg
-
-LEVEL=0
-MAXLEVEL=20
-CLEANFIRST='false'
-UPDATEDB='true'
-
-usage() {
- print "Usage: %s [OPTIONS] [BUILD_DIR]" "${0##*/}"
- print "Finds package dependencies and sets up a build order"
- echo
- prose "Run this from a directory containing a PKGBUILD."
- echo
- prose "This script will create a BUILD_DIR for recursive building; it
- tries to find dependencies that aren't built or need update."
- echo
- prose "If no BUILD_DIR is specified, it will create a temporary
- directory."
- echo
- print "Options:"
- flag "-h" "Show this message"
- flag "-A <$(_ ABSROOT)>" "Use ABSROOT as the root of the ABS tree"
- flag "-c" "Clean BUILD_DIR before working."
- flag "-m <$(_ MAX_LEVEL)>" "Limit the depth of the dependency recursion"
- flag "-n" "Don't update pacman DB"
-}
-
-while getopts 'hA:l:cmn' arg; do
- case "$arg" in
- h) usage; exit 0 ;;
- A) ABSROOT="$OPTARG" ;;
- l) LEVEL="$OPTARG" ;; # hidden option to know dep level.
- c) CLEANFIRST='true' ;;
- m) MAXLEVEL="$OPTARG" ;;
- n) UPDATEDB='false' ;;
- esac
-done
-
-if [[ ! -r PKGBUILD ]]; then
- error "This directory doesn't contain a PKGBUILD"
- usage
- exit 1
-fi
-
-shift $(( OPTIND - 1 ))
-build_dir="${1}"
-
-if [[ "$LEVEL" -eq 0 ]]; then
-
- build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}"
-
- if [[ ! -d "$build_dir" ]]; then
- mkdir -p "$build_dir"
- elif "$CLEANFIRST"; then
- # Erase files already in dir
- msg "Cleaning up files in dir"
- find "$build_dir" -mindepth 1 -delete
- fi
-
- if "$UPDATEDB"; then
- msg "Updating pacman db"
- sudo pacman -Sy --noconfirm || true
- fi
-
- # make files for log and buildorder
- touch "${build_dir}"/{log,BUILDORDER}
- buildorder="${build_dir}/BUILDORDER"
-
- msg "Checking dependencies"
-fi
-
-find_deps
-
-exit 0
diff --git a/src/libretools.conf b/src/libretools.conf
index 452a70f..a54d73b 100644
--- a/src/libretools.conf
+++ b/src/libretools.conf
@@ -15,10 +15,10 @@ BLACKLIST=https://projects.parabola.nu/blacklist.git/plain/blacklist.txt
DIFFPROG=$(which $([ -z "${DISPLAY:-}" ]||echo kdiff3 meld gvimdiff) vimdiff colordiff diff 2>/dev/null|sed 's/\s.*//;1q')
## The repos you'll be packaging for
-## Used by `toru`
+## Used by `toru`, `toru-path`
# Tip: As early repos take precedence on $REPOS loops, you can use this as
-# inverted order of precedence. Put testing repos first so fullpkg find new
-# PKGBUILDs first, for instance. Toru-path uses reverse order to enforce repo
+# inverted order of precedence. Put testing repos first so dagpkg will find new
+# PKGBUILDs first, for instance. `toru-path` uses reverse order to enforce repo
# precedence on the path cache (the last path added replaces the rest)
REPOS=('core' 'libre' 'extra' 'community' 'libre-testing' 'social' 'sugar' 'pcr' 'java')
@@ -45,21 +45,15 @@ HOOKPRERELEASE="ssh -fN ${REPODEST%%:*}"
HOOKPOSTRELEASE="sudo librechroot clean-repo"
################################################################################
-# dagpkg/fullpkg/treepkg #
+# dagpkg
################################################################################
# Note: Not being set is valid for any of the HOOK* settings.
-# Run a command to modify ./PKGBUILD before building
-# NOTE: fullpkg ONLY
-#HOOKPKGBUILDMOD="mips-add"
-
# Run a command before running FULLBUILDCMD
-# NOTE: IGNORED by fullpkg
-#HOOKPREBUILD=""
+HOOKPREBUILD=""
## Uncomment one of those or make one of your choice
-# NOTE: fullpkg passes this to eval(1bash), where the others run it directly.
# Normal
FULLBUILDCMD="sudo libremakepkg"
# Cross compiling
diff --git a/src/treepkg b/src/treepkg
deleted file mode 100755
index 9b6d34f..0000000
--- a/src/treepkg
+++ /dev/null
@@ -1,241 +0,0 @@
-#!/usr/bin/env bash
-
-# Copyright (C) 2012-2013 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/>.
-
-source libremessages
-source "$(librelib conf.sh)"
-
-load_files libretools
-check_vars libretools FULLBUILDCMD || exit 1
-# The following variables are actually optional
-#check_vars libretools HOOKPREBUILD HOOKLOCALRELEASE || exit 1
-load_files makepkg
-
-term_title "%s" "${0##*/}"
-
-# End inmediately but print an useful message
-trap_exit() {
- term_title "%s: Error!" "${0##*/}"
- error "%s: %s (leftovers on %s" "${0##*/}" "$*" "${BUILDDIR}"
- exit 1
-}
-
-# Trap signals from makepkg
-set -E
-trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT
-trap 'trap_exit "Aborted by user! Exiting..."' INT
-trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR
-
-# Add line to build order cache in CSV format
-# *must* be run from the PKGBUILD path
-# status;depth;pkgbase;[epoch:]pkgver-pkgrel;path;repo
-# $1 status
-# $2 pkgname
-add_order() {
- echo "${1};${DEPTH};${2:-${pkgbase}};$(get_full_version ${2});${PWD};$(guess_repo "$PWD")" >> "${BUILDORDER}"
- ${VERBOSE} && msg2 "%${DEPTH}s${2:-${pkgbase}} [${1}]" || true
-}
-
-# Bury a package deeper in the tree
-# $1 pkgbase
-# $2 nextdepth
-bury() {
- # Bury only if we are going to build the dep
- # Get it's current depth and dir name
- local current_depth=$(grep "build;[0-9]\+;${1};" "${BUILDORDER}" | cut -d ';' -f 2)
- local current_name="$(printf "%03d" ${current_depth})_${1}"
-
- # If there's a depth or the package is not the root of the build tree (which
- # can lead to funny chicken-and-egg problems), update the depth to the current
- # package next-depth and rename the dir too
- if [[ -z "${current_depth}" ]]; then return; fi
- if [[ -z "${current_name}" ]]; then return; fi
- if [[ ${current_depth} -eq 0 ]]; then return; fi
- if [[ ${current_depth} -ge $2 ]]; then return; fi
-
- ${VERBOSE} && msg "Burying ${1} from ${current_depth} to ${2}"
-
- {
- sed -i "s|^\(build;\)\([0-9]\+\)\(;${1};.*\)$|\1${2}\3|" "${BUILDORDER}" && \
- mv "${BUILDDIR}/${current_name}" "${BUILDDIR}/$(printf "%03d" ${2})_${1}"
- } || return 1
-}
-
-# Guess the repo from the pkgbase path
-# $1 path, pwd or toru-where
-guess_repo() {
- basename "$(dirname "${1}")"
-}
-
-if [[ ! -f PKGBUILD ]]; then
- error "Missing PKGBUILD (%s)" "$PWD"
- exit 1
-fi
-
-if ! load_PKGBUILD ; then
- error "Can't source PKGBUILD"
- exit 1
-fi
-
-# Save resources
-unset pkgdesc arch license groups backup install md5sums sha1sums \
- sha256sums source options >/dev/null 2>&1
-
-unset build package >/dev/null 2>&1
-
-for _pkg in "${pkgname[@]}"; do
- unset package_${_pkg} >/dev/null 2>&1 || true
-done
-##
-
-# Get useful values
-pkgbase="${pkgbase:-${pkgname[0]}}"
-
-# Get or set the work dir
-BUILDDIR="${1:-$(mktemp --tmpdir -d ${pkgbase}-treepkg.XXXXXXXXXX)}"
-BUILDORDER="${BUILDDIR}/BUILDORDER"
-DEPTH=${2:-0}
-NEXTDEPTH=$((${DEPTH} + 1))
-# This can be set as env vars (ie: $ V=false B=false treepkg)
-# TODO Turn into flags?
-VERBOSE=${V:-true}
-BUILD=${B:-true}
-CLEANUP=${C:-true}
-# Skip BUILDORDER creation and build anything on BUILDDIR
-BUILDNOW=${N:-false}
-IGNORE=(${I})
-
-if [[ ! -z $1 ]] && [[ $DEPTH -eq 0 ]]; then
- BUILDNOW=true
-fi
-
-if ! ${BUILDNOW}; then
- # ensure it exists
- touch "${BUILDORDER}"
-
- # If this package is already built quit silently
- for _pkg in "${pkgname[@]}"; do
-
- if in_array "${_pkg}" "${IGNORE[@]}"; then
- add_order "ignore"
- exit 0
- fi
-
- if is_built "${_pkg}" "$(get_full_version ${_pkg})"; then
- add_order "ignore"
- exit 0
- fi
- done
-
- # Ignore if already in build order
- egrep -q ";${pkgbase};" "${BUILDORDER}" && exit 0
-
- # Add pkgbase to build order
- add_order "build"
-
- # Copy the directory to the build dir
- # TODO run makepkg --source to avoid moving garbage around?
- cp -r "${PWD}" "${BUILDDIR}/$(printf "%03d" ${DEPTH})_${pkgbase}"
-
- # Cleanup dep versioning
- deps=($(echo "${depends[@]} ${makedepends[@]}" | \
- sed "s/[=<>]\+[^ ]\+//g" | \
- tr ' ' "\n" | \
- sort -u))
-
- # NOTE: getting depends from package() is a PITA
- for _dep in "${deps[@]}"; do
- # Move deps deeper in the tree if
- # pkgbase - dep1
- # \ dep2 - dep1
- # dep1 should be depth + 1
- egrep -q ";${_dep};" "${BUILDORDER}" && bury "${_dep}" ${NEXTDEPTH}
-
- # Ask toru where's a PKGBUILD
- depdir="$(toru-where ${_dep})"
-
- if [[ -z ${depdir} ]] || [[ ! -d ${depdir} ]]; then
- # We specify the pkgname because we can't source the dep PKGBUILD
- # Normally 'any' packages are missing from our work ABS
- add_order "missing" "${_dep}"
- continue
- fi
-
- pushd "${depdir}" >/dev/null
-
- # Run itself over dependencies
- $0 "${BUILDDIR}" ${NEXTDEPTH}
-
- done
- # End BUILD now
-fi
-
-# Only build at the end
-if [[ ${DEPTH} -eq 0 ]]; then
- ${VERBOSE} && msg "Starting build" || true
-
- if ${BUILD}; then
- ${VERBOSE} && msg "Build tree stored in %s" "${BUILDORDER}" || true
-
- # Build everything sorting the build dir
- # The reverse order ensures we start by the deepest packages
- for _pkg in $(ls -r "${BUILDDIR}"); do
- # Ignore if there's no PKGBUILD
- if [[ ! -f "${BUILDDIR}/${_pkg}/PKGBUILD" ]]; then continue; fi
- # Skip if already built (faster than calling is_build again)
- if [[ -f "${BUILDDIR}/${_pkg}/built_ok" ]]; then continue; fi
-
- ${VERBOSE} && msg "Building %s" "${_pkg/_/ }" || true
-
- # Remove leading zeros and space if any
- term_title "%s" "$(echo ${_pkg/_/ } | sed "s/^0\+ \?//")"
-
- # Run build command
- pushd "${BUILDDIR}/${_pkg}" >/dev/null
- sudo -E pacman -Syu --noconfirm
-
- if [[ -n "${HOOKPREBUILD:-}" ]]; then
- ${HOOKPREBUILD}
- fi
-
- ${FULLBUILDCMD}
-
- # Run local release hook with $1 = $repo
- if [[ -n "${HOOKLOCALRELEASE:-}" ]]; then
- ${HOOKLOCALRELEASE} $(egrep ";${_pkg#*_};" "${BUILDORDER}" | cut -d';' -f6)
- fi
-
- touch built_ok
- popd >/dev/null
- done
-
- else
- # Just print the working dir
- ${VERBOSE} || echo "${BUILDORDER}" || true
- fi
-
- if ${CLEANUP} ; then
- msg2 "Removing %s" "${BUILDDIR}"
- rm -rf "${BUILDDIR}"
- fi
-
-fi
-
-term_title "Done"
-exit $?