summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-05 16:39:27 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-05 16:39:27 -0300
commit070d785ab1f5a72ed52680b18a5120bb2c46c847 (patch)
tree19336516d152fcac874fa97febee37daeb312575
parent369245e8dbee7ad97acec087de77081627a255db (diff)
parent83dd1498e580510023b63611bb25feedd3699b8c (diff)
Merge branch 'master' of git://ponape.local/libretools
-rwxr-xr-xchcleanup41
-rw-r--r--doc/treepkg.markdown24
-rwxr-xr-xlibrechroot34
-rwxr-xr-xlibrerelease3
-rw-r--r--libretools.conf2
5 files changed, 39 insertions, 65 deletions
diff --git a/chcleanup b/chcleanup
index b5f631c..26c1a27 100755
--- a/chcleanup
+++ b/chcleanup
@@ -9,16 +9,16 @@
set -e
-[ ! -f /etc/libretools.d/cleansystem ] && exit 1
-[ ! -d "${DB:-/var/lib/libretools/clean}"/sync ] && exit 1
-
-source $(dirname $0)/libremessages
source /etc/makepkg.conf
+source /etc/libretools.conf
source ${HOME}/.makepkg.conf 2>/dev/null|| true
msg "Cleaning chroot..."
-cleanup_log=/tmp/libretools-cleanup.log
+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
@@ -27,33 +27,30 @@ if [ -f PKGBUILD ]; then
check=(${depends[@]} ${makedepends[@]} ${checkdepends[@]})
- if [ ${#check[@]} -ne 0 ]; then
-
-# Update the cleansystem database
- sudo pacman -b "${BD:-/var/lib/libretools/clean}" -Sy
-# Get the full list of packages needed by dependencies
- sudo pacman -b "${BD:-/var/lib/libretools/clean}" \
- -Sp \
- --print-format "%n" \
- ${check[@]} \
- >${cleanup_log}
- fi
fi
-# Diff installed packages against a clean chroot and needed packages,
-# then remove leftovers
+# 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) \
- <(cat /etc/libretools.d/cleansystem ${cleanup_log} | sort -u)
- ))
+ <(sort -u ${cleanup_log})))
[ ${#packages[@]} -eq 0 ] && exit 0
msg2 "Removing %d packages" ${#packages[@]}
# Only remove leftovers, -Rcs removes too much
-sudo pacman --noconfirm -Rn ${packages[@]}
+${DRYRUN} || sudo pacman --noconfirm -Rn ${packages[@]}
+${DRYRUN} && echo ${packages[@]}
# Cleanup
-rm -f ${cleanup_log}
+${DRYRUN} || rm -fr ${TMPDIR}
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/librechroot b/librechroot
index 9e292f5..b4766e6 100755
--- a/librechroot
+++ b/librechroot
@@ -44,39 +44,9 @@ 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
-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 "Cleaning failed: please report error"
-
-EOF
- ) > "${CHROOTDIR}/${CHROOTNAME}/clean"
-
- chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean"
- mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}"
+ cp -a "$(dirname $0)/chcleanup" "${CHROOTDIR}/${CHROOTNAME}/clean"
- rm "${CHROOTDIR}/${CHROOTNAME}/clean"
- rm "${CHROOTDIR}/${CHROOTNAME}/cleansystem"
+ mkarchroot -r "/clean"
}
function clean_repo {
diff --git a/librerelease b/librerelease
index c4d97c1..efb698e 100755
--- a/librerelease
+++ b/librerelease
@@ -118,7 +118,7 @@ else
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 {} \;
@@ -127,6 +127,7 @@ 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} \
diff --git a/libretools.conf b/libretools.conf
index 88ba515..8032397 100644
--- a/libretools.conf
+++ b/libretools.conf
@@ -19,6 +19,8 @@ ARCHES=('i686' 'x86_64' 'mips64el' 'any')
## The directory where the chroots are stored
CHROOTDIR=/home/chroot
+# Extra packages to have installed on the chroot (besides base base-devel and sudo)
+CHROOTEXTRAPKG=(distcc ccache tsocks tokyocabinet)
## The working chroot
## A chroot is useful to build packages isolated from the current system and avoid