-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
148 lines (131 loc) · 4.06 KB
/
Makefile
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
##
## Created : Sat Nov 17 14:46:20 IST 2012
## Last Modified : Fri Aug 10 23:02:01 PDT 2018
##
## Copyright (C) 2012 Sriram Karra <[email protected]>
##
## This file is part of PRS
##
## PRS is free software: you can redistribute it and/or modify it under
## the terms of the GNU Affero General Public License as published by the
## Free Software Foundation, version 3 of the License
##
## PRS 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 Affero General Public
## License for more details.
##
## You should have a copy of the license in the base directory of PRS. If
## not, see <http://www.gnu.org/licenses/>.
## TODO: 2018-04-07: What is the difference between the release and bundle targets?
##
## You do not need to use this Makefile to run the program. If all you
## want to do is to use PRS, there is nothing here.
##
##
## Releasing a new version
## =======================
##
## $ make release REL=v1.0
## $ make install REL=v1.0
##
## General Info
## ============
##
## This Makefile automates some of the steps in the release
## process. Ideally we want to automate all of the following setps
## based on a version string, which is also used to tag the source repo
##
## 1. Change the version string in prs.pyw
##
## 2. Commit the above change
##
## 3. Tag the source with the version number
##
## 4. Clone the current repo into a temporary repository
##
## 5. cd to the repository and build the documentation
##
## 6. Zip up the repository into .zip and .tar.gz archives
##
## 7. Upload the archives to github downloads section
##
## 8. Edit the announcements in gae/index.html, and update the
## timestamp for the page in the footer.
##
## 9. Push the updates to gae
##
## 10. Change the version with a '+' added to the version string.
##
## 11. Commit the changes
##
## 12. Push changes to upstream git repo
##
## The steps that involve pushing things to github and gae will come
## under the 'install' target. The rest will come under the default
## target. There is nothing to clean up at this stage.
##
src = prs.pyw
basename = cmc
default: bundle
clean:
rm -f db/sample.db
demodb: clean
cd scripts && time python createdb.py
bundle:
ifeq ($(strip ${TAG}),)
$(error "Have to specify a tag to bundle. Usage: 'make TAG=<rel>'")
endif
@echo
@echo ==== Cloning temp repository for ${TAG}
rm -rf /tmp/${basename}-${TAG}
git clone --recursive . /tmp/${basename}-${TAG}
cd /tmp/${basename}-${TAG}
git checkout ${TAG}
rm -rf /tmp/${basename}-${TAG}/.git
@echo
@echo ==== Creating bundles
rm -f /tmp/${basename}-${TAG}.zip
cd /tmp && zip -q -r ${basename}-${TAG}.zip ${basename}-${TAG}
release:
ifeq ($(strip ${REL}),)
$(error "Have to specify a release. Usage: 'make REL=<rel>'")
endif
@echo
@echo ==== Replacing version identifier in ${src}...
sed -i .bak "s/^prs_ver = \'.*\'/prs_ver = \'${REL}\'/" ${src}
@echo ==== Comitting change to repository...
git add ${src}
git commit -m 'Bumping up version to ${REL} for release'
@echo
@echo ==== Tagging release with ${REL}...
git tag -a -m 'Release ${REL}' ${REL}
@echo
@echo ==== Cloning temp repository for ${REL}
rm -rf /tmp/${basename}-${REL}
git clone --recursive . /tmp/${basename}-${REL}
find /tmp/${basename}-${REL} -name .git -print | xargs rm -rf
@echo
@echo ==== Creating bundles
rm -f /tmp/${basename}-${REL}.zip
cd /tmp && zip -q -r ${basename}-${REL}.zip ${basename}-${REL}
@echo
@echo "**********************"
@echo "***** Success *****"
@echo
@echo Bundles available here:
@echo
ls -ldh /tmp/${basename}-${REL}*
install:
ifeq ($(strip ${REL}),)
$(error "Have to specify a release. Usage: 'make REL=<rel>'")
endif
@echo
@echo ==== Pushing release changes with tags upstream...
git push --tags
@echo
@echo ==== Replacing version identifier in ${src} to dev ver...
sed -i .bak "s/^prs_ver = \'.*\'/prs_ver = \'${REL}+\'/" ${src}
@echo ==== Comitting change to repository...
git add ${src}
git commit -m 'Bumping up version to ${REL}+ for development'