Skip to content

Commit

Permalink
Merge pull request #3115 from garrettbslone/s3-portability
Browse files Browse the repository at this point in the history
content-s3: add support for different versions of libs3
  • Loading branch information
mergify[bot] committed Aug 7, 2020
2 parents 93dcbc9 + ea1f649 commit 0bf0800
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,21 @@ jobs:
env:
- TEST_INSTALL=t
- DOCKER_TAG=t
- name: "Centos 7: security,caliper,docker-deploy"
- name: "Centos 7: security,caliper,enable-content-s3,docker-deploy"
stage: test
compiler: gcc
env:
- IMG=centos7
- DOCKER_TAG=t
- name: "Centos 8: security,caliper,docker-deploy"
- TEST_CONTENT_S3=t
- name: "Centos 8: security,caliper,enable-content-s3,docker-deploy"
stage: test
compiler: gcc
env:
- IMG=centos8
- DOCKER_TAG=t
- PYTHON_VERSION=3.6
- TEST_CONTENT_S3=t

stages:
- 'style checks'
Expand Down
14 changes: 12 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,18 @@ AC_ARG_ENABLE([content-s3],
AS_HELP_STRING([--enable-content-s3], [Enable S3 storage backend]))

AS_IF([test "x$enable_content_s3" = "xyes"], [
X_AC_CHECK_COND_LIB(s3, S3_initialize)
])
X_AC_CHECK_COND_LIB(s3, S3_initialize),
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <libs3.h>],
[S3_create_bucket (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);])],
[AC_DEFINE([HAVE_S3_AUTH_REGION], [1],
[Use libs3 functions with auth region])],
[]),
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <libs3.h>],
[S3_create_bucket (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);])],
[AC_DEFINE([HAVE_S3_TIMEOUT_ARG], [1],
[Use libs3 functions with timeout arg])],
[])
], [])

AM_CONDITIONAL([ENABLE_CONTENT_S3], [test "x$enable_content_s3" = "xyes"])

Expand Down
14 changes: 14 additions & 0 deletions src/modules/content-s3/s3.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@

#include "s3.h"

#if HAVE_S3_AUTH_REGION
#define S3_create_bucket(proto, access, secret, host, buck, acl, loc, req, cb, data) \
S3_create_bucket(proto, access, secret, NULL, host, buck, acl, loc, req, cb, data)
#endif

#if HAVE_S3_TIMEOUT_ARG
#define S3_create_bucket(proto, access, secret, host, buck, acl, loc, req, cb, data) \
S3_create_bucket(proto, access, secret, NULL, host, buck, NULL, acl, loc, req, 0, cb, data)
#define S3_put_object(ctx, key, size, prop, req, cb, data) \
S3_put_object(ctx, key, size, prop, req, 0, cb, data)
#define S3_get_object(ctx, key, cond, start, cnt, req, cb, data) \
S3_get_object(ctx, key, cond, start, cnt, req, 0, cb, data)
#endif

static S3Protocol protocol = S3ProtocolHTTP;
static S3UriStyle uri_style = S3UriStylePath;

Expand Down
4 changes: 4 additions & 0 deletions src/test/docker/travis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ RUN case $BASE_IMAGE in \
esac

# Install extra dependencies if necessary here.
RUN case BASE_IMAGE in \
centos*) yum install -y libs3-devel ;; \
*) (>&2 echo "not installing libs3") ;; \
esac

# Do not forget to run `apt update` on Ubuntu/bionic.
# Do NOT run `yum upgrade` on CentOS (this will unnecessarily upgrade
Expand Down

0 comments on commit 0bf0800

Please sign in to comment.