From 8fd5887191e11e0ee64272991a8c5fc6c7636524 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Sat, 30 Apr 2011 05:53:38 -0500 Subject: * libremakepkg optionaly uses a chroot different from $CHCOPY * libremakepkg cleaning and mkarchroot update is optional * librerepkg uses -cu flags for libremakepkg --- librerepkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'librerepkg') diff --git a/librerepkg b/librerepkg index 22c237d..08451bd 100755 --- a/librerepkg +++ b/librerepkg @@ -48,5 +48,5 @@ mv rePKGBUILD PKGBUILD msg2 "Updating md5sums" makepkg -g >> PKGBUILD msg "Repackaging using libremakepkg" -sudo libremakepkg +sudo libremakepkg -cu -- cgit v1.2.3-54-g00ecf From d7e07174e2dae3d1bd9ec79c90cba9912f2cef0f Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Tue, 10 May 2011 17:00:22 -0500 Subject: * Clean cache option for libremakepkg --- libremakepkg | 12 ++++++------ librerepkg | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'librerepkg') diff --git a/libremakepkg b/libremakepkg index 6b996dc..ef276f3 100755 --- a/libremakepkg +++ b/libremakepkg @@ -39,13 +39,15 @@ usage() { } CLEAN="" +CLEAN_CACHE="" update_first=0 chrootname=${CHCOPY} -while getopts 'hcun' arg; do +while getopts 'hcCun' arg; do case "${arg}" in h) usage ;; c) CLEAN="-c" ;; + C) CLEAN_CACHE="-C" u) update_first=1 ;; n) chrootname="$OPTARG" ;; *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; @@ -62,17 +64,15 @@ pkgbuild-check-nonfree ||{ fi } -mount -o bind ${CACHEDIR} \ - ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg || exit 1 - if [ $update_first -eq 1 ]; then msg "Updating the main chroot" - mkarchroot $CLEAN ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} + # -c option in mkarchroot indicates cache + mkarchroot -c ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} fi msg "Creating the package" -makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${chrootname} -- $MAKEPKG_ARGS +makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${chrootname} -- $CLEAN_CACHE $MAKEPKG_ARGS umount ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg diff --git a/librerepkg b/librerepkg index 08451bd..0a38e00 100755 --- a/librerepkg +++ b/librerepkg @@ -48,5 +48,5 @@ mv rePKGBUILD PKGBUILD msg2 "Updating md5sums" makepkg -g >> PKGBUILD msg "Repackaging using libremakepkg" -sudo libremakepkg -cu - +sudo libremakepkg -cu -L +stdnull "popd ${tempdir}" -- cgit v1.2.3-54-g00ecf From 7f118f53283d7e228c40a40076815ce94ebb94a7 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Mon, 16 May 2011 00:44:39 -0500 Subject: Cleaned up some things, added option parse to some scripts. --- aur | 14 ++++++++++++++ createworkdir | 12 +----------- librechroot | 39 ++++++++++++++++++++++++++------------- libremakepkg | 40 ++++++++++++++++++++++------------------ librerelease | 56 +++++++++++++++++++++++++++++++++++++++++++------------- librerepkg | 10 +++++++++- 6 files changed, 115 insertions(+), 56 deletions(-) (limited to 'librerepkg') diff --git a/aur b/aur index 44ac650..b7ad018 100755 --- a/aur +++ b/aur @@ -3,6 +3,20 @@ 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..." 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/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 f2b523d..272e61d 100755 --- a/libremakepkg +++ b/libremakepkg @@ -21,47 +21,50 @@ source /etc/libretools.conf -if [ $UID -ne 0 ]; then - error "This script must be run as root" - exit 1 -fi - -usage() { +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 chrootname : use this dir instead of CHCOPY" + 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="" CLEAN_CACHE="" update_first="n" chrootname=${CHCOPY} - -while getopts 'hcun:' arg; do +_PKGINSTALL="" +while getopts 'hcun:I:' arg; do case "${arg}" in h) usage; exit 0 ;; - c) CLEAN="-c" ;; + c) _CLEAN="-c" ;; u) update_first="y" ;; n) chrootname="$OPTARG"; echo $chrootname ;; - *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; + 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 [[ $? -eq 15 ]]; then error "PKGBUILD contains non-free issues" exit 15 - exit $? fi - } + if [ $update_first = y ]; then msg "Updating the main chroot" # -c option in mkarchroot indicates cache @@ -70,6 +73,7 @@ fi msg "Creating the package" -makechrootpkg $CLEAN -r ${CHROOTDIR} -l "${chrootname}" -- $MAKEPKG_ARGS +makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL \ + -- $_MAKEPKG_ARGS exit 0 diff --git a/librerelease b/librerelease index 39d3e2d..2359de8 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 $WORKDIR/staging.")" +} + +function list_packages { + find $WORKDIR/staging/ -type f -print0 +} + +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 'hl' 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 0a38e00..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))" -- cgit v1.2.3-54-g00ecf