Makefile
3.44 KB
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
VERSION = $(shell cat ../VERSION)
subdirs = colab-spb-plugin colab-spb-theme-plugin noosfero-spb
noosfero_repo = 'git@softwarepublico.gov.br:softwarepublico/noosfero.git'
colab_repo = 'https://github.com/colab/colab.git'
noosfero_version = $(shell sed -n '1,1p' ../CORE_VERSION)
#For some reason, the tag to use in the url request, is diferent from the
#tag showed in gitlab interface.
colab_version = $(shell sed -n '2,2p' ../CORE_VERSION)
dist_all = $(patsubst %, %-dist, $(subdirs))
dist: $(dist_all)
$(dist_all): %-dist : %
if [ -f $*/Makefile ]; then make -C $* dist; fi
if [ -f $*/setup.py ]; then (cd $* && python setup.py sdist); fi
clean_all = $(patsubst %, %-clean, $(subdirs))
clean: $(clean_all)
$(MAKE) -C pkg-rpm/ clean
$(clean_all): %-clean : %
if [ -f $*/Makefile ]; then make -C $* clean; fi
if [ -f $*/setup.py ]; then rm -rf $*/dist; fi
release_plugins:
@if git tag | grep -q '^v$(VERSION)$$'; then \
echo "E: version $(VERSION) already tagged. You need a new version number"; \
false; \
fi
echo '$(VERSION)' > colab-spb-plugin/VERSION
echo '$(VERSION)' > colab-spb-theme-plugin/VERSION
echo '$(VERSION)' > noosfero-spb/VERSION
$(MAKE) dist
cp noosfero-spb/dist/*.tar.* pkg-rpm/noosfero-spb/
cp colab-spb-theme-plugin/dist/*.tar.* pkg-rpm/colab-spb-theme/
cp colab-spb-plugin/dist/*.tar.* pkg-rpm/colab-spb-plugin/
sed -i -e 's/^\(Version:\s*\).*/\1$(VERSION)/' \
pkg-rpm/colab-spb-theme/colab-spb-theme.spec \
pkg-rpm/colab-spb-plugin/colab-spb-plugin.spec \
pkg-rpm/noosfero-spb/noosfero-spb.spec
git diff
@printf "Confirm release? [y/N]"; \
read confirm; \
if [ "$$confirm" = 'y' -o "$$confirm" = 'Y' ]; then \
echo "SPB release $(VERSION)" > .commit_template; \
git commit * --file .commit_template; \
rm -f .commit_template; \
else \
echo 'Aborting at your request!'; \
git checkout -- colab-spb-theme-plugin/VERSION noosfero-spb/VERSION colab-spb-plugin/VERSION ; \
git checkout -- pkg-rpm/colab-spb-theme/ pkg-rpm/noosfero-spb/ pkg-rpm/colab-spb-plugin/ ; \
false; \
fi
# TODO add pkg-rpm/colab-spb-plugin to the git checkout all above
$(MAKE) -C pkg-rpm/ noosfero-spb-upload colab-spb-theme-upload colab-spb-plugin-upload
git tag $(VERSION) -s -m 'SPB Release $(VERSION)'
packages=noosfero colab
core_packages = $(patsubst %, %-upload, $(packages))
$(core_packages) : %-upload :
@if [ "$*" == 'noosfero' ]; then \
wget https://softwarepublico.gov.br/gitlab/softwarepublico/noosfero/repository/archive.tar.gz?ref=stable-spb-1.3 \
--no-check-certificate -O pkg-rpm/$*/$*-$(noosfero_version).tar.gz ; \
else \
wget https://github.com/colab/colab/archive/master.tar.gz -O pkg-rpm/$*/$*-$(colab_version).tar.gz; \
fi
tar -xf pkg-rpm/$*/*.tar.gz -C pkg-rpm/$*/
rm pkg-rpm/$*/*.tar.gz;
@if [ "$*" == 'noosfero' ]; then \
mv pkg-rpm/$*/$*{.git,-$(noosfero_version)}; \
(cd pkg-rpm/$*/ && tar -zcf $*-$(noosfero_version).tar.gz $*-$(noosfero_version) && rm -rf $*-$(noosfero_version)); \
sed -i -e 's/^\(Version:\s*\).*/\1$(noosfero_version)/' \
pkg-rpm/$*/$*.spec; \
else \
mv pkg-rpm/$*/$*-{master,$(colab_version)}; \
(cd pkg-rpm/$*/ && tar -zcf $*-$(colab_version).tar.gz $*-$(colab_version) && rm -rf $*-$(colab_version)); \
sed -i -e 's/^\(Version:\s*\).*/\1$(colab_version)/' \
pkg-rpm/$*/$*.spec; \
fi
$(MAKE) -C pkg-rpm/ $*-upload >> tmp.txt
tail -n 2 tmp.txt | sed 's/[^0-9]*//g' | sed -n '1,1p' >> $(shell date +'%F').txt
rm pkg-rpm/$*/*.tar.gz tmp.txt