Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build 1.1.4-dev #47

Merged
merged 13 commits into from
May 7, 2020
13 changes: 3 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cache:
env:
global:
- REPO_DIR=rasterio
- BUILD_COMMIT=1.1.3
- BUILD_COMMIT=c6c1bf8
- PLAT=x86_64
- UNICODE_WIDTH=32
- USE_CCACHE=1
Expand Down Expand Up @@ -56,13 +56,6 @@ jobs:
- MB_PYTHON_VERSION=3.8
- NP_BUILD_DEP=numpy==1.17.3
- NP_TEST_DEP=numpy==1.17.3
- name: "Python 2.7 osx"
os: osx
language: generic
env:
- MB_PYTHON_VERSION=2.7
- NP_BUILD_DEP=numpy==1.10.4
- NP_TEST_DEP=numpy==1.11.3
- name: "Python 3.5 osx"
os: osx
language: generic
Expand Down Expand Up @@ -95,8 +88,8 @@ jobs:

before_install:
- python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
- BUILD_DEPENDS="$NP_BUILD_DEP cython==0.29.14 wheel==0.31.1"
- TEST_DEPENDS="$NP_TEST_DEP attrs==19.1.0 pytest==4.0.2 click==7.0.0 mock boto3 packaging hypothesis==4.38.1 wheel==0.31.1 $GEN_DEPS"
- BUILD_DEPENDS="$NP_BUILD_DEP cython==0.29.14 wheel==0.34.2"
- TEST_DEPENDS="$NP_TEST_DEP attrs==19.1.0 pytest==4.0.2 click==7.0.0 mock boto3 packaging hypothesis==4.38.1 wheel==0.34.2 $GEN_DEPS"
- source multibuild/common_utils.sh
- source multibuild/travis_steps.sh
- before_install
Expand Down
12 changes: 11 additions & 1 deletion config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ function build_gdal {

fetch_unpack http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz
(cd gdal-${GDAL_VERSION} \
&& patch -u -p2 < ../patches/1937d70990182aef316ac76f0c7c8fb3647259b2.diff \
&& patch -u -p2 < ../patches/2310.diff \
&& ./configure \
--with-crypto=yes \
--with-hide-internal-symbols \
Expand Down Expand Up @@ -313,6 +315,14 @@ function build_wheel_cmd {
# WHEEL_SDIR (optional, default "wheelhouse")
# BUILD_DEPENDS (optional, default "")
# MANYLINUX_URL (optional, default "") (via pip_opts function)

# Update the container's auditwheel with our patched version.
if [ -n "$IS_OSX" ]; then
:
else # manylinux
/opt/python/cp37-cp37m/bin/pip install -I "git+https://github.com/sgillies/auditwheel.git#egg=auditwheel"
fi

local cmd=${1:-pip_wheel_cmd}
local repo_dir=${2:-$REPO_DIR}
[ -z "$repo_dir" ] && echo "repo_dir not defined" && exit 1
Expand All @@ -323,6 +333,6 @@ function build_wheel_cmd {
if [ -n "$BUILD_DEPENDS" ]; then
pip install $(pip_opts) $BUILD_DEPENDS
fi
(cd $repo_dir && $cmd $wheelhouse)
(cd $repo_dir && PIP_NO_BUILD_ISOLATION=0 PIP_USE_PEP517=0 $cmd $wheelhouse)
repair_wheelhouse $wheelhouse
}
7 changes: 2 additions & 5 deletions env_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ PROJ_VERSION=4.9.3
PROJ_DATUMGRID_VERSION=1.8
SQLITE_VERSION=3240000
GDAL_VERSION=2.4.4
OPENSSL_ROOT=openssl-1.0.2o
OPENSSL_HASH=ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d
OPENSSL_DOWNLOAD_URL=https://www.openssl.org/source
CURL_VERSION=7.54.0
NGHTTP2_VERSION=1.35.1
EXPAT_VERSION=2.2.6
NETCDF_VERSION=4.6.2
export MACOSX_DEPLOYMENT_TARGET=10.9
export GDAL_CONFIG=/usr/local/bin/gdal-config
export PACKAGE_DATA=1
export PROJ_LIB=/usr/local/share/proj
export PIP_NO_BUILD_ISOLATION=0
export PIP_USE_PEP517=0
export AUDITWHEEL_EXTRA_LIB_NAME_TAG=rasterio
28 changes: 28 additions & 0 deletions patches/1937d70990182aef316ac76f0c7c8fb3647259b2.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/gdal/frmts/hdf5/gh5_convenience.cpp b/gdal/frmts/hdf5/gh5_convenience.cpp
index 2569f862060..3be3263be44 100644
--- a/gdal/frmts/hdf5/gh5_convenience.cpp
+++ b/gdal/frmts/hdf5/gh5_convenience.cpp
@@ -38,6 +38,11 @@ bool GH5_FetchAttribute( hid_t loc_id, const char *pszAttrName,
CPLString &osResult, bool bReportError )

{
+ if( !bReportError && H5Aexists(loc_id, pszAttrName) <= 0 )
+ {
+ return false;
+ }
+
hid_t hAttr = H5Aopen_name(loc_id, pszAttrName);

osResult.clear();
@@ -91,6 +96,11 @@ bool GH5_FetchAttribute( hid_t loc_id, const char *pszAttrName,
double &dfResult, bool bReportError )

{
+ if( !bReportError && H5Aexists(loc_id, pszAttrName) <= 0 )
+ {
+ return false;
+ }
+
const hid_t hAttr = H5Aopen_name(loc_id, pszAttrName);

dfResult = 0.0;
185 changes: 185 additions & 0 deletions patches/2310.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
diff --git a/gdal/port/cpl_conv.cpp b/gdal/port/cpl_conv.cpp
index 290d561297d..9c047793629 100644
--- a/gdal/port/cpl_conv.cpp
+++ b/gdal/port/cpl_conv.cpp
@@ -78,6 +78,7 @@
#include "cpl_multiproc.h"
#include "cpl_string.h"
#include "cpl_vsi.h"
+#include "cpl_vsil_curl_priv.h"

#ifdef DEBUG
#define OGRAPISPY_ENABLED
@@ -1798,6 +1799,18 @@ CPLGetThreadLocalConfigOption( const char *pszKey, const char *pszDefault )
return pszResult;
}

+/************************************************************************/
+/* NotifyOtherComponentsConfigOptionChanged() */
+/************************************************************************/
+
+static void NotifyOtherComponentsConfigOptionChanged( const char *pszKey,
+ const char * /*pszValue*/ )
+{
+ // Hack
+ if( STARTS_WITH_CI(pszKey, "AWS_") )
+ VSICurlAuthParametersChanged();
+}
+
/************************************************************************/
/* CPLSetConfigOption() */
/************************************************************************/
@@ -1832,6 +1845,8 @@ void CPL_STDCALL
CPLSetConfigOption( const char *pszKey, const char *pszValue )

{
+ NotifyOtherComponentsConfigOptionChanged(pszKey, pszValue);
+
#ifdef DEBUG_CONFIG_OPTIONS
CPLAccessConfigOption(pszKey, FALSE);
#endif
@@ -1885,6 +1900,8 @@ void CPL_STDCALL
CPLSetThreadLocalConfigOption( const char *pszKey, const char *pszValue )

{
+ NotifyOtherComponentsConfigOptionChanged(pszKey, pszValue);
+
#ifdef DEBUG_CONFIG_OPTIONS
CPLAccessConfigOption(pszKey, FALSE);
#endif
diff --git a/gdal/port/cpl_vsil_curl.cpp b/gdal/port/cpl_vsil_curl.cpp
index 41713b0d404..5d49b9da989 100644
--- a/gdal/port/cpl_vsil_curl.cpp
+++ b/gdal/port/cpl_vsil_curl.cpp
@@ -65,6 +65,11 @@ void VSICurlPartialClearCache(const char* )
// Not supported.
}

+void VSICurlAuthParametersChanged()
+{
+ // Not supported.
+}
+
/************************************************************************/
/* VSICurlInstallReadCbk() */
/************************************************************************/
@@ -97,6 +102,17 @@ int VSICurlUninstallReadCbk( VSILFILE* /* fp */ )
static int N_MAX_REGIONS = 1000;
static int DOWNLOAD_CHUNK_SIZE = 16384;

+/***********************************************************ù************/
+/* VSICurlAuthParametersChanged() */
+/************************************************************************/
+
+static unsigned int gnGenerationAuthParameters = 0;
+
+void VSICurlAuthParametersChanged()
+{
+ gnGenerationAuthParameters++;
+}
+
namespace cpl {

/************************************************************************/
@@ -2550,7 +2566,10 @@ VSICurlFilesystemHandler::GetCachedFileProp( const char* pszURL,
{
CPLMutexHolder oHolder( &hMutex );

- return oCacheFileProp.tryGet(std::string(pszURL), oFileProp);
+ return oCacheFileProp.tryGet(std::string(pszURL), oFileProp) &&
+ // Let a chance to use new auth parameters
+ !(oFileProp.eExists == EXIST_NO &&
+ gnGenerationAuthParameters != oFileProp.nGenerationAuthParameters);
}

/************************************************************************/
@@ -2559,10 +2578,11 @@ VSICurlFilesystemHandler::GetCachedFileProp( const char* pszURL,

void
VSICurlFilesystemHandler::SetCachedFileProp( const char* pszURL,
- const FileProp& oFileProp )
+ FileProp& oFileProp )
{
CPLMutexHolder oHolder( &hMutex );

+ oFileProp.nGenerationAuthParameters = gnGenerationAuthParameters;
oCacheFileProp.insert(std::string(pszURL), oFileProp);
}

@@ -2576,7 +2596,9 @@ VSICurlFilesystemHandler::GetCachedDirList( const char* pszURL,
{
CPLMutexHolder oHolder( &hMutex );

- return oCacheDirList.tryGet(std::string(pszURL), oCachedDirList);
+ return oCacheDirList.tryGet(std::string(pszURL), oCachedDirList) &&
+ // Let a chance to use new auth parameters
+ gnGenerationAuthParameters == oCachedDirList.nGenerationAuthParameters;
}

/************************************************************************/
@@ -2585,7 +2607,7 @@ VSICurlFilesystemHandler::GetCachedDirList( const char* pszURL,

void
VSICurlFilesystemHandler::SetCachedDirList( const char* pszURL,
- const CachedDirList& oCachedDirList )
+ CachedDirList& oCachedDirList )
{
CPLMutexHolder oHolder( &hMutex );

@@ -2606,6 +2628,7 @@ VSICurlFilesystemHandler::SetCachedDirList( const char* pszURL,
nCachedFilesInDirList -= oldValue.oFileList.size();
oCacheDirList.remove(oldestKey);
}
+ oCachedDirList.nGenerationAuthParameters = gnGenerationAuthParameters;

nCachedFilesInDirList += oCachedDirList.oFileList.size();
oCacheDirList.insert(key, oCachedDirList);
diff --git a/gdal/port/cpl_vsil_curl_class.h b/gdal/port/cpl_vsil_curl_class.h
index 3121f1cf9de..69ffd273055 100644
--- a/gdal/port/cpl_vsil_curl_class.h
+++ b/gdal/port/cpl_vsil_curl_class.h
@@ -69,6 +69,7 @@ typedef enum
class FileProp
{
public:
+ unsigned int nGenerationAuthParameters = 0;
ExistStatus eExists = EXIST_UNKNOWN;
vsi_l_offset fileSize = 0;
time_t mTime = 0;
@@ -83,6 +84,7 @@ class FileProp
typedef struct
{
bool bGotFileList = false;
+ unsigned int nGenerationAuthParameters = 0;
CPLStringList oFileList{}; /* only file name without path */
} CachedDirList;

@@ -244,7 +246,7 @@ class VSICurlFilesystemHandler : public VSIFilesystemHandler
bool GetCachedFileProp( const char* pszURL,
FileProp& oFileProp );
void SetCachedFileProp( const char* pszURL,
- const FileProp& oFileProp );
+ FileProp& oFileProp );
void InvalidateCachedData( const char* pszURL );

CURLM *GetCurlMultiHandleFor( const CPLString& osURL );
@@ -256,7 +258,7 @@ class VSICurlFilesystemHandler : public VSIFilesystemHandler
bool GetCachedDirList( const char* pszURL,
CachedDirList& oCachedDirList );
void SetCachedDirList( const char* pszURL,
- const CachedDirList& oCachedDirList );
+ CachedDirList& oCachedDirList );
bool ExistsInCacheDirList( const CPLString& osDirname, bool *pbIsDir );

virtual CPLString GetURLFromFilename( const CPLString& osFilename );
diff --git a/gdal/port/cpl_vsil_curl_priv.h b/gdal/port/cpl_vsil_curl_priv.h
index 63710fbb1a5..234c872198a 100644
--- a/gdal/port/cpl_vsil_curl_priv.h
+++ b/gdal/port/cpl_vsil_curl_priv.h
@@ -50,4 +50,6 @@ int VSICurlInstallReadCbk( VSILFILE* fp, VSICurlReadCbkFunc pfnReadCbk,
int bStopOnInterruptUntilUninstall );
int VSICurlUninstallReadCbk( VSILFILE* fp );

+void VSICurlAuthParametersChanged();
+
#endif // CPL_VSIL_CURL_PRIV_H_INCLUDED