summaryrefslogtreecommitdiff
path: root/libremakepkg
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-06-27 21:02:28 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-06-27 21:02:28 -0300
commit8dff8b1deac0bd4a832e1dee0173e79c55ab4301 (patch)
treebce94c911af93e9a857be4c2c68db845b694a1bb /libremakepkg
parent1a60b54ff583a39e1069dcd527c347f23bbc2b5a (diff)
parentf303abe1eb26dd9037824889dc3c02df74ed9fc2 (diff)
Merge branch 'master' of ssh://vparabola/srv/git/projects/libretools
Conflicts: libremakepkg
Diffstat (limited to 'libremakepkg')
-rwxr-xr-xlibremakepkg84
1 files changed, 42 insertions, 42 deletions
diff --git a/libremakepkg b/libremakepkg
index 18e1c22..b2f8aa8 100755
--- a/libremakepkg
+++ b/libremakepkg
@@ -3,32 +3,32 @@
# 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/>.
+
+# 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/makepkg.conf
function usage {
- echo 'cd to a dir containing a PKGBUILD and run:'
+ echo 'cd to a dir containing a PKGBUILD and run:'
echo '$0 [options] [makepkg args]'
echo 'This script will build your package on a chroot.'
echo
echo 'OPTIONS:'
- echo
+ echo
echo ' -h show this message.'
echo ' -c cleans the chroot before building.'
echo ' -u updates the chroot before building.'
@@ -45,8 +45,8 @@ function buildenv {
mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}"
mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1
done
-
- if [ "$update_config" = 'y']; then
+
+ if [ "$update_config" = 'y' ] ; then
for config in etc/makepkg.conf etc/pacman.conf etc/mtab; do
msg2 "copying config /$config to ${CHROOTDIR}/${CHCOPY}/${config}"
cp --remove-destination /${config} ${CHROOTDIR}/${CHCOPY}/${config} || exit 1
@@ -78,19 +78,19 @@ done
EOF
) > "${CHROOTDIR}/${CHROOTNAME}/clean"
chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean"
- mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}"
-}
+ mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}"
+}
# End inmediately but print a useful message
trap_exit() {
-
- for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do
- umount "${CHROOTDIR}/${CHCOPY}${mp}"
- done
- error "$@"
+ for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST} ${WORKDIR}; do
+ umount "${CHROOTDIR}/${CHCOPY}${mp}"
+ done
- exit 1
+ error "$@"
+
+ exit 1
}
## Trap signals
@@ -115,15 +115,15 @@ libremakepkgargs+='ACdefiLmop:rRs'
while getopts ${libremakepkgargs} arg ; do
case "${arg}" in
- h) usage; exit 0 ;;
- c) CLEAN_FIRST="y" ;;
- u) UPDATE_FIRST="y" ;;
- U) update_config='y' ;;
- n) CHROOTNAME="$OPTARG" ;;
- M) MAKEPKG_ARGS+=" $OPTARG" ;;
- L) MAKEPKG_ARGS+=" -$arg $OPTARG"
- USE_LOG='y';;
- *) MAKEPKG_ARGS+=" -$arg $OPTARG" ;;
+ h) usage; exit 0 ;;
+ c) CLEAN_FIRST="y" ;;
+ u) UPDATE_FIRST="y" ;;
+ U) update_config='y' ;;
+ n) CHROOTNAME="$OPTARG" ;;
+ M) MAKEPKG_ARGS+=" $OPTARG" ;;
+ L) MAKEPKG_ARGS+=" -$arg $OPTARG"
+ USE_LOG='y';;
+ *) MAKEPKG_ARGS+=" -$arg $OPTARG" ;;
esac
done
@@ -135,8 +135,8 @@ fi
msg "Checking PKGBUILD for non-free issues"
pkgbuild-check-nonfree ||{
if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree
- error "PKGBUILD contains non-free issues"
- exit 15
+ error "PKGBUILD contains non-free issues"
+ exit 15
else
true
fi
@@ -144,13 +144,13 @@ pkgbuild-check-nonfree ||{
buildenv
-if [ "${UPDATE_FIRST}" = y ]; then
+if [ "${UPDATE_FIRST}" = 'y' ]; then
msg "Updating the chroot in use..."
# -c option in mkarchroot indicates cache
mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOTNAME}"
fi
-if [ "${CLEAN_FIRST}" = y ]; then
+if [ "${CLEAN_FIRST}" = 'y' ]; then
msg "Cleaning"
clean_chroot
fi
@@ -159,8 +159,8 @@ msg "Creating the package"
makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS}"
ev=$? # exit value
-[ "${USE_LOG}" == 'y' -a -e ${CHROOTDIR}/${CHROOTNAME}/build/*.log ] && {
- cp ${CHROOTDIR}/${chrootname}/build/*.log ./
+if [ "${USE_LOG}" == 'y' ]; then
+ find ${CHROOTDIR}/${CHROOTNAME}/build/ -name "*\.log" -exec cp {} ./ \;
}
exit $ev