Factor shell script size command into configure script
Commit 149839c539
introduced a small behavior regression as a drawback
for a better portability. repo-add now includes the approximate size (to the
nearest KB) rather than an exact size due to the switching of the du command
to a more portable form. Instead of sacrificing the exact size, use
configure to help us determine a valid command to acquire our filesize and
place it in the sync database.
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
9609c0f135
commit
282eeadc68
3 changed files with 10 additions and 2 deletions
|
@ -182,18 +182,24 @@ GCC_VISIBILITY_CC
|
||||||
GCC_GNU89_INLINE_CC
|
GCC_GNU89_INLINE_CC
|
||||||
|
|
||||||
# Host-dependant definitions
|
# Host-dependant definitions
|
||||||
|
SIZECMD="stat -c %s"
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
|
*bsd*)
|
||||||
|
SIZECMD="stat -f %z"
|
||||||
|
;;
|
||||||
cygwin*)
|
cygwin*)
|
||||||
host_os_cygwin=yes
|
host_os_cygwin=yes
|
||||||
CFLAGS="$CFLAGS -DCYGWIN"
|
CFLAGS="$CFLAGS -DCYGWIN"
|
||||||
;;
|
;;
|
||||||
darwin*)
|
darwin*)
|
||||||
host_os_darwin=yes
|
host_os_darwin=yes
|
||||||
|
SIZECMD="stat -f %z"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
|
AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
|
||||||
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
|
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
|
||||||
|
AC_SUBST(SIZECMD)
|
||||||
|
|
||||||
# Check for architecture, used in default makepkg.conf
|
# Check for architecture, used in default makepkg.conf
|
||||||
# (Note single space left after CARCHFLAGS)
|
# (Note single space left after CARCHFLAGS)
|
||||||
|
@ -365,6 +371,7 @@ ${PACKAGE_NAME}:
|
||||||
Architecture : ${CARCH}
|
Architecture : ${CARCH}
|
||||||
Architecture flags : ${CARCHFLAGS}
|
Architecture flags : ${CARCHFLAGS}
|
||||||
Host Type : ${CHOST}
|
Host Type : ${CHOST}
|
||||||
|
Filesize command : ${SIZECMD}
|
||||||
|
|
||||||
libalpm version : ${LIB_VERSION}
|
libalpm version : ${LIB_VERSION}
|
||||||
libalpm version info : ${LIB_VERSION_INFO}
|
libalpm version info : ${LIB_VERSION_INFO}
|
||||||
|
|
|
@ -37,6 +37,7 @@ edit = sed \
|
||||||
-e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \
|
-e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \
|
||||||
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
|
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
|
||||||
-e 's|@DBEXT[@]|$(DBEXT)|g' \
|
-e 's|@DBEXT[@]|$(DBEXT)|g' \
|
||||||
|
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
|
||||||
-e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g'
|
-e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g'
|
||||||
|
|
||||||
## All the scripts depend on Makefile so that they are rebuilt when the
|
## All the scripts depend on Makefile so that they are rebuilt when the
|
||||||
|
|
|
@ -122,7 +122,7 @@ db_write_delta()
|
||||||
|
|
||||||
# get md5sum and size of delta
|
# get md5sum and size of delta
|
||||||
md5sum="$(md5sum "$deltafile" | cut -d ' ' -f 1)"
|
md5sum="$(md5sum "$deltafile" | cut -d ' ' -f 1)"
|
||||||
csize=$(du -kL "$deltafile" | awk '{print $1 * 1024}')
|
csize=$(@SIZECMD@ "$deltafile")
|
||||||
|
|
||||||
# ensure variables were found
|
# ensure variables were found
|
||||||
if [ -z "$pkgname" -o -z "$fromver" -o -z "$tover" -o -z "$arch" ]; then
|
if [ -z "$pkgname" -o -z "$fromver" -o -z "$tover" -o -z "$arch" ]; then
|
||||||
|
@ -170,7 +170,7 @@ db_write_entry()
|
||||||
IFS=$OLDIFS
|
IFS=$OLDIFS
|
||||||
|
|
||||||
# get compressed size of package
|
# get compressed size of package
|
||||||
csize=$(du -kL "$pkgfile" | awk '{print $1 * 1024}')
|
csize=$(@SIZECMD@ "$pkgfile")
|
||||||
|
|
||||||
startdir=$(pwd)
|
startdir=$(pwd)
|
||||||
pushd "$gstmpdir" 2>&1 >/dev/null
|
pushd "$gstmpdir" 2>&1 >/dev/null
|
||||||
|
|
Loading…
Add table
Reference in a new issue