Browse code

leave it out, will move to an embedded repo

Nat! authored on 13/10/2016 15:17:57
Showing 1 changed files
1 1
deleted file mode 100755
... ...
@@ -1,231 +0,0 @@
1
-#! /bin/sh
2
-#
3
-#
4
-#
5
-
6
-generate_brew_formula()
7
-{
8
-   local project
9
-   local target
10
-   local homepage
11
-   local desc
12
-   local version
13
-   local archiveurl
14
-   local dependencies
15
-
16
-   project="$1"
17
-   shift
18
-   target="$1"
19
-   shift
20
-   homepage="$1"
21
-   shift
22
-   desc="$1"
23
-   shift
24
-   version="$1"
25
-   shift
26
-   archiveurl="$1"
27
-   shift
28
-   dependencies="$1"
29
-   shift
30
-
31
-   [ -z "${version}" ] && exit 1
32
-   [ -z "${archiveurl}" ] && exit 1
33
-
34
-   local tmparchive
35
-
36
-   tmparchive="/tmp/${target}-${version}-archive"
37
-
38
-   if [ ! -f "${tmparchive}" ]
39
-   then
40
-      exekutor curl -L -o "${tmparchive}" "${archiveurl}"
41
-      if [ $? -ne 0 -o ! -f "${tmparchive}" ]
42
-      then
43
-         echo "Download failed" >&2
44
-         exit 1
45
-      fi
46
-   else
47
-      echo "using cached file ${tmparchive} instead of downloading again" >&2
48
-   fi
49
-
50
-   #
51
-   # anything less than 17 KB is wrong
52
-   #
53
-   size="`exekutor du -k "${tmparchive}" | exekutor awk '{ print $ 1}'`"
54
-   if [ $size -lt 17 ]
55
-   then
56
-      echo "Archive truncated or missing" >&2
57
-      cat "${tmparchive}" >&2
58
-      rm "${tmparchive}"
59
-      exit 1
60
-   fi
61
-
62
-   local hash
63
-
64
-   hash="`exekutor shasum -p -a 256 "${tmparchive}" | exekutor awk '{ print $1 }'`"
65
-
66
-   exekutor cat <<EOF
67
-class ${project} < Formula
68
-   homepage "${homepage}"
69
-   desc "${desc}"
70
-   url "${archiveurl}"
71
-   version "${version}"
72
-   sha256 "${hash}"
73
-
74
-EOF
75
-
76
-IFS="
77
-"
78
-   for dependency in ${dependencies}
79
-   do
80
-      exekutor echo "   depends_on '${dependency}'"
81
-      shift
82
-   done
83
-   IFS="${DEFAULT_IFS}"
84
-
85
-   exekutor cat <<EOF
86
-   depends_on 'mulle-build' => :build
87
-
88
-   def install
89
-      system "mulle-install", "-e", "--prefix", "#{prefix}"
90
-   end
91
-
92
-   test do
93
-      system "mulle-test"
94
-   end
95
-end
96
-# FORMULA ${TARGET}.rb
97
-EOF
98
-}
99
-
100
-
101
-#
102
-# Boiler plate code from here on. Could put this into a convenient
103
-# location somewhere (mulle-homebrew ?)
104
-# From now on need:
105
-#    TAG
106
-#    HOMEBREWTAP
107
-#    RBFILE
108
-#    ORIGIN
109
-get_header_version()
110
-{
111
-   local filename
112
-
113
-   filename="$1"
114
-   fgrep "${VERSIONNAME}" "${filename}" | \
115
-   sed 's|(\([0-9]*\) \<\< [0-9]*)|\1|g' | \
116
-   sed 's|^.*(\(.*\))|\1|' | \
117
-   sed 's/ | /./g'
118
-}
119
-
120
-
121
-git_must_be_clean()
122
-{
123
-   local name
124
-   local clean
125
-
126
-   name="${1:-${PWD}}"
127
-
128
-   if [ ! -d .git ]
129
-   then
130
-      fail "\"${name}\" is not a git repository"
131
-   fi
132
-
133
-   clean=`git status -s --untracked-files=no`
134
-   if [ "${clean}" != "" ]
135
-   then
136
-      fail "repository \"${name}\" is tainted"
137
-   fi
138
-}
139
-
140
-
141
-# Parameters!
142
-#
143
-# ORIGIN
144
-# TAG
145
-#
146
-git_main()
147
-{
148
-   local origin
149
-   local tag
150
-
151
-   origin="$1"
152
-   shift
153
-   tag="$1"
154
-   shift
155
-
156
-   exekutor git_must_be_clean || exit 1
157
-
158
-   local branch
159
-
160
-   branch="`exekutor git rev-parse --abbrev-ref HEAD`"
161
-
162
-   #
163
-   # make it a release
164
-   #
165
-   exekutor git checkout -B release  || exit 1
166
-   exekutor git rebase "${branch}"   || exit 1
167
-
168
-   # if rebase fails, we shouldn't be hitting tag now
169
-   exekutor git tag "${tag}"         || exit 1
170
-
171
-   exekutor git push "${origin}" release --tags  || exit 1
172
-   exekutor git push github release --tags       || exit 1
173
-
174
-   exekutor git checkout "${branch}"          || exit 1
175
-   exekutor git push "${origin}" "${branch}"  || exit 1
176
-}
177
-
178
-
179
-#
180
-# Expected environment!
181
-# PROJECT
182
-# NAME
183
-# VERSION
184
-# HOMEPAGE
185
-# DESC
186
-# DEPENDENCIES
187
-# HOMEBREWTAP
188
-# RBFILE
189
-#
190
-homebrew_main()
191
-{
192
-   ARCHIVEURL="`eval echo "${ARCHIVEURL}"`"
193
-
194
-   redirect_exekutor "${HOMEBREWTAP}/${RBFILE}" \
195
-      generate_brew_formula "${PROJECT}" \
196
-                            "${NAME}" \
197
-                            "${HOMEPAGE}" \
198
-                            "${DESC}" \
199
-                            "${VERSION}" \
200
-                            "${ARCHIVEURL}" \
201
-                            "${DEPENDENCIES}" || exit 1
202
-   (
203
-      exekutor cd "${HOMEBREWTAP}" ;
204
-      exekutor git add "${RBFILE}" ;
205
-      exekutor git commit -m "${VERSION} release of ${NAME}" "${RBFILE}" ;
206
-      exekutor git push origin master
207
-   )  || exit 1
208
-}
209
-
210
-
211
-homebrew_initialize()
212
-{
213
-   local directory
214
-
215
-   if [ -z "${DEFAULT_IFS}" ]
216
-   then
217
-      DEFAULT_IFS="${IFS}"
218
-   fi
219
-
220
-   directory="`mulle-bootstrap library-path 2> /dev/null`"
221
-   [ ! -d "${directory}" ] && echo "failed to locate mulle-bootstrap library" >&2 && exit 1
222
-   PATH="${directory}:$PATH"
223
-
224
-   . "mulle-bootstrap-logging.sh"
225
-   . "mulle-bootstrap-functions.sh"
226
-
227
-   [ ! -d "${HOMEBREWTAP}" ] && fail "failed to locate \"${HOMEBREWTAP}\""
228
-}
229
-
230
-homebrew_initialize
231
-