[mapnik] 02/05: Imported Upstream version 3.0.12+ds

Bas Couwenberg sebastic at debian.org
Thu Sep 8 14:52:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mapnik.

commit 1335c793e9fd26aacfda0b536ed8557aeded8255
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Sep 8 15:17:07 2016 +0200

    Imported Upstream version 3.0.12+ds
---
 .travis.yml                                |   4 +-
 CHANGELOG.md                               |   8 +-
 Makefile                                   |   3 +
 appveyor.yml                               |   1 -
 include/mapnik/image.hpp                   |   1 -
 include/mapnik/image_impl.hpp              |  40 ++++----
 include/mapnik/warning_ignore.hpp          |   2 -
 scripts/build-appveyor.bat                 |  11 ++-
 scripts/build-local.bat                    |   5 -
 scripts/ensure_test_data.sh                |  24 +++--
 scripts/get-boost-icu-version-from-sdk.ps1 |  21 +++++
 scripts/parse-appveyor-yml.ps1             |   7 --
 scripts/publish_release.sh                 | 147 ++++++++++++++++++++++++-----
 scripts/test_release.sh                    |  65 +++++++++++++
 scripts/time-header                        |   2 +-
 test/unit/imaging/image.cpp                |  26 +++++
 16 files changed, 289 insertions(+), 78 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 2e54ffb..bc4d546 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -92,11 +92,11 @@ script:
  - export SCONSFLAGS='--debug=time'
  - configure BENCHMARK=${BENCH}
  - cat config.log
- # we limit the `make` to 35 min
+ # we limit the `make` to 40 min
  # to ensure that slow builds still upload their
  # ccache results and therefore should be faster
  # (and might work) for the next build
- - DURATION=2100
+ - DURATION=2400
  - scripts/travis-command-wrapper.py -s "date" -i 120 --deadline=$(( $(date +%s) + ${DURATION} )) make
  - make test
  - enabled ${COVERAGE} coverage
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b47dab..1551687 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,9 +8,9 @@ For a complete change history, see the git log.
 
 ## 3.0.12
 
-Released: xx-xx-xx
+Released: September 8, 2016
 
-(Packaged from xxxxxx)
+(Packaged from 1d22d86)
 
 #### Summary
 
@@ -41,6 +41,10 @@ Released: xx-xx-xx
 - GeoJSON - exposed `num_features_to_query` as datasource paramer (ref #3495)
 - Replaced `boost::mpl::vector<Types...>` with `std::tuple<Types...>` (ref #3503)
 - BuildingSymbolizer - fixed closing segment of polygon in building symbolizer (ref #3505)
+- Update dependencies versions
+- Fixed warnings when compiling with g++5
+- Fixed image swap (ref #3513)
+- Stop bundling testdata in source tarball (ref #3335)
 
 ## 3.0.11
 
diff --git a/Makefile b/Makefile
index 910951d..752791b 100755
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,9 @@ install:
 release:
 	./scripts/publish_release.sh
 
+test-release:
+	./scripts/test_release.sh
+
 python:
 	if [ ! -d ./bindings/python ]; then git clone git at github.com:mapnik/python-mapnik.git --recursive ./bindings/python; else (cd bindings/python && git pull && git submodule update --init); fi;
 	make
diff --git a/appveyor.yml b/appveyor.yml
index d4450d7..1511191 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,6 +1,5 @@
 environment:
   msvs_toolset: 14
-  BOOST_VERSION: 61
   FASTBUILD: 1
   matrix:
     - platform: x64
diff --git a/include/mapnik/image.hpp b/include/mapnik/image.hpp
index 13b21c8..da2f773 100644
--- a/include/mapnik/image.hpp
+++ b/include/mapnik/image.hpp
@@ -76,7 +76,6 @@ public:
 private:
     detail::image_dimensions<65535> dimensions_;
     detail::buffer buffer_;
-    pixel_type *pData_;
     double offset_;
     double scaling_;
     bool premultiplied_alpha_;
diff --git a/include/mapnik/image_impl.hpp b/include/mapnik/image_impl.hpp
index c756547..f340d9a 100644
--- a/include/mapnik/image_impl.hpp
+++ b/include/mapnik/image_impl.hpp
@@ -62,7 +62,6 @@ template <typename T>
 image<T>::image()
     : dimensions_(0,0),
       buffer_(0),
-      pData_(nullptr),
       offset_(0.0),
       scaling_(1.0),
       premultiplied_alpha_(false),
@@ -73,7 +72,6 @@ template <typename T>
 image<T>::image(int width, int height, unsigned char* data, bool premultiplied, bool painted)
     : dimensions_(width, height),
       buffer_(data, width * height * sizeof(pixel_size)),
-      pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
       offset_(0.0),
       scaling_(1.0),
       premultiplied_alpha_(premultiplied),
@@ -83,15 +81,14 @@ template <typename T>
 image<T>::image(int width, int height, bool initialize, bool premultiplied, bool painted)
     : dimensions_(width, height),
       buffer_(dimensions_.width() * dimensions_.height() * pixel_size),
-      pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
       offset_(0.0),
       scaling_(1.0),
       premultiplied_alpha_(premultiplied),
       painted_(painted)
 {
-    if (pData_ && initialize)
+    if (initialize)
     {
-        std::fill(pData_, pData_ + dimensions_.width() * dimensions_.height(), 0);
+        std::fill(begin(), end(), 0);
     }
 }
 
@@ -99,7 +96,6 @@ template <typename T>
 image<T>::image(image<T> const& rhs)
     : dimensions_(rhs.dimensions_),
       buffer_(rhs.buffer_),
-      pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
       offset_(rhs.offset_),
       scaling_(rhs.scaling_),
       premultiplied_alpha_(rhs.premultiplied_alpha_),
@@ -109,14 +105,12 @@ template <typename T>
 image<T>::image(image<T> && rhs) noexcept
     : dimensions_(std::move(rhs.dimensions_)),
       buffer_(std::move(rhs.buffer_)),
-      pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
       offset_(rhs.offset_),
       scaling_(rhs.scaling_),
       premultiplied_alpha_(rhs.premultiplied_alpha_),
       painted_(rhs.painted_)
 {
     rhs.dimensions_ = { 0, 0 };
-    rhs.pData_ = nullptr;
 }
 
 template <typename T>
@@ -153,14 +147,14 @@ template <typename T>
 inline typename image<T>::pixel_type& image<T>::operator() (std::size_t i, std::size_t j)
 {
     assert(i < dimensions_.width() && j < dimensions_.height());
-    return pData_[j * dimensions_.width() + i];
+    return *get_row(j, i);
 }
 
 template <typename T>
 inline const typename image<T>::pixel_type& image<T>::operator() (std::size_t i, std::size_t j) const
 {
     assert(i < dimensions_.width() && j < dimensions_.height());
-    return pData_[j * dimensions_.width() + i];
+    return *get_row(j, i);
 }
 
 template <typename T>
@@ -190,19 +184,19 @@ inline std::size_t image<T>::row_size() const
 template <typename T>
 inline void image<T>::set(pixel_type const& t)
 {
-    std::fill(pData_, pData_ + dimensions_.width() * dimensions_.height(), t);
+    std::fill(begin(), end(), t);
 }
 
 template <typename T>
 inline const typename image<T>::pixel_type* image<T>::data() const
 {
-    return pData_;
+    return reinterpret_cast<const pixel_type*>(buffer_.data());
 }
 
 template <typename T>
 inline typename image<T>::pixel_type* image<T>::data()
 {
-    return pData_;
+    return reinterpret_cast<pixel_type*>(buffer_.data());
 }
 
 template <typename T>
@@ -219,40 +213,40 @@ inline unsigned char* image<T>::bytes()
 
 // iterator interface
 template <typename T>
-inline typename image<T>::iterator image<T>::begin() { return pData_; }
+inline typename image<T>::iterator image<T>::begin() { return data(); }
 
 template <typename T>
-inline typename image<T>::iterator image<T>::end() { return pData_ + dimensions_.width() * dimensions_.height(); }
+inline typename image<T>::iterator image<T>::end() { return data() + dimensions_.width() * dimensions_.height(); }
 
 template <typename T>
-inline typename image<T>::const_iterator image<T>::begin() const { return pData_; }
+inline typename image<T>::const_iterator image<T>::begin() const { return data(); }
 
 template <typename T>
-inline typename image<T>::const_iterator image<T>::end() const{ return pData_ + dimensions_.width() * dimensions_.height(); }
+inline typename image<T>::const_iterator image<T>::end() const{ return data() + dimensions_.width() * dimensions_.height(); }
 
 
 template <typename T>
 inline typename image<T>::pixel_type const* image<T>::get_row(std::size_t row) const
 {
-    return pData_ + row * dimensions_.width();
+    return data() + row * dimensions_.width();
 }
 
 template <typename T>
 inline const typename image<T>::pixel_type* image<T>::get_row(std::size_t row, std::size_t x0) const
 {
-    return pData_ + row * dimensions_.width() + x0;
+    return data() + row * dimensions_.width() + x0;
 }
 
 template <typename T>
 inline typename image<T>::pixel_type* image<T>::get_row(std::size_t row)
 {
-    return pData_ + row * dimensions_.width();
+    return data() + row * dimensions_.width();
 }
 
 template <typename T>
 inline typename image<T>::pixel_type* image<T>::get_row(std::size_t row, std::size_t x0)
 {
-    return pData_ + row * dimensions_.width() + x0;
+    return data() + row * dimensions_.width() + x0;
 }
 
 template <typename T>
@@ -260,7 +254,7 @@ inline void image<T>::set_row(std::size_t row, pixel_type const* buf, std::size_
 {
     assert(row < dimensions_.height());
     assert(size <= dimensions_.width());
-    std::copy(buf, buf + size, pData_ + row * dimensions_.width());
+    std::copy(buf, buf + size, get_row(row));
 }
 
 template <typename T>
@@ -268,7 +262,7 @@ inline void image<T>::set_row(std::size_t row, std::size_t x0, std::size_t x1, p
 {
     assert(row < dimensions_.height());
     assert ((x1 - x0) <= dimensions_.width() );
-    std::copy(buf, buf + (x1 - x0), pData_ + row * dimensions_.width() + x0);
+    std::copy(buf, buf + (x1 - x0), get_row(row, x0));
 }
 
 template <typename T>
diff --git a/include/mapnik/warning_ignore.hpp b/include/mapnik/warning_ignore.hpp
index 6be432f..ccbf169 100644
--- a/include/mapnik/warning_ignore.hpp
+++ b/include/mapnik/warning_ignore.hpp
@@ -47,7 +47,6 @@
 #pragma GCC diagnostic ignored "-Wreserved-id-macro"
 #pragma GCC diagnostic ignored "-Wweak-vtables"
 #pragma GCC diagnostic ignored "-Wextra-semi"
-#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"
 #pragma GCC diagnostic ignored "-Wglobal-constructors"
 #pragma GCC diagnostic ignored "-Wheader-hygiene"
 #pragma GCC diagnostic ignored "-Wexit-time-destructors"
@@ -55,4 +54,3 @@
 #pragma GCC diagnostic ignored "-Wmissing-noreturn"
 #pragma GCC diagnostic ignored "-Wcovered-switch-default"
 #pragma GCC diagnostic ignored "-Wfloat-equal"
-
diff --git a/scripts/build-appveyor.bat b/scripts/build-appveyor.bat
index 84088d4..d1fc084 100644
--- a/scripts/build-appveyor.bat
+++ b/scripts/build-appveyor.bat
@@ -22,7 +22,6 @@ ECHO msvs_toolset^: %msvs_toolset%
 SET BUILD_TYPE=%configuration%
 SET BUILDPLATFORM=%platform%
 SET TOOLS_VERSION=%msvs_toolset%.0
-SET ICU_VERSION=56.1
 ECHO ICU_VERSION^: %ICU_VERSION%
 IF DEFINED APPVEYOR (ECHO on AppVeyor) ELSE (ECHO NOT on AppVeyor)
 ECHO ========
@@ -63,6 +62,16 @@ ECHO extracting binary deps
 IF EXIST mapnik-sdk (ECHO already extracted) ELSE (7z -y x deps.7z | %windir%\system32\FIND "ing archive")
 IF %ERRORLEVEL% NEQ 0 GOTO ERROR
 
+
+ECHO looking for boost and icu versions in SDK ...
+FOR /F "tokens=1,2 usebackq" %%i in (`powershell %APPVEYOR_BUILD_FOLDER%\scripts\get-boost-icu-version-from-sdk.ps1`) DO SET %%i=%%j
+IF %ERRORLEVEL% NEQ 0 GOTO ERROR
+
+ECHO BOOST_VERSION found in SDK^: %BOOST_VERSION%
+ECHO ICU_VERSION found in SDK^: %ICU_VERSION%
+ECHO ICU_VERSION2 found in SDK^: %ICU_VERSION2%
+
+
 CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
 IF %ERRORLEVEL% NEQ 0 GOTO ERROR
 
diff --git a/scripts/build-local.bat b/scripts/build-local.bat
index 306e10c..5a27b9b 100644
--- a/scripts/build-local.bat
+++ b/scripts/build-local.bat
@@ -10,11 +10,6 @@ SET APPVEYOR=true
 SET LOCAL_BUILD_DONT_SKIP_TESTS=true
 SET FASTBUILD=1
 
-FOR /F "tokens=1 usebackq" %%i in (`powershell .\scripts\parse-appveyor-yml.ps1`) DO SET BOOST_VERSION=%%i
-ECHO BOOST_VERSION found in appveyor.yml^: %BOOST_VERSION%
-IF "%BOOST_VERSION%"=="0" ECHO BOOST_VERSION not valid && SET ERRORLEVEL=1 && GOTO ERROR
-
-
 :: OVERRIDE PARAMETERS >>>>>>>>
 :NEXT-ARG
 
diff --git a/scripts/ensure_test_data.sh b/scripts/ensure_test_data.sh
index 288dcd8..312a9aa 100755
--- a/scripts/ensure_test_data.sh
+++ b/scripts/ensure_test_data.sh
@@ -3,17 +3,21 @@
 set -eu
 set -o pipefail
 
-VERSION=$(git describe)
-
-if [[ -d .git ]]; then
-    git submodule update --init
-else
-    if [[ ! -d ./test/data-visual ]]; then
-        echo "Downloading visual test data from https://github.com/mapnik/test-data-visual/archive/${VERSION}.tar.gz"
-        curl -L -s https://github.com/mapnik/test-data-visual/archive/${VERSION}.tar.gz | tar zxf - --strip-components=1 -C test/data-visual/
-    fi
+if [[ -f RELEASE_VERSION.md ]]; then
+    VERSION=$(cat RELEASE_VERSION.md)
     if [[ ! -d ./test/data ]]; then
         echo "Downloading unit test data from https://github.com/mapnik/test-data/archive/${VERSION}.tar.gz"
-        curl -L -s https://github.com/mapnik/test-data/archive/${VERSION}.tar.gz | tar zxf - --strip-components=1 -C test/data/
+        mkdir -p test/data/
+        curl -f -L -s https://github.com/mapnik/test-data/archive/${VERSION}.tar.gz | tar zxf - --strip-components=1 -C test/data/
     fi
+    if [[ ! -d ./test/data-visual ]]; then
+        echo "Downloading visual test data from https://github.com/mapnik/test-data-visual/archive/${VERSION}.tar.gz"
+        mkdir -p test/data-visual/
+        curl -f -L -s https://github.com/mapnik/test-data-visual/archive/${VERSION}.tar.gz | tar zxf - --strip-components=1 -C test/data-visual/
+    fi
+elif [[ -d .git ]]; then
+    git submodule update --init test/
+else
+    echo "Expected either git clone directory (with .git) or release tarball with `RELEASE_VERSION.md` in root"
+    exit 1
 fi
\ No newline at end of file
diff --git a/scripts/get-boost-icu-version-from-sdk.ps1 b/scripts/get-boost-icu-version-from-sdk.ps1
new file mode 100644
index 0000000..a24c319
--- /dev/null
+++ b/scripts/get-boost-icu-version-from-sdk.ps1
@@ -0,0 +1,21 @@
+$ErrorActionPreference = 'Stop'
+$boost_version='0'
+$icu_version='0'
+$libdir=$PSScriptRoot+"\..\mapnik-gyp\mapnik-sdk\lib"
+
+#get boost and icu versions directly from the files in the SDK
+
+#boost_python-vc140-mt-1_61.dll
+$boost_version=(Get-ChildItem $libdir -Filter *boost*.dll)[0].BaseName.split("_")[-1]
+
+#icuin56.dll
+$icu_version=(Get-ChildItem $libdir -Filter icuin*.dll)[0].BaseName.split("icuin")[-1]
+
+Write-Host "BOOST_VERSION" $boost_version
+Write-Host "ICU_VERSION" $icu_version".1"
+Write-Host "ICU_VERSION2" $icu_version"_1"
+
+trap {
+    "Error: $_"
+    exit 1
+}
diff --git a/scripts/parse-appveyor-yml.ps1 b/scripts/parse-appveyor-yml.ps1
deleted file mode 100644
index f87ae7e..0000000
--- a/scripts/parse-appveyor-yml.ps1
+++ /dev/null
@@ -1,7 +0,0 @@
-$ErrorActionPreference = 'Stop'
-$boost_version='0'
-Get-Content .\appveyor.yml |
-    foreach { 
-        if ($_ -match "BOOST_VERSION: "){ $boost_version = $_.split()[-1] }
-    }
-Write-Host $boost_version
diff --git a/scripts/publish_release.sh b/scripts/publish_release.sh
index b881c2a..7ff8749 100755
--- a/scripts/publish_release.sh
+++ b/scripts/publish_release.sh
@@ -1,35 +1,136 @@
-#!/usr/bin/env bash
+#!/bin/bash
 
 set -eu
 set -o pipefail
 
-# for normal release leave empty
-# for release candidate, add "-rcN"
+: '
+
+Usage:
+
+  git tag v3.0.12-rc7 -a -m "Tagging v3.0.12-rc7"
+  ./scripts/publish_release.sh
+
+Note: before running this script you need to tag a new release or release candidate.
+
+This script:
+
+ - confirms that the current git checkout is a valid tag
+ - Downloads a fresh checkout to a /tmp directory
+ - Updates the submodules
+ - Confirms that the test-data and test-data-visual is also tagged, otherwise tags them
+ - Removes the test-data and test-data-visual since they are large and can be downloaded dynamically for released code
+ - Creates a tarball and uploads to a DRAFT "github release"
+
+After using this script:
+
+ - Go to https://github.com/mapnik/mapnik/releases and confirm that the draft release looks good, then publish it.
+
+'
+
+function step { >&2 echo -e "\033[1m\033[36m* $1\033[0m"; }
+function step_error { >&2 echo -e "\033[1m\033[31m$1\033[0m"; }
+
+if [[ ${GITHUB_TOKEN_MAPNIK_PUBLIC_REPO:-false} == false ]]; then
+    step_error "Please set GITHUB_TOKEN_MAPNIK_PUBLIC_REPO to a github token with 'public_repo' scope (create one at https://github.com/settings/tokens)"
+    exit 1
+fi
+
 export MAPNIK_VERSION=$(git describe)
-export TARBALL_NAME="mapnik-v${MAPNIK_VERSION}"
+if [[ $(git tag -l) =~ $MAPNIK_VERSION ]]; then
+    step "Success: found $MAPNIK_VERSION (result of git describe) in tags, continuing"
+else
+    step_error "error: $MAPNIK_VERSION (result of git describe) not in "git tag -l" output, aborting"
+    step_error "You must create a valid annotated tag first, before running this ./scripts/publish_release.sh"
+    exit 1
+fi
+
+# alternatively set this to `git at github.com:mapnik/mapnik.git` to pull public tag
+export ROOT_GIT_CLONE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../ && pwd )"
+
+export TARBALL_NAME="mapnik-${MAPNIK_VERSION}"
 cd /tmp/
 rm -rf ${TARBALL_NAME}
-echo "Cloning v${MAPNIK_VERSION}"
-git clone --depth 1 --branch v${MAPNIK_VERSION} git at github.com:mapnik/mapnik.git ${TARBALL_NAME}
+step "Cloning ${MAPNIK_VERSION}"
+git clone --depth 1 --branch ${MAPNIK_VERSION} ${ROOT_GIT_CLONE} ${TARBALL_NAME}
 cd ${TARBALL_NAME}
-git checkout "tags/v${MAPNIK_VERSION}"
-echo "updating submodules"
-git submodule update --depth 100 --init
+step "Checking out ${MAPNIK_VERSION}"
+git checkout "tags/${MAPNIK_VERSION}"
+
+step "checking submodules"
+step "vendorizing and cleaning up mapbox variant"
+git submodule update --init deps/mapbox/variant
 rm -rf deps/mapbox/variant/.git
-cd test/data/
-git remote set-url origin git at github.com:mapnik/test-data
-git tag v${MAPNIK_VERSION} -a -m "tagging for v${MAPNIK_VERSION}"
-git push --tags
-cd ../../
-rm -rf test/data/
-cd test/data-visual/
-git remote set-url origin git at github.com:mapnik/test-data-visual
-git tag v${MAPNIK_VERSION} -a -m "tagging for v${MAPNIK_VERSION}"
-git push --tags
-cd ../../
-rm -rf test/data-visual/
+rm -f deps/mapbox/variant/*yml
+rm -f deps/mapbox/variant/Jamroot
+
+function check_and_tag() {
+    REPO_DIR=$1
+    REPO_NAME=$2
+    cmd="curl --fail -I https://github.com/mapnik/${REPO_NAME}/releases/tag/${MAPNIK_VERSION}"
+    if [[ $(${cmd}) ]]; then
+        step "test data already tagged, no need to initialize submodule"
+    else
+        step "tagging test data"
+        git submodule update --depth 100 --init ${REPO_DIR}
+        cd ${REPO_DIR}/
+        git remote set-url origin git at github.com:mapnik/${REPO_NAME}
+        git tag ${MAPNIK_VERSION} -a -m "tagging for ${MAPNIK_VERSION}"
+        git push --tags
+        cd ../../
+        step "removing test data submodule"
+        rm -rf ${REPO_DIR}/
+    fi
+
+}
+
+# test data
+check_and_tag test/data test-data
+# test data visual
+check_and_tag test/data-visual test-data-visual
+
+step "removing .git and .gitignore"
 rm -rf .git
 rm -rf .gitignore
+export TARBALL_COMPRESSED=${TARBALL_NAME}.tar.bz2
+echo ${MAPNIK_VERSION} > RELEASE_VERSION.md
+step "creating tarball of ${TARBALL_COMPRESSED}"
 cd ../
-tar cjf ${TARBALL_NAME}.tar.bz2 ${TARBALL_NAME}/
-#aws s3 cp --acl public-read ${TARBALL_NAME}.tar.bz2 s3://mapnik/dist/v${MAPNIK_VERSION}/
+tar cjf ${TARBALL_COMPRESSED} ${TARBALL_NAME}/
+step "uploading to github"
+# https://developer.github.com/v3/repos/releases/#create-a-release
+IS_PRERELEASE=false
+if [[ ${MAPNIK_VERSION} =~ 'rc' ]] || [[ ${MAPNIK_VERSION} =~ 'alpha' ]]; then
+  IS_PRERELEASE=true
+fi
+IS_DRAFT=true
+step "creating a draft release"
+
+export CHANGELOG_REF=$(python -c "print '${MAPNIK_VERSION}'.replace('.','').replace('v','').split('-')[0]")
+export RELEASE_NOTES="Mapnik ${MAPNIK_VERSION}\r\n\r\n[Changelog](https://github.com/mapnik/mapnik/blob/${MAPNIK_VERSION}/CHANGELOG.md#${CHANGELOG_REF})"
+step "release notes: $RELEASE_NOTES"
+
+# create draft release
+curl --data "{\"tag_name\": \"${MAPNIK_VERSION}\",\"target_commitish\": \"master\",\"name\": \"${MAPNIK_VERSION}\",\"body\": \"${RELEASE_NOTES}\",\"draft\": ${IS_DRAFT},\"prerelease\": ${IS_PRERELEASE}}" \
+https://api.github.com/repos/mapnik/mapnik/releases?access_token=${GITHUB_TOKEN_MAPNIK_PUBLIC_REPO} \
+> create_response.json
+cat create_response.json
+# parse out upload url and form it up to post tarball
+UPLOAD_URL=$(python -c "import json;print json.load(open('create_response.json'))['upload_url'].replace('{?name,label}','?name=${TARBALL_COMPRESSED}')")
+HTML_URL=$(python -c "import json;print json.load(open('create_response.json'))['html_url']")
+
+step "upload url: $UPLOAD_URL"
+
+# upload source tarball
+curl ${UPLOAD_URL} \
+-X POST \
+-H "Authorization: token ${GITHUB_TOKEN_MAPNIK_PUBLIC_REPO}" \
+-H "Content-Type:application/octet-stream" \
+--data-binary @${TARBALL_COMPRESSED}
+
+echo
+step "Success: view your new draft release at ${HTML_URL}"
+open ${HTML_URL}
+echo
+
+#step "uploading $(realpath ${TARBALL_COMPRESSED}) to s3://mapnik/dist/${MAPNIK_VERSION}/"
+#aws s3 cp --acl public-read ${TARBALL_COMPRESSED} s3://mapnik/dist/${MAPNIK_VERSION}/
diff --git a/scripts/test_release.sh b/scripts/test_release.sh
new file mode 100755
index 0000000..735068d
--- /dev/null
+++ b/scripts/test_release.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+set -eu
+set -o pipefail
+
+: '
+
+Note: before running this script you need to tag and publish a new release (it can be a draft)
+
+Usage:
+
+  ./scripts/test_release.sh
+
+This script:
+
+ - Downloads the latest release tarball from github
+ - Builds it and runs tests
+
+'
+
+function step { >&2 echo -e "\033[1m\033[36m* $1\033[0m"; }
+function step_error { >&2 echo -e "\033[1m\033[31m$1\033[0m"; }
+
+if [[ ${GITHUB_TOKEN_MAPNIK_PUBLIC_REPO:-false} == false ]]; then
+    step_error "Please set GITHUB_TOKEN_MAPNIK_PUBLIC_REPO to a github token with 'public_repo' scope (create one at https://github.com/settings/tokens)"
+    exit 1
+fi
+
+export MAPNIK_VERSION="$(git describe)"
+if [[ $(git tag -l) =~ ${MAPNIK_VERSION} ]]; then
+    step "Success: found $MAPNIK_VERSION (result of git describe) in tags, continuing"
+else
+    step_error "error: $MAPNIK_VERSION (result of git describe) not in "git tag -l" output, aborting"
+    step_error "You must create a valid annotated tag first, before running this ./scripts/publish_release.sh"
+    exit 1
+fi
+
+curl --fail https://api.github.com/repos/mapnik/mapnik/releases -H "Authorization: token ${GITHUB_TOKEN_MAPNIK_PUBLIC_REPO}" > /tmp/mapnik-releases.json
+RELEASE_ASSET_NAME=$(python -c "import json;print json.load(open('/tmp/mapnik-releases.json'))[0]['assets'][0]['name']")
+if [[ ${RELEASE_ASSET_NAME} == "mapnik-${MAPNIK_VERSION}.tar.bz2" ]]; then
+    step "Successfully found release asset to test: mapnik-${MAPNIK_VERSION}.tar.bz2"
+else
+    step_error "Error: did not find correct release asset to test: mapnik-${MAPNIK_VERSION}.tar.bz2"
+    exit 1
+fi
+
+export RELEASE_ASSET_URL=$(python -c "import json;print json.load(open('/tmp/mapnik-releases.json'))[0]['assets'][0]['url']")
+step "Downloading ${RELEASE_ASSET_URL}"
+mkdir -p /tmp/build-mapnik-${MAPNIK_VERSION}/
+rm -rf /tmp/build-mapnik-${MAPNIK_VERSION}/*
+cd /tmp/build-mapnik-${MAPNIK_VERSION}/
+# note: curl passes the "Authorization" header to redirects such that this breaks aws
+# hence we need a two step approach here to downloading rather than depending on -L
+
+# first a head request to get the download redirect
+curl -I -f ${RELEASE_ASSET_URL} -H "Accept: application/octet-stream" -H "Authorization: token ${GITHUB_TOKEN_MAPNIK_PUBLIC_REPO}" > redirect.json
+# now download from the github s3 location after stripping bogus newline
+export RELEASE_ASSET_S3=$(cat redirect.json | grep location | cut -d' ' -f2 | tr '\r' ' ')
+curl --retry 3 -f -S -L "${RELEASE_ASSET_S3}" -o mapnik-${MAPNIK_VERSION}.tar.bz2
+tar xf mapnik-${MAPNIK_VERSION}.tar.bz2
+cd mapnik-${MAPNIK_VERSION}
+source bootstrap.sh
+./configure CXX="$(pwd)/mason_packages/.link/bin/ccache clang++"
+make
+make test
diff --git a/scripts/time-header b/scripts/time-header
index 97c3c69..7561e5e 100755
--- a/scripts/time-header
+++ b/scripts/time-header
@@ -6,4 +6,4 @@ set -o pipefail
 CXXFLAGS="$(./utils/mapnik-config/mapnik-config --cflags)"
 CXX="$(./utils/mapnik-config/mapnik-config --cxx)"
 echo "Time taken to compile '$(basename $1)':"
-time ${CXX} $1 -I./test -I./deps/agg/include -Ideps -I./include $CXXFLAGS -o /tmp/header.out
\ No newline at end of file
+time ${CXX} $1 -I./test -I./deps/agg/include -Ideps -I./deps/mapbox/variant/include -I./include $CXXFLAGS -o /tmp/header.out
\ No newline at end of file
diff --git a/test/unit/imaging/image.cpp b/test/unit/imaging/image.cpp
index 2024953..bf9a44d 100644
--- a/test/unit/imaging/image.cpp
+++ b/test/unit/imaging/image.cpp
@@ -363,4 +363,30 @@ SECTION("Image copy/move")
     }
 }
 
+SECTION("image::swap")
+{
+    auto blue = mapnik::color(50, 50, 250).rgba();
+    auto orange = mapnik::color(250, 150, 0).rgba();
+
+    mapnik::image_rgba8 im;
+    mapnik::image_rgba8 im2(16, 16);
+    mapnik::image_rgba8 im3(16, 16);
+
+    im2.set(blue);
+    im3.set(orange);
+
+    // swap two non-empty images
+    CHECK_NOTHROW(im2.swap(im3));
+    CHECK(im2(0, 0) == orange);
+    CHECK(im3(0, 0) == blue);
+
+    // swap empty <-> non-empty
+    CHECK_NOTHROW(im.swap(im3));
+    CHECK(im3.data() == nullptr);
+    CHECKED_IF(im.data() != nullptr)
+    {
+        CHECK(im(0, 0) == blue);
+    }
+}
+
 } // END TEST CASE

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapnik.git



More information about the Pkg-grass-devel mailing list