Commit d1b6da64 authored by Natanael Copa's avatar Natanael Copa

abuild: whitespace fixes. use longopts for apk

parent 60eb0dc8
......@@ -83,7 +83,7 @@ warning() {
}
warning2() {
# ">>> WARNING:
# ">>> WARNING:
printf " %s\n" "$1" >&2
}
......@@ -96,7 +96,7 @@ error() {
}
error2() {
# ">>> ERROR:
# ">>> ERROR:
printf " %s\n" "$1" >&2
}
......@@ -104,7 +104,7 @@ set_xterm_title() {
if [ "$TERM" = xterm ] && [ -n "$USE_COLORS" ]; then
printf "\033]0;$1\007" >&2
fi
}
}
cleanup() {
set_xterm_title ""
......@@ -135,7 +135,7 @@ default_sanitycheck() {
[ -z "${pkgname##* *}" ] && die "pkgname contains spaces"
[ -z "$pkgver" ] && die "Missing pkgver in APKBUILD"
if [ "$pkgver" != "volatile" ] && [ -z "$nodeps" ]; then
$APK version --check -q "$pkgver" ||\
$APK version --check --quiet "$pkgver" ||\
die "$pkgver is not a valid version"
fi
[ -z "$pkgrel" ] && die "Missing pkgrel in APKBUILD"
......@@ -189,7 +189,7 @@ default_sanitycheck() {
for i in $triggers; do
local f=${i%=*}
local p=${f%.trigger}
[ "$f" = "$i" ] && die "$f: triggers must contain '='"
[ "$f" = "$i" ] && die "$f: triggers must contain '='"
[ "$p" = "$f" ] && die "$f: triggers scripts must have .trigger suffix"
if ! subpackages_has "$p" && [ "$p" != "$pkgname" ]; then
die "$p: trigger script does not match pkgname or any subpackage"
......@@ -431,7 +431,7 @@ default_fetch() {
if is_remote "$s"; then
uri_fetch_mirror "$s" || return 1
ln -sf "$SRCDEST/$(filename_from_uri $s)" "$srcdir"/
else
else
ln -sf "$startdir/$s" "$srcdir/"
fi
done
......@@ -453,7 +453,7 @@ initdcheck() {
return 1
;;
esac
done
done
}
# unpack the sources
......@@ -637,7 +637,7 @@ postcheck() {
warning "World writeable directories found:"
echo "$i"
fi
# check so we dont have any suid root binaries that are not
# check so we dont have any suid root binaries that are not
i=$(find "$dir" -type f -perm +6000 \
| xargs scanelf --nobanner --etype ET_EXEC \
| sed "s|ET_EXEC $dir|\t|")
......@@ -749,7 +749,7 @@ prepare_metafiles() {
local pkg="$name-$pkgver-r$pkgrel.apk"
local pkginfo="$controldir"/.PKGINFO
local sub
[ ! -d "$dir" ] && die "Missing $dir"
cd "$dir"
mkdir -p "$controldir"
......@@ -791,7 +791,7 @@ EOF
fi
done
fi
local last_commit="$(git_last_commit)$(git_dirty)"
if [ -n "$last_commit" ]; then
echo "commit = $last_commit" >> "$pkginfo"
......@@ -900,7 +900,7 @@ prepare_package() {
msg "Preparing ${subpkgname:+sub}package ${subpkgname:-$pkgname}..."
stripbin
prepare_metafiles && prepare_tracedeps || return 1
archcheck
archcheck
}
pkginfo_val() {
......@@ -970,7 +970,7 @@ trace_apk_deps() {
if [ -f "$dir"/.rpaths ]; then
local so_files=$(find_so_files "$dir"/.rpaths $missing) \
|| return 1
deppkgs=$($APK info -q -W $so_files) || return 1
deppkgs=$($APK info --quiet --who-owns $so_files) || return 1
fi
for found in $deppkgs; do
......@@ -1146,7 +1146,7 @@ create_apks() {
clean_abuildrepo() {
local apk
cd "$abuildrepo" || return 1
# remove compat symlink
for d in "$abuildrepo/$CARCH"; do
[ -L "$d" ] && rm "$d"
......@@ -1182,7 +1182,7 @@ build_abuildrepo() {
update_abuildrepo_index
}
update_abuildrepo_index() {
update_abuildrepo_index() {
clean_abuildrepo
mklinks_abuildrepo
......@@ -1218,7 +1218,7 @@ default_doc() {
mv "$pkgdir/usr/share/$i" "$subpkgdir/usr/share/"
fi
done
rm -f "$subpkgdir/usr/share/info/dir"
# remove if empty, ignore error (not empty)
......@@ -1240,7 +1240,7 @@ default_dev() {
for i in $origsubpackages; do
[ "${i%:*}" = "$subpkgname" ] || depends="$depends ${i%:*}"
done
cd "$pkgdir" || return 0
for i in usr/include usr/lib/pkgconfig usr/share/aclocal\
usr/share/gettext usr/bin/*-config \
......@@ -1325,7 +1325,7 @@ srcpkg() {
done
mkdir -p "$PKGDEST"
msg "Creating source package $p.src.tar.gz..."
(cd .. && tar -zcf "$PKGDEST/$p.src.tar.gz" $files)
(cd .. && tar -zcf "$PKGDEST/$p.src.tar.gz" $files)
}
# return true if arch is supported or noarch
......@@ -1368,13 +1368,13 @@ abuildindex_up2date() {
# check if index is missing
[ -f "$idx" ] || return 1
# if link or file is missing, then we need update abuildrepo index
[ -f "$file" ] || return 1
# if file exists and is newer than index, then we need update index
[ "$file" -nt "$idx" ] && return 1
return 0
}
......@@ -1434,10 +1434,10 @@ deptrace() {
deps="$deps ${i%%[<>=]*}"
done
[ -z "$deps" ] && return 0
( depparse_aports
( depparse_aports
if [ -z "$upgrade" ]; then
# list installed pkgs and prefix with 'i '
$APK info -q | sort | sed 's/^/i /'
$APK info --quiet | sort | sed 's/^/i /'
fi
) | awk -v pkgs="$deps" '
......@@ -1476,22 +1476,22 @@ builddeps() {
subpackages_has ${i%%[<>=]*} || deps="$deps $i"
done
installed_deps=$($APK info -e $deps)
installed_deps=$($APK info --installed $deps)
# find which deps are missing
for i in $deps; do
if [ "${i#\!}" != "$i" ]; then
$APK info -q -e "${i#\!}" \
$APK info --quiet --installed "${i#\!}" \
&& conflicts="$conflicts ${i#\!}"
elif ! deplist_has $i $installed_deps || [ -n "$upgrade" ]; then
missing="$missing $i"
fi
done
if [ -n "$conflicts" ]; then
error "Conflicting package(s) installed:$conflicts"
return 1
fi
if [ -z "$install_deps" ] && [ -z "$recursive" ]; then
# if we dont have any missing deps we are done now
[ -z "$missing" ] && return 0
......@@ -1511,7 +1511,7 @@ builddeps() {
--virtual .makedepends-$pkgname $deps \
&& return 0
fi
[ -z "$recursive" ] && return 1
# find dependencies that are installed but missing in repo.
......@@ -1521,7 +1521,7 @@ builddeps() {
missing="$missing $i"
fi
done
for i in $(deptrace $missing); do
# i = pkg:dir
local dir=${i#*:}
......@@ -1529,7 +1529,7 @@ builddeps() {
# ignore if dependency is in other repo
[ -d "$dir" ] || continue
# break circular deps
list_has $pkg $ABUILD_VISITED && continue
export ABUILD_VISITED="$ABUILD_VISITED $pkg"
......@@ -1538,7 +1538,7 @@ builddeps() {
cd "$dir" && $0 $forceroot $keep $quiet $install_deps \
$recursive $upgrade $color_opt abuildindex || return 1
done
$SUDO_APK add -u --repository "$abuildrepo" \
$SUDO_APK add --upgrade --repository "$abuildrepo" \
$apk_opt_wait \
--virtual .makedepends-$pkgname $deps
}
......@@ -1670,7 +1670,8 @@ post_add() {
post_add $i || return 1
fi
done
$SUDO_APK add $apk_opt_wait -u "$pkgf" || die "Failed to install $1"
$SUDO_APK add $apk_opt_wait --upgrade "$pkgf" \
|| die "Failed to install $1"
}
installdeps() {
......@@ -1766,7 +1767,7 @@ usage() {
echo " -k Keep built packages, even if APKBUILD or sources are newer"
echo " -m Disable colors (monochrome)"
echo " -p Set package destination directory"
echo " -P Set PKGDEST to REPODEST/<repo>/\$CARCH, where repo is the parents dir name"
echo " -P Set PKGDEST to REPODEST/<repo>/\$CARCH, where repo is the parents dir name"
echo " -q Quiet"
echo " -r Install missing dependencies from system repository (using sudo)"
echo " -R Recursively build and install missing dependencies (using sudo)"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment