summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-09-23 19:34:05 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-09-23 19:44:11 -0400
commit16e01bca9a23eef40191e8ca5abefdb1ab4c741a (patch)
tree5ae02623e8caede127e978de1c6940beb9aa5ca7 /src
parent8068e0fbd04085eb7982836e5ebda84d0156fd53 (diff)
fullpkg: use tab for indent
Diffstat (limited to 'src')
-rwxr-xr-xsrc/fullpkg/fullpkg30
-rwxr-xr-xsrc/fullpkg/fullpkg-build174
-rwxr-xr-xsrc/fullpkg/fullpkg-find282
3 files changed, 243 insertions, 243 deletions
diff --git a/src/fullpkg/fullpkg b/src/fullpkg/fullpkg
index 1d4388c..7724165 100755
--- a/src/fullpkg/fullpkg
+++ b/src/fullpkg/fullpkg
@@ -5,25 +5,25 @@
usage() {
- echo "cd to a dir containing a PKGBUILD and run:"
- echo "$0 [build_dir]"
- echo ""
- echo "This script will check dependencies, build them if possible "
- echo "and stage the packages on it's repo."
- echo ""
- echo "OPTIONS:"
- echo " -h : this message."
- echo ""
- echo "Wrapper for \`fullpkg-find' and \`fullpkg-build'"
- echo ""
- exit 1
+ echo "cd to a dir containing a PKGBUILD and run:"
+ echo "$0 [build_dir]"
+ echo ""
+ echo "This script will check dependencies, build them if possible "
+ echo "and stage the packages on it's repo."
+ echo ""
+ echo "OPTIONS:"
+ echo " -h : this message."
+ echo ""
+ echo "Wrapper for \`fullpkg-find' and \`fullpkg-build'"
+ echo ""
+ exit 1
}
while getopts 'h' arg; do
- case "$arg" in
- h) usage ;;
- esac
+ case "$arg" in
+ h) usage ;;
+ esac
done
shift $(( OPTIND - 1 ))
diff --git a/src/fullpkg/fullpkg-build b/src/fullpkg/fullpkg-build
index 1771d83..106ff0e 100755
--- a/src/fullpkg/fullpkg-build
+++ b/src/fullpkg/fullpkg-build
@@ -18,21 +18,21 @@ check_vars libretools FULLBUILDCMD || exit 1
#
## status: nonfree, built, failed, unstaged
list_pkgs() {
- msg="$2"
- local pkgs=($(grep "$1:" $build_dir/log)) && {
- msg "$2"
- echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2
- }
+ msg="$2"
+ local pkgs=($(grep "$1:" $build_dir/log)) && {
+ msg "$2"
+ echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2
+ }
}
## Check all build_dir, fails if one PKGBUILD is nonfree
check_nonfree() {
- find "$build_dir" -name PKGBUILD \
- -exec pkgbuild-check-nonfree {} +
- if [ "$?" -eq 15 ]; then
- error "Some PKGBUILD have nonfree problems"
- exit 15
- fi
+ find "$build_dir" -name PKGBUILD \
+ -exec pkgbuild-check-nonfree {} +
+ if [ "$?" -eq 15 ]; then
+ error "Some PKGBUILD have nonfree problems"
+ exit 15
+ fi
}
@@ -40,79 +40,79 @@ check_nonfree() {
# $1 package name
# $2 buildorder file
remove_buildorder() {
- grep -Evw "${1}" ${2} > ${2}2
- mv -f ${2}2 ${2}
+ grep -Evw "${1}" ${2} > ${2}2
+ mv -f ${2}2 ${2}
- return $?
+ return $?
}
succesfull_build() {
- if [ "$RUN" != "$FULLBUILDCMD" ]; then
- return 0 # Custom command or download sources
- fi
+ if [ "$RUN" != "$FULLBUILDCMD" ]; then
+ return 0 # Custom command or download sources
+ fi
- if source .INFO && [ -n "$repo" ]; then
+ if source .INFO && [ -n "$repo" ]; then
- if [ ! -z "$HOOKLOCALRELEASE" ]; then
- "$HOOKLOCALRELEASE" "$repo"
- fi
+ if [ ! -z "$HOOKLOCALRELEASE" ]; then
+ "$HOOKLOCALRELEASE" "$repo"
+ fi
- msg "Updating pacman db and packages"
- sudo pacman -Sy || true
+ msg "Updating pacman db and packages"
+ sudo pacman -Sy || true
- fi
+ fi
- echo "built:$(basename $PWD)" >>$build_dir/log
+ echo "built:$(basename $PWD)" >>$build_dir/log
}
build_description() {
- list_pkgs "nonfree" "Those packages contain nonfree deps:"
- list_pkgs "built" "Those packages were built and staged:"
- list_pkgs "failed" "Those packages failed to build:"
- list_pkgs "unstaged" "Those packages couldn't be staged (missing reponame):"
+ list_pkgs "nonfree" "Those packages contain nonfree deps:"
+ list_pkgs "built" "Those packages were built and staged:"
+ list_pkgs "failed" "Those packages failed to build:"
+ list_pkgs "unstaged" "Those packages couldn't be staged (missing reponame):"
}
__build() {
- pushd ${build_dir} >/dev/null
+ pushd ${build_dir} >/dev/null
- build_packages=($(sort -gr $buildorder | cut -d: -f2)) # greater levels must be built first
+ build_packages=($(sort -gr $buildorder | cut -d: -f2)) # greater levels must be built first
- while [ ${#build_packages[@]} -ge 1 ]; do
+ while [ ${#build_packages[@]} -ge 1 ]; do
- pushd "$build_dir/${build_packages[0]}" >/dev/null
+ pushd "$build_dir/${build_packages[0]}" >/dev/null
- if [ -n "${HOOKPKGBUILDMOD}" ]; then
- ${HOOKPKGBUILDMOD} || true
- fi
+ if [ -n "${HOOKPKGBUILDMOD}" ]; then
+ ${HOOKPKGBUILDMOD} || true
+ fi
- eval "$RUN"; r=$?
+ eval "$RUN"; r=$?
- case $r in
+ case $r in
- 0) succesfull_build ;;
+ 0) succesfull_build ;;
- *) error "There were errors while trying to build the package."
- echo "failed:$(basename $PWD)" >>$build_dir/log
- ;;
- esac
+ *) error "There were errors while trying to build the package."
+ echo "failed:$(basename $PWD)" >>$build_dir/log
+ ;;
+ esac
- remove_buildorder "${build_packages[0]}" $buildorder || true
+ remove_buildorder "${build_packages[0]}" $buildorder || true
-# which is next package?
- build_packages=($(sort -gr $buildorder | cut -d: -f2))
- popd > /dev/null
- done
+ # which is next package?
+ build_packages=($(sort -gr $buildorder | cut -d: -f2))
+ popd > /dev/null
+ done
- popd >/dev/null
+ popd >/dev/null
}
# End inmediately but print a useful message
trap_exit() {
- error "$@"
- warning "Leftover files left on $build_dir"
- mv .BUILDORDER BUILDORDER
- exit 1
+ error "$@"
+ warning "Leftover files left on $build_dir"
+ mv .BUILDORDER BUILDORDER
+ exit 1
}
# Trap signals from makepkg
@@ -128,35 +128,35 @@ MESSAGE="Building packages"
usage() {
- echo ""
- echo "$(basename $0) [options] <build_dir>"
- echo ""
- echo "Builds packages from build_dir, create a build_dir using:"
- echo "'fullpkg-find <build_dir>'"
- echo ""
- echo "If no <build_dir> is specified, it uses the current directory."
- echo ""
- echo "OPTIONS:"
- echo " -h : this message."
- echo " -c : clean <build_dir> on succesfull build"
- echo " -N : don't check for freedom issues." #Also made by fullpkg-find
- echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"."
- echo " -g : get sources for building packages on build_dir."
- echo ""
- exit 1
+ echo ""
+ echo "$(basename $0) [options] <build_dir>"
+ echo ""
+ echo "Builds packages from build_dir, create a build_dir using:"
+ echo "'fullpkg-find <build_dir>'"
+ echo ""
+ echo "If no <build_dir> is specified, it uses the current directory."
+ echo ""
+ echo "OPTIONS:"
+ echo " -h : this message."
+ echo " -c : clean <build_dir> on succesfull build"
+ echo " -N : don't check for freedom issues." #Also made by fullpkg-find
+ echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"."
+ echo " -g : get sources for building packages on build_dir."
+ echo ""
+ exit 1
}
while getopts 'hNr:g' arg; do
- case $arg in
- h) usage ;;
- c) CLEAN ;;
- N) CHECKNONFREE="false" ;;
- r) RUN="$OPTARG"
- MESSAGE="Executing custom action";;
- g) RUN='makepkg -g > /dev/null'
- MESSAGE="Downloading packages";;
- esac
+ case $arg in
+ h) usage ;;
+ c) CLEAN ;;
+ N) CHECKNONFREE="false" ;;
+ r) RUN="$OPTARG"
+ MESSAGE="Executing custom action";;
+ g) RUN='makepkg -g > /dev/null'
+ MESSAGE="Downloading packages";;
+ esac
done
shift $(( OPTIND - 1 ))
@@ -164,26 +164,26 @@ build_dir="${1:-`pwd`}"
buildorder="${build_dir}/BUILDORDER"
if [ ! -e "$buildorder" ]; then
- error "This is not a build_dir. Make one using fullpkg."
- usage
+ error "This is not a build_dir. Make one using fullpkg."
+ usage
else
-# backup BUILDORDER
- cp "$buildorder" "$build_dir/.BUILDORDER"
+ # backup BUILDORDER
+ cp "$buildorder" "$build_dir/.BUILDORDER"
fi
if "$CHECKNONFREE"; then
- check_nonfree
+ check_nonfree
fi
msg "$MESSAGE"
__build
if [ "$RUN" != "$FULLBUILDCMD" ]; then
- # Used for downloading or custom command
- mv "$build_dir/.BUILDORDER" "$buildorder"
- exit 0
+ # Used for downloading or custom command
+ mv "$build_dir/.BUILDORDER" "$buildorder"
+ exit 0
elif "$CLEANUP"; then
- find "$build_dir" -mindepth 1 -delete
+ find "$build_dir" -mindepth 1 -delete
fi
build_description
diff --git a/src/fullpkg/fullpkg-find b/src/fullpkg/fullpkg-find
index a927782..a8f2ac8 100755
--- a/src/fullpkg/fullpkg-find
+++ b/src/fullpkg/fullpkg-find
@@ -8,114 +8,114 @@
# Get repo name. Asumes ${ABSROOT}/repo/package/PKGBUILD
guess_repo() {
- basename $(dirname $(pwd))
+ basename $(dirname $(pwd))
}
# This function is stolen from makechrootpkg.
# That probably has some copyright/licensing implications.
copy_files() {
- local copydir="$build_dir/${pkgbase:-${pkgname[0]}}"
- mkdir -p "$copydir"
-
- # Copy PKGBUILD and sources
- cp PKGBUILD "$copydir"
- (
- load_PKGBUILD
- for file in "${source[@]}"; do
- file="${file%%::*}"
- file="${file##*://*/}"
- if [[ -f $file ]]; then
- cp "$file" "$copydir/"
- elif [[ -f $SRCDEST/$file ]]; then
- cp "$SRCDEST/$file" "$copydir/"
- fi
- done
-
- # Find all changelog and install files, even inside functions
- for i in 'changelog' 'install'; do
- while read -r file; do
- # evaluate any bash variables used
- eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
- [[ -f $file ]] && cp "$file" "$copydir"
- done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
- done
- )
+ local copydir="$build_dir/${pkgbase:-${pkgname[0]}}"
+ mkdir -p "$copydir"
+
+ # Copy PKGBUILD and sources
+ cp PKGBUILD "$copydir"
+ (
+ load_PKGBUILD
+ for file in "${source[@]}"; do
+ file="${file%%::*}"
+ file="${file##*://*/}"
+ if [[ -f $file ]]; then
+ cp "$file" "$copydir/"
+ elif [[ -f $SRCDEST/$file ]]; then
+ cp "$SRCDEST/$file" "$copydir/"
+ fi
+ done
+
+ # Find all changelog and install files, even inside functions
+ for i in 'changelog' 'install'; do
+ while read -r file; do
+ # evaluate any bash variables used
+ eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
+ [[ -f $file ]] && cp "$file" "$copydir"
+ done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
+ done
+ )
}
# Checks ABSROOT and look for target pkg deps. Adds them if not built or outdated.
find_deps() {
-# Check this level
- load_PKGBUILD
-
- local repo="${repo:-$(guess_repo)}"
- local pkgbase="${pkgbase:-${pkgname[0]}}"
-
- if ! pkgbuild-check-nonfree > /dev/null 2> /dev/null; then
- if [ "$?" -eq 15 ]; then
- error "pkgbase" has nonfree issues
- return 15
- fi
- fi
-
- # Checking any package built, since otherwise e.g. kdebase would
- # be always considered outdated: there is no package built named kdebase.
- # TODO: maybe check for the package requested in case of recursive calls,
- # instead of the first one listed?
- if is_built "${pkgname[0]}" "$(get_full_version "${pkgname[0]}")"; then
- exit 0 # pkg is built and updated
- fi
-
-# greater levels are built first
- echo "${LEVEL}:${pkgbase}" >>"$build_dir/BUILDORDER"
-# PKGBUILD is already there
- if [ -d "${build_dir}/${pkgbase}" ]; then
- exit 0
-# Copy dir to build_dir
- else
- copy_files
-
-# to identify repo later
- echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO"
- fi
-
-# current package plus a space for every level
- msg2 "%${LEVEL}s${pkgbase}-$(get_full_version)"
-
-## Check next levels
- declare -i next_level=$LEVEL+1
-
-# All deps in separate line, only once, without version.
- deps=($(echo "${depends[@]} ${makedepends[@]}" | \
- sed "s/[=<>]\+[^ ]\+//g" | \
- tr ' ' "\n" | \
- sort -u))
-
- for _dep in ${deps[@]}; do
-
- local found=false
- # May fail, e.g. since abslibre-mips64el doesn't include
- # arch=any packages.
- local pkgdir=$(toru -p ${_dep}) || true
-
- if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then
- found=true
-
- pushd "${pkgdir}" > /dev/null
-# runs itself on dep's PKGBUILD dir
- $0 -l ${next_level} ${build_dir} || return $?
- popd > /dev/null
- fi
-
- if ! (( found )); then
- echo "dep_not_found:$_dep" >>$build_dir/log
- fi
-
- done
-
-## End variable block
-
- unset next_level dir
+ # Check this level
+ load_PKGBUILD
+
+ local repo="${repo:-$(guess_repo)}"
+ local pkgbase="${pkgbase:-${pkgname[0]}}"
+
+ if ! pkgbuild-check-nonfree > /dev/null 2> /dev/null; then
+ if [ "$?" -eq 15 ]; then
+ error "pkgbase" has nonfree issues
+ return 15
+ fi
+ fi
+
+ # Checking any package built, since otherwise e.g. kdebase would
+ # be always considered outdated: there is no package built named kdebase.
+ # TODO: maybe check for the package requested in case of recursive calls,
+ # instead of the first one listed?
+ if is_built "${pkgname[0]}" "$(get_full_version "${pkgname[0]}")"; then
+ exit 0 # pkg is built and updated
+ fi
+
+ # greater levels are built first
+ echo "${LEVEL}:${pkgbase}" >>"$build_dir/BUILDORDER"
+ # PKGBUILD is already there
+ if [ -d "${build_dir}/${pkgbase}" ]; then
+ exit 0
+ # Copy dir to build_dir
+ else
+ copy_files
+
+ # to identify repo later
+ echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO"
+ fi
+
+ # current package plus a space for every level
+ msg2 "%${LEVEL}s${pkgbase}-$(get_full_version)"
+
+ ## Check next levels
+ declare -i next_level=$LEVEL+1
+
+ # All deps in separate line, only once, without version.
+ deps=($(echo "${depends[@]} ${makedepends[@]}" | \
+ sed "s/[=<>]\+[^ ]\+//g" | \
+ tr ' ' "\n" | \
+ sort -u))
+
+ for _dep in ${deps[@]}; do
+
+ local found=false
+ # May fail, e.g. since abslibre-mips64el doesn't include
+ # arch=any packages.
+ local pkgdir=$(toru -p ${_dep}) || true
+
+ if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then
+ found=true
+
+ pushd "${pkgdir}" > /dev/null
+ # runs itself on dep's PKGBUILD dir
+ $0 -l ${next_level} ${build_dir} || return $?
+ popd > /dev/null
+ fi
+
+ if ! (( found )); then
+ echo "dep_not_found:$_dep" >>$build_dir/log
+ fi
+
+ done
+
+ ## End variable block
+
+ unset next_level dir
}
. libremessages
@@ -129,40 +129,40 @@ UPDATEDB='true'
usage() {
- echo ""
- echo "cd to a dir containing a PKGBUILD and run:"
- echo "$(basename $0) [options] <build_dir>"
- echo ""
- echo "This script will create a build_dir for recursive building"
- echo "it tries to find dependencies that aren't built or need update."
- echo ""
- echo "If no <build_dir> is specified, the script works on a tempdir"
- echo ""
- echo "OPTIONS:"
- echo " -h : this message."
- echo " -A <absroot> : use this ABSROOT."
- echo " -c : clean <build_dir> before working."
- echo " -m <max_level> : check deps until this level"
- echo " -n : don't update pacman db."
- echo ""
- exit 1
+ echo ""
+ echo "cd to a dir containing a PKGBUILD and run:"
+ echo "$(basename $0) [options] <build_dir>"
+ echo ""
+ echo "This script will create a build_dir for recursive building"
+ echo "it tries to find dependencies that aren't built or need update."
+ echo ""
+ echo "If no <build_dir> is specified, the script works on a tempdir"
+ echo ""
+ echo "OPTIONS:"
+ echo " -h : this message."
+ echo " -A <absroot> : use this ABSROOT."
+ echo " -c : clean <build_dir> before working."
+ echo " -m <max_level> : check deps until this level"
+ echo " -n : don't update pacman db."
+ echo ""
+ exit 1
}
while getopts 'hA:l:cmn' arg; do
- case "$arg" in
- h) usage ;;
- A) ABSROOT="$OPTARG" ;;
- l) LEVEL="$OPTARG" ;; # hidden option to know dep level.
- c) CLEANFIRST='true' ;;
- m) MAXLEVEL="$OPTARG" ;;
- n) UPDATEDB='false' ;;
- esac
+ case "$arg" in
+ h) usage ;;
+ A) ABSROOT="$OPTARG" ;;
+ l) LEVEL="$OPTARG" ;; # hidden option to know dep level.
+ c) CLEANFIRST='true' ;;
+ m) MAXLEVEL="$OPTARG" ;;
+ n) UPDATEDB='false' ;;
+ esac
done
if [ ! -r PKGBUILD ]; then
- error "This directory doesnt contain a PKGBUILD"
- usage
+ error "This directory doesnt contain a PKGBUILD"
+ usage
fi
shift $(( OPTIND - 1 ))
@@ -170,26 +170,26 @@ build_dir="${1}"
if [ "$LEVEL" -eq 0 ]; then
- build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}"
+ build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}"
- if [ ! -d "$build_dir" ]; then
- mkdir -p "$build_dir"
- elif "$CLEANFIRST"; then
- # Erase files already in dir
- msg "Cleaning up files in dir"
- find "$build_dir" -mindepth 1 -delete
- fi
+ if [ ! -d "$build_dir" ]; then
+ mkdir -p "$build_dir"
+ elif "$CLEANFIRST"; then
+ # Erase files already in dir
+ msg "Cleaning up files in dir"
+ find "$build_dir" -mindepth 1 -delete
+ fi
- if "$UPDATEDB"; then
- msg "Updating pacman db"
- sudo pacman -Sy --noconfirm || true
- fi
+ if "$UPDATEDB"; then
+ msg "Updating pacman db"
+ sudo pacman -Sy --noconfirm || true
+ fi
-# make files for log and buildorder
- touch "${build_dir}"/{log,BUILDORDER}
- buildorder="${build_dir}/BUILDORDER"
+ # make files for log and buildorder
+ touch "${build_dir}"/{log,BUILDORDER}
+ buildorder="${build_dir}/BUILDORDER"
- msg "Checking dependencies"
+ msg "Checking dependencies"
fi
find_deps