summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-05-16 19:14:47 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-05-16 19:14:47 -0300
commitbf87a77517cb5d960865faaf820decaa338c4f63 (patch)
tree6c10ea4f2a80ae3d5df3ae08b40f6ad5c9195ed6
parent56e183631d6e4e12df4990d119456dd81423938e (diff)
parent76c75b8971e4ad2f6c336c9413088e6fd0e70f69 (diff)
Merge branch 'master' of ssh://vparabola/srv/git/projects/libretools
Conflicts: libremakepkg
-rwxr-xr-xaur72
-rwxr-xr-xcreateworkdir12
-rwxr-xr-xfullpkg11
-rwxr-xr-xlibrechroot39
-rwxr-xr-xlibremakepkg61
-rwxr-xr-xlibremessages3
-rwxr-xr-xlibrerelease56
-rwxr-xr-xlibrerepkg14
-rwxr-xr-xlibrestage28
-rw-r--r--libretools.conf31
-rwxr-xr-xmipsrelease22
-rwxr-xr-xpkgbuild-check-nonfree18
12 files changed, 265 insertions, 102 deletions
diff --git a/aur b/aur
new file mode 100755
index 0000000..b7ad018
--- /dev/null
+++ b/aur
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+source /etc/libretools.conf
+source /etc/abs.conf
+
+function usage {
+ echo "Usage: $0 pkgname-from-aur1 [pkgname-from-aur2 ...]"
+ echo
+ echo "This script will download packages from aur to the current dir"
+ echo "and check their license for nonfree issues."
+}
+
+while getopts 'h' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ *) usage; exit 1 ;;
+ esac
+done
+
+missing_deps=()
+for _pkg in ${@}; do
+ msg "Downloading $_pkg..."
+ wget -O - -q http://aur.archlinux.org/packages/$_pkg/$_pkg.tar.gz | \
+ tar xzf - >/dev/null 2>&1
+
+ [[ $? -ne 0 ]] && {
+ error "Couldn't get $_pkg"
+ continue
+ }
+
+ stdnull "pushd $_pkg"
+
+ source PKGBUILD
+
+ pkgbuild-check-nonfree || {
+ if [ $? -eq 15 ]; then
+ warning "This PKGBUILD links to known unfree packages"
+ fi
+ }
+
+ msg2 "Checking license..."
+ free=0
+ for _license in ${license[@]}; do
+ if [ ! -d /usr/share/licenses/common/$_license ]; then
+ warning "License $_license is not a common license"
+ free=1
+ fi
+ done
+
+ if [ $free -eq 1 ]; then
+ plain "Please check that the license is included in the package and
+ *specially* that it respects your freedom."
+ fi
+
+ for _dep in ${depends[@]} ${makedepends[@]}; do
+ if ! is_built $_dep; then
+ if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then
+ missing_deps=(${missing_deps} $_dep)
+ fi
+ fi
+ done
+
+ stdnull popd
+
+done
+
+[[ ${#missing_deps[*]} -gt 0 ]] && {
+ msg2 "Retrieving missing deps: ${missing_deps[@]}"
+ $0 ${missing_deps[@]}
+}
+
+exit 0
diff --git a/createworkdir b/createworkdir
index 8680215..a28d198 100755
--- a/createworkdir
+++ b/createworkdir
@@ -47,8 +47,7 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
}
-# Create the staging and repo dirs
-_repodir=${WORKDIR}/repos
+# Create the staging dirs
for _repo in ${REPOS[@]}; do
[[ ! -d ${WORKDIR}/staging/${_repo} ]] && {
stdnull "mkdir -p ${WORKDIR}/staging/${_repo}" || {
@@ -56,15 +55,6 @@ for _repo in ${REPOS[@]}; do
exit 1
}
}
-
- for _arch in ${ARCHES[@]}; do
- [[ ! -d ${_repodir}/${_repo}/${_arch} ]] && {
- stdnull "mkdir -p ${_repodir}/${_repo}/${_arch}" || {
- error "Can't create ${_repodir}/${_repo}/${_arch}"
- exit 1
- }
- }
- done
done
msg "Finished, your packaging dir tree looks like this now:"
diff --git a/fullpkg b/fullpkg
index 696e97f..c292bdd 100755
--- a/fullpkg
+++ b/fullpkg
@@ -108,7 +108,7 @@ repo=${1:-$(guess_repo)}
source PKGBUILD
msg "Building ${repo:-missing repo}/${pkgbase:-${pkgname[@]}}: $pkgdesc"
-is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}" && exit 0
+is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}" && exit 0
#sudo pacman -Sy
@@ -124,6 +124,11 @@ check_queue || exit 1
failed=()
missing=()
+if ! grep mips64el PKGBUILD >/dev/null; then
+ msg "Adding mips64el arch"
+ sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD"
+fi
+
# Gets the dependency list from the package_* functions
#pkgdeps=($(cat PKGBUILD | \
# tr -d "\n" | \
@@ -152,11 +157,11 @@ for _dep in ${deps[@]}; do
# TODO find split packages
[[ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]] && {
source "$ABSROOT/${_repo}/$_dep/PKGBUILD"
- msg2 "Checking for $_dep>=$pkgver"
+ msg2 "Checking for $_dep>=$pkgver-$pkgrel"
# If this version is built, continue with the next dep
- if is_built "$_dep>=$pkgver"; then
+ if is_built "$_dep>=$pkgver-$pkgrel"; then
msg2 "No need to build this one"
break
fi
diff --git a/librechroot b/librechroot
index ec437de..b308b7d 100755
--- a/librechroot
+++ b/librechroot
@@ -23,6 +23,19 @@
source /etc/libretools.conf
+function usage {
+ echo "Usage: $0 chrootname"
+ echo "Change to a chroot in $CHROOTDIR. Use it as root."
+ echo
+ echo "Default chroot name: $CHCOPY"
+}
+
+while getopts 'h' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ esac
+done
+
[[ "$UID" != "0" ]] && {
error "This script must be run as root."
exit 1
@@ -32,28 +45,28 @@ custom_config=${XDG_CONFIG_HOME}/libretools/libretools.conf
[[ -e ${custom_config} ]] && source ${custom_config}
# Enter the chroot copy by default
-root=${1:-$CHCOPY}
+chrootname=${1:-$CHCOPY}
CACHEDIR=${CACHEDIR:-/var/cache/pacman/pkg}
-[[ ! -d ${CHROOTDIR}/${root} ]] && {
- error "${CHROOTDIR}/$root is not a dir."
+[[ ! -d ${CHROOTDIR}/${chrootname} ]] && {
+ error "${CHROOTDIR}/${chrootname} is not a dir."
exit 1
}
-mount -t proc proc ${CHROOTDIR}/${root}/proc/
-mount -t sysfs sys ${CHROOTDIR}/${root}/sys/
-mount -o bind /dev ${CHROOTDIR}/${root}/dev/
+mount -t proc proc ${CHROOTDIR}/${chrootname}/proc/
+mount -t sysfs sys ${CHROOTDIR}/${chrootname}/sys/
+mount -o bind /dev ${CHROOTDIR}/${chrootname}/dev/
# Share pacman cache
-mount -o bind ${CACHEDIR} ${CHROOTDIR}/${root}/var/cache/pacman/pkg
+mount -o bind ${CACHEDIR} ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg
-cp -L /etc/resolv.conf ${CHROOTDIR}/${root}/etc/resolv.conf
+cp -L /etc/resolv.conf ${CHROOTDIR}/${chrootname}/etc/resolv.conf
-chroot ${CHROOTDIR}/${root} /bin/bash
+chroot ${CHROOTDIR}/${chrootname} /bin/bash
-umount ${CHROOTDIR}/${root}/proc/
-umount ${CHROOTDIR}/${root}/sys/
-umount ${CHROOTDIR}/${root}/dev/
-umount ${CHROOTDIR}/${root}/var/cache/pacman/pkg
+umount ${CHROOTDIR}/${chrootname}/proc/
+umount ${CHROOTDIR}/${chrootname}/sys/
+umount ${CHROOTDIR}/${chrootname}/dev/
+umount ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg
exit 0
diff --git a/libremakepkg b/libremakepkg
index af0b7a9..54a5578 100755
--- a/libremakepkg
+++ b/libremakepkg
@@ -1,5 +1,6 @@
#!/bin/bash
-# Copyright 2010 Nicolás Reynolds
+# Copyright 2010 - 2011 Nicolás Reynolds
+# Copyright 2011 Joshua Ismael Haase Hernández
# ---------- GNU General Public License 3 ----------
@@ -20,31 +21,63 @@
source /etc/libretools.conf
+function usage {
+ 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 " -h : show this message."
+ echo " -c : cleans CHCOPY and cachedir."
+ echo " -u : updates before building."
+ echo " -n : use this dir instead of CHCOPY."
+ echo " -I pkgname : install this package, use it as many times needed."
+ echo
+}
+
+_CLEAN=""
+CLEAN_CACHE=""
+update_first="n"
+chrootname=${CHCOPY}
+_PKGINSTALL=""
+#libremakepkg own args
+libremakepkgargs='hcun:I:'
+#now makepkg args
+libremakepkgargs+='ACdefiLmoprRs'
+
+while getopts ${libremakepkgargs} arg ; do
+ case "${arg}" in
+ h) usage; exit 0 ;;
+ c) _CLEAN="-c" ;;
+ u) update_first="y" ;;
+ n) chrootname="$OPTARG"; echo $chrootname ;;
+ I) _PKGINSTALL+="-I $OPTARG " ;;
+ *) _MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
+ esac
+done
+
if [ $UID -ne 0 ]; then
error "This script must be run as root"
exit 1
fi
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"
+pkgbuild-check-nonfree ||{
+ if [[ $? -eq 15 ]]; then
+ error "PKGBUILD contains non-free issues"
+ exit 15
fi
}
-[[ -z $1 ]] && {
- CLEAN="-c"
-
+if [ $update_first = y ]; then
msg "Updating the main chroot"
- mkarchroot -c ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT}
+ # -c option in mkarchroot indicates cache
+ mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOT}"
+fi
- mount -o bind ${CACHEDIR} ${CHROOTDIR}/${CHCOPY}/var/cache/pacman/pkg || exit 1
-}
msg "Creating the package"
-makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${CHCOPY} -- $@
+makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL -- $_MAKEPKG_ARGS
exit 0
diff --git a/libremessages b/libremessages
index 9fbbc2b..c297f2d 100755
--- a/libremessages
+++ b/libremessages
@@ -46,8 +46,7 @@ else
fi
stdnull() {
- local action=$1;
- eval "${action} >/dev/null 2>&1"
+ eval "$@ >/dev/null 2>&1"
}
plain() {
diff --git a/librerelease b/librerelease
index 39d3e2d..1505098 100755
--- a/librerelease
+++ b/librerelease
@@ -24,29 +24,59 @@
source /etc/libretools.conf
custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
-usage () {
- printf "$(gettext "Usage: %s")" "$0"
+function usage {
+ echo "$(gettext "Usage: $0")"
echo
- printf "$(gettext "This script")"
+ echo "$(gettext "This script uploads packages on $WORKDIR/stagging")"
+ echo "$(gettext "to parabola server.")"
+ echo
+ echo "$(gettext "OPTIONS:")"
+ echo "$(gettext " -h this message.")"
+ echo "$(gettext " -l only list packages but not upload them.")"
+ echo "$(gettext " -c clean packages on $WORKDIR/staging.")"
+}
+
+function list_packages {
+ find $WORKDIR/staging/ -type f -printf "%f\n"
+}
+
+function clean_non_packages {
+ find $WORKDIR/staging/ -type -f \! -iname "*.pkg.tar.*" -delete
}
+function clean_packages {
+ find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete
+}
+
+while getopts 'hlc' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ l) list_packages; exit 0 ;;
+ c) clean_packages; exit $? ;;
+ esac
+done
+
[[ -e $custom_config ]] && source $custom_config
[[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}"
+clean_non_packages
msg "Uploading packages..."
rsync --recursive \
- --copy-links \
- --hard-links \
- --partial \
- --prune-empty-dirs \
- --human-readable \
- --progress \
- -e "ssh " \
- ${WORKDIR}/staging \
- ${PARABOLAHOST}:${LIBREDESTDIR}/ || exit 1
+ --copy-links \
+ --hard-links \
+ --partial \
+ --prune-empty-dirs \
+ --human-readable \
+ --progress \
+ -e "ssh " \
+ ${WORKDIR}/staging \
+ ${PARABOLAHOST}:${LIBREDESTDIR}/ || {
+ error "Sync failed, try again"
+ exit 1
+}
msg "Removing packages from local [staging]"
-find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete
+clean_packages
exit 0
diff --git a/librerepkg b/librerepkg
index 22c237d..79a3e1d 100755
--- a/librerepkg
+++ b/librerepkg
@@ -36,9 +36,17 @@ source rePKGBUILD
usage() {
echo "cd to a dir with a rePKGBUILD and other file info and run"
- echo $0
+ echo "$0 "
+ echo
+ echo "This script will repackage an arch package without compiling"
}
+while getopts 'h' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ esac
+done
+
stdnull "tempdir=$(mktemp -d /tmp/$(basename $PWD).XXXXX)"
msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))"
@@ -48,5 +56,5 @@ mv rePKGBUILD PKGBUILD
msg2 "Updating md5sums"
makepkg -g >> PKGBUILD
msg "Repackaging using libremakepkg"
-sudo libremakepkg
-
+sudo libremakepkg -cu -L
+stdnull "popd ${tempdir}"
diff --git a/librestage b/librestage
index 6d7b45e..e51975b 100755
--- a/librestage
+++ b/librestage
@@ -44,6 +44,12 @@ EOU
repos=$@
+while getopts 'h' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ esac
+done
+
if [ ${#repos} -eq 0 ]; then
usage
exit 1;
@@ -55,20 +61,27 @@ fi
}
# Source the needed files
-source ./PKGBUILD
-[[ -e ./rePKGBUILD ]] && source ./rePKGBUILD
source /etc/makepkg.conf
[[ -e ~/.makepkg.conf ]] && source ~/.makepkg.conf
+source ./PKGBUILD
+[[ -e ./rePKGBUILD ]] && source ./rePKGBUILD
# Default package location
PKGDEST=${PKGDEST:-.}
SRCPKGDEST=${SRCPKGDEST:-.}
+PKGEXT=".pkg.tar.?z"
+
+staged='n'
# Copies the packages to the specified repos inside staging
for _arch in ${arch[@]}; do
for pkg in ${pkgname[@]}; do
- pkgfile="$pkg-$pkgver-$pkgrel-$_arch$PKGEXT"
- pkgpath="$PKGDEST/$pkgfile"
+
+ pkgpath=$(find ${PKGDEST}/ -type f -name "${pkg}-${pkgver}-${pkgrel}-${_arch}${PKGEXT}")
+
+ [[ -z ${pkgpath} ]] && continue;
+
+ pkgfile=$(basename ${pkgpath})
if [ -e "${pkgpath}" ]; then
msg "Found ${pkgfile}"
@@ -83,6 +96,7 @@ for _arch in ${arch[@]}; do
exit 1
} && {
msg2 "${pkg} staged on [${_repo}]"
+ staged='y'
}
} || {
ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || {
@@ -90,6 +104,7 @@ for _arch in ${arch[@]}; do
exit 1
} && {
msg2 "${pkg} staged on [${_repo}]"
+ staged='y'
}
}
done
@@ -97,4 +112,9 @@ for _arch in ${arch[@]}; do
done
done
+if [ $staged = 'n' ]; then
+ error "No package was staged"
+ exit 1
+fi
+
exit 0
diff --git a/libretools.conf b/libretools.conf
index 2485be3..8a7769f 100644
--- a/libretools.conf
+++ b/libretools.conf
@@ -13,7 +13,7 @@ WORKDIR=/home/$USER/packages
REPOS=('libre' 'libre-testing' 'core' 'community' 'extra' 'social' 'sugar')
# The architectures
-ARCHES=('i686' 'x86_64' 'mips64el')
+ARCHES=('i686' 'x86_64' 'mips64el' 'any')
## The directory where the chroots are stored
CHROOTDIR=/home/chroot
@@ -50,7 +50,20 @@ ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git/
#COMMITCMD=git
#COMMITCMD=hg
-# Recommended SSH Config
+# Checks if vars aren't empty
+#
+for VAR in CHROOTDIR CHROOT CHCOPY CACHEDIR PARABOLAHOST LIBREDESTDIR \
+ LIBRESRCDIR BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT COMMITCMD DIFFTOOL; do
+
+ [[ -z ${!VAR} ]] && {
+ echo "Configure $VAR var in /etc/libretools.conf"
+ exit 1
+ }
+done
+
+source /usr/bin/libremessages
+
+## Recommended SSH Config follows
# SSH host, it's better if you have it configured on ~/.ssh/config
# with ControlMaster auto (and a shell opened somewhere else)
#
@@ -73,17 +86,3 @@ ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git/
# HostName parabolagnulinux.org
# User parabola
# IdentityFile ~/.ssh/id_rsa
-
-
-# Checks if vars aren't empty
-#
-for VAR in CHROOTDIR CHROOT CHCOPY CACHEDIR PARABOLAHOST LIBREDESTDIR \
- LIBRESRCDIR BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT COMMITCMD DIFFTOOL; do
-
- [[ -z ${!VAR} ]] && {
- echo "Configure $VAR var in /etc/libretools.conf"
- exit 1
- }
-done
-
-source /usr/bin/libremessages
diff --git a/mipsrelease b/mipsrelease
index 07d27ec..97e12d2 100755
--- a/mipsrelease
+++ b/mipsrelease
@@ -2,25 +2,11 @@
# Temporary script for uploading mips64el packages to the server
source /etc/makepkg.conf
-source /etc/libretools.conf
-msg "Uploading packages"
-for pkg in $@; do
- msg2 "$pkg"
- scp $pkg ${PARABOLAHOST}:mips64el/stage3/ ||{
- error "Failed to upload ${pkg}"
- plain "Try running this command again:"
- echo
- plain "$0 $@"
- exit 1
- }
-done
+pushd ${PKGDEST} >/dev/null
-msg "Updating db"
-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/ || {
- error "Could not update db"
-}
+repo-add stage3.db.tar.gz $@
+
+popd >/dev/null
exit $?
diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree
index c55e7f6..7f04787 100755
--- a/pkgbuild-check-nonfree
+++ b/pkgbuild-check-nonfree
@@ -23,7 +23,7 @@ source /etc/libretools.conf
[[ -f $XDG_CONFIG_HOME/libretools/libretools.conf ]] && \
source $XDG_CONFIG_HOME/libretools/libretools.conf
-pushd /tmp >/dev/null
+pushd $(mktemp -d) >/dev/null
# This is the exit status.
ev=0
@@ -44,6 +44,7 @@ wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null || {
# Get everything before the `:' in the blacklist (that's the names of the
# packages).
unfree=($(cut -d: -f1 blacklist.txt))
+freerep=($(cut -d: -f2 blacklist.txt))
popd >/dev/null
@@ -59,10 +60,17 @@ msg "Looking for unfree dependencies"
for item in ${pkgname[@]} ${depends[@]} ${makedepends[@]} ; do
# We cycle through all of the programs in the array (if any), and check if
# they are in the `unfree' array.
- if in_array $item ${unfree[@]}
- then
- ev=15
- msg2 "found $item"
+ if in_array $item ${unfree[@]} ; then
+ # if item has a free replacement, use error 16.
+ if in_array $item-libre ${freerep[@]} ; then
+ warning "$item -> $item-libre"
+ if [[ $ev -ne 15 ]]; then
+ ev=16
+ fi
+ else
+ ev=15
+ msg2 "found $item"
+ fi
fi
done