makepkg: code cleanup

* Collapse some if statements (Andrew Fyfe)
* Add some E_ exit designations

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-06-02 11:45:17 -04:00
parent e19d7da4f9
commit 9883c157f9

View file

@ -431,8 +431,6 @@ generate_checksums() {
echo ")" echo ")"
done done
exit 0 # $E_OK
} }
check_checksums() { check_checksums() {
@ -946,15 +944,15 @@ while [ "$#" -ne "0" ]; do
--source) SOURCEONLY=1 ;; --source) SOURCEONLY=1 ;;
--help) --help)
usage usage
exit 0 exit 0 #E_OK
;; ;;
--version) --version)
version version
exit 0 exit 0 #E_OK
;; ;;
--*) --*)
usage usage
exit 1 exit 1 #E_INVALID_OPTION
;; ;;
-*) -*)
while getopts "bcCdefFghiLmop:rRsS-" opt; do while getopts "bcCdefFghiLmop:rRsS-" opt; do
@ -977,11 +975,11 @@ while [ "$#" -ne "0" ]; do
s) DEP_BIN=1 ;; s) DEP_BIN=1 ;;
h) h)
usage usage
exit 0 exit 0 #E_OK
;; ;;
V) V)
version version
exit 0 exit 0 #E_OK
;; ;;
-) -)
OPTIND=0 OPTIND=0
@ -989,7 +987,7 @@ while [ "$#" -ne "0" ]; do
;; ;;
*) *)
usage usage
exit 1 exit 1 #E_INVALID_OPTION
;; ;;
esac esac
done done
@ -1210,37 +1208,30 @@ else
warning "$(gettext "pacman was not found in PATH; skipping dependency checks.")" warning "$(gettext "pacman was not found in PATH; skipping dependency checks.")"
fi fi
# get back to our src directory so we can begin with sources
cd "$startdir" cd "$startdir"
mkdir -p src mkdir -p src
cd "$srcdir" cd "$srcdir"
if [ "$GENINTEG" = "1" ]; then
download_sources
generate_checksums
exit 0 # $E_OK
fi
if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then
warning "$(gettext "Skipping source retrieval -- using existing src/ tree")" warning "$(gettext "Skipping source retrieval -- using existing src/ tree")"
else
download_sources
fi
if [ "$GENINTEG" = "1" ]; then
generate_checksums
fi
if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then
warning "$(gettext "Skipping source integrity checks -- using existing src/ tree")" warning "$(gettext "Skipping source integrity checks -- using existing src/ tree")"
else
check_checksums
fi
#Extract sources
if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then
warning "$(gettext "Skipping source extraction -- using existing src/ tree")" warning "$(gettext "Skipping source extraction -- using existing src/ tree")"
else else
download_sources
check_checksums
extract_sources extract_sources
fi fi
if [ "$NOBUILD" = "1" ]; then if [ "$NOBUILD" = "1" ]; then
msg "$(gettext "Sources are ready.")" msg "$(gettext "Sources are ready.")"
exit 0 exit 0 #E_OK
else else
# check for existing pkg directory; don't remove if we are repackaging # check for existing pkg directory; don't remove if we are repackaging
if [ -d "$pkgdir" -a "$REPKG" = "0" ]; then if [ -d "$pkgdir" -a "$REPKG" = "0" ]; then
@ -1284,6 +1275,6 @@ msg "$(gettext "Finished making: %s")" "$pkgname ($date)"
installpackage installpackage
exit 0 exit 0 #E_OK
# vim: set ts=2 sw=2 noet: # vim: set ts=2 sw=2 noet: