summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchcleanup6
-rw-r--r--cleansystem131
-rwxr-xr-xfullpkg-find16
-rwxr-xr-xlibreaddiff97
-rwxr-xr-xlibrechroot15
-rwxr-xr-xlibrerelease15
-rwxr-xr-xtoru13
-rwxr-xr-xtoru-path2
-rwxr-xr-xtreepkg51
-rwxr-xr-xupdate-cleansystem2
10 files changed, 165 insertions, 183 deletions
diff --git a/chcleanup b/chcleanup
index a893320..d1c71c7 100755
--- a/chcleanup
+++ b/chcleanup
@@ -2,6 +2,10 @@
[ ! -f ~/cleansystem ] && exit 1
-sudo pacman --noconfirm -Rcs $(comm -23 <(pacman -Qq | sort) <(sort /etc/libretools.d/cleansystem))
+packages=($(comm -23 <(pacman -Qq | sort) <(sort /etc/libretools.d/cleansystem)))
+
+echo "Removing: ${packages[@]}"
+
+sudo pacman --noconfirm -Rcs ${packages[@]}
exit $?
diff --git a/cleansystem b/cleansystem
deleted file mode 100644
index f210416..0000000
--- a/cleansystem
+++ /dev/null
@@ -1,131 +0,0 @@
-acl
-attr
-autoconf
-automake
-bash
-binutils
-bison
-bzip2
-ca-certificates
-cloog
-coreutils
-cracklib
-cronie
-cryptsetup
-curl
-db
-dbus-core
-device-mapper
-dhcpcd
-diffutils
-dirmngr
-e2fsprogs
-expat
-fakeroot
-file
-filesystem
-findutils
-flex
-gawk
-gcc
-gcc-libs
-gdbm
-gettext
-glib2
-glibc
-gmp
-gnupg
-gnupg2
-gpgme
-grep
-groff
-grub
-gzip
-heirloom-mailx
-iana-etc
-inetutils
-initscripts
-iproute2
-iputils
-isl
-jfsutils
-kbd
-keyutils
-kmod
-krb5
-less
-libarchive
-libassuan
-libcap
-libfetch
-libffi
-libgcrypt
-libgpg-error
-libgssglue
-libksba
-libldap
-libltdl
-libmpc
-libnl
-libpcap
-libpipeline
-libsasl
-libssh2
-libtirpc
-libtool
-libusb
-libusb-compat
-licenses-libre
-linux-api-headers
-linux-libre
-logrotate
-lvm2
-m4
-make
-man-db
-man-pages
-mdadm
-mkinitcpio
-mkinitcpio-busybox
-mpfr
-nano
-ncurses
-openssl
-pacman
-pacman-mirrorlist-libre
-pam
-patch
-pciutils
-pcmciautils
-pcre
-perl
-pinentry
-pkg-config
-popt
-ppl
-ppp
-procps
-psmisc
-pth
-readline
-reiserfsprogs
-run-parts
-sed
-shadow
-sudo
-sysfsutils
-sysvinit
-tar
-texinfo
-tzdata
-udev
-usbutils
-util-linux
-vi
-wget
-which
-wpa_supplicant
-xfsprogs
-xz
-your-freedom
-zlib
diff --git a/fullpkg-find b/fullpkg-find
index 8c0c063..9ddfa08 100755
--- a/fullpkg-find
+++ b/fullpkg-find
@@ -80,17 +80,16 @@ find_deps() {
local found=false
# TODO change for where_is or toru-path
- local pkgdir=$(toru -p ${_dep})
+ # May fail, e.g. since abslibre-mips64el doesn't include
+ # arch=any packages.
+ local pkgdir=$(toru -p ${_dep}) || true
if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then
found=true
pushd "${pkgdir}" > /dev/null
# runs itself on dep's PKGBUILD dir
- $0 -l ${next_level} ${build_dir}
-
-# probable circular deps
- [ $? -eq 20 ] && return 20
+ $0 -l ${next_level} ${build_dir} || return $?
popd > /dev/null
fi
@@ -188,13 +187,8 @@ fi
find_deps || {
# Probable circular deps
- if [ "$?" -eq 20 ]; then
-
-# Show error only on level 0
- if [ "$LEVEL" -eq 0 ]; then
+ if [ "$?" -eq 20 -a "$LEVEL" -eq 0 ]; then
error "Check for circular deps on $build_dir/BUILDORDER";
- fi
-
fi
# Pass message 20
exit 20
diff --git a/libreaddiff b/libreaddiff
new file mode 100755
index 0000000..c8b5214
--- /dev/null
+++ b/libreaddiff
@@ -0,0 +1,97 @@
+#!/bin/bash
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011, 2012 Michał Masłowski <mtjm@mtjm.eu>
+#
+# 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/>.
+
+
+set -e
+
+. /etc/libretools.conf
+custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
+[ -e $custom_config ] && . $custom_config
+
+for arg in "$@" ; do
+ case "$arg" in
+ -h|--h|--he|--hel|--help|-\?)
+ echo 'Usage: find-pkgs.sh repo [arch]
+
+This script outputs a diff of package names and versions in repo
+between pacman'\''s sync db and abslibre checkout.' >&2
+ exit 0
+ ;;
+ esac
+done
+
+# The repo to find missing packages in.
+repo=$1
+# The arch to check in Arch repos, other will have all arches checked.
+arch=${2:-mips64el}
+# A Python tuple of repos which don't have arch=any packages.
+archrepos='("core", "extra", "community")'
+
+diff -U0 \
+ <( (
+ cd /var/lib/pacman/sync
+ for f in $repo.db ; do
+ tar xOf $f | python -c 'import sys
+arch = None
+name = None
+version = None
+it = iter(sys.stdin)
+try:
+ while True:
+ line = next(it)
+ if line == "%ARCH%\n":
+ arch = next(it)
+ if arch == "'"$arch"'\n" or "'$repo'" not in '"$archrepos"':
+ print("%s-%s" % (name.strip(), version.strip()))
+ if line == "%NAME%\n":
+ name = next(it)
+ if line == "%VERSION%\n":
+ version = next(it)
+except StopIteration:
+ pass
+'
+ done
+ ) | sort ) \
+ <( (
+ cd "${WORKDIR}/abslibre"
+ # Needed to not include pkgnames specific to other arches.
+ CARCH=$arch
+ for f in $repo/* ; do
+ unset pkgname
+ unset epoch
+ unset pkgver
+ unset pkgrel
+ unset arch
+ . $f/PKGBUILD || continue
+ is_here=false
+ for arc in ${arch[@]} ; do
+ if [ "$arc" = "any" -o "$arc" = "$CARCH" ] ; then
+ is_here=true
+ break
+ fi
+ done
+ if [ "$is_here" = "true" ] ; then
+ for name in ${pkgname[@]} ; do
+ if [ -z "$epoch" ] ; then
+ echo $name-$pkgver-$pkgrel
+ else
+ echo $name-$epoch:$pkgver-$pkgrel
+ fi
+ done
+ fi
+ done
+ ) | sort ) | sed -rn 's/^[+-][^+-].+$/&/p'
diff --git a/librechroot b/librechroot
index 31516ac..9e292f5 100755
--- a/librechroot
+++ b/librechroot
@@ -24,14 +24,15 @@
function usage {
+ echo ""
echo "Usage: $0 [options] [chrootname]"
echo "Use it as root."
- echo ''
+ echo ""
echo "Default chroot name: $CHROOT"
echo "Default chrootdir: $CHROOTDIR"
- echo ''
+ echo ""
echo "OPTIONS:"
- echo ''
+ 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"
@@ -43,9 +44,7 @@ function usage {
}
function clean_chroot { # Clean packages with pacman
-
msg "Cleaning chroot: ${CHROOTDIR}/${CHROOTNAME}"
-
cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/cleansystem"
(cat <<EOF
#!/bin/bash
@@ -83,8 +82,12 @@ EOF
function clean_repo {
msg "Cleaning repo for chroot: ${CHROOTDIR}/${CHROOTNAME}"
if [ -d "${CHROOTDIR}/${CHROOTNAME}/repo" ]; then
- rm -rf "${CHROOTDIR}/${CHROOTNAME}/repo"
+ 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"
}
source /etc/libretools.conf
diff --git a/librerelease b/librerelease
index f31bc3a..bac5b88 100755
--- a/librerelease
+++ b/librerelease
@@ -72,7 +72,12 @@ function sign_packages {
fi
msg2 "Signing ${package}..."
- gpg --default-key "${SIGID}" --output "${package}${SIGEXT}" --detach-sig "${package}"
+ gpg --default-key "${SIGID}" --output "${package}${SIGEXT}" \
+ --detach-sig "${package}" || {
+ error "Signing failed"
+ exit 2
+ }
+
done
}
@@ -110,11 +115,17 @@ done
clean_non_packages
if [ ! -z "${SIGID}" ]; then
sign_packages
-else
+else
error "Package signing is *required*"
exit 1
fi
+# Make the permissions of the packages 644 otherwize 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 {} \;
+
msg "Uploading packages..."
rsync --recursive \
${dryrun} \
diff --git a/toru b/toru
index 9616119..766331b 100755
--- a/toru
+++ b/toru
@@ -12,7 +12,7 @@
# * Possibility to hook up ABS dirs besides ABSROOT (low priority)
# * Tell updates and non available binary packages (working on this)
-source $(dirname $0)/toru-utils
+source $(dirname $(command -v $0))/toru-utils
# Saves contents on a named cache
# $1 cache name (repo)
@@ -137,7 +137,7 @@ update() {
fi
- package_paths=($(read_cache ${_repo}.paths))
+ package_paths=($(read_cache ${_repo}.paths || true))
# Inform how many PKGBUILDS were found and quit immediately if none
$quiet || msg "Found $((${#pkgbuilds[*]}-1)) PKGBUILDs to update"
@@ -148,7 +148,7 @@ update() {
update_sync_file=true
# Load PKGBUILD's metadata
- source ${_pkgbuild}
+ source ${_pkgbuild} || continue
# Guess pkgbase from PKGBUILD's basedir
_pkgpath=$(dirname "${_pkgbuild}")
@@ -165,7 +165,7 @@ update() {
for _pkg in ${pkgname[@]}; do
# Keep removing unneeded stuff
- unset package_${_pkg} >/dev/null 2>&1
+ unset package_${_pkg} >/dev/null 2>&1 || true
# Fill the list of packages to find
packages_in_abs+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel))
package_paths+=($_pkg:$_pkgpath)
@@ -199,7 +199,7 @@ update() {
split_pkgname_from_pkgver ${TMPDIR}/packages_in_abs | sort -k1b,1 > ${TMPDIR}/in_abs
split_pkgname_from_pkgver ${TMPDIR}/packages_in_sync | sort -k1b,1 > ${TMPDIR}/in_sync
- $quiet || msg "This packages are available to update"
+ $quiet || msg "These packages are available to update"
# Join both files by pkgname, the end result is:
# pkgname syncver absver
join ${TMPDIR}/in_sync ${TMPDIR}/in_abs | \
@@ -297,8 +297,7 @@ while getopts 'haqfpum' arg; do
f) force=true ;;
u) commands+=(update);;
p) shift $(( OPTIND - 1 ))
- where_is "$1"
- exit $?;;
+ where_is "$1" || exit 1;;
m) commands+=(missing);;
esac
diff --git a/toru-path b/toru-path
index 25d3995..b82dbb2 100755
--- a/toru-path
+++ b/toru-path
@@ -1,6 +1,6 @@
#!/bin/bash
-source $(dirname $0)/toru-utils
+source $(dirname $(command -v $0))/toru-utils
LASTSYNCFILE=${TORUPATH}/lastsync.paths
diff --git a/treepkg b/treepkg
index a49301e..e742858 100755
--- a/treepkg
+++ b/treepkg
@@ -114,34 +114,37 @@ NEXTDEPTH=$((${DEPTH} + 1))
VERBOSE=${V:-true}
BUILD=${B:-true}
CLEANUP=${C:-true}
+# Skip BUILDORDER creation and build anything on BUILDDIR
+BUILDNOW=${N:-false}
+if ! ${BUILDNOW}; then
# ensure it exists
-touch "${BUILDORDER}"
+ touch "${BUILDORDER}"
# If this package is already built quit silently
-if is_built "${pkgbase}" "${fullver}"; then
- add_order "ignore"
- exit 0
-fi
+ if is_built "${pkgbase}" "${fullver}"; then
+ add_order "ignore"
+ exit 0
+ fi
# Ignore if already in build order
-egrep -q ";${pkgbase};" "${BUILDORDER}" && exit 0
+ egrep -q ";${pkgbase};" "${BUILDORDER}" && exit 0
# Add pkgbase to build order
-add_order "build"
+ 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}"
+ cp -r "${PWD}" "${BUILDDIR}/$(printf "%03d" ${DEPTH})_${pkgbase}"
# Cleanup dep versioning
-deps=($(echo "${depends[@]} ${makedepends[@]}" | \
- sed "s/[=<>]\+[^ ]\+//g" | \
- tr ' ' "\n" | \
- sort -u))
+ deps=($(echo "${depends[@]} ${makedepends[@]}" | \
+ sed "s/[=<>]\+[^ ]\+//g" | \
+ tr ' ' "\n" | \
+ sort -u))
# NOTE: getting depends from package() is a PITA
-for _dep in ${deps[@]}; do
+ for _dep in ${deps[@]}; do
# Ignore if already in build order
# TODO move deps deeper in the tree if
# pkgbase - dep1
@@ -149,24 +152,26 @@ for _dep in ${deps[@]}; do
# 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}
+ egrep -q ";${_dep};" "${BUILDORDER}" && bury "${_dep}" ${NEXTDEPTH}
# Ask toru where's a PKGBUILD
- depdir="$(where_is ${_dep})"
+ depdir="$(where_is ${_dep})"
- if [ -z "${depdir}" -o ! -d "${depdir}" ]; then
+ if [ -z "${depdir}" -o ! -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
+ add_order "missing" "${_dep}"
+ continue
+ fi
- pushd "${depdir}" >/dev/null
+ pushd "${depdir}" >/dev/null
# Run itself over dependencies
- $0 "${BUILDDIR}" ${NEXTDEPTH}
+ $0 "${BUILDDIR}" ${NEXTDEPTH}
-done
+ done
+# End BUILD now
+fi
# Only build at the end
if [ ${DEPTH} -eq 0 ]; then
@@ -198,7 +203,7 @@ if [ ${DEPTH} -eq 0 ]; then
${VERBOSE} || echo "${BUILDORDER}" || true
fi
-if (( CLEANUP )); then
+if ${CLEANUP} ; then
msg2 "Removing ${BUILDDIR}"
rm -rf "${BUILDDIR}"
fi
diff --git a/update-cleansystem b/update-cleansystem
index d4ad943..dd3ff6c 100755
--- a/update-cleansystem
+++ b/update-cleansystem
@@ -19,6 +19,6 @@ pacman -r ${tmpdir} --config /etc/pacman.conf -Sy
pacman -r ${tmpdir} \
--config /etc/pacman.conf \
-Sp --print-format "%n" \
- base base-devel ${@} | sort > $(dirname $0)/cleansystem
+ base base-devel sudo ${@} | sort > /etc/libretools.d/cleansystem
exit $?