-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrelease.sh
executable file
·90 lines (78 loc) · 2.28 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# taken grom xbmc-czech-sf.net
TOOLS=$(dirname "$0")
BUILD_DIR=tmp
PUBLISH_DIR=repo
echo "Cleaning up *.pyc files.."
find . -name '*.pyc' | xargs rm -f
if [ -z $1 ];
then
addons=$(ls -l | grep "^d" | gawk -F' ' '{print $9}')
elif [ "$1" == "-n" ];
then
echo "Determining which addons need to be released"
addons=$(./needs_release.sh | grep Addon | gawk -F' ' '{print $2}')
else
addons=$1
fi
for addonFile in $addons ; do
dirname=$addonFile
if [ ! -f $addonFile/addon.xml ] ; then
#echo "$addonFile/addon.xml does not exist, skipping"
continue
fi
addon_id=$("$TOOLS/get_addon_attribute" "$addonFile/addon.xml" "id")
addon_version=$("$TOOLS/get_addon_attribute" "$addonFile/addon.xml" "version")
if [ -z "$addon_id" ] ; then
echo "Addon id not found!" >&2
exit 1
fi
if [ -z "$addon_version" ] ; then
echo "Addon id not found!" >&2
exit 2
fi
target_dir="$BUILD_DIR/$addon_id"
if [ ! -d "$target_dir" ] ; then
mkdir "$target_dir"
fi
echo "Packing $addon_id $addon_version"
# make package
package="$target_dir/$addon_id-$addon_version.zip"
if [ -e "$package" ] ; then
rm "$package"
fi
zip -FS -q -r "$package" "$dirname" -x "*.py[oc] *.sw[onp]" ".*"
# copy changelog file
changelog=$(ls "$dirname"/[Cc]hangelog.txt)
if [ -f "$changelog" ] ; then
cp "$changelog" "$target_dir"/changelog-$addon_version.txt
fi
# copy icon file
icon="$dirname"/icon.png
if [ -f "$icon" ] ; then
cp "$icon" "$target_dir"/
fi
echo $(find $addon_id -type f | xargs md5sum | md5sum | tr -d -) > $BUILD_DIR/${addon_id}.md5
git stash
git checkout gh-pages
mkdir -p $PUBLISH_DIR/$addon_id/
mv $target_dir/* $PUBLISH_DIR/$addon_id/
mv tmp/${addon_id}.md5 hashes/$addon_id
git add $PUBLISH_DIR/$addon_id
git add hashes/$addon_id
# generate unique hash of released addon for further check
git commit -m "Release $addon_id $addon_version"
git checkout master
git stash pop
done
echo "Regenerate addons.xml"
python addons_xml_generator.py
git stash
git checkout gh-pages
mv tmp/addons.xml* repo
./update-directory-index.sh
git add repo
git commit -m 'update metadata files'
git checkout master
git stash pop
echo "Done"