Permalink
Browse files

Switch package to deps-upgradeable

  • Loading branch information...
dpb587 committed Aug 4, 2015
1 parent 89fd589 commit 26f115dfd5d80444fee543e17edf198e7d15b485
@@ -0,0 +1,53 @@
#!/bin/bash

# args: package-name dep-name

set -e
set -u

export PACKAGE_NAME="${1}"
export DEP_NAME="${2}"

DEP_DIR="${PWD}/packages/${PACKAGE_NAME}/deps/${DEP_NAME}"
DEP_BLOB_DIR="${PWD}/blobs/${PACKAGE_NAME}-blobs/${DEP_NAME}"


echo "==> ${PACKAGE_NAME}/${DEP_NAME}"


if [ -f "${DEP_DIR}/VERSION" ] ; then
VERSION_LOCAL=$( cat "${DEP_DIR}/VERSION" )
else
VERSION_LOCAL=missing
fi

echo "--| local ${VERSION_LOCAL}"


VERSION_CHECK=$( . "${DEP_DIR}/check" )

echo "--| check ${VERSION_CHECK}"


if [[ "${VERSION_CHECK}" == "${VERSION_LOCAL}" ]] ; then
exit
fi


echo "--> fetching new version"

rm -fr "${DEP_BLOB_DIR}-new"
mkdir -p "${DEP_BLOB_DIR}-new"

cd "${DEP_BLOB_DIR}-new"

export VERSION="${VERSION_CHECK}"
"${DEP_DIR}/get"

rm -fr "${DEP_BLOB_DIR}"
mv "${DEP_BLOB_DIR}-new" "${DEP_BLOB_DIR}"

echo "${VERSION}" > "${DEP_DIR}/VERSION"


echo "-->" $( du -sh ${DEP_BLOB_DIR} | cut -f1 )
@@ -0,0 +1,90 @@
#!/bin/bash

set -e


#
# Run through all package deps
#

for PACKAGE_NAME in $( cd packages ; find . -type d -depth 1 | cut -c3- ) ; do
[ -e "packages/${PACKAGE_NAME}/deps" ] || continue

for DEP_NAME in $( cd "packages/${PACKAGE_NAME}/deps" ; find . -type d -depth 1 | cut -c3- ) ; do
./bin/deps-upgrade "${PACKAGE_NAME}" "${DEP_NAME}"
done
done


#
# Check if we actually updated anything
#

DIFFS=$( echo $( git diff HEAD --name-only | wc -l ) )

if [ 0 -eq $DIFFS ] ; then
# no changes; nothing else to do
exit
elif [ 1 -eq $DIFFS ] ; then
COMMIT_HEADER="Upgraded 1 package dependency"
else
COMMIT_HEADER="Upgraded ${DIFFS} package dependencies"
fi


#
# Upload new blobs
#

bosh -n upload blobs

git add config/blobs.yml


#
# Generate the commit message
#

(
echo "${COMMIT_HEADER}"

PACKAGE_CURR=""

for VERSION_PATH in $(
git diff HEAD --name-only \
| grep -E "^packages/([^/]+)/deps/([^/]+)/VERSION$" \
| sort
) ; do
git add "${VERSION_PATH}"

DEP_NAME=$( basename $( dirname "${VERSION_PATH}" ) )
PACKAGE_NAME=$( basename $( dirname $( dirname $( dirname "${VERSION_PATH}" ) ) ) )

if [[ "$PACKAGE_CURR" != "$PACKAGE_NAME" ]] ; then
echo ""
echo "${PACKAGE_NAME}"
echo ""

PACKAGE_CURR="${PACKAGE_NAME}"
fi

VERSION_OLD=$( git show HEAD:$VERSION_PATH )
VERSION_NEW=$( cat "${VERSION_PATH}" )

echo " * ${DEP_NAME} now ${VERSION_NEW} (was ${VERSION_OLD})"
done
) > commit.msg


#
# Create the commit
#

git commit -F commit.msg


#
# Cleanup after ourselves
#

rm commit.msg
@@ -1,13 +1,13 @@
---
openvpn-blobs/lzo-2.09.tar.gz:
openvpn-blobs/lzo/lzo.tar.gz:
object_id: 3fb15d07-79ae-43a7-b064-2ada94037d5a
sha: e2a60aca818836181e7e6f8c4f2c323aca6ac057
size: 594855
openvpn-blobs/openssl-1.0.1m.tar.gz:
openvpn-blobs/openssl/openssl.tar.gz:
object_id: eef27b1e-d235-4555-b3c3-b40d0db612ef
sha: 4ccaf6e505529652f9fdafa01d1d8300bd9f3179
size: 4533406
openvpn-blobs/openvpn-2.3.6.tar.gz:
openvpn-blobs/openvpn/openvpn.tar.gz:
object_id: 8d7f81e5-f7cc-4802-b013-208526a9e58f
sha: c11047662da1de9ae32a9977d3726fad06336027
size: 1213272
@@ -0,0 +1 @@
2.09
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

wget \
-q \
-O- \
http://www.oberhumer.com/opensource/lzo/download/ \
| grep -E 'href="lzo-[^"]+.tar.gz"' \
| sed -E 's/^.+href="lzo-([^"]+).tar.gz".+$/\1/' \
| gsort -rV \
| head -n1
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

wget \
-q \
-O lzo.tar.gz \
"http://www.oberhumer.com/opensource/lzo/download/lzo-${VERSION}.tar.gz"
@@ -0,0 +1 @@
1.0.1m
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

git ls-remote --tags https://github.com/openssl/openssl.git \
| cut -f2 \
| grep -Ev '\^{}' \
| grep -E '^refs/tags/OpenSSL_.+$' \
| sed -E 's/^refs\/tags\/OpenSSL_(.+)$/\1/' \
| tr '_' '.' \
| grep -E '^\d+\.\d+\.\d+\w*$' \
| gsort -rV \
| head -n1
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

wget \
-q \
--no-check-certificate \
-O openssl.tar.gz \
"https://www.openssl.org/source/openssl-${VERSION}.tar.gz"
@@ -0,0 +1 @@
2.3.6
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

git ls-remote --tags https://github.com/OpenVPN/openvpn.git \
| cut -f2 \
| grep -Ev '\^{}' \
| grep -E '^refs/tags/v.+$' \
| sed -E 's/^refs\/tags\/v(.+)$/\1/' \
| tr '_' '.' \
| grep -E '^\d+\.\d+\.\d+$' \
| gsort -rV \
| head -n1
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

wget \
-q \
-O openvpn.tar.gz \
"http://swupdate.openvpn.org/community/releases/openvpn-${VERSION}.tar.gz"
@@ -3,57 +3,49 @@
set -e
set -u

tar -xzf openvpn-blobs/openssl-1.0.1m.tar.gz
tar -xzf openvpn-blobs/openvpn-2.3.6.tar.gz
tar -xzf openvpn-blobs/lzo-2.09.tar.gz
( cd openvpn-blobs/openssl

tar -xzf openssl.tar.gz
cd openssl-*

pushd openssl-1.0.1m
./config \
-DSSL_ALLOW_ADH \
--shared \
--prefix=${BOSH_INSTALL_TARGET}/external/openssl \
--openssldir=${BOSH_INSTALL_TARGET}/external/openssldir

./config \
-DSSL_ALLOW_ADH \
--shared \
--prefix=${BOSH_INSTALL_TARGET}/external/openssl \
--openssldir=${BOSH_INSTALL_TARGET}/external/openssldir
make
make install
)

make
make install
( cd openvpn-blobs/lzo

popd
tar -xzf lzo.tar.gz
cd lzo-*

./configure \
--prefix=${BOSH_INSTALL_TARGET}/external/lzo \

pushd lzo-2.09
make
make install
)

./configure \
--prefix=${BOSH_INSTALL_TARGET}/external/lzo \
( cd openvpn-blobs/openvpn

make
make install
tar -xzf openvpn.tar.gz
cd openvpn-*

popd
export OPENSSL_CRYPTO_CFLAGS="-I ${BOSH_INSTALL_TARGET}/external/openssl/include"
export OPENSSL_CRYPTO_LIBS="-L${BOSH_INSTALL_TARGET}/external/openssl/lib -lcrypto"
export OPENSSL_SSL_CFLAGS="-I ${BOSH_INSTALL_TARGET}/external/openssl/include"
export OPENSSL_SSL_LIBS="-L${BOSH_INSTALL_TARGET}/external/openssl/lib -lssl"
export LZO_CFLAGS="-I ${BOSH_INSTALL_TARGET}/external/lzo/include"
export LZO_LIBS="-L${BOSH_INSTALL_TARGET}/external/lzo/lib -llzo2"

./configure \
--prefix=${BOSH_INSTALL_TARGET} \
--disable-plugin-auth-pam

pushd openvpn-2.3.6

export OPENSSL_CRYPTO_CFLAGS="-I ${BOSH_INSTALL_TARGET}/external/openssl/include"
export OPENSSL_CRYPTO_LIBS="-L${BOSH_INSTALL_TARGET}/external/openssl/lib -lcrypto"
export OPENSSL_SSL_CFLAGS="-I ${BOSH_INSTALL_TARGET}/external/openssl/include"
export OPENSSL_SSL_LIBS="-L${BOSH_INSTALL_TARGET}/external/openssl/lib -lssl"
export LZO_CFLAGS="-I ${BOSH_INSTALL_TARGET}/external/lzo/include"
export LZO_LIBS="-L${BOSH_INSTALL_TARGET}/external/lzo/lib -llzo2"

./configure \
--prefix=${BOSH_INSTALL_TARGET} \
--disable-plugin-auth-pam

make
make install

unset LZO_LIBS
unset LZO_CFLAGS
unset OPENSSL_SSL_LIBS
unset OPENSSL_SSL_CFLAGS
unset OPENSSL_CRYPTO_LIBS
unset OPENSSL_CRYPTO_CFLAGS

popd
make
make install
)
@@ -1,9 +1,4 @@
---
name: "openvpn"
files:
# https://www.openssl.org/source/openssl-1.0.1m.tar.gz
- "openvpn-blobs/openssl-1.0.1m.tar.gz"
# http://swupdate.openvpn.org/community/releases/openvpn-2.3.6.tar.gz
- "openvpn-blobs/openvpn-2.3.6.tar.gz"
# http://www.oberhumer.com/opensource/lzo/download/lzo-2.09.tar.gz
- "openvpn-blobs/lzo-2.09.tar.gz"
- "openvpn-blobs/**/*"

0 comments on commit 26f115d

Please sign in to comment.