From 0097ea36511596b3de1947a2069d708079887058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 27 Jun 2011 00:16:33 -0500 Subject: "first working prtools + fixes" --- createworkdir | 4 +- fullpkg | 21 ++- prfullpkg | 403 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ prmipsrelease | 100 +++++++++++++++ prtools.conf | 4 + 5 files changed, 517 insertions(+), 15 deletions(-) create mode 100755 prfullpkg create mode 100755 prmipsrelease create mode 100644 prtools.conf diff --git a/createworkdir b/createworkdir index a28d198..53298f6 100755 --- a/createworkdir +++ b/createworkdir @@ -28,7 +28,7 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf # Create the WORKDIR [[ ! -d ${WORKDIR} ]] && { msg "Creating WORKDIR on ${WORKDIR}" - stdnull "mkdir -p ${WORKDIR}" ||{ + mkdir -p ${WORKDIR} ||{ error "Could not create ${WORKDIR}" exit 1 } @@ -50,7 +50,7 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf # Create the staging dirs for _repo in ${REPOS[@]}; do [[ ! -d ${WORKDIR}/staging/${_repo} ]] && { - stdnull "mkdir -p ${WORKDIR}/staging/${_repo}" || { + mkdir -p ${WORKDIR}/staging/${_repo} || { error "Can't create ${WORKDIR}/staging/${_repo}" exit 1 } diff --git a/fullpkg b/fullpkg index c25ed85..7a08112 100755 --- a/fullpkg +++ b/fullpkg @@ -11,7 +11,7 @@ if [ -z $XDG_CONFIG_HOME ]; then error "There's no XDG_CONFIG_HOME var set" exit 1 fi -# set and ban_file +# set ban_file [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ source $XDG_CONFIG_HOME/libretools/libretools.conf ban_file=$XDG_CONFIG_HOME/libretools/ban @@ -35,6 +35,7 @@ function usage { echo " -m max_level : check deps until this level" echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"" echo + exit 1 } ## Build order management ## @@ -89,7 +90,6 @@ function find_deps { local fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) # If package and correct ${fullver} is built exit -# TODO?: If this package is in force_build: skip this step if is_built "${pkgbase}>=${fullver}"; then exit 0 fi @@ -121,9 +121,6 @@ function find_deps { # Increase build level declare -i next_level=$level+1 -# Pass the offline flag to children - [[ "$OFFLINE" -eq true ]] - for _dep in ${deps[@]}; do for _repo in ${REPOS[@]}; do # try to find $_dep on each repo from dirname @@ -136,10 +133,11 @@ function find_deps { [ $? -eq 20 ] && return 20 popd > /dev/null break 1 # found, go to next dep - + done # if search pkgname in repo doesn't work # this should find pkgsplits - elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \ + for _repo in ${REPOS[@]}; do + if _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \ "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | grep -w "$_dep" 2>&1)); then _dir=$(dirname $(echo $_dir | cut -d: -f1)) @@ -150,7 +148,6 @@ function find_deps { [ $? -eq 20 ] && return 20 popd > /dev/null break 1 # found, go to next dep - else echo "dep_not_found:$_dep:$_repo" >> $build_dir/log fi @@ -278,15 +275,14 @@ check_deps_only='n' do_cleanup='n' max_level=21 OFFLINE=false -while getopts 'ha:b:cCd:l:nm:r:o' arg; do +while getopts 'ha:b:cCd:l:nm:r:' arg; do case $arg in - h) usage; exit 0 ;; + h) usage ;; a) ABSROOT="$OPTARG" ;; b) build_only='y' build_dir="$OPTARG" [ -z ${build_dir} ] && { usage - exit 1 } [ ! -r ${build_dir}/BUILDORDER ] && { error "${build_dir}/BUILDORDER doesn't exist." @@ -301,7 +297,6 @@ while getopts 'ha:b:cCd:l:nm:r:o' arg; do n) noupdate='y';; m) max_level=$OPTARG ;; r) FULLBUILDCMD="$OPTARG" ;; - o) OFFLINE=true ;; esac done @@ -312,7 +307,7 @@ if [ ${build_only} == 'n' ]; then [ ! -r PKGBUILD ] && { error "This isn't a build directory" - usage && exit 1 + usage } # Add mips64el if missing from arch=() and it isn't an 'any' package diff --git a/prfullpkg b/prfullpkg new file mode 100755 index 0000000..458eefa --- /dev/null +++ b/prfullpkg @@ -0,0 +1,403 @@ +#!/bin/bash +# TO TEST: (on find_deps) +# * Detect pkgnames by provides, replaces, etc. instead of dir tree + +source /etc/makepkg.conf +source /etc/abs.conf +source /etc/libretools.conf +source /etc/libretools.d/prtools.conf + +# Avoid /libretools dir doesn't exist errors +if [ -z $XDG_CONFIG_HOME ]; then + error "There's no XDG_CONFIG_HOME var set" + exit 1 +fi +# set ban_file +[ -e $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ + source $XDG_CONFIG_HOME/libretools/libretools.conf +ban_file=$XDG_CONFIG_HOME/libretools/ban + + +##### START FUNCTIONS ##### + +function usage { + echo "cd to a dir containing a PKGBUILD and run:" + echo "$0 [options]" + printf "This script will check dependencies, build them if possible " + printf "and stage the packages on it's repo." + echo + echo "OPTIONS:" + echo " -h : this message." + echo " -a absdir : set absdir as ABSROOT." + echo " -b build_dir : use a fullpkg build_dir and only build." + echo " -c : check deps only, do not build." + echo " -d build_dir : use this dir to build. Defaults to mktemp." + echo " -n : don't update pacman db." + echo " -m max_level : check deps until this level" + echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"" +# echo " -t : build from testing" + echo + exit 1 +} + + +## Build order management ## + +# Removes a package from the buildorder +# $1 package name +# $2 buildorder file +remove_buildorder() { + grep -Evw "${1}" ${2} > ${2}2 + mv -f ${2}2 ${2} +} + +# Guesses the repo name according to the parent dir of the current package +# assuming the form ${ABSROOT}/package/repo/PKGBUILD +guess_repo() { + basename $(pwd) +} + +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + +# Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir +# cleans the build_dir +function cleanup { +# Do nothing OR +# Already cleaned + [[ "${do_cleanup}" = "n" || ! -d ${build_dir} ]] && return 0 + +# Only do cleanup on level 0 + msg "Cleaning up..." + [ $level -eq 0 ] && rm -rf $build_dir/* +} + +# Check PKGBUILD and find non built or outdated deps +# on ABSROOT which should be abslibre-misp64el +function find_deps { + ## Check this level. + source PKGBUILD + local repo=${repo:-$(guess_repo)} + local pkgbase=${pkgbase:-${pkgname[0]}} + local epoch=${epoch:-0} + local fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) + +# If package and correct ${fullver} is built exit + if is_built "${pkgbase}>=${fullver}"; then + exit 0 + fi + +# Tell which packages are deeper in deps (even if they are on build_dir) +# so we can build them first. + echo "${level}:${pkgbase}" >> "${build_dir}/BUILDORDER" + +# if pkgbuild directory is on build_dir, do not copy and exit + if [ -d "${build_dir}/${pkgbase}" ]; then + exit 0 + else +# Copy dir to build_dir + mkdir ${build_dir}/${pkgbase} + cp -r $(pwd)/* ${build_dir}/${pkgbase} +# Info to eval later + echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO" + fi + +# Inform the current package plus a space for every level for indent + msg2 "%${level}s${pkgbase}-${fullver}" + +## Check next levels +# Clean version checking + deps=$(echo "${depends[@]} ${makedepends[@]}" | \ + sed "s/[=<>]\+[^ ]\+//g" | \ + tr ' ' "\n" | \ + sort -u) + + # Increase build level + declare -i next_level=$level+1 + + for _dep in ${deps[@]}; do + if [ -d "${ABSROOT}/${_dep}" ]; then + # search in REPOS array order + for _repo in ${REPOS[@]}; do + if [ -e "${ABSROOT}/${_dep}/${_repo}/PKGBUILD" ]; then + + pushd "${ABSROOT}/${_dep}/${_repo}" > /dev/null + $0 -c -d ${build_dir} -l ${next_level} + [ $? -eq 20 ] && return 20 # probable circular deps + popd > /dev/null + break 1 # found, go to next dep + + fi + done + + else # pkgsplit, needs guess + + for _repo in ${REPOS[@]}; do + if _dir=($(find "$ABSROOT/" -type f \ + -wholename "*/${_repo}/PKGBUILD" -print0 2>/dev/null | \ + "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | \ + grep -w "$_dep" 2>&1)) ; + then + + _dir=$(dirname $(echo $_dir | cut -d: -f1)) + plain "guess for $_dep -> $_dir" + + pushd "$_dir" > /dev/null + $0 -c -d ${build_dir} -l ${next_level} + [ $? -eq 20 ] && return 20 # probable circular dep + popd > /dev/null + break 1 # found, go to next dep + fi + done + fi + done + + unset next_level dir + # unset PKGBUILD variables + unset pkgname pkgver pkgrel epoch pkgdesc arch url license groups depends \ + makedepens checkdepends optdepends provides conflicts replaces backup \ + options install changelog source noextract md5sums build check package +} + +function _pkg_build () { + pushd ${build_dir} > /dev/null + # packages to build are on $buildorder + # greater levels must be built first + build_packages=($(sort -gr $buildorder | cut -d: -f2)) + + while [ ${#build_packages[@]} -ge 1 ]; do + pushd $build_dir/${build_packages[0]} > /dev/null + source PKGBUILD + + msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" + + msg2 "Checking for non free deps" + pkgbuild-check-nonfree || { + if [ $? -eq 15 ]; then # this error means nonfree others means fail. +# log they have nonfree deps and so didn't build + echo "nonfree:$(basename $PWD)" >> $build_dir/log +# take out package from $buildorder + remove_buildorder "$(basename $PWD)" $buildorder +# continue building next package + continue + fi + } + + msg2 "Building $(basename $PWD)" +# this buildcmd is on libretools.conf + $FULLBUILDCMD; r=$? + case $r in +###### Succesfull Build ###### + 0) + plain "The build was succesful." + source .INFO && [ -n $repo ] && { + +# Calls a local release script if it's used + [ -z $HOOKLOCALRELEASE ] || \ + find -name "*.pkg.tar.?z" -print0 | \ + xargs -0 $HOOKLOCALRELEASE $repo + +# Stage for releasing + librestage $repo || { + echo "unstaged:$(basename $PWD)" >> $build_dir/log + } + + msg "Updating pacman db and packages" + sudo pacman -Sy || true + } + + echo "built:$(basename $PWD)" >> $build_dir/log + ;; +###### Failed Build ###### + *) + error "There were errors while trying to build the package." + echo "failed:$(basename $PWD)" >> $build_dir/log + ;; + esac + +# Package was built or failed: take it out of $buildorder + remove_buildorder "${build_packages[0]}" $buildorder || true + +# Set build_packages before next cycle run + build_packages=($(sort -gr $buildorder | cut -d: -f2)) + popd > /dev/null + done + + pkgs=($(grep "nonfree:" $build_dir/log)) && { + error "Those packages contain nonfree deps:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + pkgs=($(grep "built:" $build_dir/log)) && { + msg "Those packages were built and staged:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + pkgs=($(grep "failed:" $build_dir/log)) && { + error "Those packages failed to build:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + pkgs=($(grep "unstaged:" $build_dir/log)) && { + error "Those packages couldn't be staged because of missing reponame:" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } + + popd > /dev/null +} + +# End inmediately but print a useful message +trap_exit() { + + error "$@" + warning "Leftover files left on $build_dir" + + exit 1 +} + +## END FUNCTIONS ## + +## Trap signals +# From makepkg +set -E +trap 'cleanup' 0 +trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "Aborted by user! Exiting..."' INT +trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR + +force_build="" +level=0 +noupdate='n' +build_only='n' +check_deps_only='n' +do_cleanup='n' +max_level=21 +OFFLINE=false +while getopts 'ha:b:cCd:l:nm:r:' arg; do + case $arg in + h) usage ;; + a) ABSROOT="$OPTARG" ;; + b) build_only='y' + build_dir="$OPTARG" + [ -z ${build_dir} ] && { + usage + } + [ ! -r ${build_dir}/BUILDORDER ] && { + error "${build_dir}/BUILDORDER doesn't exist." + exit 1 + };; + c) check_deps_only='y' ;; + C) do_cleanup='y';; + d) build_dir="$OPTARG" ;; +# hidden option to know what to build first. +# if $level > 0 it will not build + l) level=$OPTARG ;; + n) noupdate='y';; + m) max_level=$OPTARG ;; + r) FULLBUILDCMD="$OPTARG" ;; + esac +done + +if [ ${build_only} == 'n' ]; then + +# Check if we are actually on a build directory +# Do this early + + [ ! -r PKGBUILD ] && { + error "This isn't a build directory" + usage + } + + # Add mips64el if missing from arch=() and it isn't an 'any' package + if ! grep mips64el PKGBUILD >/dev/null; then + warning "Adding mips64el arch" + sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" + fi + +fi + +# Only on level 0 +if [ $level -eq 0 ]; then + # if build_dir exist use it, else make a build_dir + build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)} + mkdir -p ${build_dir} # in case of -d option + + # make files for log and buildorder + touch ${build_dir}/{log,BUILDORDER} + buildorder=${build_dir}/BUILDORDER + + [ ${noupdate} = 'n' ] && { + msg "Updating pacman db and packages" + sudo pacman -Syu --noconfirm || true + } + +# Build only + [ ${build_only} == 'y' ] && { + msg "Build Packages" + _pkg_build + exit 0 + } + + msg "Checking dependencies" +fi + +## if $level = 20 it's highly likely there are circular deps +[ $level -ge $max_level ] && exit 20 + +# Tries to find deps and build order +find_deps || { + # if find_deps finds circular deps + # it should exit with status 20 + [ $? -eq 20 ] && { + # only show message on level 0 + [ $level -eq 0 ] && error "Check for circular deps on $build_dir/BUILDORDER"; + } + exit 20 +} + +# levels greater than 0 must only check deps +[ $check_deps_only = 'y' -o $level -gt 0 ] && exit 0 + +# check BUILDORDER to not include banned deps and +[ $level -eq 0 -a -d $build_dir ] && { +# Check for banned deps + if [ -w $ban_file -a -r $ban_file ]; then + chmod o+rw $ban_file || error "Ban file is not readable/writable ($ban_file)" + + else + rsync -e ssh -aq $PARABOLAHOST:mips64el/ban >/dev/null 2>&1 || { + warning "Failed to get ban list" && [ -r ${ban_file} ] && { + +# Use local copy of ban file if it is avaliable and continue. + search=$(cat ${ban_file} | tr "\n" "|") +# Keep track of banned files + egrep -w "$search" ${buildorder} >> ${build_dir}/banned +# Take banned packages out from buildorder + egrep -vw "$search" ${buildorder} > ${buildorder}2 + mv -f ${buildorder}2 ${buildorder} + unset search + } + } + fi +} + +## START Building +msg "Building packages:" + +# Build the package +_pkg_build + +echo +msg2 "Check if your system works fine and librerelease if it does" + +exit 0 diff --git a/prmipsrelease b/prmipsrelease new file mode 100755 index 0000000..cd4d4ba --- /dev/null +++ b/prmipsrelease @@ -0,0 +1,100 @@ +#!/bin/bash +# Lic: GPLv3+ +# Author: Nicolas Reynolds +# Local release of mips64el packages + clean ABS sync +# Called by HOOKLOCALRELEASE + +# $1 repo +# $2+ packages + +source /etc/makepkg.conf +source /etc/libretools.conf +source /etc/libretools.d/prtools.conf + +usage() { + echo "$0 repo package1 [ package2 ... packageN ]" + echo + echo " release packages locally on ${PKGDEST}/stage3." + echo " and make a clean ABS sync " +} + +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + +repo=$1; shift +repo-add ${PKGDEST}/stage3.db.tar.gz $@ + +# Get all needed sources +source PKGBUILD +fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) +pkgbase=${pkgbase:-$pkgname[0]} + +msg "Adding packages to [stage3]..." +repo-add $@ +for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" + repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* +done + +# Copy PKGBUILD and sources + +msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" +dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" +mkdir -p ${dest_dir} >/dev/null +rm -rf ${dest_dir}/* #if package existed already there + +# Set target CARCH as it might be used within the PKGBUILD to select correct sources +eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") +export CARCH +source=($(. "PKGBUILD"; echo ${source[@]})) +cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" +for f in ${source[@]}; do + basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') + if [ -f "$basef" ]; then + cp --remove-destination "$basef" "${dest_dir}" + fi +done + +( . PKGBUILD + for i in 'changelog' 'install'; do + filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) + for file in $filelist; do + # evaluate any bash variables used + eval file=${file} + if [ -f "$file" ]; then + cp --remove-destination "$file" "${dest_dir}" + fi + done + done +) +# END add clean abs + +# Commit the changes + + pushd "$dest_dir" >/dev/null + + source "${dest_dir}/PKGBUILD" + epoch=${epoch:-0} + fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-${pkgname[0]}} + + git add "${dest_dir}/." # add using .gitignore + + git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && \ + msg2 "${pkgbase} ${fullver} ${repo}" + + popd >/dev/null + +# END commit + +exit $? diff --git a/prtools.conf b/prtools.conf new file mode 100644 index 0000000..5b41216 --- /dev/null +++ b/prtools.conf @@ -0,0 +1,4 @@ + +# Absroot for libretools-pr +ABSROOT=$WORKDIR/prabs +HOOKLOCALRELEASE="prmipsrelease" \ No newline at end of file -- cgit v1.1-4-g5e80 From 75f8632e677bd11bb88be037aa6aab32a79ab008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 27 Jun 2011 14:17:50 -0500 Subject: some fixes --- fullpkg | 1 + libremakepkg | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/fullpkg b/fullpkg index 7a08112..35598eb 100755 --- a/fullpkg +++ b/fullpkg @@ -133,6 +133,7 @@ function find_deps { [ $? -eq 20 ] && return 20 popd > /dev/null break 1 # found, go to next dep + fi done # if search pkgname in repo doesn't work # this should find pkgsplits diff --git a/libremakepkg b/libremakepkg index e446833..b8d8c9a 100755 --- a/libremakepkg +++ b/libremakepkg @@ -32,6 +32,7 @@ function usage { echo ' -h show this message.' echo ' -c cleans the chroot before building.' echo ' -u updates the chroot before building.' + echo ' -U copy pacman, makepkg, and mtag config files to the chroot' echo ' -n use this dir instead of "${CHCOPY}".' echo ' -M <--arg> passes long args to makepkg, use it as many times as needed.' echo @@ -44,11 +45,13 @@ function buildenv { mkdir -p "${CHROOTDIR}/${CHCOPY}${mp}" mount -o bind ${mp} "${CHROOTDIR}/${CHCOPY}${mp}" || exit 1 done - - 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 - done + + 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 + done + fi } # Clean packages with pacman @@ -74,6 +77,7 @@ while [ "\$clean" = 'false' ]; do done EOF ) > "${CHROOTDIR}/${CHROOTNAME}/clean" + chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean" mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" } @@ -102,9 +106,10 @@ UPDATE_FIRST="n" USE_LOG='n' CHROOTNAME=${CHCOPY} MAKEPKG_ARGS="" +update_config='n' #libremakepkg own args -libremakepkgargs='hcun:I:M:' +libremakepkgargs='hcuUn:I:M:' #now makepkg args libremakepkgargs+='ACdefiLmop:rRs' @@ -113,7 +118,8 @@ while getopts ${libremakepkgargs} arg ; do h) usage; exit 0 ;; c) CLEAN_FIRST="y" ;; u) UPDATE_FIRST="y" ;; - n) chrootname="$OPTARG"; echo $chrootname ;; + U) update_config='y' + n) CHROOTNAME="$OPTARG" ;; M) MAKEPKG_ARGS+=" $OPTARG" ;; L) MAKEPKG_ARGS+=" -$arg $OPTARG" USE_LOG='y';; @@ -150,7 +156,7 @@ if [ "${CLEAN_FIRST}" = y ]; then fi msg "Creating the package" -makechrootpkg -r ${CHROOTDIR} -l "${CHROOTNAME}" -- ${MAKEPKG_ARGS} +makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS} ev=$? # exit value [ "${USE_LOG}" == 'y' -a -e ${CHROOTDIR}/${CHROOTNAME}/build/*.log ] && { -- cgit v1.1-4-g5e80 From eb5cbeea0dc649d18ea4d6330c0787fc5a962b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 27 Jun 2011 16:41:39 -0500 Subject: fixes and tabs -> spaces --- aur | 4 +- fullpkg | 12 ++-- libremessages | 50 +++++++-------- librerelease | 110 ++++++++++++++++---------------- librerepkg | 2 +- librestage | 14 ++--- libretools.conf | 3 +- mipsrelease | 12 ++-- prfullpkg | 12 ++-- prmipsrelease | 134 +++++++++++++++++++-------------------- toru | 192 ++++++++++++++++++++++++++++---------------------------- 11 files changed, 272 insertions(+), 273 deletions(-) diff --git a/aur b/aur index a7408b7..011dc45 100755 --- a/aur +++ b/aur @@ -30,8 +30,8 @@ function usage { while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; - *) usage; exit 1 ;; + h) usage; exit 0 ;; + *) usage; exit 1 ;; esac done diff --git a/fullpkg b/fullpkg index 35598eb..cae91da 100755 --- a/fullpkg +++ b/fullpkg @@ -59,12 +59,12 @@ guess_repo() { # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi } # Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir diff --git a/libremessages b/libremessages index c297f2d..d333f3f 100755 --- a/libremessages +++ b/libremessages @@ -28,49 +28,49 @@ export TEXTDOMAINDIR='/usr/share/locale' 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)" + 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" + 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() { - eval "$@ >/dev/null 2>&1" + eval "$@ >/dev/null 2>&1" } plain() { - local mesg=$1; shift - printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + 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 + 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 + 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 + 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 + local mesg=$1; shift + printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } diff --git a/librerelease b/librerelease index 4e7c491..ed221c8 100755 --- a/librerelease +++ b/librerelease @@ -1,4 +1,4 @@ -#!/bin/bash + #!/bin/bash # Librerelease # Uploads packages into [staging] @@ -21,67 +21,67 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -source /etc/libretools.conf -custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf + source /etc/libretools.conf + custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf -function usage { - echo "$(gettext "Usage: $0")" - echo - 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 usage { + echo "$(gettext "Usage: $0")" + echo + 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 { - repos=($(find "$WORKDIR/staging/" -mindepth 1 -type d \! -empty -printf '%f ' 2>/dev/null)) - for _repo in ${repos[@]}; do - msg2 "$_repo" - find ${WORKDIR}/staging/${_repo} -type f -printf "%f\n" - done - unset repos -} + function list_packages { + repos=($(find "$WORKDIR/staging/" -mindepth 1 -type d \! -empty -printf '%f ' 2>/dev/null)) + for _repo in ${repos[@]}; do + msg2 "$_repo" + find ${WORKDIR}/staging/${_repo} -type f -printf "%f\n" + done + unset repos + } -function clean_non_packages { - find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.?z" -delete -} + function clean_non_packages { + find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.?z" -delete + } -function clean_packages { - find ${WORKDIR}/staging/ -iname "*.pkg.tar.?z" -delete -} + function clean_packages { + find ${WORKDIR}/staging/ -iname "*.pkg.tar.?z" -delete + } -while getopts 'hlc' arg; do - case $arg in - h) usage; exit 0 ;; - l) list_packages; exit 0 ;; - c) clean_packages; exit $? ;; - esac -done + 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 + [[ -e $custom_config ]] && source $custom_config -[[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" + [[ ! -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}/ || { - error "Sync failed, try again" - exit 1 -} + 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}/ || { + error "Sync failed, try again" + exit 1 + } -msg "Removing packages from local [staging]" -clean_packages + msg "Removing packages from local [staging]" + clean_packages -exit 0 + exit 0 diff --git a/librerepkg b/librerepkg index 5125023..883dabf 100755 --- a/librerepkg +++ b/librerepkg @@ -43,7 +43,7 @@ usage() { while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; + h) usage; exit 0 ;; esac done diff --git a/librestage b/librestage index 917c9bf..07e9ca9 100755 --- a/librestage +++ b/librestage @@ -5,19 +5,19 @@ # Copyright 2010 Nicolás Reynolds # ---------- 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 . @@ -46,7 +46,7 @@ repos=$@ while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; + h) usage; exit 0 ;; esac done @@ -98,7 +98,7 @@ for _arch in ${ARCHES[@]}; do exit 1 } && { msg2 "${pkg} staged on [${_repo}]" - staged='y' + staged='y' } } || { ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || { @@ -106,7 +106,7 @@ for _arch in ${ARCHES[@]}; do exit 1 } && { msg2 "${pkg} staged on [${_repo}]" - staged='y' + staged='y' } } done diff --git a/libretools.conf b/libretools.conf index d19e265..18284a0 100644 --- a/libretools.conf +++ b/libretools.conf @@ -46,7 +46,6 @@ HOOKLOCALRELEASE="mipsrelease" # Don't change unless you know what you're doing and you won't screw # anything ;) LIBREDESTDIR=/home/parabolavnx/parabolagnulinux.org/repo -LIBRESRCDIR=/home/parabolavnx/parabolagnulinux.org/repo/pkgbuilds ## ABSLibre ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git @@ -65,7 +64,7 @@ FULLBUILDCMD="sudo libremakepkg -cumL -M --noconfirm -M --nocheck" # Checks if vars aren't empty for VAR in CHROOTDIR CHROOT CHCOPY CACHEDIR PARABOLAHOST LIBREDESTDIR \ - LIBRESRCDIR BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT \ + BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT \ COMMITCMD DIFFTOOL FULLBUILDCMD; do [[ -z ${!VAR} ]] && { diff --git a/mipsrelease b/mipsrelease index 5228bd9..dae489c 100755 --- a/mipsrelease +++ b/mipsrelease @@ -22,12 +22,12 @@ usage() { # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi } repo=$1; shift diff --git a/prfullpkg b/prfullpkg index 458eefa..2ec9661 100755 --- a/prfullpkg +++ b/prfullpkg @@ -62,12 +62,12 @@ guess_repo() { # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi } # Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir diff --git a/prmipsrelease b/prmipsrelease index cd4d4ba..29da6e0 100755 --- a/prmipsrelease +++ b/prmipsrelease @@ -1,4 +1,4 @@ -#!/bin/bash + #!/bin/bash # Lic: GPLv3+ # Author: Nicolas Reynolds # Local release of mips64el packages + clean ABS sync @@ -7,94 +7,94 @@ # $1 repo # $2+ packages -source /etc/makepkg.conf -source /etc/libretools.conf -source /etc/libretools.d/prtools.conf + source /etc/makepkg.conf + source /etc/libretools.conf + source /etc/libretools.d/prtools.conf -usage() { - echo "$0 repo package1 [ package2 ... packageN ]" - echo - echo " release packages locally on ${PKGDEST}/stage3." - echo " and make a clean ABS sync " -} + usage() { + echo "$0 repo package1 [ package2 ... packageN ]" + echo + echo " release packages locally on ${PKGDEST}/stage3." + echo " and make a clean ABS sync " + } ## # usage : get_full_version( $epoch, $pkgver, $pkgrel ) # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## -get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi -} - -repo=$1; shift -repo-add ${PKGDEST}/stage3.db.tar.gz $@ + get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + } + + repo=$1; shift + repo-add ${PKGDEST}/stage3.db.tar.gz $@ # Get all needed sources -source PKGBUILD -fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) -pkgbase=${pkgbase:-$pkgname[0]} + source PKGBUILD + fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-$pkgname[0]} -msg "Adding packages to [stage3]..." -repo-add $@ -for name in ${pkgname[@]}; do - msg2 "${name} ${fullver}" - repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* -done + msg "Adding packages to [stage3]..." + repo-add $@ + for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" + repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* + done # Copy PKGBUILD and sources -msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" -dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" -mkdir -p ${dest_dir} >/dev/null -rm -rf ${dest_dir}/* #if package existed already there + msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" + dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" + mkdir -p ${dest_dir} >/dev/null + rm -rf ${dest_dir}/* #if package existed already there # Set target CARCH as it might be used within the PKGBUILD to select correct sources -eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") -export CARCH -source=($(. "PKGBUILD"; echo ${source[@]})) -cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" -for f in ${source[@]}; do - basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') - if [ -f "$basef" ]; then - cp --remove-destination "$basef" "${dest_dir}" - fi -done - -( . PKGBUILD - for i in 'changelog' 'install'; do - filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) - for file in $filelist; do - # evaluate any bash variables used - eval file=${file} - if [ -f "$file" ]; then - cp --remove-destination "$file" "${dest_dir}" - fi - done - done -) + eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") + export CARCH + source=($(. "PKGBUILD"; echo ${source[@]})) + cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" + for f in ${source[@]}; do + basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') + if [ -f "$basef" ]; then + cp --remove-destination "$basef" "${dest_dir}" + fi + done + + ( . PKGBUILD + for i in 'changelog' 'install'; do + filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) + for file in $filelist; do + # evaluate any bash variables used + eval file=${file} + if [ -f "$file" ]; then + cp --remove-destination "$file" "${dest_dir}" + fi + done + done + ) # END add clean abs # Commit the changes - pushd "$dest_dir" >/dev/null + pushd "$dest_dir" >/dev/null - source "${dest_dir}/PKGBUILD" - epoch=${epoch:-0} - fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) - pkgbase=${pkgbase:-${pkgname[0]}} + source "${dest_dir}/PKGBUILD" + epoch=${epoch:-0} + fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-${pkgname[0]}} - git add "${dest_dir}/." # add using .gitignore + git add "${dest_dir}/." # add using .gitignore - git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && \ - msg2 "${pkgbase} ${fullver} ${repo}" + git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && \ + msg2 "${pkgbase} ${fullver} ${repo}" - popd >/dev/null + popd >/dev/null # END commit -exit $? + exit $? diff --git a/toru b/toru index e411b3b..e211878 100755 --- a/toru +++ b/toru @@ -1,4 +1,4 @@ -#!/bin/bash + #!/bin/bash # Queries the ABS # License: GPL3 @@ -13,8 +13,8 @@ # * Possibility to hook up ABS dirs besides ABSROOT (low priority) # * Tell updates and non available binary packages (working on this) -source /etc/abs.conf -source /etc/libretools.conf + source /etc/abs.conf + source /etc/libretools.conf #[ ! -w / ] && { # error "This script must be run as root." @@ -23,53 +23,53 @@ source /etc/libretools.conf # Stores the lastsync date -lastsync() { - [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { - error "The sync date can't be saved. ${lastsyncfile} isn't writable." - return 1 - } + lastsync() { + [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { + error "The sync date can't be saved. ${lastsyncfile} isn't writable." + return 1 + } - date +%s > ${lastsyncfile} - touch ${lastsyncfile} -} + date +%s > ${lastsyncfile} + touch ${lastsyncfile} + } ## # usage : get_full_version( $epoch, $pkgver, $pkgrel ) # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## -get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi -} + get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + } # Outputs an ordered package-fullpkgver array -print_package_array() { - echo "$@" | tr " " "\n" | sort -V -u -} + print_package_array() { + echo "$@" | tr " " "\n" | sort -V -u + } # Gets repo.db contents # $1 repo -get_db_contents() { - [ ! -r /var/lib/pacman/sync/$1.db ] && return 0 + get_db_contents() { + [ ! -r /var/lib/pacman/sync/$1.db ] && return 0 - bsdtar -tf /var/lib/pacman/sync/$1.db | \ - cut -d'/' -f1 | \ - sort -V -u -} + bsdtar -tf /var/lib/pacman/sync/$1.db | \ + cut -d'/' -f1 | \ + sort -V -u + } -extract_pkgname() { - echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" -} + extract_pkgname() { + echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" + } -extract_fullpkgver() { - echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" -} + extract_fullpkgver() { + echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" + } # Updates the database by finding all PKGBUILDS @@ -78,103 +78,103 @@ extract_fullpkgver() { # * Get all packages already on package repos # * Compare them # Args: -update() { + update() { # The PKGBUILDs found - local pkgbuilds=() + local pkgbuilds=() # The list of pkgname-fullpkgver - local packages_to_sync=() - local packages_in_sync=() - local needed_updates=() - local old_versions=() + local packages_to_sync=() + local packages_in_sync=() + local needed_updates=() + local old_versions=() # Find all the PKGBUILDs newer than the last update # Update newer, otherwise everything - if [ $force ] || [ ! -e ${lastsyncfile} ]; then - $quiet || msg "Forcing upgrade" - pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD')) - else - pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) - fi + if [ $force ] || [ ! -e ${lastsyncfile} ]; then + $quiet || msg "Forcing upgrade" + pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD')) + else + pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) + fi # Inform how many PKGBUILDS were found and quit immediately if none - $quiet || msg "Found $((${#pkgbuilds[*]}-1)) packages to update" - [ ${#pkgbuilds[*]} -eq 1 ] && { - $quiet || msg2 "There's nothing to be done. Phew!" - exit 0 - } + $quiet || msg "Found $((${#pkgbuilds[*]}-1)) packages to update" + [ ${#pkgbuilds[*]} -eq 1 ] && { + $quiet || msg2 "There's nothing to be done. Phew!" + exit 0 + } - for _pkgbuild in ${pkgbuilds[@]}; do + for _pkgbuild in ${pkgbuilds[@]}; do # The repo name is guessed # You *must* use repo/pkgbase structure - _pkgpath=$(dirname "${_pkgbuild}") - _pkgbase=$(basename "${_pkgpath}") - _pkgrepo=$(basename $(dirname "${_pkgpath}")) + _pkgpath=$(dirname "${_pkgbuild}") + _pkgbase=$(basename "${_pkgpath}") + _pkgrepo=$(basename $(dirname "${_pkgpath}")) - source ${_pkgbuild} + source ${_pkgbuild} - for _pkg in ${pkgname[@]}; do + for _pkg in ${pkgname[@]}; do # Fill the list of packages to find - packages_to_sync+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel)) - done + packages_to_sync+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel)) + done - unset pkgbase pkgname pkgver pkgrel source epoch - done + unset pkgbase pkgname pkgver pkgrel source epoch + done # Get repo database contents - packages_in_sync=($(get_db_contents ${_pkgrepo})) - print_package_array "${packages_to_sync[@]}" > ${TMPDIR}/packages_to_sync - print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync + packages_in_sync=($(get_db_contents ${_pkgrepo})) + print_package_array "${packages_to_sync[@]}" > ${TMPDIR}/packages_to_sync + print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync # We've orderer the files! - needed_updates=($(comm --nocheck-order -32 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) - old_versions=($(comm --nocheck-order -31 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + needed_updates=($(comm --nocheck-order -32 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + old_versions=($(comm --nocheck-order -31 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) - $quiet || msg "This packages are available to update" - for _update in ${needed_updates[@]}; do - pkg=$(extract_pkgname $_update) + $quiet || msg "This packages are available to update" + for _update in ${needed_updates[@]}; do + pkg=$(extract_pkgname $_update) - $quiet && echo $pkg - $quiet || { - ver=$(extract_fullpkgver $_update) - oldver=$(extract_fullpkgver $(grep -w $pkg ${TMPDIR}/packages_in_sync)) + $quiet && echo $pkg + $quiet || { + ver=$(extract_fullpkgver $_update) + oldver=$(extract_fullpkgver $(grep -w $pkg ${TMPDIR}/packages_in_sync)) - msg2 "$pkg $oldver => $ver" - } + msg2 "$pkg $oldver => $ver" + } - done + done # lastsync -} + } ## MAIN -commands=() -repos=() -quiet=false -force=false -while getopts 'hqfu' arg; do - case $arg in - h) usage; exit 0 ;; - q) quiet=true ;; - f) force=true ;; - u) commands+=(update);; - esac - - shift $((OPTIND-1)) -done + commands=() + repos=() + quiet=false + force=false + while getopts 'hqfu' arg; do + case $arg in + h) usage; exit 0 ;; + q) quiet=true ;; + f) force=true ;; + u) commands+=(update);; + esac + + shift $((OPTIND-1)) + done # This is the syncfile, stores the last date as content and mtime #lastsyncfile=${ABSROOT}/toru.lastsync -TMPDIR=$(mktemp -d) + TMPDIR=$(mktemp -d) -[[ -z ${TMPDIR} ]] && exit 1 + [[ -z ${TMPDIR} ]] && exit 1 -${commands[0]} ${@} + ${commands[0]} ${@} -rm -rf ${TMPDIR} + rm -rf ${TMPDIR} -exit $? + exit $? -- cgit v1.1-4-g5e80 From f303abe1eb26dd9037824889dc3c02df74ed9fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 27 Jun 2011 18:46:24 -0500 Subject: libremakepkg uses find to copy logs and has no trailing space --- libremakepkg | 84 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/libremakepkg b/libremakepkg index b8d8c9a..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 . + +# 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 . 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" + 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" ;; + *) 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,23 +144,23 @@ 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 msg "Creating the package" -makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS} +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 -- cgit v1.1-4-g5e80