summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua I. Haase H. (xihh) <hahj87@gmail.com>2012-12-04 21:19:22 -0600
committerJoshua I. Haase H. (xihh) <hahj87@gmail.com>2012-12-04 21:19:22 -0600
commitacc2c792c423c5aa81aa95f0516de7724dba3ab9 (patch)
tree73cacea8eff5cdfd23f42b740597b5498d152509
parentd11741d73bbf6940c45ee0f2cadea980e9e40785 (diff)
parent098d7430e6447c4658704c3bcf88ea1ed7a5206b (diff)
Merge branch 'master' of gitpar:libretools
Conflicts: librechroot libremakepkg
-rw-r--r--Makefile68
-rwxr-xr-xaur123
-rwxr-xr-xbuildenv28
-rwxr-xr-xchcleanup11
-rwxr-xr-xdiff-unfree85
-rw-r--r--doc/treepkg.markdown24
-rw-r--r--doc/workflows.markdown60
-rwxr-xr-xlb16
-rwxr-xr-xlibrechroot142
-rwxr-xr-xlibrediff65
-rwxr-xr-xlibremakepkg124
-rwxr-xr-xlibremessages101
-rwxr-xr-xlibremkchroot67
-rwxr-xr-xlibrerepkg72
-rw-r--r--libretools.conf107
-rwxr-xr-xsrc/abslibre-tools/abslibre-commit (renamed from abslibre-commit)0
-rwxr-xr-xsrc/abslibre-tools/createworkdir (renamed from createworkdir)0
-rwxr-xr-xsrc/abslibre-tools/libreaddiff (renamed from libreaddiff)0
-rwxr-xr-xsrc/abslibre-tools/librecommit (renamed from librecommit)0
-rwxr-xr-xsrc/abslibre-tools/librerelease (renamed from librerelease)16
-rwxr-xr-xsrc/abslibre-tools/librestage (renamed from librestage)0
-rwxr-xr-xsrc/abslibre-tools/updateabslibre (renamed from updateabslibre)0
-rwxr-xr-xsrc/aur133
-rwxr-xr-xsrc/chroot-tools/chcleanup57
-rwxr-xr-xsrc/chroot-tools/librechroot158
-rw-r--r--src/chroot-tools/librechroot.gpl240
-rwxr-xr-xsrc/chroot-tools/libremakepkg195
-rwxr-xr-xsrc/chroot-tools/libremakepkg.gpl2105
-rwxr-xr-xsrc/chroot-tools/libremkchroot65
-rwxr-xr-xsrc/diff-unfree86
-rwxr-xr-xsrc/fullpkg/fullpkg (renamed from fullpkg)0
-rwxr-xr-xsrc/fullpkg/fullpkg-build (renamed from fullpkg-build)0
-rwxr-xr-xsrc/fullpkg/fullpkg-find (renamed from fullpkg-find)11
-rwxr-xr-xsrc/is_built (renamed from is_built)0
-rwxr-xr-xsrc/is_unfree (renamed from is_unfree)5
-rwxr-xr-xsrc/librediff57
-rwxr-xr-xsrc/libremessages85
-rwxr-xr-xsrc/librerepkg69
-rw-r--r--src/libretools.conf137
-rwxr-xr-xsrc/mips64el-tools/add-mips64el (renamed from add-mips64el)0
-rwxr-xr-xsrc/mips64el-tools/librebasebuilder (renamed from librebasebuilder)0
-rwxr-xr-x[-rw-r--r--]src/mips64el-tools/mips-add (renamed from mips64el/mips-add)0
-rw-r--r--src/mips64el-tools/mips64el.conf (renamed from mips64el/mips64el.conf)0
-rwxr-xr-xsrc/mips64el-tools/mipsrelease (renamed from mips64el/mipsrelease)5
-rwxr-xr-xsrc/pkgbuild-check-nonfree (renamed from pkgbuild-check-nonfree)142
-rwxr-xr-xsrc/pr-tools/prfullpkg (renamed from prtools/prfullpkg)0
-rwxr-xr-xsrc/pr-tools/prmipsrelease (renamed from prtools/prmipsrelease)0
-rw-r--r--src/pr-tools/prtools.conf (renamed from prtools/prtools.conf)0
-rwxr-xr-x[-rw-r--r--]src/pr-tools/prtoru (renamed from prtools/prtoru)0
-rwxr-xr-xsrc/toru/toru (renamed from toru)0
-rwxr-xr-xsrc/toru/toru-info28
-rwxr-xr-xsrc/toru/toru-path50
-rwxr-xr-xsrc/toru/toru-utils (renamed from toru-utils)7
-rwxr-xr-xsrc/toru/toru-where7
-rwxr-xr-xsrc/treepkg (renamed from treepkg)40
-rwxr-xr-xtoru-path34
-rwxr-xr-xupdate-cleansystem24
57 files changed, 1510 insertions, 1139 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..802117a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,68 @@
+# Configuration
+DESTDIR=
+
+#prefix=/usr/local
+prefix=/usr
+exec_prefix=$(prefix)
+datarootdir=$(prefix)/share
+
+bindir=$(exec_prefix)/bin
+sbindir=$(exec_prefix)/sbin
+#sysconfdir=$(prefix)/etc
+sysconfdir=/etc
+datadir=$(datarootdir)
+docdir=$(datarootdir)/doc
+
+################################################################################
+
+pseudo-packages=abslibre-tools chroot-tools fullpkg mips64el-tools pr-tools toru
+packages=libretools libretools-pr libretools-mips64el
+
+libretools=abslibre-tools chroot-tools fullpkg toru misc
+libretools-pr=pr-tools
+libretools-mips64el=mips64el-tools
+
+################################################################################
+
+all: PHONY libretools
+install: PHONY install-libretools install-doc
+
+install-doc: $(patsubst doc/%,$(DESTDIR)$(docdir)/libretools/%,$(wildcard doc/*))
+
+$(DESTDIR)$(docdir)/libretools/%: doc/%
+ install -Dm644 '$<' '$@'
+
+$(DESTDIR)$(sysconfdir)/libretools.conf: src/libretools.conf
+ install -Dm644 '$<' '$@'
+
+$(foreach pkg,$(pseudo-packages) ., \
+$(eval \
+$(DESTDIR)$(bindir)/%: src/$(pkg)/%; \
+ install -Dm755 '$$<' '$$@' \
+) \
+$(eval \
+$(DESTDIR)$(sysconfdir)/libretools.d/%: src/$(pkg)/%; \
+ install -Dm644 '$$<' '$$@' \
+))
+
+################################################################################
+
+progs = $(shell find src/$1 -maxdepth 1 -type f -executable -printf '%f\n')
+confs = $(shell find src/$1 -maxdepth 1 -type f -not -executable -printf '%f\n')
+files = $(addprefix $(DESTDIR)$2/,$(call progs,$1)) \
+ $(addprefix $(DESTDIR)$3/,$(call confs,$1))
+
+.SECONDEXPANSION:
+$(packages): %: PHONY $$($$*)
+$(addprefix install-,$(packages)): install-%: PHONY $$(addprefix install-,$$($$*))
+
+$(pseudo-packages) misc: %: PHONY
+$(addprefix install-,$(pseudo-packages)): install-%: PHONY $$(call files,$$*,$(bindir),$(sysconfdir)/libretools.d)
+# special cases
+install-misc: PHONY $(call files,.,$(bindir),$(sysconfdir))
+
+################################################################################
+
+FORCE: PHONY
+PHONY:
+.PHONY: FORCE PHONY
diff --git a/aur b/aur
deleted file mode 100755
index b96cb20..0000000
--- a/aur
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/bash
-# Copyright 2010 Nicolás Reynolds, Joshua Ismael
-
-# ---------- GNU General Public License 3 ----------
-
-# This file is part of Parabola.
-
-# Parabola 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.
-
-# Parabola 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.
-
-# You should have received a copy of the GNU General Public License
-# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-
-source /etc/libretools.conf
-source /etc/abs.conf
-
-function usage {
- echo "Usage: $0 pkgname-from-aur1 [pkgname-from-aur2 ...]"
- echo
- echo "This script will download packages from aur to the current dir"
- echo "and check their license for nonfree issues."
-}
-
-while getopts 'h' arg; do
- case $arg in
- h) usage; exit 0 ;;
- *) usage; exit 1 ;;
- esac
-done
-
-missing_deps=()
-for _pkg in ${@}; do
-
-# Remove the version
- _pkg="${_pkg%%[<>=]*}"
-
- if [ -f "${_pkg}/PKGBUILD" ]; then
- warning "${_pkg} already existed."
-
-# Check if we want to diff
- if [ -z "${DIFFTOOL}" ]; then
- continue
- else
-# Store our copy of the PKGBUILD dir
- _diff="${PWD}/${_pkg}"
- stdnull "pushd $(mktemp -d /tmp/${_pkg}.XXXX)"
- msg2 "Downloading PKGBUILD into ${PWD} for diff"
- fi
- fi
-
- msg "Downloading $_pkg..."
- wget -O - -q https://aur.archlinux.org/packages/$_pkg/$_pkg.tar.gz | \
- tar xzf - >/dev/null 2>&1
-
- if [ $? -ne 0 ]; then
- error "Couldn't get $_pkg"
- continue
- fi
-
- stdnull "pushd $_pkg"
-
- if [ ! -z "$_diff" ]; then
- msg2 "Diffing files"
-# Diff all files with our difftool
- for file in *; do
- ${DIFFTOOL} ${_diff}/${file} ${file}
- done
-
-# Go back to our copy to continue working
- stdnull "pushd ${_diff}"
- fi
-
- source PKGBUILD
-
- if ! pkgbuild-check-nonfree; then
- if [ $? -eq 15 ]; then
- warning "This PKGBUILD links to known unfree packages"
- fi
- fi
-
- msg2 "Checking license..."
- free=0
- for _license in ${license[@]}; do
- if [ ! -d /usr/share/licenses/common/$_license ]; then
- warning "License $_license is not a common license"
- free=1
- fi
- done
-
- if [ $free -eq 1 ]; then
- plain "Please check that the license is included in the package and
- *specially* that it respects your freedom."
- fi
-
- for _dep in ${depends[@]} ${makedepends[@]}; do
- _dep=${_dep/[<>=]*/}
- if ! is_built $_dep; then
- if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then
- msg2 "$_dep will be get from AUR"
- missing_deps+=($_dep)
- fi
- else
- msg2 "$_dep is on repos"
- fi
- done
-
- stdnull popd
-
-done
-
-[[ ${#missing_deps[*]} -gt 0 ]] && {
- msg2 "Retrieving missing deps: ${missing_deps[@]}"
- $0 ${missing_deps[@]}
-}
-
-exit 0
diff --git a/buildenv b/buildenv
deleted file mode 100755
index 84a1fc2..0000000
--- a/buildenv
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-trap "umount_all" 0 ERR TERM KILL
-
-user=${SUDO_USER:-${1}}
-
-umount_all() {
- for mp in home/pkgdest home/srcdest home/${user}; do
- msg "Umounting /$mp"
- umount $CHROOTDIR/$CHROOT/$mp || error "Couldn't umount"
- done
-}
-
-source /etc/libretools.conf
-
-for mp in home/pkgdest home/srcdest home/${user} var/lib/toru; do
- msg "Binding /$mp"
- mount -o bind /$mp $CHROOTDIR/$CHROOT/$mp || exit 1
-done
-
-for etc in etc/makepkg.conf etc/abs.conf etc/mtab; do
- msg "Copying config /$etc"
- cp --remove-destination /$etc $CHROOTDIR/$CHROOT/$etc || exit 1
-done
-
-$(dirname $0)/librechroot $CHROOT
-
-exit $?
diff --git a/chcleanup b/chcleanup
deleted file mode 100755
index 7074b84..0000000
--- a/chcleanup
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-[ ! -f /etc/libretools.d/cleansystem ] && exit 1
-
-packages=($(comm -23 <(pacman -Qq | sort) <(sort /etc/libretools.d/cleansystem)))
-
-echo "Removing: ${packages[@]}"
-
-sudo pacman --noconfirm -Rcs ${packages[@]}
-
-exit $?
diff --git a/diff-unfree b/diff-unfree
deleted file mode 100755
index a0a8d63..0000000
--- a/diff-unfree
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/bash
-# This script will help you diff a *-libre PKGBUILD against the unfree one
-# to check for updates.
-# Copyright 2010 Nicolás Reynolds
-
-# ---------- GNU General Public License 3 ----------
-
-# This file is part of Parabola.
-
-# Parabola 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.
-
-# Parabola 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.
-
-# You should have received a copy of the GNU General Public License
-# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-
-source /etc/libretools.conf
-custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
-
-[[ "$1" == "--help" ]] && {
- msg "Diff-Unfree helps you diff build scripts from ABSLibre against
- (Unfree) ABS. Package name and repo will we guessed if you don't
- specify them."
- msg2 "Usage: $0 [community|packages] [unfree-package] [repo]"
- exit 0
-}
-
-[[ ! -r PKGBUILD ]] && {
- error "This is not a build dir."
- exit 1
-}
-
-package_guess=$(basename $PWD)
-
-repo=${1:-$(basename $(dirname $PWD))}
-package=${2:-${package_guess/-libre}}
-trunk=${3:-trunk}
-
-tmp_dir=$(mktemp -d /tmp/${package}.XXXXXX)
-
-svnrepo="packages"
-case $repo in
- community*)
- svnrepo="community"
- ;;
- multilib*)
- svnrepo="community"
- ;;
- *)
- ;;
-esac
-
-unfree_dir="${tmp_dir}/${svnrepo}/${package}/${trunk}"
-
-[[ ! -d "${tmp_dir}" ]] && {
- error "Can't create temp dir"
- exit 1
-}
-
-stdnull 'pushd "${tmp_dir}"'
-
-msg "Getting diff from $repo/$package..."
-
-stdnull 'svn checkout --depth=empty svn://svn.archlinux.org/$svnrepo'
-
-cd ${svnrepo}
-svn update ${package}
-
-# Back to start dir
-stdnull popd
-
-msg "Diffing files"
-
-for _file in ${unfree_dir}/*; do
- msg2 "$(basename "${_file}")"
- ${DIFFTOOL} "$PWD/$(basename "${_file}")" "${_file}"
-done
-
-exit $?
diff --git a/doc/treepkg.markdown b/doc/treepkg.markdown
index 2808599..7f7ece1 100644
--- a/doc/treepkg.markdown
+++ b/doc/treepkg.markdown
@@ -13,9 +13,9 @@ 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 plain text 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.
+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
@@ -24,9 +24,9 @@ pkgbase.
So, to use `treepkg` you need to run `toru-path` after the ABS tree update.
-> Currently `toru-path` doesn't remove duplicated or updated pairs, but it
-> picks the last ones and only processes new PKGBUILDs. This means `toru-path`
-> works correctly but it's database will grow up slowly.
+> 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
@@ -105,6 +105,9 @@ 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
@@ -114,13 +117,14 @@ 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 where left. If you pass this path to `treepkg` as the
+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 re-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.
+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.markdown b/doc/workflows.markdown
new file mode 100644
index 0000000..f55ae7e
--- /dev/null
+++ b/doc/workflows.markdown
@@ -0,0 +1,60 @@
+# Workflows
+
+Describe your packaging workflow here!
+
+
+## fauno's way
+
+During packaging, I don't usually restart a build from scratch if I have to
+make changes to the PKGBUILD. I use a lot of commenting out commands already
+ran, `makepkg -R`, etc. When I used `libremakepkg` I ended up using a lot more
+`librechroot` and working from inside the unconfigured chroot, because
+`makechrootpkg` (the underlying technology for `libremakepkg`) tries to be too
+smart.
+
+When I started writing `treepkg` I found that mounting what I need directly on
+the chroot and working from inside it was much more comfortable and simple than
+having a makepkg wrapper doing funny stuff (for instance, mangling makepkg.conf
+and breaking everything.)
+
+This is how the chroot is configured:
+
+* Create the same user (with same uid) on the chroot that the one I use regularly.
+
+* Give it password-less sudo on the chroot.
+
+* Bind mount /home to /chroot/home, where I have the abslibre-mips64el clone.
+
+* Bind mount /var/cache/pacman/pkg to /chroot/var/cache/pacman/pkg
+
+* Put these on system's fstab so I don't have to do it everytime
+
+* Configure makepkg.conf to PKGDEST=CacheDir and SRCDEST to something on my home.
+
+Workflow:
+
+* Enter the chroot with `systemd-nspawn -D/chroot` and `su - fauno`.
+
+* From another shell (I use tmux) edit the abslibre or search for updates with
+ `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).
+
+What this allows:
+
+* Not having to worry about the state of the chroot. `chcleanup` removes and
+ adds packages in a smart way so shared dependencies stay and others move
+ along (think of installing and removing qt for a complete kde rebuild).
+
+* Building many packages in a row without recreating a chroot for every one of
+ them.
+
+* Knowing that any change you made to the chroot stays as you want (no one
+ touches your makepkg.conf)
+
+* Hability to run regular commands, not through a chroot wrapper. I can `cd` to
+ a dir and use `makepkg -whatever` on it and nothing breaks.
+
+* No extra code spent on wrappers.
diff --git a/lb b/lb
deleted file mode 100755
index 85fb4df..0000000
--- a/lb
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# LibreTools wrapper
-# License: GPLv3
-
-source /etc/libretools.conf
-
-command=$1; shift
-
-[[ ! -x ~/l/libre"${command}" ]] && {
- error "Command not found"
- exit 1
-}
-
-~/l/libre${command} "$@"
-
-exit $?
diff --git a/librechroot b/librechroot
deleted file mode 100755
index ae4a94b..0000000
--- a/librechroot
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/bin/bash
-# LibreChRoot
-# Enters a chroot
-
-# Copyright 2010 Nicolás Reynolds
-# Copyright 2011 Joshua Haase
-
-# ---------- GNU General Public License 3 ----------
-
-# This file is part of Parabola.
-
-# Parabola 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.
-
-# Parabola 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.
-
-# You should have received a copy of the GNU General Public License
-# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-
-function usage {
-
- echo ""
- echo "Usage: $0 [options] [chrootname]"
- echo "Use it as root."
- echo ""
- echo "Default chroot name: $CHROOT"
- echo "Default chrootdir: $CHROOTDIR"
- echo ""
- echo "OPTIONS:"
- echo ""
- echo " -c : clean the chroot using pacman"
- echo " only 'base', 'base-devel' and 'sudo' on chroot"
- echo " -d <chrootdir> : use <chrootdir> instead of default"
- echo " -r : clean /repo on the chroot"
- echo " -h : this message"
- echo " -u : update the chroot"
- echo ""
-
-}
-
-function clean_chroot { # Clean packages with pacman
- msg "Cleaning chroot: ${CHROOTDIR}/${CHROOTNAME}"
- cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/cleansystem"
- (cat <<EOF
-#!/bin/bash
-export LANG=C
-
-count='0'
-
-while [ "\$count" -lt "3" ]; do
-
- pkgs=(\$(comm -23 <(pacman -Qq | sort) <(sort /cleansystem)))
-
- if [ \${#pkgs[@]} -gt 0 ]; then
- pacman --noconfirm -Rcs \${pkgs[@]}
- else
- echo "clean"
- exit 0
- fi
-
- declare -i "count=\$count + 1"
-
-done
-
-echo "Please run \`update-cleansystem\' and try again"
-
-EOF
- ) > "${CHROOTDIR}/${CHROOTNAME}/clean"
-
- chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean"
- mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}"
-
- rm "${CHROOTDIR}/${CHROOTNAME}/clean"
- rm "${CHROOTDIR}/${CHROOTNAME}/cleansystem"
-}
-
-function clean_repo {
- msg "Cleaning repo for chroot: ${CHROOTDIR}/${CHROOTNAME}"
-
- if [ -d "${CHROOTDIR}/${CHROOTNAME}/repo" ]; then
- find "${CHROOTDIR}/${CHROOTNAME}/repo/" -mindepth 1 -delete
- else
- mkdir -p "${CHROOTDIR}/${CHROOTNAME}/repo"
- fi
-
- bsdtar -czf "${CHROOTDIR}/${CHROOTNAME}/repo/repo.db.tar.gz" -T /dev/null
- ln -s "repo.db.tar.gz" "${CHROOTDIR}/${CHROOTNAME}/repo/repo.db"
-
- exit 0
-}
-source /etc/libretools.conf
-
-if [ -e "$XDG_CONFIG_HOME/libretools/libretools.conf" ]; then
- source "$XDG_CONFIG_HOME/libretools/libretools.conf"
-fi
-
-CLEANCHROOT='false'
-UPDATE='false'
-CLEANREPO='false'
-CHROOTNAME="${CHROOT:-${SUDO_USER:-root}}"
-
-while getopts 'hrcud:' arg; do
- case $arg in
- h) usage; exit 0 ;;
- c) CLEANCHROOT='true' ;;
- u) UPDATE='true' ;;
- r) CLEANREPO='true' ;;
- d) CHROOTDIR="$(readlink -e $OPTARG)" ;;
- esac
-done
-
-[[ "$UID" != "0" ]] && {
- error "This script must be run as root."
- exit 1
-}
-
-shift $(($OPTIND - 1))
-
-if [ $# -eq 1 ]; then
- CHROOTNAME="$1"
-fi
-
-if "$CLEANREPO"; then
- clean_repo
-fi
-
-if "$CLEANCHROOT"; then
- clean_chroot
-elif "$UPDATE"; then
- msg "Updating chroot: ${CHROOTDIR}/${CHROOTNAME}"
- mkarchroot -u "${CHROOTDIR}/${CHROOTNAME}"
-else
- msg "Entering chroot: ${CHROOTDIR}/${CHROOTNAME}"
- mkarchroot -r "bash" "${CHROOTDIR}/${CHROOTNAME}"
-fi
-
-exit 0
diff --git a/librediff b/librediff
deleted file mode 100755
index 1f39eb9..0000000
--- a/librediff
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-# Generates a patch for a nonfree PKGBUILD
-#
-# Copyright 2010 Nicolás Reynolds
-
-# ---------- GNU General Public License 3 ----------
-
-# This file is part of Parabola.
-
-# Parabola 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.
-
-# Parabola 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.
-
-# You should have received a copy of the GNU General Public License
-# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-
-usage() {
- echo "Usage: $0 <pkgname> [<pkgname2> ...]"
- echo "Requirements:"
- echo "* Have a <pkgname>/ directory with nonfree build scripts inside"
- echo "* Have a <pkgname>-libre/ directory with libre build scripts inside"
-}
-
-# Load custom config or system-wide config
-custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
-if [ -e $custom_config ]; then
- source $custom_config
-else
- source /etc/libretools.conf
-fi
-
-# Print usage if no package has been given
-[[ -z "$@" ]] && {
- usage
- exit 1
-}
-
-
-for package in $@; do
-# Continue on errors
- [[ ! -d ./${package} || ! -d ./${package}-libre ]] && {
- error "no matching ${package} and ${package}-libre found"
- continue
- }
-
- [[ ! -f ./${package}/PKGBUILD || ! -f ./${package}-libre/PKGBUILD ]] && {
- error "no matching PKGBUILDs found for ${package}-libre"
- continue
- }
-
- source ./${package}-libre/PKGBUILD
- [[ -z ${pkgbase} ]] && pkgbase=${pkgname}
-
-# Generate a diff file, no -r since we don't want to patch src/ nor pkg/
- diff -auN ${package} ${package}-libre > $PATCHDIR/${pkgbase}-${pkgver}-${pkgrel}.patch
-
-done
-
-exit 0
diff --git a/libremakepkg b/libremakepkg
deleted file mode 100755
index 873e588..0000000
--- a/libremakepkg
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/bash
-# Copyright 2010 - 2011 Nicolás Reynolds
-# Copyright 2011 Joshua Ismael Haase Hernández
-
-# ---------- GNU General Public License 3 ----------
-
-# This file is part of Parabola.
-
-# Parabola 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.
-
-# Parabola 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.
-
-# You should have received a copy of the GNU General Public License
-# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-
-
-# set -x # uncomment for debug
-
-function copy_log { # copy logs if they exist
- find "${CHROOTDIR}/${CHROOT}/build/" -maxdepth 1 -name "*\.log" -exec cp {} ./ \;
-}
-
-
-function trap_exit { # End inmediately but print a useful message
- copy_log
- error "$@"
- exit 1
-}
-
-# Trap signals from makepkg
-set -E
-trap 'trap_exit "(libremakepkg): TERM signal caught. Exiting..."' TERM HUP QUIT
-trap 'trap_exit "(libremakepkg): Aborted by user! Exiting..."' INT
-trap 'trap_exit "(libremakepkg): An unknown error has occurred. Exiting..."' ERR
-
-source /etc/libretools.conf
-
-CLEANFIRST="false"
-UPDATEFIRST="false"
-CHECKNONFREE="true"
-LIBRECHROOT_ARGS=""
-MAKEPKG_ARGS=""
-
-function usage {
-
- echo ''
- echo 'cd to a dir containing a PKGBUILD and run:'
- echo '$0 [options] [-- makechrootpkg args [-- makepkg args]]'
- echo 'This script will build your package on a chroot.'
- echo ''
- echo 'OPTIONS:'
- echo ''
- echo ' -h : show this message.'
- echo ' -c : clean the chroot before building.'
- echo ' -u : update the chroot before building.'
- echo ' -d <chrootdir> : use this dir instead of "$CHROOTDIR"'
- echo ' -n <chrootname> : use this dir instead of "$CHROOT".'
- echo ' -N : do not check freedom issues' # As fullpkg-check will do that before
- echo ''
- exit 1
-
-}
-
-while getopts 'hcud:n:N' arg ; do
- case "${arg}" in
- h) usage ;;
- c) CLEANFIRST="true" ;;
- u) UPDATEFIRST="true" ;;
- d) CHROOTDIR="$OPTARG"
- LIBRECHROOT_ARGS='-d "$OPTARG"' ;;
- n) CHROOT="$OPTARG" ;;
- N) CHECKNONFREE="false" ;;
- esac
-done
-
-# Pass all arguments after -- right to makechrootpkg
-MAKEPKG_ARGS="$makepkg_args ${*:$OPTIND}"
-
-if (( EUID )); then
- error "This script must be run as root"
- exit 1
-fi
-
-if [ ! -e PKGBUILD ]; then # Check if we are actually on a build directory. Do this early.
- error "This isn't a build directory"; usage
-fi
-
-if "$CHECKNONFREE"; then
-
- msg "Checking PKGBUILD for non-free issues"
-
- if ! pkgbuild-check-nonfree; then
-
- if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree
- error "PKGBUILD contains non-free issues"
- exit 15
- else
- warning "PKGBUILD couldn't be check aganist non-free issues"
- fi
- fi
-fi
-
-if "$CLEANFIRST"; then
- librechroot -c "$LIBRECHROOT_ARGS" "$CHROOT"
-fi
-
-if "$UPDATEFIRST"; then
- librechroot -u "$LIBRECHROOT_ARGS" "$CHROOT"
-fi
-
-unset CLEANFIRST UPDATEFIRST LIBRECHROOT_ARGS
-
-makechrootpkg -d -r "$CHROOTDIR" -l "$CHROOT" -- $MAKEPKG_ARGS
-ev="$?" # exit value
-
-copy_log
-
-exit $ev
diff --git a/libremessages b/libremessages
deleted file mode 100755
index 5d817dd..0000000
--- a/libremessages
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
-# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
-# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
-# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
-# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
-# Copyright (c) 2006 by Alex Smith <alex@alex-smith.me.uk>
-# Copyright (c) 2006 by Andras Voroskoi <voroskoi@frugalware.org>
-# Copyright (c) 2011 by Joshua Haase <hahj87@gmail.com>
-#
-# 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 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/>.
-
-# gettext initialization
-export TEXTDOMAIN='libretools'
-export TEXTDOMAINDIR='/usr/share/locale'
-
-# check if messages are to be printed using color
-unset ALL_OFF BOLD BLUE GREEN RED YELLOW
-if [[ -t 2 ]]; then
- # prefer terminal safe colored and bold text when tput is supported
- if tput setaf 0 &>/dev/null; then
- ALL_OFF="$(tput sgr0)"
- BOLD="$(tput bold)"
- PURPLE="${ALL_OFF}$(tput setaf 5)"
- BLUE="${BOLD}$(tput setaf 4)"
- GREEN="${BOLD}$(tput setaf 2)"
- RED="${BOLD}$(tput setaf 1)"
- YELLOW="${BOLD}$(tput setaf 3)"
- else
- ALL_OFF="\e[1;0m"
- BOLD="\e[1;1m"
- BLUE="${BOLD}\e[1;34m"
- GREEN="${BOLD}\e[1;32m"
- RED="${BOLD}\e[1;31m"
- YELLOW="${BOLD}\e[1;33m"
- PURPLE="${BOLD}\033[1;30;40m"
- fi
-fi
-readonly ALL_OFF BOLD BLUE GREEN RED YELLOW PURPLE
-
-stdnull() {
- eval "$@ >/dev/null 2>&1"
-}
-
-plain() {
- local mesg=$1; shift
- printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-msg() {
- local mesg=$1; shift
- printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-msg2() {
- local mesg=$1; shift
- printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-warning() {
- local mesg=$1; shift
- printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-error() {
- local mesg=$1; shift
- printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-stat_busy() {
- local mesg=$1; shift
- printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" >&2
-}
-
-stat_done() {
- printf "${BOLD}done${ALL_OFF}\n" >&2
-}
-
-# usage : in_array( $needle, $haystack )
-in_array() {
- [[ $2 ]] || return 1 # Not found
-
- local needle=$1; shift
- local item
-
- for item in "$@"; do
- [[ ${item#@} = $needle ]] && return 0 # Found
- done
-
- return 1 # Not Found
-}
diff --git a/libremkchroot b/libremkchroot
deleted file mode 100755
index c1f2072..0000000
--- a/libremkchroot
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-# LibreMkChroot
-# Creates a chroot
-
-# Copyright 2011 Luke Shumaker
-
-# ---------- GNU General Public License 3 ----------
-
-# This file is part of Parabola.
-
-# Parabola 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.
-
-# Parabola 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.
-
-# You should have received a copy of the GNU General Public License
-# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-
-source /etc/libretools.conf
-
-if [ -e "$XDG_CONFIG_HOME/libretools/libretools.conf" ]; then
- source "$XDG_CONFIG_HOME/libretools/libretools.conf"
-fi
-
-#CHROOTNAME="${CHROOT:-${SUDO_USER:-root}}"
-
-cmd=${0##*/}
-
-function usage {
- echo "Usage: $cmd [OPTIONS]"
- echo 'This script will create a chroot to build packages in.'
- echo "Use \`librechroot' to interact with the chroot after it is created."
- echo ''
- echo 'Options:'
- echo ' -h Show this message'
- echo ''
- echo ' -f Force overwrite of files in the working-dir'
- echo ''
- echo ' -d <chrootdir> Use this dir instead of "$CHROOTDIR".'
- echo " -c <pacmandir> Location of pacman cache. Default: \`/var/cache/pacman/pkg'."
- echo ' -C <file> Location of pacman config file.'
- echo ' -M <file> Location of makepkg config file.'
-}
-
-mkchroot_args='';
-while getopts 'hfd:c:C:M:' arg; do
- case "$arg" in
- h) usage; exit 0 ;;
- f) mkchroot_args="$mkchroot_args -$arg" ;;
- c|C|M) mkchroot_args="$mkchroot_args -$arg $OPTARG" ;;
- d) CHROOTDIR=$OPTARG ;;
- ?) usage; exit 1 ;;
- esac
-done
-
-if (( EUID )); then
- error "This script must be run as root"
- exit 1
-fi
-
-mkdir -p "${CHROOTDIR}"
-xargs -d'\n' mkarchroot $mkchroot_args "${CHROOTDIR}/root" < /etc/libretools.d/cleansystem
diff --git a/librerepkg b/librerepkg
deleted file mode 100755
index d506003..0000000
--- a/librerepkg
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-# Copyright 2011 Joshua Ismael Haase Hernandez
-
-# ---------- GNU General Public License 3 ----------
-
-# This file is part of Parabola.
-
-# Parabola 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.
-
-# Parabola 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.
-
-# You should have received a copy of the GNU General Public License
-# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-
-source /etc/libretools.conf
-custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
-if [ -x $custom_config ]; then
- source $custom_config;
- unset $custom_config
-fi
-
-[[ ! -r rePKGBUILD ]] && {
- error "This build does not contains a rePKGBUILD."
- exit 1
-}
-
-source /etc/makepkg.conf
-source /etc/abs.conf
-source rePKGBUILD
-
-usage() {
- echo "cd to a dir with a rePKGBUILD and other file info and run"
- echo "$0 [makepkg flags]"
- echo
- echo "This script will repackage an arch package without compiling"
-}
-
-while getopts 'h' arg; do
- case $arg in
- h) usage; exit 0 ;;
- esac
-done
-
-makepkgflags=$@
-
-tempdir=$(mktemp -d /tmp/$(basename $PWD).XXXXX)
-
-msg "Copying files"
-cp ./* ${tempdir}/
-
-for _arch in ${arch[@]}; do
-
- msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))"
-
- stdnull pushd ${tempdir}
-
- msg2 "Updating md5sums"
- makepkg -gp rePKGBUILD >> rePKGBUILD
-
- echo "export CARCH=${_arch}" >> rePKGBUILD
-
- msg "Repackaging using makepkg"
- makepkg -Lcdp rePKGBUILD ${makepkgflags}
-
- stdnull popd ${tempdir}
-done
diff --git a/libretools.conf b/libretools.conf
deleted file mode 100644
index 514c37d..0000000
--- a/libretools.conf
+++ /dev/null
@@ -1,107 +0,0 @@
-## Blacklist URL
-BLACKLIST=http://repo.parabolagnulinux.org/docs/blacklist.txt
-
-# Diff tool (vimdiff, gvimdiff, meld, etc)
-DIFFTOOL=vimdiff
-
-# The dir where you work on
-WORKDIR=/home/$USER/packages
-# The repos you'll be packaging for
-# 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.
-REPOS=('core' 'extra' 'community' 'libre' 'libre-testing' 'social' 'sugar')
-
-# The architectures
-ARCHES=('i686' 'x86_64' 'mips64el' 'any')
-
-## The directory where the chroots are stored
-CHROOTDIR=/home/chroot
-
-## The working chroot
-## A chroot is useful to build packages isolated from the current system and avoid
-## unwanted (as in not in dependencies) automatic library linking
-# CHROOT=$SUDO_USER
-# CHROOT=root
-
-## Obtains CacheDir from pacman.conf
-CACHEDIR=`grep "^#\?CacheDir" /etc/pacman.conf | cut -d'=' -f2`
-
-## Parabola hostname (should be the same used on ssh_config
-PARABOLAHOST=parabola
-
-## Run a command before releasing a package (ie. SSH connection, SSH tunnel, etc.)
-HOOKPRERELEASE="ssh -fN parabola"
-
-## Server destination of libre packages
-# Don't change unless you know what you're doing and you won't screw
-# anything ;)
-LIBREDESTDIR=/srv/http/repo/public
-
-## ABSLibre
-ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git
-
-## Commit Command
-## Should be git or hg
-## Uncomment only one of those
-#COMMITCMD=git
-#COMMITCMD=hg
-
-## Uncomment one of those or make one of your choice
-# Normal fullpkg
-FULLBUILDCMD="sudo libremakepkg -cuN"
-# Cross compiling fullkpg
-# FULLBUILDCMD="sudo libremakepkg -cuN -d '/path/to/cross-compiling/chroot'"
-
-## Toru
-# Section for toru's vars
-TORUPATH=/var/lib/libretools/toru
-
-## Package signing
-# Leave commented to disable signing
-#SIGEXT=".sig"
-#SIGID="0xYOURID"
-
-# Checks if vars aren't empty
-
-for VAR in CHROOTDIR CHROOT CACHEDIR PARABOLAHOST LIBREDESTDIR \
- BLACKLIST WORKDIR REPOS ARCHES ABSLIBREGIT \
- COMMITCMD DIFFTOOL FULLBUILDCMD; do
-
- ret=0
- [[ -z ${!VAR} ]] && {
- echo "Configure $VAR var in /etc/libretools.conf"
- ret=1
- }
- [ $ret -ne 0 ] && exit 1
-done
-
-source /usr/bin/libremessages
-
-## These are architecture specific files.
-## Uncomment them if you installed libretools-mips64el
-# source /etc/libretools.d/mips64el.conf
-
-## Recommended SSH Config follows
-# SSH host, it's better if you have it configured on ~/.ssh/config
-# with ControlMaster auto (and a shell opened somewhere else)
-#
-# Example:
-# Host *
-# Protocol 2
-# ControlMaster auto
-# ControlPath /tmp/ssh-%r@%h:%p
-#
-## Repo server
-# Host parabola
-# Port 22
-# HostName repo.parabolagnulinux.org
-# User parabolavnx
-# IdentityFile ~/.ssh/id_rsa
-#
-## Git server
-# Host vparabola
-# Port 1863
-# HostName parabolagnulinux.org
-# User parabola
-# IdentityFile ~/.ssh/id_rsa
diff --git a/abslibre-commit b/src/abslibre-tools/abslibre-commit
index e906fbd..e906fbd 100755
--- a/abslibre-commit
+++ b/src/abslibre-tools/abslibre-commit
diff --git a/createworkdir b/src/abslibre-tools/createworkdir
index b443c08..b443c08 100755
--- a/createworkdir
+++ b/src/abslibre-tools/createworkdir
diff --git a/libreaddiff b/src/abslibre-tools/libreaddiff
index 98646a2..98646a2 100755
--- a/libreaddiff
+++ b/src/abslibre-tools/libreaddiff
diff --git a/librecommit b/src/abslibre-tools/librecommit
index 1698bed..1698bed 100755
--- a/librecommit
+++ b/src/abslibre-tools/librecommit
diff --git a/librerelease b/src/abslibre-tools/librerelease
index c113572..efb698e 100755
--- a/librerelease
+++ b/src/abslibre-tools/librerelease
@@ -66,8 +66,6 @@ function sign_packages {
if ! gpg --quiet --verify "${package}${SIGEXT}" >/dev/null 2>&1; then
error "Failed! Resigning..."
rm -f "${package}${SIGEXT}"
- else
- continue
fi
fi
@@ -91,7 +89,7 @@ function clean_non_packages {
# Clean everything if not on dry-run mode
function clean {
[ -z ${dryrun} ] && \
- find ${WORKDIR}/staging/ -type f -delete
+ rm -f $@
}
if [ -w / ]; then
@@ -116,16 +114,20 @@ clean_non_packages
if [ ! -z "${SIGID}" ]; then
sign_packages
else
- error "Package signing is *required*"
+ error "Package signing is *required*, please set SIGID on your libretools.conf"
exit 1
fi
-# Make the permissions of the packages 644 otherwize the user will get access
+# Make the permissions of the packages 644 otherwise the user will get access
# denied error when they try to download (rsync --no-perms doesn't seem to
# work).
find ${WORKDIR}/staging -type f -exec chmod 644 {} \;
find ${WORKDIR}/staging -type d -exec chmod 755 {} \;
+# Get the synced files
+SYNCED_FILES=($(find ${WORKDIR}/staging -type f))
+
+msg "%s to upload" $(du -h -d 0 ${WORKDIR}/staging | tr "\t" " " | cut -d" " -f1)
msg "Uploading packages..."
rsync --recursive \
${dryrun} \
@@ -144,8 +146,8 @@ rsync --recursive \
exit 1
}
-msg "Removing packages from local [staging]"
-clean
+msg "Removing ${#SYNCED_FILES[@]} files from local [staging]"
+clean ${SYNCED_FILES[@]}
msg "Running db-update on repos"
ssh ${PARABOLAHOST} dbscripts/db-update
diff --git a/librestage b/src/abslibre-tools/librestage
index b474bb1..b474bb1 100755
--- a/librestage
+++ b/src/abslibre-tools/librestage
diff --git a/updateabslibre b/src/abslibre-tools/updateabslibre
index 76f964a..76f964a 100755
--- a/updateabslibre
+++ b/src/abslibre-tools/updateabslibre
diff --git a/src/aur b/src/aur
new file mode 100755
index 0000000..12efb81
--- /dev/null
+++ b/src/aur
@@ -0,0 +1,133 @@
+#!/bin/bash
+# Copyright 2010 Nicolás Reynolds, Joshua Ismael
+
+# ---------- GNU General Public License 3 ----------
+
+# This file is part of Parabola.
+
+# Parabola 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.
+
+# Parabola 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.
+
+# You should have received a copy of the GNU General Public License
+# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+
+. /etc/libretools.conf
+. /etc/abs.conf
+
+cmd=${0##*/}
+
+usage() {
+ echo "Usage: $cmd pkgname-from-aur1 [pkgname-from-aur2 ...]"
+ echo
+ echo "This script will download packages from aur to the current dir"
+ echo "and check their license for nonfree issues."
+}
+
+main() {
+ while getopts 'h' arg; do
+ case $arg in
+ h) usage; exit 0;;
+ *) usage; exit 1;;
+ esac
+ done
+
+ local missing_deps=()
+ for _pkg in "$@"; do
+
+ # Remove the version
+ _pkg="${_pkg%%[<>=]*}"
+
+ if [[ -f "${_pkg}/PKGBUILD" ]]; then
+ warning "${_pkg} already existed."
+
+ # Check if we want to diff
+ if [[ -z "${DIFFTOOL}" ]]; then
+ continue
+ else
+ # Store our copy of the PKGBUILD dir
+ _diff="${PWD}/${_pkg}"
+ stdnull "pushd $(mktemp --tmpdir -d ${_pkg}.XXXX)"
+ msg2 "Downloading PKGBUILD into ${PWD} for diff"
+ fi
+ fi
+
+ msg "Downloading $_pkg..."
+ local url=https://aur.archlinux.org/packages/${_pkg:0:2}/${_pkg}/$_pkg.tar.gz
+ wget -O - -q "$url" | tar xzf - >/dev/null 2>&1
+
+ if [[ $? -ne 0 ]]; then
+ error "Couldn't get $_pkg"
+ continue
+ fi
+
+ stdnull "pushd $_pkg"
+
+ if [[ ! -z "$_diff" ]]; then
+ msg2 "Diffing files"
+ # Diff all files with our difftool
+ for file in *; do
+ "${DIFFTOOL}" "${_diff}/${file}" "${file}"
+ done
+
+ # Go back to our copy to continue working
+ stdnull "pushd ${_diff}"
+ fi
+
+ . PKGBUILD
+
+ ################################################################
+
+ if ! pkgbuild-check-nonfree; then
+ if [[ $? = 15 ]]; then
+ warning "This PKGBUILD links to known unfree packages"
+ fi
+ fi
+
+ ################################################################
+
+ msg2 "Checking license..."
+ local free=0
+ for _license in ${license[@]}; do
+ if [[ ! -d /usr/share/licenses/common/$_license ]]; then
+ warning "License $_license is not a common license"
+ free=1
+ fi
+ done
+
+ if [[ $free -eq 1 ]]; then
+ plain "Please check that the license is included in the package and *specially* that it respects your freedom."
+ fi
+
+ ################################################################
+
+ for _dep in "${depends[@]}" "${makedepends[@]}"; do
+ _dep=${_dep/[<>=]*/}
+ if ! is_built $_dep; then
+ if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then
+ msg2 "$_dep will be get from AUR"
+ missing_deps+=($_dep)
+ fi
+ else
+ msg2 "$_dep is on repos"
+ fi
+ done
+
+ stdnull popd
+ done
+
+ [[ ${#missing_deps[*]} -gt 0 ]] && {
+ msg2 "Retrieving missing deps: ${missing_deps[@]}"
+ $0 ${missing_deps[@]}
+ }
+
+ exit 0
+}
+
+main "$@"
diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup
new file mode 100755
index 0000000..17c1f02
--- /dev/null
+++ b/src/chroot-tools/chcleanup
@@ -0,0 +1,57 @@
+#!/bin/bash
+# (c) Nicolás Reynolds <fauno@parabola.nu>
+# Released under GPLv3
+#
+# Performs chroot cleanup smartly, it only removes the unneeded packages or
+# leaves you with a cleansystem
+#
+# See: HOOKPREBUILD
+
+set -e
+DRYRUN=${DRYRUN:-false}
+
+source /etc/makepkg.conf
+source /etc/libretools.conf
+source ${HOME}/.makepkg.conf 2>/dev/null|| true
+
+msg "Cleaning chroot..."
+
+TMPDIR="$(mktemp -d /tmp/$(basename $0)-XXXXX)"
+cleanup_log="${TMPDIR}"/libretools-cleanup.log
+
+cp -a /var/lib/pacman/sync "${TMPDIR}/"
+touch ${cleanup_log}
+
+# If we're running makepkg
+if [ -f PKGBUILD ]; then
+ source PKGBUILD || true
+
+ check=(${depends[@]} ${makedepends[@]} ${checkdepends[@]})
+
+fi
+
+# Get the full list of packages needed by dependencies, including the base system
+sudo pacman -b "${TMPDIR}" \
+ -Sp \
+ --print-format "%n" \
+ base base-devel sudo \
+ ${CHROOTEXTRAPKG[@]} \
+ ${check[@]} \
+ >${cleanup_log}
+
+# Diff installed packages against a clean chroot then remove leftovers
+packages=($(comm -23 <(pacman -Qq | sort) \
+ <(sort -u ${cleanup_log})))
+
+[ ${#packages[@]} -eq 0 ] && exit 0
+
+msg2 "Removing %d packages" ${#packages[@]}
+
+# Only remove leftovers, -Rcs removes too much
+${DRYRUN} || sudo pacman --noconfirm -Rn ${packages[@]}
+${DRYRUN} && echo ${packages[@]}
+
+# Cleanup
+${DRYRUN} || rm -fr ${TMPDIR}
+
+exit $?
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
new file mode 100755
index 0000000..6594f15
--- /dev/null
+++ b/src/chroot-tools/librechroot
@@ -0,0 +1,158 @@
+#!/bin/bash -euE
+# librechroot
+
+# Copyright 2010 Nicolás Reynolds
+# Copyright 2011 Joshua Haase
+# Copyright 2012 Luke Shumaker
+#
+# This file is part of Parabola.
+#
+# Parabola 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.
+#
+# Parabola 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+
+. /etc/libretools.conf
+
+# This file (librechroot) is GPLv3+, but I would like to use some code
+# modified from devtools' "makechrootpkg", which is GPLv2.
+. "$(dirname "$0")/librechroot.gpl2"
+# This gives us the functions:
+# - sync
+
+cmd=${0##*/}
+usage() {
+ echo "Usage: $cmd [OPTIONS] "
+ echo 'Interacts with a chroot.'
+ echo ''
+ echo "The default CHROOT is \`${CHROOT}'."
+ echo ''
+ echo 'Options:'
+ echo ' Settings:'
+ echo " -n <CHROOT> Use this chroot instead of \`$CHROOT'"
+ echo ' -l <COPY> Use this as the chroot copy instead of basing it'
+ echo ' on the username'
+ echo ' -N Disable networking in the chroot'
+ echo ''
+ echo ' Modes: (the last mode given will be used)'
+ echo ' -C Clean /repo in the chroot'
+ echo ' -c Clean the packages installed in the chroot'
+ echo ' -I <FILE> Install the package FILE into the chroot'
+ echo ' -i <PKG> Install the package PKG from repos into the chroot'
+ echo ' -m Make sure the chroot exists; do nothing else'
+ echo ' -r <CMD> Run CMD in the chroot'
+ echo " -s Sync the copy with the 'root' copy"
+ echo ' -u Update the chroot'
+ echo ' -h Print this message'
+}
+
+main() {
+ CHROOTCOPY=$LIBREUSER
+ [[ $CHROOTCOPY != root ]] || CHROOTCOPY=copy
+
+ local mode=enter
+ local archroot_args=(-f)
+ local ARG=''
+ while getopts 'n:l:NCcI:i:mrsuh' arg; do
+ case $arg in
+ n) CHROOT=$OPTARG;;
+ l) CHROOTCOPY=$OPTARG;;
+ N) archroot_args+=(-N);;
+
+ C) mode=clean_repo;;
+ c) mode=clean_pacman;;
+ I) mode=install_file; ARG=$OPTARG;;
+ i) mode=install_pkg; ARG=$OPTARG;;
+ m) mode=noop;;
+ r) mode=run; ARG=$OPTARG;;
+ s) mode=sync;;
+ u) mode=update;;
+
+ h) usage; exit 0;;
+ *) usage; exit 1;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+ if [[ $# > 0 ]]; then
+ usage
+ exit 1
+ fi
+
+ # not local
+ rootdir="${CHROOTDIR}/${CHROOT}/root"
+ copydir="${CHROOTDIR}/${CHROOT}/${CHROOTCOPY}"
+
+ ########################################################################
+
+ if (( EUID )); then
+ error "This script must be run as root."
+ exit 1
+ fi
+
+ # Keep this lock as long as we are running
+ # Note that '9' is the same FD number as in (mk)archroot
+ lock_open_write 9 "$copydir" "Locking chroot copy '$CHROOTCOPY'"
+
+ if [[ ! -d $rootdir ]]; then
+ libremkchroot "$CHROOT"
+ fi
+
+ if [[ ! -d $copydir ]] && [[ $mode != sync ]]; then
+ sync
+ fi
+
+ ########################################################################
+
+ case "$mode" in
+ clean_repo)
+ msg "Cleaning local pacman repository"
+ rm -rf "${copydir}/repo"
+ mkdir "${copydir}/repo"
+ bsdtar -czf "${copydir}/repo/repo.db.tar.gz" -T /dev/null
+ ln -s "repo.db.tar.gz" "${copydir}/repo/repo.db"
+ ;;
+ clean_pacman)
+ msg "Intelligently cleaning packages"
+ cp -a "$(which chcleanup)" "${copydir}/clean"
+ echo '#!/bin/bash' > "${copydir}/cleanstrap"
+ echo 'mkdir /build' >> "${copydir}/cleanstrap"
+ echo 'cd /build; /clean' >> "${copydir}/cleanstrap"
+ chmod 755 "${copydir}/cleanstrap"
+ archroot "${archroot_args[@]}" "${copydir}" -r /cleanstrap
+ ;;
+ install_file)
+ msg "Installing package file: $ARG"
+ cp "$ARG" "$copydir/${ARG##*/}"
+ archroot "${archroot_args[@]}" "$copydir" -r "pacman -U /${ARG##*/} --noconfirm"
+ rm "$copydir/${ARG##*/}"
+ ;;
+ install_pkg)
+ msg "Installing package(s): $ARG"
+ archroot "${archroot_args[@]}" "$copydir" -i $ARG
+ ;;
+ noop) :;;
+ run)
+ msg "Running command"
+ archroot "${archroot_args[@]}" "${copydir}" -r "$ARG"
+ ;;
+ sync) sync;;
+ update)
+ msg "Updating chroot"
+ archroot "${archroot_args[@]}" "${copydir}" -u
+ ;;
+ enter)
+ msg "Entering chroot"
+ archroot "${archroot_args[@]}" "${copydir}" -r bash
+ ;;
+ esac
+}
+
+main "$@"
diff --git a/src/chroot-tools/librechroot.gpl2 b/src/chroot-tools/librechroot.gpl2
new file mode 100644
index 0000000..6ba361f
--- /dev/null
+++ b/src/chroot-tools/librechroot.gpl2
@@ -0,0 +1,40 @@
+#!/bin/bash
+# Contains code derived from devtools' "makechrootpkg"
+
+# Copyright 2011-2012 The Arch Linux Development Team
+# Copyright 2012 Luke Shumaker
+#
+# 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.
+
+sync() {
+ if [[ $CHROOTCOPY = root ]]; then
+ error "Cannot sync the root copy with itself"
+ exit 1
+ fi
+
+ lock_open_read 8 "$rootdir" "Locking clean chroot"
+
+ stat_busy 'Creating clean working copy'
+ local use_rsync=false
+ if type -P btrfs >/dev/null; then
+ [[ -d $copydir ]] && btrfs subvolume delete "$copydir" &>/dev/null
+ btrfs subvolume snapshot "$chrootdir/root" "$copydir" &>/dev/null || use_rsync=true
+ else
+ use_rsync=true
+ fi
+
+ if $use_rsync; then
+ mkdir -p "$copydir"
+ rsync -a --delete -q -W -x "$CHROOTDIR/$CHROOT/root/" "$copydir"
+ fi
+ stat_done
+
+ lock_close 8
+}
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
new file mode 100755
index 0000000..4e810d1
--- /dev/null
+++ b/src/chroot-tools/libremakepkg
@@ -0,0 +1,195 @@
+#!/bin/bash -euE
+# libremakepkg
+
+# Copyright 2010 - 2011 Nicolás Reynolds
+# Copyright 2011 Joshua Ismael Haase Hernández
+# Copyright 2012 Luke Shumaker
+#
+# This file is part of Parabola.
+#
+# Parabola 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.
+#
+# Parabola 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+
+. /etc/libretools.conf
+
+shopt -s nullglob
+
+# This file (libremakepkg) is GPLv3+, but I would like to use some code
+# modified from devtools' "makechrootpkg", which is GPLv2.
+. "$(dirname "$0")/libremakepkg.gpl2"
+# This gives us the functions:
+# - chroot_init
+# - chroot_extract
+# - chroot_build
+# - copy_pkgs
+
+# Boring functions #############################################################
+
+##
+# copy logs if they exist
+##
+copy_logs() {
+ for l in "$copydir"/build/*.log; do
+ chown "$LIBREUSER" "$l"
+ mv "$l" .
+ done
+}
+
+##
+# End inmediately but print a useful message
+##
+trap_exit() {
+ copy_logs
+ error "$*"
+ exit 1
+}
+
+##
+# Usage: makepkg_conf_get SETTING [DEFAULT]
+##
+makepkg_conf_get() {
+ local setting=$1
+ if [[ -f $LIBREHOME/.makepkg.conf ]]; then
+ eval $(grep "^$setting=" "$LIBREHOME/.makepkg.conf")
+ fi
+ if [[ -z ${!setting:-} ]]; then
+ eval $(grep "^$setting=" "/etc/makepkg.conf")
+ fi
+ if [[ -z ${!setting:-} && -n ${2:-} ]]; then
+ eval "$setting='$2'"
+ fi
+}
+
+chroot_makepkg_conf_get() {
+ local setting=$1
+ eval $(grep "^$setting=" "$copydir/etc/makepkg.conf")
+}
+
+chroot_makepkg_conf_set() {
+ local key=$1
+ local val=$2
+ sed -i "/^$key=/d" "$copydir/etc/makepkg.conf"
+ echo "$key='$val'" >> "$copydir/etc/makepkg.conf"
+}
+
+# Functions that check for issues with the build ###############################
+
+libre_check_pkgbuild() {
+ msg "Checking PKGBUILD for issues"
+ # TODO
+ if ! pkgbuild-check-nonfree -f; then
+ if [[ $? -eq 15 ]]; then
+ # other errors mean fail, not nonfree
+ error "PKGBUILD contains non-free issues"
+ exit 15
+ else
+ warning "PKGBUILD couldn't be check aganist non-free issues"
+ fi
+ fi
+}
+
+libre_check_src() {
+ msg "Checking src directory for issues"
+ # TODO
+}
+
+libre_check_pkg() {
+ msg "Checking final package for issues"
+ # TODO
+}
+
+
+# The main program #############################################################
+
+cmd=${0##*/}
+usage() {
+ echo "Usage: $cmd [options] [-- makepkg args]"
+ echo 'This program will build your package.'
+ echo ''
+ echo 'OPTIONS:'
+ echo " -n <CHROOT> Use this chroot instead of \`$CHROOT'"
+ echo ' -l <COPY> Use this chroot copy instead of basing it'
+ echo ' on the username'
+ echo ''
+ echo " -m <MAKEPKG> Use the command MAKEPKG instead of 'makepkg'"
+ echo ''
+ echo ' -h Show this message'
+}
+
+main() {
+ # Parse command line ###################################################
+
+ CHROOTCOPY=$LIBREUSER
+ [[ $CHROOTCOPY != root ]] || CHROOTCOPY=copy
+
+ makepkg_args='-s --noconfirm -L '
+ MAKEPKG=makepkg
+
+ while getopts 'n:l:m:Rh' arg ; do
+ case "${arg}" in
+ n) CHROOT=$OPTARG;;
+ l) CHROOTCOPY=$OPTARG;;
+ m) MAKEPKG=$OPTARG;;
+ h) usage; exit 0;;
+ *) usage; exit 1;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+ # Pass all arguments after -- right to makepkg
+ makepkg_args+=" $*"
+
+ rootdir="${CHROOTDIR}/${CHROOT}/root"
+ copydir="${CHROOTDIR}/${CHROOT}/${CHROOTCOPY}"
+
+ # Init #################################################################
+
+ if (( EUID )); then
+ error "This script must be run as root"
+ exit 1
+ fi
+
+ if [[ ! -f PKGBUILD ]]; then
+ # This is the message used by makepkg
+ error "PKGBUILD does not exist"
+ exit 1
+ fi
+
+ # Trap signals from makepkg
+ trap 'trap_exit "(libremakepkg): TERM signal caught. Exiting..."' TERM HUP QUIT
+ trap 'trap_exit "(libremakepkg): Aborted by user! Exiting..."' INT
+ trap 'trap_exit "(libremakepkg): An unknown error has occurred. Exiting..."' ERR
+
+ makepkg_conf_get SRCDEST .
+ makepkg_conf_get PKGDEST .
+
+ # OK, we're starting now ###############################################
+
+ lock_open_write 9 "$copydir" "Locking chroot '$CHROOTCOPY'"
+
+ # Set target CARCH as it might be used within the PKGBUILD to select correct sources
+ chroot_makepkg_conf_get CARCH
+ export CARCH
+
+ chroot_init
+
+ libre_check_pkgbuild
+ chroot_extract
+ libre_check_src
+ chroot_build
+ libre_check_pkg
+
+ copy_pkgs
+ copy_logs
+}
+
+main "$@"
diff --git a/src/chroot-tools/libremakepkg.gpl2 b/src/chroot-tools/libremakepkg.gpl2
new file mode 100755
index 0000000..1077b66
--- /dev/null
+++ b/src/chroot-tools/libremakepkg.gpl2
@@ -0,0 +1,105 @@
+#!/bin/bash
+# Contains code derived from devtools' "makechrootpkg"
+
+# Copyright 2011-2012 The Arch Linux Development Team
+# Copyright 2012 Luke Shumaker
+#
+# 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.
+
+chroot_init() {
+ # make sure the chroot exists
+ librechroot -n "$CHROOT" -l "$CHROOTCOPY" -m
+
+ if [[ -r "$LIBREHOME/.gnupg/pubring.gpg" ]]; then
+ install -D "$HOME/.gnupg/pubring.gpg" "$copydir/build/.gnupg/pubring.gpg"
+ fi
+
+ mkdir -p "$copydir/pkgdest"
+ mkdir -p "$copydir/srcdest"
+ chroot_makepkg_conf_set PKGDEST /pkgdest
+ chroot_makepkg_conf_set SRCDEST /srcdest
+
+ cat > "$copydir/etc/sudoers.d/nobody-pacman" <<EOF
+Defaults env_keep += "HOME"
+nobody ALL = NOPASSWD: /usr/bin/pacman
+EOF
+ chmod 440 "$copydir/etc/sudoers.d/nobody-pacman"
+}
+
+chroot_extract() {
+ rm -rf "$copydir"/build/*
+ cp PKGBUILD "$copydir/build/"
+ (
+ set +euE
+ source PKGBUILD
+
+ # Copy source files
+ for file in "${source[@]}"; do
+ file="${file%%::*}"
+ file="${file##*://*/}"
+ if [[ -f $file ]]; then
+ cp "$file" "$copydir/srcdest/"
+ elif [[ -f $SRCDEST/$file ]]; then
+ cp "$SRCDEST/$file" "$copydir/srcdest/"
+ 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")\"
+ if [[ -f $file ]]; then
+ cp "$file" "$copydir/build/"
+ fi
+ done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
+ done
+ )
+
+ chown -R nobody "$copydir"/{build,pkgdest,srcdest}
+
+ cp -a "$(which chcleanup)" "${copydir}/clean"
+ local file="$copydir/chrootextract"
+ echo '#!/bin/bash' > "$file"
+ echo '. /etc/profile' >> "$file"
+ echo 'export HOME=/build' >> "$file"
+ echo 'cd /build' >> "$file"
+ echo '/clean' >> "$file"
+ echo "sudo -u nobody ${MAKEPKG} $makepkg_args -o" >> "$file"
+ chmod 755 "$file"
+ archroot "$copydir" -r /chrootextract
+}
+
+chroot_build() {
+ local file="$copydir/chrootbuild"
+ echo '#!/bin/bash' > "$file"
+ echo '. /etc/profile' >> "$file"
+ echo 'export HOME=/build' >> "$file"
+ echo 'cd /build' >> "$file"
+ echo "sudo -u nobody ${MAKEPKG} $makepkg_args -e" >> "$file"
+ chmod 755 "$file"
+ archroot -N "$copydir" -r /chrootbuild
+}
+
+copy_pkgs() {
+ for pkgfile in "$copydir"/pkgdest/*.pkg.tar*; do
+ mkdir -p "$copydir/repo"
+ pushd "$copydir/repo" >/dev/null
+ cp "$pkgfile" .
+ repo-add repo.db.tar.gz "${pkgfile##*/}"
+ popd >/dev/null
+
+ chown "$LIBREUSER" "$pkgfile"
+ mv "$pkgfile" "$PKGDEST"
+ if [[ $PKGDEST != . ]]; then
+ ln -s "$PKGDEST/${pkgfile##*/}" .
+ fi
+ done
+}
diff --git a/src/chroot-tools/libremkchroot b/src/chroot-tools/libremkchroot
new file mode 100755
index 0000000..d3652a5
--- /dev/null
+++ b/src/chroot-tools/libremkchroot
@@ -0,0 +1,65 @@
+#!/bin/bash -euE
+# libremkchroot
+
+# Copyright 2011, 2012 Luke Shumaker
+#
+# This file is part of Parabola.
+#
+# Parabola 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.
+#
+# Parabola 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+
+. /etc/libretools.conf
+
+cmd=${0##*/}
+
+usage() {
+ echo "Usage: $cmd [OPTIONS] [CHROOT]"
+ echo 'This script will create a chroot to build packages in.'
+ echo "Use \`librechroot' to interact with the chroot after it is created."
+ echo ''
+ echo "The default CHROOT is \`${CHROOT}'."
+ echo ''
+ echo 'Options:'
+ echo ' -h Show this message'
+ echo ''
+ echo ' -C <file> Location of pacman config file.'
+ echo ' -M <file> Location of makepkg config file.'
+}
+
+main() {
+ archroot_args=(-f);
+ while getopts 'hC:M:' arg; do
+ case "$arg" in
+ C|M) archroot_args+=("-$arg" "$OPTARG");;
+
+ h) usage; exit 0;;
+ *) usage; exit 1;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+ case $# in
+ 0) :;;
+ 1) CHROOT="$1";;
+ *) usage; exit 1;;
+ esac
+
+ if (( EUID )); then
+ error "This script must be run as root"
+ exit 1
+ fi
+
+ mkdir -p "${CHROOTDIR}/${CHROOT}"
+ archroot "${archroot_args[@]}" "${CHROOTDIR}/${CHROOT}/root" -i base base-devel sudo "${CHROOTEXTRAPKG[@]}"
+}
+
+main "$@"
diff --git a/src/diff-unfree b/src/diff-unfree
new file mode 100755
index 0000000..24ada67
--- /dev/null
+++ b/src/diff-unfree
@@ -0,0 +1,86 @@
+#!/bin/bash
+# This script will help you diff a *-libre PKGBUILD against the unfree one
+# to check for updates.
+# Copyright 2010 Nicolás Reynolds
+
+# ---------- GNU General Public License 3 ----------
+
+# This file is part of Parabola.
+
+# Parabola 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.
+
+# Parabola 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.
+
+# You should have received a copy of the GNU General Public License
+# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+
+. /etc/libretools.conf
+
+cmd=${0##*/}
+
+usage() {
+ echo "Usage: $cmd [community|packages] [unfree-package] [repo]"
+ echo "Usage: $cmd --help"
+ echo "Helps you diff build scripts from ABSLibre against (Unfree) ABS."
+ echo ""
+ echo "Package name and repo will we guessed if you don't specify them."
+}
+
+main() {
+ if [[ "$1" == "--help" ]]; then
+ usage
+ exit 0
+ fi
+
+ local package_guess=${PWD##*/}
+ local repo=${1:-$(basename ${PWD%/*})}
+ local package=${2:-${package_guess%-libre}}
+ local trunk=${3:-trunk}
+
+ svnrepo="packages"
+ case $repo in
+ community*) svnrepo="community";;
+ multilib*) svnrepo="community";;
+ *) :;;
+ esac
+
+ if [[ ! -r PKGBUILD ]]; then
+ error "This is not a build dir."
+ exit 1
+ fi
+
+
+ tmp_dir="$(mktemp --tmpdir -d ${package}.XXXXXX)"
+ if [[ ! -d "${tmp_dir}" ]]; then
+ error "Can't create temp dir"
+ exit 1
+ fi
+ unfree_dir="${tmp_dir}/${svnrepo}/${package}/${trunk}"
+
+ stdnull 'pushd "${tmp_dir}"'
+
+ msg "Getting diff from $repo/$package..."
+
+ stdnull 'svn checkout --depth=empty svn://svn.archlinux.org/$svnrepo'
+
+ cd ${svnrepo}
+ svn update ${package}
+
+ # Back to start dir
+ stdnull popd
+
+ msg "Diffing files"
+
+ for _file in ${unfree_dir}/*; do
+ msg2 "$(basename "${_file}")"
+ ${DIFFTOOL} "$PWD/$(basename "${_file}")" "${_file}"
+ done
+}
+
+main "$@"
diff --git a/fullpkg b/src/fullpkg/fullpkg
index 6d6153a..6d6153a 100755
--- a/fullpkg
+++ b/src/fullpkg/fullpkg
diff --git a/fullpkg-build b/src/fullpkg/fullpkg-build
index b497db5..b497db5 100755
--- a/fullpkg-build
+++ b/src/fullpkg/fullpkg-build
diff --git a/fullpkg-find b/src/fullpkg/fullpkg-find
index 205ef71..b09edf9 100755
--- a/fullpkg-find
+++ b/src/fullpkg/fullpkg-find
@@ -11,14 +11,6 @@ guess_repo() {
basename $(dirname $(pwd))
}
-# Finds a PKGBUILD on toru's path cache
-# Look in all caches but pick the first one
-# TODO move to a toru flag (-p?)
-where_is() {
- grep -m1 "^${1}:" "${TORUPATH}/paths" 2>/dev/null| \
- cut -d: -f2 2>/dev/null
-}
-
# return : full version spec, including epoch (if necessary), pkgver, pkgrel
# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel )
get_fullver() {
@@ -113,10 +105,9 @@ find_deps() {
for _dep in ${deps[@]}; do
local found=false
-# TODO change for where_is or toru-path
# May fail, e.g. since abslibre-mips64el doesn't include
# arch=any packages.
- local pkgdir=$(where_is ${_dep}) || true
+ local pkgdir=$(toru -p ${_dep}) || true
if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then
found=true
diff --git a/is_built b/src/is_built
index 1fa79d2..1fa79d2 100755
--- a/is_built
+++ b/src/is_built
diff --git a/is_unfree b/src/is_unfree
index f32c193..c2a37c9 100755
--- a/is_unfree
+++ b/src/is_unfree
@@ -1,11 +1,8 @@
#!/bin/bash
# Checks if a package is on blacklist
-# fail immediately on error
-set -E
+. /etc/libretools.conf
blacklist="$XDG_CONFIG_HOME/libretools/blacklist.txt"
-
egrep -q "^${1}:" "${blacklist}"
-
exit $?
diff --git a/src/librediff b/src/librediff
new file mode 100755
index 0000000..6dbe41b
--- /dev/null
+++ b/src/librediff
@@ -0,0 +1,57 @@
+#!/bin/bash
+# Generates a patch for a nonfree PKGBUILD
+#
+# Copyright 2010 Nicolás Reynolds
+
+# ---------- GNU General Public License 3 ----------
+
+# This file is part of Parabola.
+
+# Parabola 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.
+
+# Parabola 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.
+
+# You should have received a copy of the GNU General Public License
+# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+
+. /etc/libretools.conf
+
+cmd=${0##*/}
+
+usage() {
+ echo "Usage: $cmd <pkgname> [<pkgname2> ...]"
+ echo "Requirements:"
+ echo " * Have a <pkgname>/ directory with nonfree build scripts inside"
+ echo " * Have a <pkgname>-libre/ directory with libre build scripts inside"
+}
+
+main() {
+ local packages=("$@")
+ if [[ ${packages[#]} = 0 ]]; then
+ usage
+ exit 1
+ fi
+
+ for package in "${packages[@]}"; do
+ if [[ ! -f ./${package}/PKGBUILD || ! -f ./${package}-libre/PKGBUILD ]]
+ then
+ error "Build scripts not found for ${package}(-libre)"
+ else
+
+ . ./${package}-libre/PKGBUILD
+ [[ -z ${pkgbase} ]] && pkgbase=${pkgname}
+
+ # Generate a diff file, no -r since we don't want to patch src/ nor pkg/
+ diff -auN ${package} ${package}-libre > $PATCHDIR/${pkgbase}-${pkgver}-${pkgrel}.patch
+ done
+
+ exit 0
+}
+
+main "$@"
diff --git a/src/libremessages b/src/libremessages
new file mode 100755
index 0000000..ccb5fb4
--- /dev/null
+++ b/src/libremessages
@@ -0,0 +1,85 @@
+#!/bin/bash
+# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
+# Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
+# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
+# Copyright (c) 2006 by Alex Smith <alex@alex-smith.me.uk>
+# Copyright (c) 2006 by Andras Voroskoi <voroskoi@frugalware.org>
+# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
+# Copyright (c) 2011 by Joshua Haase <hahj87@gmail.com>
+#
+# 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 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/>.
+
+################################################################################
+# Inherit most functions from devtools #
+################################################################################
+
+# This is only installed in Parabola's distribution of devtools, not Arch's
+. /usr/share/devtools/common.sh
+
+################################################################################
+# gettext initialization #
+################################################################################
+
+export TEXTDOMAIN='libretools'
+export TEXTDOMAINDIR='/usr/share/locale'
+
+################################################################################
+# Devtools overrides #
+################################################################################
+
+# Override several functions with built-in text to uses gettext
+
+warning() {
+ local mesg=$1; shift
+ printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+error() {
+ local mesg=$1; shift
+ printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+stat_done() {
+ printf "${BOLD}$(gettext "done")${ALL_OFF}\n" >&2
+}
+
+################################################################################
+# Own functions #
+################################################################################
+
+stdnull() {
+ eval "$@ >/dev/null 2>&1"
+}
+
+# Set the terminal title
+term_title() {
+ local fmt=''
+ case "$TERM" in
+ screen|tmux) fmt='\ek%s\e\\';;
+ xterm*|rxvt*) fmt='\e]0;%s\a';;
+ esac
+ printf "$fmt" "$*"
+}
+
+################################################################################
+# Run one of the defined functions if invoked directly #
+################################################################################
+
+if [[ "${0##*/}" = libremessages ]]; then
+ _libremessages_cmd=$1
+ shift
+ "$_libremessages_cmd" "$@"
+ unset _libremessages_cmd
+fi
diff --git a/src/librerepkg b/src/librerepkg
new file mode 100755
index 0000000..85c58d9
--- /dev/null
+++ b/src/librerepkg
@@ -0,0 +1,69 @@
+#!/bin/bash
+# Copyright 2011 Joshua Ismael Haase Hernandez
+
+# ---------- GNU General Public License 3 ----------
+
+# This file is part of Parabola.
+
+# Parabola 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.
+
+# Parabola 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.
+
+# You should have received a copy of the GNU General Public License
+# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+
+. /etc/libretools.conf
+. /etc/makepkg.conf
+. /etc/abs.conf
+
+cmd=${0##*/}
+
+usage() {
+ echo "cd to a dir with a rePKGBUILD and other file info and run"
+ echo "$cmd [makepkg flags]"
+ echo ""
+ echo "This script will repackage an arch package without compiling"
+}
+
+main() {
+ while getopts 'h' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ esac
+ done
+ makepkgflags=("$@")
+
+ if [[ ! -r rePKGBUILD ]]; then
+ error "This build does not contains a rePKGBUILD."
+ exit 1
+ fi
+ . rePKGBUILD
+
+ tempdir="$(mktemp --tmpdir -d ${PWD##*/}.XXXXX)"
+
+ msg "Copying files"
+ cp ./* "${tempdir}/"
+
+ for _arch in "${arch[@]}"; do
+ msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))"
+ stdnull pushd "${tempdir}"
+
+ msg2 "Updating md5sums"
+ makepkg -gp rePKGBUILD >> rePKGBUILD
+
+ echo "export CARCH=${_arch}" >> rePKGBUILD
+
+ msg "Repackaging using makepkg"
+ makepkg -Lcdp rePKGBUILD "${makepkgflags[@]}"
+
+ stdnull popd "${tempdir}"
+ done
+}
+
+main "$@"
diff --git a/src/libretools.conf b/src/libretools.conf
new file mode 100644
index 0000000..5e45350
--- /dev/null
+++ b/src/libretools.conf
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+################################################################################
+# misc #
+################################################################################
+
+## Blacklist URL
+## Used by `pkgbuild-check-nonfree`
+BLACKLIST=http://repo.parabolagnulinux.org/docs/blacklist.txt
+
+## Diff tool (vimdiff, gvimdiff, meld, etc)
+## Used by `aur`, `diff-unfree`
+DIFFTOOL=`which vimdiff gvimdiff meld colordiff 2>/dev/null|sed 's/\s.*//'`
+
+## The repos you'll be packaging for
+## Used by `toru`, `createworkdir`, `prfullpkg`
+# 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
+# precedence on the path cache (the last path added replaces the rest)
+REPOS=('core' 'libre' 'extra' 'community' 'libre-testing' 'social' 'sugar' 'pcr' 'java')
+
+## The architectures
+## Used by `librestage`
+ARCHES=('i686' 'x86_64' 'mips64el' 'any')
+
+################################################################################
+# chroot #
+################################################################################
+
+## The directory where the chroots are stored
+CHROOTDIR=/var/lib/archbuild
+## Extra packages to have installed on the chroot (besides base base-devel and sudo)
+CHROOTEXTRAPKG=(distcc ccache tsocks)
+## The meaning of this changes based on the version of libretools+devtools
+## do NOT set it to 'root'
+CHROOT=default
+
+################################################################################
+# abslibre #
+################################################################################
+
+# The dir where you work on
+WORKDIR=/home/$USER/packages
+
+## Package signing
+SIGEXT=".sig"
+#SIGID="0xYOURID"
+
+## Parabola hostname
+PARABOLAHOST=parabola
+## Assumes something similar in your .ssh/config:
+
+## Repo server
+# Host parabola
+# Port 1863
+# HostName repo.parabolagnulinux.org
+# User repo
+
+## Server destination of libre packages
+# Don't change unless you know what you're doing and you won't screw
+# anything ;)
+LIBREDESTDIR=/srv/http/repo/public
+
+## ABSLibre
+ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git
+
+## Commit Command
+## Should be git or hg
+## Uncomment only one of those
+COMMITCMD=git
+#COMMITCMD=hg
+
+################################################################################
+# fullpkg #
+################################################################################
+
+## Uncomment one of those or make one of your choice
+# Normal fullpkg
+FULLBUILDCMD="sudo libremakepkg"
+# Cross compiling fullkpg
+# FULLBUILDCMD="sudo libremakepkg -n cross-compile-chroot"
+# Build from within the chroot (or host system)
+# FULLBUILDCMD="makepkg -sL --noconfirm"
+
+# Run a command before releasing a package (ie. SSH connection, SSH tunnel, etc.)
+HOOKPRERELEASE="ssh -fN parabola"
+
+# Run a command before running FULLBUILDCMD, usually to cleanup uneeded packages
+# Note! chcleanup *is not* chroot aware, if you run it as it is it will cleanup
+# your system
+# HOOKPREBUILD="chcleanup"
+
+# Locally release the package or any other action after running FULLBUILDCMD
+# succesfully
+# HOOKLOCALRELEASE=""
+
+################################################################################
+# toru #
+################################################################################
+
+# Section for toru's vars
+TORUPATH=/var/lib/libretools/toru
+
+################################################################################
+# This probably shouldn't be in a .conf file... #
+################################################################################
+
+LIBREUSER="${SUDO_USER:-$USER}"
+LIBREHOME="$(eval echo ~$LIBREUSER)"
+if [[ -z ${XDG_CONFIG_HOME:-} ]]; then
+ export XDG_CONFIG_HOME="${LIBREHOME}/.config"
+fi
+if [[ -e "$XDG_CONFIG_HOME/libretools/libretools.conf" ]]; then
+ . "$XDG_CONFIG_HOME/libretools/libretools.conf"
+fi
+
+ret=0
+for VAR in CHROOTDIR CHROOT PARABOLAHOST LIBREDESTDIR \
+ BLACKLIST WORKDIR REPOS ARCHES ABSLIBREGIT \
+ COMMITCMD DIFFTOOL FULLBUILDCMD SIGEXT SIGID; do
+
+ if [[ -z ${!VAR} ]]; then
+ echo "Configure $VAR var in /etc/libretools.conf"
+ ret=1
+ fi
+done
+if [[ $CHROOT == root ]]; then
+ echo "Configured var CHROOT cannot equal 'root'"
+ ret=1
+fi
+if [[ $ret != 0 ]]; then
+ exit 1
+fi
+unset ret
+
+. /usr/bin/libremessages
diff --git a/add-mips64el b/src/mips64el-tools/add-mips64el
index e06d857..e06d857 100755
--- a/add-mips64el
+++ b/src/mips64el-tools/add-mips64el
diff --git a/librebasebuilder b/src/mips64el-tools/librebasebuilder
index f7d3a25..f7d3a25 100755
--- a/librebasebuilder
+++ b/src/mips64el-tools/librebasebuilder
diff --git a/mips64el/mips-add b/src/mips64el-tools/mips-add
index da9b431..da9b431 100644..100755
--- a/mips64el/mips-add
+++ b/src/mips64el-tools/mips-add
diff --git a/mips64el/mips64el.conf b/src/mips64el-tools/mips64el.conf
index 836b407..836b407 100644
--- a/mips64el/mips64el.conf
+++ b/src/mips64el-tools/mips64el.conf
diff --git a/mips64el/mipsrelease b/src/mips64el-tools/mipsrelease
index f245c47..4d7a7de 100755
--- a/mips64el/mipsrelease
+++ b/src/mips64el-tools/mipsrelease
@@ -43,7 +43,7 @@ fi
source PKGBUILD
fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel})
pkgs=()
-makepkg --source -f
+makepkg --source -f --skippgpcheck
msg "Adding packages to [stage3]..."
for name in ${pkgname[@]}; do
@@ -53,7 +53,6 @@ done
repo-add ${PKGDEST}/stage3.db.tar.gz ${pkgs[@]}
-#sudo pacman -Sy
librestage ${repo}
@@ -63,6 +62,4 @@ pushd ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null
tar xvf $SRCPKGDEST/${pkgbase:-${pkgname[0]}}-${fullver}${SRCEXT}
popd >/dev/null
-$libretoolsdir/chcleanup || true
-
exit $?
diff --git a/pkgbuild-check-nonfree b/src/pkgbuild-check-nonfree
index df0ff36..0fd480c 100755
--- a/pkgbuild-check-nonfree
+++ b/src/pkgbuild-check-nonfree
@@ -1,6 +1,7 @@
#!/bin/bash
# pkgbuild-check-nonfree
# Copyright 2010 Joshua Ismael Haase Hernández, Joseph Graham
+# Copyright 2012 Luke Shumaker
# ---------- GNU General Public License 3 ----------
@@ -19,15 +20,20 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-# function log_end {
+. /etc/libretools.conf
+
+cmd=${0##*/}
+ev=0
+
+# log_end() {
# kill "$teepid"
# rm "$logpipe"
# }
-# function log {
-# LOG="pkgbuild-check-nonfree-$(date -u +%Y%m%d).log"
+# log() {
+# local LOG="pkgbuild-check-nonfree-$(date -u +%Y%m%d).log"
# # ensure overridden package variables survive tee with split packages
-# logpipe="$(mktemp -u "$startdir/logpipe.XXXXXXXX")"
+# logpipe="$(mktemp)"
# mkfifo "$logpipe"
# tee "$LOG" < "$logpipe" &
# teepid=$!
@@ -35,18 +41,15 @@
# }
-function unset_pkgbuild {
-
+unset_pkgbuild() {
unset 'pkgbase' 'pkgname' 'pkgver' 'pkgrel' 'epoch' 'pkgdesc' \
'arch' 'url' 'license' 'groups' 'optdepends' 'provides' \
'conflicts' 'replaces' 'backup' 'options' 'install' \
'changelog' 'source' 'noextract' 'md5sums' 'build' \
'check' 'package' 'depends' 'makedepends' 'checkdepends'
-
}
-function assert_pkgbuild {
-
+assert_pkgbuild() {
if [ -e "$1" ]; then
source "$1"
@@ -60,16 +63,15 @@ function assert_pkgbuild {
return 1
}
-function check_replacement {
-
+check_replacement() {
[ $2 ] || return 0 # Free (not found)
local needle=$1; shift
local item
local rep
for line in $@; do
- item="$(echo "$line" | cut -d':' -f1)"
- rep="$(echo "$line" | cut -s -d':' -f2)"
+ local item="$(echo "$line" | cut -d':' -f1)"
+ local rep="$(echo "$line" | cut -s -d':' -f2)"
if [ "$item" == "$needle" ]; then
if [ -z "$rep" ]; then
@@ -84,8 +86,11 @@ function check_replacement {
return 0 # Free (not found)
}
-function get_blacklist { # Download the blacklist.
-
+##
+# Download the blacklist.
+##
+get_blacklist() {
+ mkdir -p "$XDG_CONFIG_HOME/libretools"
pushd "$XDG_CONFIG_HOME/libretools" >/dev/null
msg "Downloading the blacklist of proprietary software packages."
@@ -103,103 +108,80 @@ function get_blacklist { # Download the blacklist.
popd > /dev/null
}
-function check_deps { # Check wheter a package depends on non-free
-
+##
+# Check wheter a package depends on non-free
+##
+check_deps() {
unset_pkgbuild
-
if ! assert_pkgbuild "$1"; then
- return 1 # not PKGBUILD
+ exit 1 # not PKGBUILD
fi
msg2 "${pkgbase:-${pkgname[0]}} $pkgver $pkgrel ${epoch:-""}" # > "$logpipe"
- for pkg in ${pkgname[@]} ${depends[@]} ${makedepends[@]} ${checkdepends[@]}; do
+ for pkg in "${pkgname[@]}" "${depends[@]}" "${makedepends[@]}" "${checkdepends[@]}"; do
- lines=($(grep "$pkg" "$XDG_CONFIG_HOME/libretools/blacklist.txt" | tr " " "_"))
+ local lines=($(grep "$pkg" "$XDG_CONFIG_HOME/libretools/blacklist.txt" | tr " " "_"))
- rep="$(check_replacement $pkg ${lines[@]})"
- freedom=$?
+ local rep="$(check_replacement $pkg ${lines[@]})"
+ local freedom=$?
- if [ "$freedom" -eq 15 ]; then
+ if [[ $freedom = 15 ]]; then
warning "found $pkg" # > "$logpipe"
ev=15
- continue
-
elif [ -n "$rep" ]; then
-
if [ "$rep" = "$pkg" ]; then
plain "$pkg is repackaged with the same name." # > "$logpipe"
- continue
else
plain "$pkg -> $rep" # > "$logpipe"
- continue
fi
-
fi
-
done
-
}
-function usage {
+usage() {
# TODO: implement PKGBUILD arguments
+ echo "Usage: $cmd [OPTIONS] [PKGBUILD1 PKGBUILD2 ...]"
echo ""
- echo "$(basename $0) [options] [PKGBUILD1 PKGBUILD2 ...]"
- echo ""
- echo "OPTIONS"
+ echo "If no PKGBUILD is specified, \`./PKGBUILD' is implied"
echo ""
- echo " -h : this message"
- echo ""
- echo "If no PKGBUILD is specified, one is searched on current directory"
-
- exit 1
+ echo "Options:"
+ echo " -f Allow running as root user"
+ echo " -h Show this message"
}
-while getopts 'h' arg; do
- case "$arg" in
- h) usage ;;
- esac
-done
-
-if [ -w / ]; then
- error "Run as normal user"
-fi
-
-source /etc/libretools.conf
-if [ -e "$XDG_CONFIG_HOME/libretools/libretools.conf" ]; then
- source "$XDG_CONFIG_HOME/libretools/libretools.conf"
-fi
-
-if [ -z "${BLACKLIST}" ]; then
- error "BLACKLIST variable is not set your libretools.conf file"
- exit 1
-fi
-
-if [ ! -d "$XDG_CONFIG_HOME/libretools" ]; then
- mkdir -p "$XDG_CONFIG_HOME/libretools"
-fi
-
-startdir=`pwd`
-
-get_blacklist
-# log
+main() {
+ local asroot=false
+ while getopts 'fh' arg; do
+ case "$arg" in
+ f) asroot=true;;
+ h) usage; exit 0;;
+ *) usage; exit 1;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+ pkgbuilds=("$@")
+ if [[ $# < 1 ]]; then
+ pkgbuilds=("`pwd`/PKGBUILD")
+ fi
-shift $(( OPTIND - 1))
+ if [[ -w / ]] && ! $asroot; then
+ error "Run as normal user"
+ exit 1
+ fi
-msg "Looking for unfree dependencies"
+ get_blacklist
+ # log
-if [ $# -ge 1 ]; then
+ msg "Looking for unfree dependencies"
- for p in $@; do
- if [ -n "$p" ]; then
+ for p in "${pkgbuilds[@]}"; do
+ if [[ -n "$p" ]]; then
check_deps "$p"
fi
done
-else
-
- check_deps "`pwd`/PKGBUILD"
-
-fi
+ return $ev
+}
-exit $ev
+main "$@"
diff --git a/prtools/prfullpkg b/src/pr-tools/prfullpkg
index bbb8d73..bbb8d73 100755
--- a/prtools/prfullpkg
+++ b/src/pr-tools/prfullpkg
diff --git a/prtools/prmipsrelease b/src/pr-tools/prmipsrelease
index 1fbd696..1fbd696 100755
--- a/prtools/prmipsrelease
+++ b/src/pr-tools/prmipsrelease
diff --git a/prtools/prtools.conf b/src/pr-tools/prtools.conf
index 5b41216..5b41216 100644
--- a/prtools/prtools.conf
+++ b/src/pr-tools/prtools.conf
diff --git a/prtools/prtoru b/src/pr-tools/prtoru
index 2898b66..2898b66 100644..100755
--- a/prtools/prtoru
+++ b/src/pr-tools/prtoru
diff --git a/toru b/src/toru/toru
index 28f0b8a..28f0b8a 100755
--- a/toru
+++ b/src/toru/toru
diff --git a/src/toru/toru-info b/src/toru/toru-info
new file mode 100755
index 0000000..523f682
--- /dev/null
+++ b/src/toru/toru-info
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Prints info about a given pkgname
+source /etc/libretools.conf
+
+for _pkg in $@; do
+ _pkgbuild="$(toru-where $_pkg)"
+
+ if [ -f "$_pkgbuild/PKGBUILD" ]; then
+ source "$_pkgbuild/PKGBUILD" 2>/dev/null || {
+ warning "Errors on %s" $_pkg
+ continue
+ }
+
+ deps="${depends[@]} ${makedepends[@]} ${checkdepends[@]}"
+ repo="$(basename $(dirname "$_pkgbuild"))"
+
+ unset build package depends makedepends checkdepends optdepends source md5sums
+
+ msg "%s/%s %s-%s" $repo $_pkg $pkgver $pkgrel
+ msg2 "$pkgdesc"
+ msg2 "$url"
+ msg2 "Depends: ${deps}"
+ else
+ warning "%s doesn't exist" $_pkg
+ fi
+
+ unset pkgname pkgver pkgrel pkgdesc url
+done
diff --git a/src/toru/toru-path b/src/toru/toru-path
new file mode 100755
index 0000000..baeaeb5
--- /dev/null
+++ b/src/toru/toru-path
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+source $(dirname $(command -v $0))/toru-utils
+
+TORUPATH=${T:-${TORUPATH}}
+VERBOSE=${V:-false}
+
+if [ ! -w "$TORUPATH" ]; then
+ error "Toru's path isn't writable. Please check $TORUPATH"
+ exit 1
+fi
+
+LASTSYNCFILE=${TORUPATH}/lastsync.paths
+PATHFILE=${TORUPATH}/paths.tch
+
+if [ ! -e "${PATHFILE}" ]; then
+ tcamgr create "${PATHFILE}"
+fi
+
+# TODO pass other paths via flags
+# ABSROOT has trailing slash
+fullrepos=()
+for (( i = ${#REPOS[@]}-1 ; i >= 0 ; i-- )); do
+ ${VERBOSE} && msg "Processing [%s]" ${REPOS[$i]}
+
+ [ -d "${ABSROOT}${REPOS[$i]}" ] && \
+ fullrepos+=("${ABSROOT}${REPOS[$i]}")
+done
+pkgbuilds=($(get_pkgbuilds ${fullrepos[@]}))
+
+msg "Updating path cache"
+msg2 "${#pkgbuilds[@]} PKGBUILDs to update"
+for _pkgbuild in ${pkgbuilds[@]}; do
+# plain "$_pkgbuild"
+ source ${_pkgbuild} >/dev/null 2>&1 || {
+ error "${_pkgbuild} contains errors, skipping"
+ continue
+ }
+
+ fullpath=$(dirname ${_pkgbuild})
+
+ for _pkg in ${pkgbase} ${pkgname[@]} ${provides[@]}; do
+ $VERBOSE && msg2 "${_pkg} -> ${fullpath}"
+ tcamgr put ${PATHFILE} ${_pkg/[<>=]*} ${fullpath}
+ done
+
+ unset pkgbase pkgname provides
+done
+
+lastsync ${LASTSYNCFILE}
diff --git a/toru-utils b/src/toru/toru-utils
index 0818aa6..316e6b8 100755
--- a/toru-utils
+++ b/src/toru/toru-utils
@@ -1,15 +1,8 @@
#!/bin/bash
-#!/bin/bash
-
source /etc/abs.conf
source /etc/libretools.conf
-if [ ! -w "$TORUPATH" ]; then
- error "Toru's path isn't writable. Please check $TORUPATH"
- exit 1
-fi
-
LASTSYNCFILE=${TORUPATH}/lastsync
FORCE=false
QUIET=false
diff --git a/src/toru/toru-where b/src/toru/toru-where
new file mode 100755
index 0000000..e9ab29d
--- /dev/null
+++ b/src/toru/toru-where
@@ -0,0 +1,7 @@
+#!/bin/bash
+# Locates a PKGBUILD dir on toru's path cache
+source /etc/libretools.conf
+
+PATHFILE=${TORUPATH}/paths.tch
+
+tcamgr get ${PATHFILE} $1 2>/dev/null || echo ""
diff --git a/treepkg b/src/treepkg
index d21377d..8c4cc8e 100755
--- a/treepkg
+++ b/src/treepkg
@@ -18,12 +18,15 @@
source /etc/libretools.conf
source $XDG_CONFIG_HOME/libretools/libretools.conf >/dev/null 2>&1|| true
+term_title "$(basename $0)"
+
# Get system variables
source /etc/makepkg.conf
source $HOME/makepkg.conf >/dev/null 2>&1|| true
# End inmediately but print an useful message
trap_exit() {
+ term_title "error!"
error "($(basename $0)) $@ (leftovers on ${BUILDDIR})"
exit 1
}
@@ -81,16 +84,8 @@ bury() {
} || return 1
}
-# Finds a PKGBUILD on toru's path cache
-# Look in all caches but pick the first one
-# TODO move to a toru flag (-p?)
-where_is() {
- grep -m1 "^${1}:" "${TORUPATH}/paths" 2>/dev/null| \
- cut -d: -f2 2>/dev/null
-}
-
# Guess the repo from the pkgbase path
-# $1 path, pwd or where_is
+# $1 path, pwd or toru-where
guess_repo() {
basename "$(dirname "${1}")"
}
@@ -142,10 +137,12 @@ if ! ${BUILDNOW}; then
touch "${BUILDORDER}"
# If this package is already built quit silently
- if is_built "${pkgbase}" "${fullver}"; then
- add_order "ignore"
- exit 0
- fi
+ for _pkg in ${pkgname[@]}; do
+ if is_built "${_pkg}" "${fullver}"; then
+ add_order "ignore"
+ exit 0
+ fi
+ done
# Ignore if already in build order
egrep -q ";${pkgbase};" "${BUILDORDER}" && exit 0
@@ -165,17 +162,14 @@ if ! ${BUILDNOW}; then
# NOTE: getting depends from package() is a PITA
for _dep in ${deps[@]}; do
-# Ignore if already in build order
-# TODO move deps deeper in the tree if
+# Move deps deeper in the tree if
# pkgbase - dep1
# \ dep2 - dep1
# dep1 should be depth + 1
-# probably sed -i buildorder and increase dep's dep depth :D
-# remember to change dir name from xxx_pkgbase to xxx+1_pkgbase
egrep -q ";${_dep};" "${BUILDORDER}" && bury "${_dep}" ${NEXTDEPTH}
# Ask toru where's a PKGBUILD
- depdir="$(where_is ${_dep})"
+ depdir="$(toru-where ${_dep})"
if [ -z "${depdir}" -o ! -d "${depdir}" ]; then
# We specify the pkgname because we can't source the dep PKGBUILD
@@ -205,16 +199,25 @@ if [ ${DEPTH} -eq 0 ]; then
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 ${_pkg/_/ }" || true
+# Remove leading zeros and space if any
+ term_title "$(echo ${_pkg/_/ } | sed "s/^0\+ \?//")"
+
# Run build command
pushd "${BUILDDIR}/${_pkg}" >/dev/null
sudo pacman -Syu --noconfirm
+ ${HOOKPREBUILD}
+
${FULLBUILDCMD}
# Run local release hook with $1 = $repo
${HOOKLOCALRELEASE} $(egrep ";${_pkg#*_};" "${BUILDORDER}" | cut -d';' -f6)
+
+ touch built_ok
popd >/dev/null
done
@@ -230,4 +233,5 @@ fi
fi
+term_title "done"
exit $?
diff --git a/toru-path b/toru-path
deleted file mode 100755
index 5065a30..0000000
--- a/toru-path
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-source $(dirname $(command -v $0))/toru-utils
-
-LASTSYNCFILE=${TORUPATH}/lastsync.paths
-
-# TODO pass other paths via flags
-pkgbuilds=($(get_pkgbuilds ${ABSROOT}))
-paths=()
-
-msg "Updating path cache"
-msg2 "${#pkgbuilds[@]} PKGBUILDs to update"
-for _pkgbuild in ${pkgbuilds[@]}; do
- $DEBUG && plain "$_pkgbuild"
- source ${_pkgbuild} || {
- error "${_pkgbuild} contains errors, skipping"
- continue
- }
-
- fullpath=$(dirname ${_pkgbuild})
-
- for _pkg in ${pkgbase} ${pkgname[@]} ${provides[@]}; do
- paths+=(${_pkg/[<>=]*}:${fullpath})
- done
-
- unset pkgbase pkgname provides
-done
-
-# TODO remove old paths
-# by joining new paths to old paths and exclude the joining points from the
-# cache (sort of a sql join)
-echo ${paths[@]} | tr ' ' "\n" | sort >> ${TORUPATH}/paths
-
-lastsync ${LASTSYNCFILE}
diff --git a/update-cleansystem b/update-cleansystem
deleted file mode 100755
index 97c2922..0000000
--- a/update-cleansystem
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-# Updates the cleansystem file
-# Creates a fake Parabola root and prints all packages installable from base
-# and base-devel plus extras
-
-set -E
-
-if [ ! -w / ]; then
- echo "Run as root."
- exit 1
-fi
-
-tmpdir=/tmp/cleansystem.${RANDOM}
-
-mkdir -p ${tmpdir}/var/lib/pacman
-
-# We sync first because updating info gets printed to stdout too
-pacman -r ${tmpdir} --config /etc/pacman.conf -Sy 2>/dev/null
-pacman -r ${tmpdir} \
- --config /etc/pacman.conf \
- -Sp --print-format "%n" \
- base base-devel sudo ${@} | sort > /etc/libretools.d/cleansystem
-
-exit $?