diff options
author | Stefan Seelmann <seelmann@apache.org> | 2015-06-06 22:32:17 +0300 |
---|---|---|
committer | Stefan Seelmann <seelmann@apache.org> | 2015-06-06 22:32:17 +0300 |
commit | 1b1d46eed3a9f1830d5563ba0f2319e441e503c0 (patch) | |
tree | 9e7eacaa096e4ab73f94b553bb1b952d13d521f0 /dist | |
parent | fdcd881bdd4d90cad9791c5f0304403c70064151 (diff) |
Move scripts to dist folder, extend dist.sh script, update readme
git-svn-id: https://svn.apache.org/repos/asf/directory/studio/trunk@1683944 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dist')
-rwxr-xr-x | dist/dist.sh | 92 | ||||
-rwxr-xr-x | dist/sign.sh | 64 |
2 files changed, 156 insertions, 0 deletions
diff --git a/dist/dist.sh b/dist/dist.sh new file mode 100755 index 000000000..a96dee8b2 --- /dev/null +++ b/dist/dist.sh @@ -0,0 +1,92 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Script to collect and sign update sites and distribution packages. + +set -e + +# Check if version is set +if [ -z "$VERSION" ]; then + echo "VERSION is not set" + exit 1; +fi + +# Only continue if target directory does not exist yet +WORK_DIR=$PWD +TARGET_DIR=${WORK_DIR}/target +if [ -e "$TARGET_DIR" ]; then + echo "Target already exists" + exit 1; +fi + +echo +echo "### Creating dist folders" +DIST_DIR=${TARGET_DIR}/${VERSION} +UPDATE_SITE_DIR=${TARGET_DIR}/update/${VERSION} +mkdir -p ${DIST_DIR} +mkdir -p ${UPDATE_SITE_DIR} + +echo +echo "### Copying update sites" +cp -a ../p2repositories/dependencies/target/repository ${UPDATE_SITE_DIR}/dependencies +cp -a ../p2repositories/eclipse/target/repository ${UPDATE_SITE_DIR}/eclipse + +echo +echo "### Signing update sites" +cd ${UPDATE_SITE_DIR}/dependencies +sh ${WORK_DIR}/sign.sh +zip -r ${DIST_DIR}/ApacheDirectoryStudio-${VERSION}-p2repository-dependencies.zip * +cd ${UPDATE_SITE_DIR}/eclipse +sh ${WORK_DIR}/sign.sh +zip -r ${DIST_DIR}/ApacheDirectoryStudio-${VERSION}-p2repository.zip * + +echo +echo "### Copying dist files" +cd ${WORK_DIR} +cp ../target/org.apache.directory.studio.parent-${VERSION}-source-release.zip ${DIST_DIR}/ApacheDirectoryStudio-${VERSION}-src.zip +cp ../product/target/products/ApacheDirectoryStudio-${VERSION}-*.{zip,tar.gz} ${DIST_DIR}/ + +echo +echo "### Checking legal files" +cd ${DIST_DIR} +for file in * +do + echo "Checking $file" + case $file in + *.zip) + cmd="unzip -l $file" + ;; + *.tar.gz) + cmd="tar -tzvf $file" + ;; + *) + echo "Unknown file type: $file" + exit 1 + ;; + esac + eval "$cmd" | grep "LICENSE.txt" + eval "$cmd" | grep "NOTICE.txt" +done + +echo +echo "### Signing dist files" +sh ${WORK_DIR}/sign.sh + +echo +echo "### Success" + diff --git a/dist/sign.sh b/dist/sign.sh new file mode 100755 index 000000000..71268e73e --- /dev/null +++ b/dist/sign.sh @@ -0,0 +1,64 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +if [ -z "$RELEASE_KEY" ]; then + echo "PGP Key ID: " + read RELEASE_KEY + + echo "PGP Key Password: " + stty -echo + read PASSWORD + stty echo + echo "" +fi + +for FILE in $(find . -maxdepth 2 -not '(' -name "sign.sh" -or -name ".*" -or -name "*.md5" -or -name "*.sha1" -or -name "*.asc" ')' -and -type f) ; do + if [ -f "$FILE.asc" ]; then + echo "Skipping: $FILE" + continue + fi + + echo "Signing: $FILE ... " + + # MD5 + if [ ! -f "$FILE.md5" ]; + then + openssl md5 < "$FILE" | cut "-d " -f2 > "$FILE.md5" + echo " - Generated '$FILE.md5'" + else + echo " - Skipped '$FILE.md5' (file already existing)" + fi + + # SHA1 + if [ ! -f "$FILE.sha1" ]; + then + gpg --default-key "$RELEASE_KEY" --print-md SHA1 "$FILE" > "$FILE".sha1 + echo " - Generated '$FILE.sha1'" + else + echo " - Skipped '$FILE.sha1' (file already existing)" + fi + + # ASC + if [ ! -f "$FILE.asc" ]; + then + echo "$PASSWORD" | gpg --default-key "$RELEASE_KEY" --detach-sign --armor --no-tty --yes --passphrase-fd 0 "$FILE" + echo " - Generated '$FILE.asc'" + else + echo " - Skipped '$FILE.asc' (file already existing)" + fi +done |