summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am16
-rw-r--r--doc/Makefile.am2
-rw-r--r--lib/libalpm/be_local.c38
-rw-r--r--lib/libalpm/conflict.c3
-rw-r--r--lib/libalpm/group.c2
-rw-r--r--lib/libalpm/handle.c5
-rw-r--r--lib/libalpm/package.c2
-rw-r--r--lib/libalpm/package.h2
-rw-r--r--scripts/makepkg.sh.in194
-rw-r--r--src/pacman/package.c9
-rw-r--r--src/util/testdb.c8
11 files changed, 167 insertions, 114 deletions
diff --git a/Makefile.am b/Makefile.am
index e08b809b..7d6f3065 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,14 +23,22 @@ dist_pkgdata_DATA = \
proto/ChangeLog.proto
# run the pactest test suite and vercmp tests
-check-local: test/pacman test/scripts test/util src/pacman src/util
+check-local: test-pacman test-pacsort test-vercmp test-parseopts
+
+test-pacman: test/pacman src/pacman
LC_ALL=C $(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
--test $(top_srcdir)/test/pacman/tests/*.py \
-p $(top_builddir)/src/pacman/pacman
- $(SH) $(top_srcdir)/test/util/pacsorttest.sh \
+
+test-pacsort: test/util src/util
+ $(BASH_SHELL) $(top_srcdir)/test/util/pacsorttest.sh \
$(top_builddir)/src/util/pacsort
- $(SH) $(top_srcdir)/test/util/vercmptest.sh \
+
+test-vercmp: test/util src/util
+ $(BASH_SHELL) $(top_srcdir)/test/util/vercmptest.sh \
$(top_builddir)/src/util/vercmp
+
+test-parseopts: test/scripts scripts
$(BASH_SHELL) $(top_srcdir)/test/scripts/parseopts_test.sh \
$(top_srcdir)/scripts/library/parseopts.sh
@@ -45,4 +53,6 @@ update-po:
$(MAKE) -C scripts/po update-po
$(MAKE) -C src/pacman/po update-po
+.PHONY: test-pacman test-pacsort test-vercmp test-parseopts update-po
+
# vim:set ts=2 sw=2 noet:
diff --git a/doc/Makefile.am b/doc/Makefile.am
index a2018c71..e6ed29c0 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -92,6 +92,8 @@ html: $(HTML_DOCS)
website: website.tar.gz
+.PHONY: html website
+
website.tar.gz: html
$(AM_V_GEN)bsdtar czf $@ $(HTML_DOCS) \
asciidoc-override.css \
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 39df15b0..aab6718f 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -783,7 +783,8 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
/* DESC */
if(inforeq & INFRQ_DESC) {
char *path;
- _alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
+ _alpm_log(db->handle, ALPM_LOG_DEBUG,
+ "writing %s-%s DESC information back to db\n",
info->name, info->version);
path = _alpm_local_db_pkgpath(db, info, "desc");
if(!path || (fp = fopen(path, "w")) == NULL) {
@@ -800,26 +801,10 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
fprintf(fp, "%%DESC%%\n"
"%s\n\n", info->desc);
}
- if(info->groups) {
- fputs("%GROUPS%\n", fp);
- for(lp = info->groups; lp; lp = lp->next) {
- fputs(lp->data, fp);
- fputc('\n', fp);
- }
- fputc('\n', fp);
- }
if(info->url) {
fprintf(fp, "%%URL%%\n"
"%s\n\n", info->url);
}
- if(info->licenses) {
- fputs("%LICENSE%\n", fp);
- for(lp = info->licenses; lp; lp = lp->next) {
- fputs(lp->data, fp);
- fputc('\n', fp);
- }
- fputc('\n', fp);
- }
if(info->arch) {
fprintf(fp, "%%ARCH%%\n"
"%s\n\n", info->arch);
@@ -845,6 +830,22 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
fprintf(fp, "%%REASON%%\n"
"%u\n\n", info->reason);
}
+ if(info->groups) {
+ fputs("%GROUPS%\n", fp);
+ for(lp = info->groups; lp; lp = lp->next) {
+ fputs(lp->data, fp);
+ fputc('\n', fp);
+ }
+ fputc('\n', fp);
+ }
+ if(info->licenses) {
+ fputs("%LICENSE%\n", fp);
+ for(lp = info->licenses; lp; lp = lp->next) {
+ fputs(lp->data, fp);
+ fputc('\n', fp);
+ }
+ fputc('\n', fp);
+ }
if(info->validation) {
fputs("%VALIDATION%\n", fp);
if(info->validation & ALPM_PKG_VALIDATION_NONE) {
@@ -875,7 +876,8 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
/* FILES */
if(inforeq & INFRQ_FILES) {
char *path;
- _alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
+ _alpm_log(db->handle, ALPM_LOG_DEBUG,
+ "writing %s-%s FILES information back to db\n",
info->name, info->version);
path = _alpm_local_db_pkgpath(db, info, "files");
if(!path || (fp = fopen(path, "w")) == NULL) {
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 85429029..5714932c 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -547,7 +547,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
* consideration cannot itself be a link, as it might be unowned- path
* components can be safely checked as all directories are "unowned". */
if(!resolved_conflict && dbpkg && !S_ISLNK(lsbuf.st_mode)) {
- char *rpath = calloc(PATH_MAX, sizeof(char));
+ char rpath[PATH_MAX];
if(realpath(path, rpath)) {
const char *relative_rpath = rpath + rootlen;
if(_alpm_filelist_contains(alpm_pkg_get_files(dbpkg), relative_rpath)) {
@@ -556,7 +556,6 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
resolved_conflict = 1;
}
}
- free(rpath);
}
/* is the file unowned and in the backup list of the new package? */
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index 4f4d8ce0..7c3d64f7 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -30,7 +30,7 @@
alpm_group_t *_alpm_group_new(const char *name)
{
- alpm_group_t* grp;
+ alpm_group_t *grp;
CALLOC(grp, 1, sizeof(alpm_group_t), return NULL);
STRDUP(grp->name, name, free(grp); return NULL);
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 2db27fbf..816162bd 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -333,7 +333,7 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
char **storage, int must_exist)
{
struct stat st;
- char *real = NULL;
+ char real[PATH_MAX];
const char *path;
path = value;
@@ -344,9 +344,7 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
return ALPM_ERR_NOT_A_DIR;
}
- CALLOC(real, PATH_MAX, sizeof(char), return ALPM_ERR_MEMORY);
if(!realpath(path, real)) {
- free(real);
return ALPM_ERR_NOT_A_DIR;
}
path = real;
@@ -359,7 +357,6 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
if(!*storage) {
return ALPM_ERR_MEMORY;
}
- free(real);
return 0;
}
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index a1d75a75..46d14731 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -461,7 +461,7 @@ int _alpm_files_cmp(const void *f1, const void *f2)
alpm_pkg_t *_alpm_pkg_new(void)
{
- alpm_pkg_t* pkg;
+ alpm_pkg_t *pkg;
CALLOC(pkg, 1, sizeof(alpm_pkg_t), return NULL);
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index be779b46..c473549a 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -128,7 +128,7 @@ struct __alpm_pkg_t {
alpm_file_t *_alpm_file_copy(alpm_file_t *dest, const alpm_file_t *src);
int _alpm_files_cmp(const void *f1, const void *f2);
-alpm_pkg_t* _alpm_pkg_new(void);
+alpm_pkg_t *_alpm_pkg_new(void);
int _alpm_pkg_dup(alpm_pkg_t *pkg, alpm_pkg_t **new_ptr);
void _alpm_pkg_free(alpm_pkg_t *pkg);
void _alpm_pkg_free_trans(alpm_pkg_t *pkg);
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 125f68c7..d1251b84 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -168,7 +168,7 @@ clean_up() {
# clean up dangling symlinks to packages
for pkg in ${pkgname[@]}; do
- for file in ${pkg}-*-*-${CARCH}{${PKGEXT},${SRCEXT}}; do
+ for file in ${pkg}-*-*-*{${PKGEXT},${SRCEXT}}; do
if [[ -h $file && ! -e $file ]]; then
rm -f "$file"
fi
@@ -261,50 +261,92 @@ get_full_version() {
}
##
+# usage : get_pkg_arch( [$pkgname] )
+# return : architecture of the package
+##
+get_pkg_arch() {
+ if [[ -z $1 ]]; then
+ if [[ $arch = "any" ]]; then
+ printf "%s\n" "any"
+ else
+ printf "%s\n" "$CARCH"
+ fi
+ else
+ local arch_override
+ eval $(declare -f package_$1 | sed -n 's/\(^[[:space:]]*arch=\)/arch_override=/p')
+ if [[ $arch_override = "any" ]]; then
+ printf "%s\n" "any"
+ else
+ printf "%s\n" "$CARCH"
+ fi
+ fi
+}
+
+##
# Checks to see if options are present in makepkg.conf or PKGBUILD;
# PKGBUILD options always take precedence.
#
-# usage : check_option( $option )
-# return : y - enabled
-# n - disabled
-# ? - not found
+# usage : check_option( $option, $expected_val )
+# return : 0 - matches expected
+# 1 - does not match expected
+# 127 - not found
##
check_option() {
- local ret=$(in_opt_array "$1" ${options[@]})
- if [[ $ret != '?' ]]; then
- printf "%s\n" "$ret"
- return
- fi
+ in_opt_array "$1" ${options[@]}
+ case $? in
+ 0) # assert enabled
+ [[ $2 = y ]]
+ return ;;
+ 1) # assert disabled
+ [[ $2 = n ]]
+ return
+ esac
# fall back to makepkg.conf options
- ret=$(in_opt_array "$1" ${OPTIONS[@]})
- if [[ $ret != '?' ]]; then
- printf "%s\n" "$ret"
- return
- fi
+ in_opt_array "$1" ${OPTIONS[@]}
+ case $? in
+ 0) # assert enabled
+ [[ $2 = y ]]
+ return ;;
+ 1) # assert disabled
+ [[ $2 = n ]]
+ return
+ esac
- echo '?' # Not Found
+ # not found
+ return 127
}
##
# Check if option is present in BUILDENV
#
-# usage : check_buildenv( $option )
-# return : y - enabled
-# n - disabled
-# ? - not found
+# usage : check_buildenv( $option, $expected_val )
+# return : 0 - matches expected
+# 1 - does not match expected
+# 127 - not found
##
check_buildenv() {
in_opt_array "$1" ${BUILDENV[@]}
+ case $? in
+ 0) # assert enabled
+ [[ $2 = "y" ]]
+ return ;;
+ 1) # assert disabled
+ [[ $2 = "n" ]]
+ return ;;
+ esac
+
+ # not found
+ return 127
}
##
# usage : in_opt_array( $needle, $haystack )
-# return : y - enabled
-# n - disabled
-# ? - not found
+# return : 0 - enabled
+# 1 - disabled
+# 127 - not found
##
in_opt_array() {
local needle=$1; shift
@@ -312,15 +354,16 @@ in_opt_array() {
local opt
for opt in "$@"; do
if [[ $opt = "$needle" ]]; then
- echo 'y' # Enabled
- return
+ # enabled
+ return 0
elif [[ $opt = "!$needle" ]]; then
- echo 'n' # Disabled
- return
+ # disabled
+ return 1
fi
done
- echo '?' # Not Found
+ # not found
+ return 127
}
@@ -910,12 +953,12 @@ run_function() {
local pkgfunc="$1"
# clear user-specified buildflags if requested
- if [[ $(check_option buildflags) = "n" ]]; then
+ if check_option "buildflags" "n"; then
unset CFLAGS CXXFLAGS LDFLAGS
fi
# clear user-specified makeflags if requested
- if [[ $(check_option makeflags) = "n" ]]; then
+ if check_option "makeflags" "n"; then
unset MAKEFLAGS
fi
@@ -962,13 +1005,13 @@ run_function() {
run_build() {
# use distcc if it is requested (check buildenv and PKGBUILD opts)
- if [[ $(check_buildenv distcc) = "y" && $(check_option distcc) != "n" ]]; then
+ if check_buildenv "distcc" "y" && ! check_option "distc" "n"; then
[[ -d /usr/lib/distcc/bin ]] && export PATH="/usr/lib/distcc/bin:$PATH"
export DISTCC_HOSTS
fi
# use ccache if it is requested (check buildenv and PKGBUILD opts)
- if [[ $(check_buildenv ccache) = "y" && $(check_option ccache) != "n" ]]; then
+ if check_buildenv "ccache" "y" && ! check_option "ccache" "n"; then
[[ -d /usr/lib/ccache/bin ]] && export PATH="/usr/lib/ccache/bin:$PATH"
fi
@@ -994,12 +1037,12 @@ tidy_install() {
cd_safe "$pkgdir"
msg "$(gettext "Tidying install...")"
- if [[ $(check_option docs) = "n" && -n ${DOC_DIRS[*]} ]]; then
+ if check_option "docs" "n" && [[ -n ${DOC_DIRS[*]} ]]; then
msg2 "$(gettext "Removing doc files...")"
rm -rf -- ${DOC_DIRS[@]}
fi
- if [[ $(check_option purge) = "y" && -n ${PURGE_TARGETS[*]} ]]; then
+ if check_option "purge" "y" && [[ -n ${PURGE_TARGETS[*]} ]]; then
msg2 "$(gettext "Purging unwanted files...")"
local pt
for pt in "${PURGE_TARGETS[@]}"; do
@@ -1011,7 +1054,7 @@ tidy_install() {
done
fi
- if [[ $(check_option zipman) = "y" && -n ${MAN_DIRS[*]} ]]; then
+ if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then
msg2 "$(gettext "Compressing man and info pages...")"
local manpage ext file link hardlinks hl
find ${MAN_DIRS[@]} -type f 2>/dev/null |
@@ -1047,13 +1090,13 @@ tidy_install() {
done
fi
- if [[ $(check_option strip) = "y" ]]; then
+ if check_option "strip" "y"; then
msg2 "$(gettext "Stripping unneeded symbols from binaries and libraries...")"
# make sure library stripping variables are defined to prevent excess stripping
[[ -z ${STRIP_SHARED+x} ]] && STRIP_SHARED="-S"
[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
local binary
- find . -type f -perm -u+w 2>/dev/null | while read binary ; do
+ find . -type f -perm -u+w -print0 2>/dev/null | while read -d '' binary ; do
case "$(file -bi "$binary")" in
*application/x-sharedlib*) # Libraries (.so)
strip $STRIP_SHARED "$binary";;
@@ -1065,17 +1108,17 @@ tidy_install() {
done
fi
- if [[ $(check_option libtool) = "n" ]]; then
+ if check_option "libtool" "n"; then
msg2 "$(gettext "Removing "%s" files...")" "libtool"
find . ! -type d -name "*.la" -exec rm -f -- '{}' \;
fi
- if [[ $(check_option emptydirs) = "n" ]]; then
+ if check_option "emptydirs" "n"; then
msg2 "$(gettext "Removing empty directories...")"
find . -depth -type d -empty -delete
fi
- if [[ $(check_option upx) = "y" ]]; then
+ if check_option "upx" "y"; then
msg2 "$(gettext "Compressing binaries with %s...")" "UPX"
local binary
find . -type f -perm -u+w 2>/dev/null | while read binary ; do
@@ -1201,7 +1244,7 @@ write_pkginfo() {
printf "builddate = %s\n" "$builddate"
printf "packager = %s\n" "$packager"
printf "size = %s\n" "$size"
- printf "arch = %s\n" "$PKGARCH"
+ printf "arch = %s\n" "$pkgarch"
[[ $license ]] && printf "license = %s\n" "${license[@]}"
[[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}"
@@ -1234,14 +1277,15 @@ write_pkginfo() {
done
for it in "${packaging_options[@]}"; do
- local ret="$(check_option $it)"
- if [[ $ret != "?" ]]; then
- if [[ $ret = "y" ]]; then
+ check_option "$it" "y"
+ case $? in
+ 0)
printf "makepkgopt = %s\n" "$it"
- else
+ ;;
+ 1)
printf "makepkgopt = %s\n" "!$it"
- fi
- fi
+ ;;
+ esac
done
check_license
@@ -1287,11 +1331,7 @@ create_package() {
nameofpkg="$1"
fi
- if [[ $arch = "any" ]]; then
- PKGARCH="any"
- else
- PKGARCH=$CARCH
- fi
+ pkgarch=$(get_pkg_arch)
write_pkginfo $nameofpkg > .PKGINFO
@@ -1313,7 +1353,7 @@ create_package() {
msg2 "$(gettext "Compressing package...")"
local fullver=$(get_full_version)
- local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${PKGARCH}${PKGEXT}"
+ local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${pkgarch}${PKGEXT}"
local ret=0
[[ -f $pkg_file ]] && rm -f "$pkg_file"
@@ -1465,17 +1505,14 @@ install_package() {
msg "$(gettext "Installing %s package group with %s...")" "$pkgbase" "$PACMAN -U"
fi
- local fullver pkg pkglist
+ local fullver pkgarch pkg pkglist
for pkg in ${pkgname[@]}; do
fullver=$(get_full_version $pkg)
- if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT} ]]; then
- pkglist+=" $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT}"
- else
- pkglist+=" $PKGDEST/${pkg}-${fullver}-any${PKGEXT}"
- fi
+ pkgarch=$(get_pkg_arch $pkg)
+ pkglist+=("$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}")
done
- if ! run_pacman -U $pkglist; then
+ if ! run_pacman -U ${pkglist[@]}; then
warning "$(gettext "Failed to install built package(s).")"
return 0
fi
@@ -1653,12 +1690,12 @@ check_software() {
# check for sudo if we will need it during makepkg execution
if (( ! ( ASROOT || INFAKEROOT ) && ( DEP_BIN || RMDEPS || INSTALL ) )); then
if ! type -p sudo >/dev/null; then
- warning "$(gettext "Sudo can not be found. Will use su to acquire root privileges.")"
+ warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "sudo" "su"
fi
fi
# fakeroot - building as non-root user
- if [[ $(check_buildenv fakeroot) = "y" ]] && (( EUID > 0 )); then
+ if check_buildenv "fakeroot" "y" && (( EUID > 0 )); then
if ! type -p fakeroot >/dev/null; then
error "$(gettext "Cannot find the %s binary required for building as non-root user.")" "fakeroot"
ret=1
@@ -1666,7 +1703,7 @@ check_software() {
fi
# gpg - package signing
- if [[ $SIGNPKG == 'y' || (-z "$SIGNPKG" && $(check_buildenv sign) == 'y') ]]; then
+ if [[ $SIGNPKG == 'y' ]] || { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; }; then
if ! type -p gpg >/dev/null; then
error "$(gettext "Cannot find the %s binary required for signing packages.")" "gpg"
ret=1
@@ -1690,7 +1727,7 @@ check_software() {
fi
# upx - binary compression
- if [[ $(check_option upx) == 'y' ]]; then
+ if check_option "upx" "y"; then
if ! type -p upx >/dev/null; then
error "$(gettext "Cannot find the %s binary required for compressing binaries.")" "upx"
ret=1
@@ -1698,7 +1735,7 @@ check_software() {
fi
# distcc - compilation with distcc
- if [[ $(check_buildenv distcc) = "y" && $(check_option distcc) != "n" ]]; then
+ if check_buildenv "distcc" "y" && ! check_option "distcc" "n" ]]; then
if ! type -p distcc >/dev/null; then
error "$(gettext "Cannot find the %s binary required for distributed compilation.")" "distcc"
ret=1
@@ -1706,7 +1743,7 @@ check_software() {
fi
# ccache - compilation with ccache
- if [[ $(check_buildenv ccache) = "y" && $(check_option ccache) != "n" ]]; then
+ if check_buildenv "ccache" "y" && ! check_option "ccache" "n"; then
if ! type -p ccache >/dev/null; then
error "$(gettext "Cannot find the %s binary required for compiler cache usage.")" "ccache"
ret=1
@@ -1714,7 +1751,7 @@ check_software() {
fi
# strip - strip symbols from binaries/libraries
- if [[ $(check_option strip) = "y" ]]; then
+ if check_option "strip" "y"; then
if ! type -p strip >/dev/null; then
error "$(gettext "Cannot find the %s binary required for object file stripping.")" "strip"
ret=1
@@ -1722,7 +1759,7 @@ check_software() {
fi
# gzip - compressig man and info pages
- if [[ $(check_option zipman) = "y" ]]; then
+ if check_option "zipman" "y"; then
if ! type -p gzip >/dev/null; then
error "$(gettext "Cannot find the %s binary required for compressing man and info pages.")" "gzip"
ret=1
@@ -2062,7 +2099,7 @@ PACMAN=${PACMAN:-pacman}
# check if messages are to be printed using color
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
-if [[ -t 2 && ! $USE_COLOR = "n" && $(check_buildenv color) = "y" ]]; then
+if [[ -t 2 && ! $USE_COLOR = "n" ]] && check_buildenv "color" "y"; then
# prefer terminal safe colored and bold text when tput is supported
if tput setaf 0 &>/dev/null; then
ALL_OFF="$(tput sgr0)"
@@ -2146,7 +2183,7 @@ use the %s option.")" "makepkg" "--asroot"
error "$(gettext "The %s option is meant for the root user only. Please\n\
rerun %s without the %s flag.")" "--asroot" "makepkg" "--asroot"
exit 1 # $E_USER_ABORT
- elif (( EUID > 0 )) && [[ $(check_buildenv fakeroot) != "y" ]]; then
+ elif (( EUID > 0 )) && ! check_buildenv "fakeroot" "y"; then
warning "$(gettext "Running %s as an unprivileged user will result in non-root\n\
ownership of the packaged files. Try using the %s environment by\n\
placing %s in the %s array in %s.")" "makepkg" "fakeroot" "'fakeroot'" "BUILDENV" "$MAKEPKG_CONF"
@@ -2230,7 +2267,7 @@ if declare -f build >/dev/null; then
fi
if declare -f check >/dev/null; then
# "Hide" check() function if not going to be run
- if [[ $RUN_CHECK = 'y' || (! $(check_buildenv check) = "n" && ! $RUN_CHECK = "n") ]]; then
+ if [[ $RUN_CHECK = 'y' ]] || { ! check_buildenv "check" "n" && [[ $RUN_CHECK != "n" ]]; }; then
CHECKFUNC=1
fi
fi
@@ -2246,8 +2283,7 @@ if [[ -n "${PKGLIST[@]}" ]]; then
fi
# check if gpg signature is to be created and if signing key is valid
-[[ -z $SIGNPKG ]] && SIGNPKG=$(check_buildenv sign)
-if [[ $SIGNPKG == 'y' ]]; then
+if { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; } || [[ $SIGNPKG == 'y' ]]; then
if ! gpg --list-key ${GPGKEY} &>/dev/null; then
if [[ ! -z $GPGKEY ]]; then
error "$(gettext "The key %s does not exist in your keyring.")" "${GPGKEY}"
@@ -2261,8 +2297,8 @@ fi
if (( ! SPLITPKG )); then
fullver=$(get_full_version)
- if [[ -f $PKGDEST/${pkgname}-${fullver}-${CARCH}${PKGEXT} \
- || -f $PKGDEST/${pkgname}-${fullver}-any${PKGEXT} ]] \
+ pkgarch=$(get_pkg_arch)
+ if [[ -f $PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT} ]] \
&& ! (( FORCE || SOURCEONLY || NOBUILD )); then
if (( INSTALL )); then
warning "$(gettext "A package has already been built, installing existing package...")"
@@ -2278,8 +2314,8 @@ else
somepkgbuilt=0
for pkg in ${pkgname[@]}; do
fullver=$(get_full_version $pkg)
- if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT} \
- || -f $PKGDEST/${pkg}-${fullver}-any${PKGEXT} ]]; then
+ pkgarch=$(get_pkg_arch $pkg)
+ if [[ -f $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT} ]]; then
somepkgbuilt=1
else
allpkgbuilt=0
@@ -2361,7 +2397,7 @@ if (( SOURCEONLY )); then
cd_safe "$startdir"
# if we are root or if fakeroot is not enabled, then we don't use it
- if [[ $(check_buildenv fakeroot) != "y" ]] || (( EUID == 0 )); then
+ if ! check_buildenv "fakeroot" "y" || (( EUID == 0 )); then
create_srcpackage
else
enter_fakeroot
@@ -2453,7 +2489,7 @@ else
cd_safe "$startdir"
# if we are root or if fakeroot is not enabled, then we don't use it
- if [[ $(check_buildenv fakeroot) != "y" ]] || (( EUID == 0 )); then
+ if ! check_buildenv "fakeroot" "y" || (( EUID == 0 )); then
if (( ! REPKG )); then
devel_update
(( BUILDFUNC )) && run_build
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 57bf6cef..fe04d407 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -175,7 +175,14 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No"), cols);
}
- list_display(_("Validated By :"), validation, cols);
+ if(from == ALPM_PKG_FROM_SYNCDB && extra) {
+ string_display(_("MD5 Sum :"), alpm_pkg_get_md5sum(pkg), cols);
+ string_display(_("SHA256 Sum :"), alpm_pkg_get_sha256sum(pkg), cols);
+ string_display(_("Signatures :"),
+ alpm_pkg_get_base64_sig(pkg) ? _("Yes") : _("None"), cols);
+ } else {
+ list_display(_("Validated By :"), validation, cols);
+ }
if(from == ALPM_PKG_FROM_FILE) {
alpm_siglist_t siglist;
diff --git a/src/util/testdb.c b/src/util/testdb.c
index f3a7b659..2017b60f 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -253,7 +253,7 @@ static void usage(void)
int main(int argc, char *argv[])
{
- int ret = 0;
+ int errors = 0;
alpm_errno_t err;
const char *dbpath = DBPATH;
int a = 1;
@@ -285,13 +285,13 @@ int main(int argc, char *argv[])
alpm_option_set_logcb(handle, output_cb);
if(!dbnames) {
- ret = check_localdb();
+ errors = check_localdb();
} else {
- ret = check_syncdbs(dbnames);
+ errors = check_syncdbs(dbnames);
alpm_list_free(dbnames);
}
- cleanup(ret);
+ cleanup(errors > 0);
}
/* vim: set ts=2 sw=2 noet: */