[build] Fixing runtime check/save of last updated file for package data tarball
This commit is contained in:
8
configure
vendored
8
configure
vendored
@@ -592,6 +592,7 @@ PACKAGE_STRING='libpostal 0.1'
|
|||||||
PACKAGE_BUGREPORT=''
|
PACKAGE_BUGREPORT=''
|
||||||
PACKAGE_URL=''
|
PACKAGE_URL=''
|
||||||
|
|
||||||
|
ac_unique_file="src"
|
||||||
# Factoring default headers for most tests.
|
# Factoring default headers for most tests.
|
||||||
ac_includes_default="\
|
ac_includes_default="\
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -632,6 +633,7 @@ ac_header_list=
|
|||||||
ac_subst_vars='am__EXEEXT_FALSE
|
ac_subst_vars='am__EXEEXT_FALSE
|
||||||
am__EXEEXT_TRUE
|
am__EXEEXT_TRUE
|
||||||
LTLIBOBJS
|
LTLIBOBJS
|
||||||
|
LIBPOSTAL_DATA_UPDATED_PATH
|
||||||
HAVE_STAT_FALSE
|
HAVE_STAT_FALSE
|
||||||
HAVE_STAT_TRUE
|
HAVE_STAT_TRUE
|
||||||
HAVE_DATE_STAT_FALSE
|
HAVE_DATE_STAT_FALSE
|
||||||
@@ -2993,6 +2995,7 @@ END
|
|||||||
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
|
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case `pwd` in
|
case `pwd` in
|
||||||
*\ * | *\ *)
|
*\ * | *\ *)
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
|
||||||
@@ -11609,6 +11612,7 @@ CC="$lt_save_CC"
|
|||||||
# Only expand once:
|
# Only expand once:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ac_config_headers="$ac_config_headers config.h"
|
ac_config_headers="$ac_config_headers config.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -12621,6 +12625,10 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
LAST_UPDATED_PATH=$srcdir/libpostal_data_last_updated
|
||||||
|
LIBPOSTAL_DATA_UPDATED_PATH=$LAST_UPDATED_PATH
|
||||||
|
|
||||||
|
|
||||||
cat >confcache <<\_ACEOF
|
cat >confcache <<\_ACEOF
|
||||||
# This file is a shell script that caches the results of configure
|
# This file is a shell script that caches the results of configure
|
||||||
# tests run on this system so they can be shared between configure
|
# tests run on this system so they can be shared between configure
|
||||||
|
|||||||
@@ -50,4 +50,7 @@ AC_CONFIG_FILES([Makefile
|
|||||||
AM_CONDITIONAL([HAVE_DATE_STAT], [date -r . >/dev/null 2>&1])
|
AM_CONDITIONAL([HAVE_DATE_STAT], [date -r . >/dev/null 2>&1])
|
||||||
AM_CONDITIONAL([HAVE_STAT], [stat -f %Sm . >/dev/null 2>&1])
|
AM_CONDITIONAL([HAVE_STAT], [stat -f %Sm . >/dev/null 2>&1])
|
||||||
|
|
||||||
|
LAST_UPDATED_PATH=$srcdir/libpostal_data_last_updated
|
||||||
|
AC_SUBST([LIBPOSTAL_DATA_UPDATED_PATH], $LAST_UPDATED_PATH)
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
ifeq ("$(wildcard $(LIBPOSTAL_DATA_LAST_UPDATED))", "")
|
|
||||||
LAST_MODIFIED_DATE = $(EPOCH_DATE)
|
|
||||||
else
|
|
||||||
LAST_MODIFIED_DATE = $(call get_last_modified,$(LIBPOSTAL_DATA_LAST_UPDATED))
|
|
||||||
endif
|
|
||||||
@@ -26,45 +26,43 @@ LIBPOSTAL_S3_BUCKET_NAME = libpostal
|
|||||||
LIBPOSTAL_S3_BUCKET_URL = http://$(LIBPOSTAL_S3_BUCKET_NAME).s3.amazonaws.com
|
LIBPOSTAL_S3_BUCKET_URL = http://$(LIBPOSTAL_S3_BUCKET_NAME).s3.amazonaws.com
|
||||||
LIBPOSTAL_DATA_FILE = libpostal_data.tar.gz
|
LIBPOSTAL_DATA_FILE = libpostal_data.tar.gz
|
||||||
|
|
||||||
|
LIBPOSTAL_DATA_DIR = $(datadir)/libpostal/
|
||||||
|
|
||||||
EPOCH_DATE = Jan 1 00:00:00 1970
|
EPOCH_DATE = Jan 1 00:00:00 1970
|
||||||
|
|
||||||
LIBPOSTAL_DATA_DIR = $(datadir)/libpostal/
|
LAST_MODIFIED_DATE = $(EPOCH_DATE)
|
||||||
LIBPOSTAL_DATA_LAST_UPDATED = $(LIBPOSTAL_DATA_DIR)libpostal_data_last_updated
|
|
||||||
|
|
||||||
if HAVE_DATE_STAT
|
if HAVE_DATE_STAT
|
||||||
USE_DATE_STAT = 1
|
USE_DATE_STAT = 1
|
||||||
|
|
||||||
define get_last_modified
|
|
||||||
$(shell date -d "@$$(shell cat $1)")
|
|
||||||
endef
|
|
||||||
|
|
||||||
else
|
else
|
||||||
if HAVE_STAT
|
if HAVE_STAT
|
||||||
USE_STAT = 1
|
USE_STAT = 1
|
||||||
|
|
||||||
define get_last_modified
|
|
||||||
$(shell date -r "$(shell cat $1)")
|
|
||||||
endef
|
|
||||||
|
|
||||||
else
|
else
|
||||||
$(error Cannot get file modification date on this platform);
|
$(error Cannot get file modification date on this platform);
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(eval include $(srcdir)/Makefile.LastModified)
|
|
||||||
|
|
||||||
libpostal_data_mkdir:
|
libpostal_data_mkdir:
|
||||||
mkdir -p $(LIBPOSTAL_DATA_DIR)
|
mkdir -p $(LIBPOSTAL_DATA_DIR)
|
||||||
|
|
||||||
libpostal_data.tar.gz: libpostal_data_mkdir
|
libpostal_data_updated:
|
||||||
if [ `curl $(LIBPOSTAL_S3_BUCKET_URL)/$(LIBPOSTAL_DATA_FILE) -z "$(LAST_MODIFIED_DATE)" --silent --remote-time -o $(LIBPOSTAL_DATA_DIR)$(LIBPOSTAL_DATA_FILE) -w %{http_code}` = "200" ]; then \
|
if [ ! -e @LIBPOSTAL_DATA_UPDATED_PATH@ ]; then \
|
||||||
if [ "x$(USE_DATE_STAT)" != "x" ]; then \
|
echo "$(EPOCH_DATE)" > @LIBPOSTAL_DATA_UPDATED_PATH@; \
|
||||||
echo $$(date -d"$$(date -d "@$$(date -r $(LIBPOSTAL_DATA_DIR)$(LIBPOSTAL_DATA_FILE)) +%s") + 1 second" +%s) > $(LIBPOSTAL_DATA_LAST_UPDATED); \
|
fi;
|
||||||
elif [ "x$(USE_STAT)" != "x" ]; then \
|
|
||||||
echo $$(date -r $$(stat -f %m $(LIBPOSTAL_DATA_DIR)$(LIBPOSTAL_DATA_FILE)) -v+1S +%s) > $(LIBPOSTAL_DATA_LAST_UPDATED); \
|
libpostal_data.tar.gz: libpostal_data_mkdir libpostal_data_updated
|
||||||
fi; \
|
if [ $$(curl $(LIBPOSTAL_S3_BUCKET_URL)/$(LIBPOSTAL_DATA_FILE) -z "$$(cat @LIBPOSTAL_DATA_UPDATED_PATH@)" --silent --remote-time -o $(LIBPOSTAL_DATA_DIR)$(LIBPOSTAL_DATA_FILE) -w %{http_code}) = "200" ]; then \
|
||||||
tar -xvzf $(LIBPOSTAL_DATA_DIR)$(LIBPOSTAL_DATA_FILE) -C $(LIBPOSTAL_DATA_DIR); \
|
if [ "x$(USE_DATE_STAT)" != "x" ]; then \
|
||||||
|
echo $$(date -d "$$(date -d "@$$(date -r $(LIBPOSTAL_DATA_DIR)$(LIBPOSTAL_DATA_FILE) +%s)") + 1 second") > @LIBPOSTAL_DATA_UPDATED_PATH@; \
|
||||||
|
elif [ "x$(USE_STAT)" != "x" ]; then \
|
||||||
|
echo $$(date -r $$(stat -f %m $(LIBPOSTAL_DATA_DIR)$(LIBPOSTAL_DATA_FILE)) -v+1S) > @LIBPOSTAL_DATA_UPDATED_PATH@; \
|
||||||
|
fi; \
|
||||||
|
tar -xvzf $(LIBPOSTAL_DATA_DIR)$(LIBPOSTAL_DATA_FILE) -C $(LIBPOSTAL_DATA_DIR); \
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
address_dictionary_builder: address_dictionary_builder.c
|
address_dictionary_builder: address_dictionary_builder.c
|
||||||
|
|||||||
Reference in New Issue
Block a user