summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfullpkg185
-rwxr-xr-xis_built7
-rwxr-xr-xmipsrelease17
-rwxr-xr-xpkgbuild-check-nonfree22
4 files changed, 227 insertions, 4 deletions
diff --git a/fullpkg b/fullpkg
new file mode 100755
index 0000000..036e820
--- /dev/null
+++ b/fullpkg
@@ -0,0 +1,185 @@
+#!/bin/bash
+# TODO
+# * Do version checking
+# * Detect circular builds
+# * Detect pkgnames by provides, replaces, etc. instead of dir tree
+
+
+tmp_dir=$(mktemp -d)
+queue_file=$(mktemp)
+[[ ! -w $queue_file ]] && exit 1
+
+source /etc/makepkg.conf
+source /etc/abs.conf
+source /etc/libretools.conf
+
+[[ -r ~/.config/libretools/libretools.conf ]] && \
+ source ~/.config/libretools/libretools.conf
+
+# Queue Management
+# * Always get the queue list from the server
+# * Add/Remove from queue
+# * Check if a package is listed
+
+# TODO
+# * Check for concurrence
+
+# Get the queue list from the server
+get_queue() {
+ rsync -e ssh -aq $PARABOLAHOST:mips64el/queue $queue_file >/dev/null 2>&1 || {
+ echo ":: Failed to retrieve queue list"
+ return 1
+ }
+}
+
+# Put the queue list on the server
+put_queue() {
+ rsync -e ssh -aq $queue_file $PARABOLAHOST:mips64el/queue >/dev/null 2>&1 || {
+ echo ":: Failed to put queue list"
+ return 1
+ }
+}
+
+# Add packages to the queue
+update_queue() {
+ get_queue || return $?
+
+ basename $PWD | sed "s/$/:$PACKAGER/" >> $queue_file || return 2
+
+ put_queue || return $?
+}
+
+# Remove a package from the queue
+remove_queue() {
+ get_queue || return $?
+
+ grep -vw "^$(basename $PWD)" $queue_file > $queue_file.2
+ cat $queue_file.2 > $queue_file
+
+ put_queue || return $?
+}
+
+# Checks if a package is listed
+check_queue() {
+ get_queue || return $?
+
+ packager=$(grep -w "$(basename $PWD)" ${queue_file} | cut -d ':' -f2)
+
+ [[ ! -z $packager ]] && [[ "$packager" != "$PACKAGER" ]] && {
+ echo ":: $(basename $PWD) is being packaged by $packager. Please wait."
+ return 1
+ }
+
+ return 0
+}
+
+
+# TODO keep track of spawned fullpkgs
+quit() {
+ remove_queue
+
+ exit 1
+}
+
+source PKGBUILD
+echo ":: Building ${pkgbase} ${pkgname[@]}"
+
+trap "quit" SIGTERM SIGKILL
+
+check_queue || exit 1
+
+failed=()
+missing=()
+
+# Gets the dependency list from the package_* functions
+#pkgdeps=($(cat PKGBUILD | \
+# tr -d "\n" | \
+# sed -n "s/depends=(\([^)]\+\))/\n::\1\n/pg" | \
+# grep --color=never "^::" | \
+# tr -d [:\'\"] | \
+# tr " " "\n" | \
+# sort -u))
+
+# Clean version checking
+deps=$(echo "${depends[@]} ${makedepends[@]} ${pkgdeps[@]}" | \
+ sed "s/[=<>]\+[^ ]\+//g" | \
+ tr ' ' "\n" | \
+ sort -u)
+
+echo $_deps
+
+sudo pacman -Sy
+
+for _dep in ${deps[@]}; do
+ is_built $_dep && continue
+
+ for _repo in ${REPOS[@]}; do
+ # TODO find split packages
+ [[ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]] && {
+ cp -r "$ABSROOT/$_repo/$_dep" $tmp_dir/ || {
+ echo "Can't copy $_dep to the work dir."
+ exit 1
+ }
+
+ # Enter the work dir and run this command in it
+ pushd $tmp_dir/$_dep >/dev/null
+ $0
+
+ [[ $? -eq 1 ]] && {
+ failed=(${failed[@]} $_dep)
+ }
+
+ popd >/dev/null
+
+ break
+# } || {
+# The package can't be found
+# This can happen if:
+# * The package is built inside a split package
+# * The package is provided by some other package (ie by *-libre packages)
+# echo "==> Missing package $_dep"
+# missing=(${missing[@]} $_dep)
+ }
+ done
+done
+
+# TODO probably not elegant enough
+#[[ ${#failed[@]} -gt 0 ]] || [[ ${#missing[@]} -gt 0 ]] && {
+ [[ ${#failed[@]} -gt 0 ]] && {
+ echo ":: This packages failed to build: ${failed[@]}"
+ }
+
+# [[ ${#missing[@]} -gt 0 ]] && {
+# echo ":: This packages are missing: ${missing[@]}"
+# }
+
+# exit 1
+#}
+
+# Let everybody know we're building this
+update_queue || {
+ echo ":: Couldn't update the queue, let your partners know about this."
+}
+
+cp -r ../$(basename $PWD) $tmp_dir/
+pushd $tmp_dir/$(basename $PWD) >/dev/null
+
+sudo pacman -Sy
+makepkg --noconfirm -sLcr ; r=$?
+case $r in
+ 0)
+ echo "==> The build was succesful."
+ mipsrelease *.pkg.tar.*
+ ;;
+ 1)
+ echo "==> The build failed."
+ ;;
+ 2)
+ echo "==> The build failed."
+ ;;
+esac
+
+# Remove from queue
+remove_queue
+
+exit $r
diff --git a/is_built b/is_built
new file mode 100755
index 0000000..9dc5d1c
--- /dev/null
+++ b/is_built
@@ -0,0 +1,7 @@
+#!/bin/bash
+# Detect is a package is installed or in a database
+
+pacman -Qqi $1 >/dev/null 2>&1 || \
+pacman -Sqi $1 >/dev/null 2>&1
+
+exit $?
diff --git a/mipsrelease b/mipsrelease
new file mode 100755
index 0000000..82cd51f
--- /dev/null
+++ b/mipsrelease
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Temporary script for uploading mips64el packages to the server
+
+source /etc/makepkg.conf
+source /etc/libretools.conf
+
+for pkg in $@; do
+ scp $pkg ${PARABOLAHOST}:mips64el/stage3/
+done
+
+scp ${PARABOLAHOST}:mips64el/stage3/stage3.db.tar.gz ${SRCDEST}/ && \
+repo-add ${SRCDEST}/stage3.db.tar.gz $@ && \
+scp ${SRCDEST}/stage3.db.tar.gz ${PARABOLAHOST}:mips64el/stage3/
+
+#ssh parabola bash -c "cd /home/parabolavnx/mips64el/stage3/ ; repo-add stage3.db.tar.gz $@"
+
+exit $?
diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree
index 0ac6c6e..418a0bf 100755
--- a/pkgbuild-check-nonfree
+++ b/pkgbuild-check-nonfree
@@ -1,6 +1,6 @@
#!/bin/bash
# pkgbuild-check-nonfree
-# Copyright 2010 Joshua Ismael Haase Hernández
+# Copyright 2010 Joshua Ismael Haase Hernández, Joseph Graham
# ---------- GNU General Public License 3 ----------
@@ -25,31 +25,45 @@ source /etc/libretools.conf
pushd /tmp >/dev/null
+# This is the exit status.
ev=0
+# Check if the blacklist variable is empty, and if so error.
[[ ${#BLACKLIST} -eq 0 ]] && {
echo "Please set up the BLACKLIST variable in your libretools.conf file"
exit 1
}
+# Download the blacklist.
echo "Downloading the blacklist of proprietary software packages."
wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null || {
echo "Download failed, exiting"
exit 1
}
+# Get everything before the `:' in the blacklist (that's the names of the
+# packages).
unfree=($(cut -d: -f1 blacklist.txt))
popd >/dev/null
-source /etc/rc.d/functions
+source /etc/rc.d/functions # We want the `in_array' function.
source ./PKGBUILD
+# The following piece of code will check whether a package is, or depends on;
+# any non free package(s).
+
+# The `pkgname', `depends', `makedepends' arrays have been sourced from
+# ./PKGBUILD.
echo "Looking for unfree dependencies"
-for where in pkgname depends makedepends; do
+for where in pkgname depends makedepends ; do
echo " Found in «${where}»:"
+
+ # We cycle through all of the programs in the array (if any), and check if
+ # they are in the `unfree' array.
for item in ${!where[@]} ; do
- if in_array $item ${unfree[@]}; then
+ if in_array $item ${unfree[@]}
+ then
ev=15
echo $item
fi