summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcreateworkdir31
-rwxr-xr-xis_built4
-rwxr-xr-xlibrechroot7
-rwxr-xr-xlibrecommit6
-rwxr-xr-xlibrediff4
-rwxr-xr-xlibremakepkg18
-rwxr-xr-xlibremessages77
-rwxr-xr-xlibrerelease9
-rwxr-xr-xlibrestage12
-rw-r--r--libretools.conf1
-rwxr-xr-xmipsrelease20
-rwxr-xr-xpkgbuild-check-nonfree14
-rwxr-xr-xupdateabslibre10
13 files changed, 167 insertions, 46 deletions
diff --git a/createworkdir b/createworkdir
index 2589a8a..8680215 100755
--- a/createworkdir
+++ b/createworkdir
@@ -25,18 +25,25 @@ source /etc/libretools.conf
custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
[[ -e $custom_config ]] && source $custom_config
-# Send every output to /dev/null
-stdnull=">/dev/null 2>&1"
-
# Create the WORKDIR
[[ ! -d ${WORKDIR} ]] && {
- echo "Creating WORKDIR on ${WORKDIR}"
- mkdir -p ${WORKDIR} ${stdnull} || exit 1
+ msg "Creating WORKDIR on ${WORKDIR}"
+ stdnull "mkdir -p ${WORKDIR}" ||{
+ error "Could not create ${WORKDIR}"
+ exit 1
+ }
}
[[ ! -d ${WORKDIR}/abslibre/.git ]] && {
- echo "Cloning into ABSLibre"
- git clone ${ABSLIBREGIT} ${WORKDIR}/abslibre || exit 1
+ msg "Cloning into ABSLibre"
+ CMD="git clone ${ABSLIBREGIT} ${WORKDIR}/abslibre"
+ ${CMD} || {
+ error "Could not clone ABSLibre"
+ plain "Try running this command:"
+ echo
+ plain "${CMD}"
+ exit 1
+ }
}
@@ -44,23 +51,23 @@ stdnull=">/dev/null 2>&1"
_repodir=${WORKDIR}/repos
for _repo in ${REPOS[@]}; do
[[ ! -d ${WORKDIR}/staging/${_repo} ]] && {
- mkdir -p ${WORKDIR}/staging/${_repo} ${stdnull} || {
- echo "ERROR: Can't create ${WORKDIR}/staging/${_repo}"
+ stdnull "mkdir -p ${WORKDIR}/staging/${_repo}" || {
+ error "Can't create ${WORKDIR}/staging/${_repo}"
exit 1
}
}
for _arch in ${ARCHES[@]}; do
[[ ! -d ${_repodir}/${_repo}/${_arch} ]] && {
- mkdir -p ${_repodir}/${_repo}/${_arch} ${stdnull} || {
- echo "ERROR: Can't create ${_repodir}/${_repo}/${_arch}"
+ stdnull "mkdir -p ${_repodir}/${_repo}/${_arch}" || {
+ error "Can't create ${_repodir}/${_repo}/${_arch}"
exit 1
}
}
done
done
-echo "All done, your packaging dir tree looks like this now:"
+msg "Finished, your packaging dir tree looks like this now:"
ls --color=always ${WORKDIR}/*/*
exit 0
diff --git a/is_built b/is_built
index 9dc5d1c..968c771 100755
--- a/is_built
+++ b/is_built
@@ -1,7 +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
+stdnull "pacman -Qqi $1" || \
+stdnull "pacman -Sqi $1"
exit $?
diff --git a/librechroot b/librechroot
index 99adcc0..ec437de 100755
--- a/librechroot
+++ b/librechroot
@@ -21,12 +21,13 @@
# 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
+
[[ "$UID" != "0" ]] && {
- echo "This script must be run as root."
+ error "This script must be run as root."
exit 1
}
-source /etc/libretools.conf
custom_config=${XDG_CONFIG_HOME}/libretools/libretools.conf
[[ -e ${custom_config} ]] && source ${custom_config}
@@ -35,7 +36,7 @@ root=${1:-$CHCOPY}
CACHEDIR=${CACHEDIR:-/var/cache/pacman/pkg}
[[ ! -d ${CHROOTDIR}/${root} ]] && {
- echo "${CHROOTDIR}/$root is not a dir."
+ error "${CHROOTDIR}/$root is not a dir."
exit 1
}
diff --git a/librecommit b/librecommit
index 9fc3391..fc47d74 100755
--- a/librecommit
+++ b/librecommit
@@ -18,6 +18,12 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+usage () {
+ printf "$(gettext "cd to the dir with the PKGBUILD you are commiting and %s")" "$0"
+ echo
+ printf "$(gettext "This script commits the package using name, pkgver an pkgver")"
+}
+
if [ ! -e PKGBUILD ]; then exit 1; fi
source PKGBUILD
diff --git a/librediff b/librediff
index 9715c53..59a9791 100755
--- a/librediff
+++ b/librediff
@@ -45,12 +45,12 @@ fi
for package in $@; do
# Continue on errors
[[ ! -d ./${package} || ! -d ./${package}-libre ]] && {
- echo "Error: no matching ${package} and ${package}-libre found"
+ error "no matching ${package} and ${package}-libre found"
continue
}
[[ ! -f ./${package}/PKGBUILD || ! -f ./${package}-libre/PKGBUILD ]] && {
- echo "Error: no matching PKGBUILDs found for ${package}-libre"
+ error "no matching PKGBUILDs found for ${package}-libre"
continue
}
diff --git a/libremakepkg b/libremakepkg
index cf3f13f..78ebefb 100755
--- a/libremakepkg
+++ b/libremakepkg
@@ -18,24 +18,34 @@
# 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 [ $UID -ne 0 ]; then
- echo "This script must be run as root"
+ error "This script must be run as root"
exit 1
fi
-source /etc/libretools.conf
+msg "Checking PKGBUILD for non-free issues"
+pkgbuild-check-nonfree ||{
+ if [[$?=15]]; then
+ error "PKGBUILD contains non-free issues"
+ exit 15
+ else
+ error "Check failed, continuing"
+ fi
+}
[[ -z $1 ]] && {
CLEAN="-c"
- echo "Updating the main chroot"
+ msg "Updating the main chroot"
mount -o bind ${CACHEDIR} ${CHROOTDIR}/${CHROOT}/var/cache/pacman/pkg || exit 1
mkarchroot -u -- ${CHROOTDIR}/${CHROOT}
mount -o bind ${CACHEDIR} ${CHROOTDIR}/${CHCOPY}/var/cache/pacman/pkg || exit 1
}
-echo "Creating the package"
+msg "Creating the package"
makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${CHCOPY} -- $@
exit 0
diff --git a/libremessages b/libremessages
new file mode 100755
index 0000000..9fbbc2b
--- /dev/null
+++ b/libremessages
@@ -0,0 +1,77 @@
+# 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 tput setaf 0 &>/dev/null; then
+ ALL_OFF="$(tput sgr0)"
+ BOLD="$(tput bold)"
+ BLUE="${BOLD}$(tput setaf 4)"
+ GREEN="${BOLD}$(tput setaf 2)"
+ RED="${BOLD}$(tput setaf 1)"
+ YELLOW="${BOLD}$(tput setaf 3)"
+ PURPLE="${ALL_OFF}$(tput setaf 5)"
+else
+ ALL_OFF="\033[1;0m"
+ BOLD="\033[1;1m"
+ BLUE="${BOLD}\033[1;34m"
+ GREEN="${BOLD}\033[1;32m"
+ RED="${BOLD}\033[1;31m"
+ YELLOW="${BOLD}\033[1;33m"
+ PURPLE="${BOLD}\033[1;30;40m"
+fi
+
+stdnull() {
+ local action=$1;
+ eval "${action} >/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
+}
+
diff --git a/librerelease b/librerelease
index 900cad3..8160833 100755
--- a/librerelease
+++ b/librerelease
@@ -23,11 +23,16 @@
source /etc/libretools.conf
custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
+
+usage () {
+ printf "$(gettext "Usage: %s")" "$0"
+ echo
+ printf "$(gettext "This script")"
[[ -e $custom_config ]] && source $custom_config
[[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}"
-echo ":: Uploading packages..."
+msg "Uploading packages..."
rsync --recursive \
--copy-links \
--hard-links \
@@ -39,7 +44,7 @@ rsync --recursive \
${WORKDIR}/staging \
${PARABOLAHOST}:${LIBREDESTDIR}/ || exit 1
-echo ":: Removing packages from local [staging]"
+msg "Removing packages from local [staging]"
find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete
exit 0
diff --git a/librestage b/librestage
index 70aaa4a..f75d101 100755
--- a/librestage
+++ b/librestage
@@ -50,7 +50,7 @@ if [ ${#repos} -eq 0 ]; then
fi
[[ ! -e ./PKGBUILD ]] && {
- echo "PKGBUILD not found"
+ error "PKGBUILD not found"
exit 1
}
@@ -70,7 +70,7 @@ for _arch in ${arch[@]}; do
pkgpath="$PKGDEST/$pkgfile"
if [ -e "${pkgpath}" ]; then
- echo found ${pkgfile}
+ msg "Found ${pkgfile}"
canonical=""
for _repo in ${repos[@]}; do
@@ -78,17 +78,17 @@ for _arch in ${arch[@]}; do
[[ -z "$canonical" ]] && {
canonical="${WORKDIR}/staging/${_repo}/${pkgfile}"
cp "${pkgpath}" "${WORKDIR}/staging/${_repo}/" || {
- echo "Can't put ${pkgfile} on [staging]"
+ error "Can't put ${pkgfile} on [staging]"
exit 1
} && {
- echo "${pkg} staged on [${_repo}]"
+ msg2 "${pkg} staged on [${_repo}]"
}
} || {
ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || {
- echo "Can't put ${pkgfile} on [staging]"
+ error "Can't put ${pkgfile} on [staging]"
exit 1
} && {
- echo "${pkg} staged on [${_repo}]"
+ msg2 "${pkg} staged on [${_repo}]"
}
}
done
diff --git a/libretools.conf b/libretools.conf
index 8fe80a7..b2ff53c 100644
--- a/libretools.conf
+++ b/libretools.conf
@@ -64,3 +64,4 @@ for VAR in CHROOTDIR CHROOT CHCOPY CACHEDIR PARABOLAHOST LIBREDESTDIR \
}
done
+source libremessages \ No newline at end of file
diff --git a/mipsrelease b/mipsrelease
index 82cd51f..46c02ce 100755
--- a/mipsrelease
+++ b/mipsrelease
@@ -4,14 +4,26 @@
source /etc/makepkg.conf
source /etc/libretools.conf
+trap_not_uploaded () {
+
+}
+
+msg "Uploading packages"
for pkg in $@; do
- scp $pkg ${PARABOLAHOST}:mips64el/stage3/
+ msg2 "$pkg"
+ scp $pkg ${PARABOLAHOST}:mips64el/stage3/ ||{
+ error "Failed to upload ${pkg}"
+ plain "Try running this command again:"
+ echo
+ plain "$0 $@"
+ exit 1
+}
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 $@"
+scp ${SRCDEST}/stage3.db.tar.gz ${PARABOLAHOST}:mips64el/stage3/ || {
+ error "Could not update db"
+}
exit $?
diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree
index 418a0bf..6f3837b 100755
--- a/pkgbuild-check-nonfree
+++ b/pkgbuild-check-nonfree
@@ -30,14 +30,14 @@ 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"
+ error "BLACKLIST variable is not set your libretools.conf file"
exit 1
}
# Download the blacklist.
-echo "Downloading the blacklist of proprietary software packages."
+msg "Downloading the blacklist of proprietary software packages."
wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null || {
- echo "Download failed, exiting"
+ error "Download failed, exiting"
exit 1
}
@@ -55,9 +55,9 @@ source ./PKGBUILD
# The `pkgname', `depends', `makedepends' arrays have been sourced from
# ./PKGBUILD.
-echo "Looking for unfree dependencies"
+msg "Looking for unfree dependencies"
for where in pkgname depends makedepends ; do
- echo " Found in «${where}»:"
+ msg2 " Cheking in «${where}»:"
# We cycle through all of the programs in the array (if any), and check if
# they are in the `unfree' array.
@@ -65,9 +65,9 @@ for where in pkgname depends makedepends ; do
if in_array $item ${unfree[@]}
then
ev=15
- echo $item
+ plain $item
fi
done
done
-exit $ev
+exit $ev \ No newline at end of file
diff --git a/updateabslibre b/updateabslibre
index 74c42f1..76f964a 100755
--- a/updateabslibre
+++ b/updateabslibre
@@ -26,12 +26,14 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
[[ -e $custom_config ]] && source $custom_config
# Send every output to /dev/null
-stdnull=">/dev/null 2>&1"
-echo "Updating ABSLibre..."
+msg "Updating ABSLibre..."
pushd ${WORKDIR}/abslibre ${stdnull}
- git pull ${ABSLIBREGIT} || exit 1
-popd ${stdnull}
+ git pull ${ABSLIBREGIT} || {
+ error "Failed pull"
+ exit 1
+}
+stdnull "popd"
exit 0