summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2015-09-01 09:16:49 (GMT)
committerPaul Kocialkowski <contact@paulk.fr>2015-09-01 09:22:31 (GMT)
commit43230f1239729183fb7d3bff0313253208de9740 (patch)
tree987a9ac5cc1822f87c24086a732aff492271ae15
downloadrelease-scripts-43230f1239729183fb7d3bff0313253208de9740.zip
release-scripts-43230f1239729183fb7d3bff0313253208de9740.tar.gz
release-scripts-43230f1239729183fb7d3bff0313253208de9740.tar.bz2
Initial commit: Release scripts
Replicant 4.2 0004 images release Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rwxr-xr-xrelease.sh308
-rwxr-xr-xreleasediff.sh95
-rwxr-xr-xreleasetag.sh103
3 files changed, 506 insertions, 0 deletions
diff --git a/release.sh b/release.sh
new file mode 100755
index 0000000..5dd19d1
--- /dev/null
+++ b/release.sh
@@ -0,0 +1,308 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
+# Copyright (C) 2011-2015 Paul Kocialkowski <contact@paulk.fr>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# Variables
+SCRIPT=$0
+REPLICANT_DIR=$1
+RELEASE_DIR=$2
+RELEASE_TYPE=$3
+
+ARGS_COUNT=2
+REPO="../tools/repo"
+RELEASE_TOOLS_DIR="$REPLICANT_DIR/out/host/linux-x86/bin"
+RELEASE_TOOLS="adb fastboot heimdall mkbootimg"
+RELEASE_SDK_DIR="$REPLICANT_DIR/out/host/linux-x86/sdk"
+RELEASE_SDK="replicant-sdk_linux-x86.zip"
+RELEASE_IMAGES_DIR="$REPLICANT_DIR/out/target/product"
+RELEASE_IMAGES="recovery.img replicant-4.2-crespo.zip replicant-4.2-galaxysmtd.zip replicant-4.2-i9100.zip replicant-4.2-n7000.zip replicant-4.2-maguro.zip replicant-4.2-p3100.zip replicant-4.2-p3110.zip replicant-4.2-p5100.zip replicant-4.2-p5110.zip replicant-4.2-i9300.zip replicant-4.2-n7100.zip replicant-4.2-gta04.zip bootable.zip"
+RELEASE_DEVICES="crespo galaxysmtd i9100 n7000 maguro p3100 p3110 p5100 p5110 i9300 n7100 gta04"
+RELEASE_SCRIPTS_DIR=$( dirname "$SCRIPT" )
+RELEASE_SCRIPTS="release.sh releasediff.sh releasetag.sh"
+RELEASE_SECURITY_DIR="$REPLICANT_DIR/vendor/replicant-security"
+RELEASE_SECURITY="media.x509.pem platform.x509.pem shared.x509.pem system.x509.pem"
+RELEASE_KEY="4A80EB23"
+
+METADATA="$RELEASE_DIR/metadata"
+SECURITY="$RELEASE_DIR/security"
+SCRIPTS="$RELEASE_DIR/scripts"
+TOOLS="$RELEASE_DIR/tools"
+IMAGES="$RELEASE_DIR/images"
+SDK="$RELEASE_DIR/sdk"
+
+VERSION="4.2"
+RELEASE="0004"
+
+release_signatures_tools () {
+ if ! [ -d "$TOOLS" ]
+ then
+ return
+ fi
+
+ dir=$( pwd )
+
+ cd "$TOOLS"
+ for tool in $RELEASE_TOOLS
+ do
+ gpg --default-key "$RELEASE_KEY" --armor --output "$tool.asc" --detach-sign "$tool"
+ done
+ cd "$dir"
+}
+
+release_signatures_sdk () {
+ if ! [ -d "$SDK" ]
+ then
+ return
+ fi
+
+ dir=$( pwd )
+
+ cd "$SDK"
+ for sdk in $RELEASE_SDK
+ do
+ gpg --default-key "$RELEASE_KEY" --armor --output "$sdk.asc" --detach-sign "$sdk"
+ done
+ cd "$dir"
+}
+
+release_signatures_images () {
+ if ! [ -d "$IMAGES" ]
+ then
+ return
+ fi
+
+ cd "$IMAGES"
+ for device in $RELEASE_DEVICES
+ do
+ if ! [ -d "$IMAGES/$device" ]
+ then
+ continue
+ fi
+
+ for image in $RELEASE_IMAGES
+ do
+ if [ -f "$IMAGES/$device/$image" ]
+ then
+ gpg --default-key "$RELEASE_KEY" --armor --output "$IMAGES/$device/$image.asc" --detach-sign "$IMAGES/$device/$image"
+ fi
+ done
+ done
+}
+
+release_signatures () {
+ echo "Releasing signatures"
+
+ release_signatures_tools
+ release_signatures_sdk
+ release_signatures_images
+
+ mkdir -p "$SECURITY"
+ gpg --armor --output "$SECURITY/$RELEASE_KEY.asc" --export "$RELEASE_KEY"
+
+ dir=$( pwd )
+
+ cd "$SECURITY"
+ rm "security.md5"
+ md5sum * > "security.md5"
+ cd "$dir"
+}
+
+release_images () {
+ echo "Releasing images"
+ mkdir -p "$IMAGES"
+
+ for device in $RELEASE_DEVICES
+ do
+ echo "Releasing images for $device"
+ mkdir -p "$IMAGES/$device"
+
+ for image in $RELEASE_IMAGES
+ do
+ if [ -f "$RELEASE_IMAGES_DIR/$device/$image" ]
+ then
+ cp "$RELEASE_IMAGES_DIR/$device/$image" "$IMAGES/$device/"
+ fi
+ done
+
+ dir=$( pwd )
+
+ cd "$IMAGES/$device"
+ md5sum * > "$device.md5"
+ cd "$dir"
+ done
+}
+
+release_sdk () {
+ echo "Releasing sdk"
+ mkdir -p "$SDK"
+
+ for sdk in $RELEASE_SDK
+ do
+ cp "$RELEASE_SDK_DIR/$sdk" "$SDK/"
+ done
+
+ dir=$( pwd )
+
+ cd "$SDK"
+ md5sum * > "sdk.md5"
+ cd "$dir"
+}
+
+release_tools () {
+ echo "Releasing tools"
+ mkdir -p "$TOOLS"
+
+ for tool in $RELEASE_TOOLS
+ do
+ cp "$RELEASE_TOOLS_DIR/$tool" "$TOOLS/"
+ done
+
+ dir=$( pwd )
+
+ cd "$TOOLS"
+ md5sum * > "tools.md5"
+ cd "$dir"
+}
+
+release_scripts () {
+ echo "Releasing scripts"
+ mkdir -p "$SCRIPTS"
+
+ for script in $RELEASE_SCRIPTS
+ do
+ cp "$RELEASE_SCRIPTS_DIR/$script" "$SCRIPTS/"
+ done
+}
+
+release_security () {
+ echo "Releasing security"
+ mkdir -p "$SECURITY"
+
+ for security in $RELEASE_SECURITY
+ do
+ cp "$RELEASE_SECURITY_DIR/$security" "$SECURITY/"
+ done
+
+ dir=$( pwd )
+
+ cd "$SECURITY"
+ md5sum * > "security.md5"
+ cd "$dir"
+}
+
+release_metadata_about () {
+ cat "$REPLICANT_DIR/vendor/replicant/README.mkdn" | awk "/^Replicant$/{replicant=1} /^CyanogenMod$/{replicant=0} replicant" > "$METADATA/readme.txt"
+}
+
+release_metadata_date () {
+ date "+%Y-%m-%d" > "$METADATA/date.txt"
+}
+
+release_metadata_changelog () {
+ cat "$REPLICANT_DIR/vendor/replicant/CHANGELOG.mkdn" | awk "/### .*/{n++} n==1, /### .*/ {n++} n==2" > "$METADATA/changelog.txt"
+}
+
+release_metadata_release () {
+ echo "replicant-$VERSION-$RELEASE" > "$METADATA/release.txt"
+}
+
+release_metadata_prebuilt () {
+ dir=$( pwd )
+
+ cd "$REPLICANT_DIR/vendor/replicant/prebuilt/common/apps/"
+ md5sum *.apk > "$METADATA/prebuilt.md5"
+ cd "$dir"
+}
+
+release_metadata_git () {
+ dir=$( pwd )
+ cd "$REPLICANT_DIR"
+
+ for git_repo in ".repo/manifests"
+ do
+ cd $git_repo
+ echo "manifest"
+ git show --format=oneline -s "replicant-$VERSION-$RELEASE" 2>/dev/null || git show --format=oneline -s
+ echo ""
+ cd "$REPLICANT_DIR"
+
+ done > "$METADATA/git-tags.txt"
+
+ $REPO list | while read git_repo
+ do
+ cd $git_repo
+ echo "$git_repo" | sed "s/ : .*$/ /g"
+ git show --format=oneline -s "replicant-$VERSION-$RELEASE" 2>/dev/null || git show --format=oneline -s
+ echo ""
+ cd "$REPLICANT_DIR"
+ done >> "$METADATA/git-tags.txt"
+
+ $REPO manifest -r > "$METADATA/manifest.xml"
+
+ cd "$dir"
+}
+
+release_metadata_sdk() {
+ echo "Releasing metadata"
+ mkdir -p "$METADATA"
+ release_metadata_git
+ release_metadata_prebuilt
+ release_metadata_release
+ release_metadata_date
+ release_metadata_about
+}
+
+release_metadata () {
+ echo "Releasing metadata"
+ mkdir -p "$METADATA"
+ release_metadata_git
+ release_metadata_prebuilt
+ release_metadata_release
+ release_metadata_changelog
+ release_metadata_date
+ release_metadata_about
+}
+
+print_help () {
+ echo "$SCRIPT: [REPLICANT_DIR] [RELEASE_DIR] (RELEASE_TYPE)"
+}
+
+# Check for the correct number of args
+if [ "$#" -lt "$ARGS_COUNT" ]
+then
+ print_help
+ exit 1
+fi
+
+case "$RELEASE_TYPE" in
+ "signatures")
+ release_signatures
+ ;;
+ "sdk")
+ release_metadata_sdk
+ release_scripts
+ release_sdk
+ ;;
+ *)
+ release_metadata
+ release_security
+ release_scripts
+ release_tools
+ release_images
+ ;;
+esac
diff --git a/releasediff.sh b/releasediff.sh
new file mode 100755
index 0000000..68ba5cb
--- /dev/null
+++ b/releasediff.sh
@@ -0,0 +1,95 @@
+#!/bin/sh
+#
+# Copyright (C) 2013-2015 Paul Kocialkowski <contact@paulk.fr>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# Variables
+SCRIPT=$0
+REPLICANT_DIR=$1
+RELEASE_DIR=$2
+
+ARGS_COUNT=2
+COLOR=1
+REPO="../tools/repo"
+METADATA="$RELEASE_DIR/metadata"
+
+regexp=".*path=\"\([^\"]*\)\".*revision=\"\([^\"]*\)\".*"
+if [ "$COLOR" = "1" ]
+then
+ color_start="\033[36m"
+ color_end="\033[0m"
+else
+ color_start=""
+ color_end=""
+fi
+
+diff_repos () {
+ paths=$( cat "$METADATA/manifest.xml" | grep "path=" | sed "s/$regexp/\1/g" )
+
+ dir=$( pwd )
+
+ cd "$REPLICANT_DIR"
+
+ $REPO list | while read git_repo
+ do
+ path=$( echo "$git_repo" | sed "s/\([^ ]*\) : .*$/\1/g" )
+ match=$( echo "$paths" | grep "$path" )
+ if [ "$match" = "" ]
+ then
+ echo "New repository: ""$color_start""$path""$color_end"
+ echo ""
+ fi
+ done
+
+ cd "$dir"
+
+ cat "$METADATA/manifest.xml" | grep "path=" | while read line
+ do
+ path=$( echo "$line" | sed "s/$regexp/\1/g" )
+ commit=$( echo "$line" | sed "s/$regexp/\2/g" )
+
+ if [ "$path" = "" ] || [ "$commit" = "" ]
+ then
+ break
+ fi
+
+ dir=$( pwd )
+
+ cd "$REPLICANT_DIR/$path"
+ log=$( git shortlog "$commit..HEAD" )
+ if [ "$log" != "" ]
+ then
+ echo "Updated repository: ""$color_start""$path""$color_end"
+ echo "$log"
+ echo ""
+ fi
+
+ cd "$dir"
+ done
+}
+
+print_help () {
+ echo "$SCRIPT: [REPLICANT_DIR] [RELEASE_DIR]"
+}
+
+# Check for the correct number of args
+if [ "$#" -lt "$ARGS_COUNT" ]
+then
+ print_help
+ exit 1
+fi
+
+diff_repos
diff --git a/releasetag.sh b/releasetag.sh
new file mode 100755
index 0000000..21fdad4
--- /dev/null
+++ b/releasetag.sh
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# Variables
+SCRIPT=$0
+REPLICANT_DIR=$1
+MANIFEST=$2
+
+ARGS_COUNT=1
+COLOR=1
+TMP="/tmp"
+REPO="../tools/repo"
+RELEASE_KEY="4A80EB23"
+REMOTE="replicant"
+PUSH_REMOTE="git.replicant.us"
+
+VERSION="4.2"
+RELEASE="0004"
+
+if [ "$COLOR" = "1" ]
+then
+ color_start="\033[36m"
+ color_end="\033[0m"
+else
+ color_start=""
+ color_end=""
+fi
+
+manifest () {
+ dir=$( pwd )
+ cd "$REPLICANT_DIR"
+
+ $REPO manifest -r > $MANIFEST
+
+ cd "$dir"
+}
+
+tag_repos () {
+ list=""
+
+ default=$( cat $MANIFEST | grep default | grep "remote=\"$REMOTE\"" )
+ if [ "$default" != "" ]
+ then
+ list=$( cat $MANIFEST | grep project | grep -v "remote=\"" )"\n"
+ fi
+
+ list="$list"$( cat $MANIFEST | grep project | grep "remote=\"$REMOTE\"" )
+
+ echo "$list" | while read repo
+ do
+ path=$( echo "$repo" | sed "s/.*path=\"\([^\"]*\)\".*/\1/g" )
+ revision=$( echo "$repo" | sed "s/.*revision=\"\([^\"]*\)\".*/\1/g" )
+
+ dir=$( pwd )
+ cd "$REPLICANT_DIR/$path"
+
+ echo "Tagging ""$color_start""$path""$color_end"" with $revision"
+
+ git tag -s -u $RELEASE_KEY -m "Replicant $VERSION $RELEASE images release" -a "replicant-$VERSION-$RELEASE" $revision
+
+ echo "Pusing ""$color_start""$path""$color_end"
+
+ path=$( echo $path | tr '[:upper:]' '[:lower:]' )
+
+ git push "git@$PUSH_REMOTE:replicant/$path.git" "replicant-$VERSION-$RELEASE"
+
+ cd "$dir"
+ done
+}
+
+print_help () {
+ echo "$SCRIPT: [REPLICANT_DIR] (MANIFEST)"
+}
+
+# Check for the correct number of args
+if [ "$#" -lt "$ARGS_COUNT" ]
+then
+ print_help
+ exit 1
+fi
+
+if [ "$MANIFEST" = "" ]
+then
+ MANIFEST="$TMP/manifest.xml"
+ manifest
+fi
+
+tag_repos