forked from darlinghq/darling-cups
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmitcups
executable file
·100 lines (87 loc) · 2.29 KB
/
submitcups
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
91
92
93
94
95
96
97
98
99
100
#!/bin/sh
#
# Script to tag and submit cups.
#
# Usage:
#
# ./submitcups [-project name] [-tagonly] [-train train] version
#
# The default project is "cups". The default train is the newest macOS/iOS
# SDK known to Xcode. The "-tagonly" option just tags the version in the
# repository without submitting.
#
# Parse command-line...
project="cups"
train=""
version=""
while test $# -gt 0; do
opt="$1"
shift
case "$opt" in
-project)
project="$1"
shift
;;
-tagonly)
train="tag"
;;
-train)
train="$1"
shift
;;
-*)
echo "Usage: submitcups [-project project] [-tagonly] [-train train] version"
exit 1
;;
*)
version="$opt"
;;
esac
done
if test "x$version" = x; then
echo "Usage: submitcups [-project project] [-tagonly] [-train train] version"
exit 1
fi
if test "x$train" = x; then
if test "$project" = cups_ios; then
build=`xcodebuild -sdk iphoneos -version ProductBuildVersion`
train=`xbs getTrainForBuild --embedded $build --quiet`
else
build=`xcodebuild -sdk macosx -version ProductBuildVersion`
train=`xbs getTrainForBuild $build --quiet`
fi
echo "Auto-detected train for submission is $train."
fi
# Make sure we don't have any pending changes...
git pull
# Make sure we're on the master branch and no local commits
if test "x`git checkout master | grep -e '^Your branch is ahead of' `" != x; then
echo Error: Local repository has checkins not pushed:
echo ""
git checkout master
echo ""
echo Push these changes before submitting.
exit 1
fi
if test "x`git status | grep -e '^ modified:' `" != x; then
echo Error: Local files have modifications:
echo ""
git status | grep -e '^ modified:'
echo ""
echo Commit these changes before submitting.
exit 1
fi
# See if we've tagged the release...
tagname="cups-$version"
if test "x`git tag | grep ^$tagname`" != x; then
echo "Tag for $tagname already exists..."
else
# Tag it...
git tag -a $tagname -m "Tag $tagname"
# Submit change for project version.
git push origin $tagname
fi
if test "x$train" != xtag; then
# Submit the tag...
xbs submitproject -git -url ssh://stash.sd.apple.com/img/cups.git -tag $tagname -project $project -version $version $train
fi