Skip to content
Snippets Groups Projects
Unverified Commit a1ec18e9 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

fdroid: fix and improve fdroidMergeRequest.sh

+ Fix NDK detection
+ Force git config
+ Add some verbosity for Jenkins

Change-Id: Ie4f79bccb2b863f496203aa0307ca2d828d54e78
Gitlab: #540
parent d288e197
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# This script pull/clone a fdroiddata repository # This script pull/clone a fdroiddata repository
set -x # Get a more verbose output for Jenkins
if [ $# -lt 3 ] ; then if [ $# -lt 3 ] ; then
echo "Usage:" echo "Usage:"
echo "1: commit" echo "1: commit"
...@@ -9,6 +11,7 @@ if [ $# -lt 3 ] ; then ...@@ -9,6 +11,7 @@ if [ $# -lt 3 ] ; then
echo "3: versionCode" echo "3: versionCode"
echo "4: private gitlab.com access token (optional)" echo "4: private gitlab.com access token (optional)"
echo "e.g. ./fdroidMergeRequest.sh e5d0d7d2e625e2455fce3d041dd563c45ab9d4a9 20190123 146 djlhsdKH345456DDGfo7" echo "e.g. ./fdroidMergeRequest.sh e5d0d7d2e625e2455fce3d041dd563c45ab9d4a9 20190123 146 djlhsdKH345456DDGfo7"
echo "NOTE: you need to set \$ANDROID_NDK"
exit exit
fi fi
...@@ -29,16 +32,31 @@ fi ...@@ -29,16 +32,31 @@ fi
git -C fdroiddata remote add upstream https://gitlab.com/fdroid/fdroiddata.git git -C fdroiddata remote add upstream https://gitlab.com/fdroid/fdroiddata.git
git -C fdroiddata fetch upstream || exit git -C fdroiddata fetch upstream || exit
git -C fdroiddata status
git -C fdroiddata checkout upstream/master git -C fdroiddata checkout upstream/master
git -C fdroiddata config user.name "savoirfairelinux"
git -C fdroiddata config user.email mobile@savoirfairelinux.com
METADATA_FOLDER=fdroiddata/metadata METADATA_FOLDER=fdroiddata/metadata
cp $METADATA_FOLDER/cx.ring.txt $METADATA_FOLDER/cx.ring.txt_ cp ${METADATA_FOLDER}/cx.ring.txt ${METADATA_FOLDER}/cx.ring.txt_
head -n -12 ${METADATA_FOLDER}/cx.ring.txt_ > ${METADATA_FOLDER}/cx.ring.txt
source_properties="${ANDROID_NDK}/source.properties"
if [ ! -s "${source_properties}" ]; then
echo "No NDK found. Abort!"
exit 1
fi
head -n -12 $METADATA_FOLDER/cx.ring.txt_ > $METADATA_FOLDER/cx.ring.txt major_version=$(sed -En -e 's/^Pkg.Revision[ \t]*=[ \t]*([0-9a-f]+).*/\1/p' ${source_properties})
numerical_minor_version=$(sed -En -e 's/^Pkg.Revision[ \t]*=[ \t]*[0-9a-f]+\.([0-9]+).*/\1/p' ${source_properties})
minor_version=$(echo ${numerical_minor_version} | tr 0123456789 abcdefghij)
ndk_version=r${major_version}${minor_version}
echo "Build:$versionName,$versionCode echo "Build:${versionName},${versionCode}
commit=$commit commit=${commit}
timeout=10800 timeout=10800
subdir=client-android/ring-android/app subdir=client-android/ring-android/app
submodules=yes submodules=yes
...@@ -50,32 +68,33 @@ echo "Build:$versionName,$versionCode ...@@ -50,32 +68,33 @@ echo "Build:$versionName,$versionCode
export ANDROID_NDK_ROOT=\"\$ANDROID_NDK\" && \\ export ANDROID_NDK_ROOT=\"\$ANDROID_NDK\" && \\
export ANDROID_ABI=\"armeabi-v7a arm64-v8a x86\" && \\ export ANDROID_ABI=\"armeabi-v7a arm64-v8a x86\" && \\
./compile.sh --release --no-gradle ./compile.sh --release --no-gradle
ndk=r17b" >> $METADATA_FOLDER/cx.ring.txt ndk=${ndk_version}" >> ${METADATA_FOLDER}/cx.ring.txt
tail -n 13 $METADATA_FOLDER/cx.ring.txt_ | head -n -2 >> $METADATA_FOLDER/cx.ring.txt tail -n 13 ${METADATA_FOLDER}/cx.ring.txt_ | head -n -2 >> ${METADATA_FOLDER}/cx.ring.txt
echo "Current Version:$versionName" >> $METADATA_FOLDER/cx.ring.txt echo "Current Version:${versionName}" >> ${METADATA_FOLDER}/cx.ring.txt
echo "Current Version Code:$versionCode" >> $METADATA_FOLDER/cx.ring.txt echo "Current Version Code:${versionCode}" >> ${METADATA_FOLDER}/cx.ring.txt
rm $METADATA_FOLDER/cx.ring.txt_ rm ${METADATA_FOLDER}/cx.ring.txt_
git -C fdroiddata add metadata/cx.ring.txt git -C fdroiddata add metadata/cx.ring.txt
git -C fdroiddata commit -s -m "Updates Jami to $versionName" git -C fdroiddata commit -s -m "Updates Jami to $versionName"
git -C fdroiddata push origin master git -C fdroiddata status
git -C fdroiddata push origin HEAD:master
FDROID_METADATA_PROJECT_ID=36528 FDROID_METADATA_PROJECT_ID=36528
SFL_METADATA_PROJECT_ID=10540147 SFL_METADATA_PROJECT_ID=10540147
if [ $# -ge 4 ] ; then if [ $# -ge 4 ] ; then
curl --request POST \ curl --request POST \
--url https://gitlab.com/api/v4/projects/$SFL_METADATA_PROJECT_ID/merge_requests \ --url https://gitlab.com/api/v4/projects/${SFL_METADATA_PROJECT_ID}/merge_requests \
--header 'content-type: application/json' \ --header 'content-type: application/json' \
--header "private-token: $gitlabToken" \ --header "private-token: ${gitlabToken}" \
--data "{ --data "{
\"id\": 1, \"id\": 1,
\"title\": \"New Jami revision\", \"title\": \"New Jami revision\",
\"target_branch\": \"master\", \"target_branch\": \"master\",
\"source_branch\": \"master\", \"source_branch\": \"master\",
\"target_project_id\": $FDROID_METADATA_PROJECT_ID \"target_project_id\": ${FDROID_METADATA_PROJECT_ID}
}" }"
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment