-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (86 loc) · 4.95 KB
/
Makefile
File metadata and controls
130 lines (86 loc) · 4.95 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
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
SKYFIELD_DATA_VERSION ?= $(shell pip show skyfield-data | grep Version | awk '{print $$2}')
KOSMORROLIB_VERSION ?= $(shell pip show kosmorrolib | grep Version | awk '{print $$2}')
KOSMORRO_VERSION ?= $(shell pip show kosmorro | grep Version | awk '{print $$2}')
DEBPKG_KEY_ID ?= ""
clean:
rm -rf *.deb
aptly publish drop main || true
aptly repo drop main || true
rm -rf ~/.aptly/public/
rm -rf main repos tmp
packages: deb
repos: packages repo-apt
#######################
### DEBIAN PACKAGES ###
#######################
.PHONY: deb
deb: python3-skyfield-data.deb python3-kosmorrolib.deb kosmorro.deb
repo-apt:
mkdir main && mv *.deb main
aptly repo create main
aptly repo add main main/
mkdir -p ~/.aptly/public
aptly publish repo --architectures=all --distribution=main --suite=stable --gpg-key="$(DEBPKG_KEY_ID)" main
rm -rf repos/apt
mkdir -p repos
cp -r ~/.aptly/public repos/apt
# Clean:
aptly publish drop main
aptly repo drop main
rm -rf main
python3-skyfield-data.deb:
mkdir -p skyfield-data-deb/DEBIAN
mkdir -p skyfield-data-deb/usr/bin
mkdir -p skyfield-data-deb/usr/share/doc/python3-skyfield-data
mkdir -p skyfield-data-deb/usr/lib/python3/dist-packages
pip install --target=tmp skyfield-data
rm -rf tmp/skyfield_data/__pycache__
cp -r tmp/skyfield_data skyfield-data-deb/usr/lib/python3/dist-packages
cp -r tmp/skyfield_data-$(SKYFIELD_DATA_VERSION).dist-info skyfield-data-deb/usr/lib/python3/dist-packages
cp deb/skyfield-data/control skyfield-data-deb/DEBIAN/control
curl https://raw.githubusercontent.com/brunobord/skyfield-data/refs/tags/$(SKYFIELD_DATA_VERSION)/CHANGELOG.md | python deb/mkchangelogs.py python3-skyfield-data Deuchnord "jerome@deuchnord.fr" | gzip -9 > skyfield-data-deb/usr/share/doc/python3-skyfield-data/changelog.gz
curl https://raw.githubusercontent.com/brunobord/skyfield-data/refs/tags/$(SKYFIELD_DATA_VERSION)/COPYING > skyfield-data-deb/usr/share/doc/python3-skyfield-data/copyright
sed -i "s/Version: __VERSION__/Version: $(SKYFIELD_DATA_VERSION)/" skyfield-data-deb/DEBIAN/control
fakeroot dpkg-deb --build skyfield-data-deb
mv skyfield-data-deb.deb python3-skyfield-data_$(SKYFIELD_DATA_VERSION)_all.deb
rm -rf skyfield-data-deb tmp
python3-kosmorrolib.deb:
mkdir -p kosmorrolib-deb/DEBIAN
mkdir -p kosmorrolib-deb/usr/bin
mkdir -p kosmorrolib-deb/usr/share/doc/python3-kosmorrolib
mkdir -p kosmorrolib-deb/usr/lib/python3/dist-packages
pip install --target=tmp kosmorrolib
rm -rf tmp/kosmorrolib/__pycache__
cp -r tmp/kosmorrolib kosmorrolib-deb/usr/lib/python3/dist-packages
cp -r tmp/kosmorrolib-$(KOSMORROLIB_VERSION).dist-info kosmorrolib-deb/usr/lib/python3/dist-packages
cp deb/kosmorrolib/control kosmorrolib-deb/DEBIAN/control
curl https://raw.githubusercontent.com/Kosmorro/lib/refs/tags/v$(KOSMORROLIB_VERSION)/CHANGELOG.md | python deb/mkchangelogs.py python3-kosmorrolib Deuchnord "jerome@deuchnord.fr" | gzip -9 > kosmorrolib-deb/usr/share/doc/python3-kosmorrolib/changelog.gz
curl https://raw.githubusercontent.com/Kosmorro/lib/refs/tags/v$(KOSMORROLIB_VERSION)/LICENSE.md > kosmorrolib-deb/usr/share/doc/python3-kosmorrolib/copyright
sed -i "s/Version: __VERSION__/Version: $(KOSMORROLIB_VERSION)/" kosmorrolib-deb/DEBIAN/control
fakeroot dpkg-deb --build kosmorrolib-deb
mv kosmorrolib-deb.deb python3-kosmorrolib_$(KOSMORROLIB_VERSION)_all.deb
rm -rf kosmorrolib-deb tmp
kosmorro.deb:
mkdir -p kosmorro-deb/DEBIAN
mkdir -p kosmorro-deb/usr/bin
mkdir -p kosmorro-deb/usr/share/doc/kosmorro
mkdir -p kosmorro-deb/usr/share/man/man1
mkdir -p kosmorro-deb/usr/lib/python3/dist-packages
pip install --target=tmp kosmorro
# remove pycache folders:
rm -rf tmp/kosmorro/__pycache__ tmp/kosmorro/i18n/__pycache__
# Replace shebang in executable:
printf "#!/usr/bin/env python3\n$$(tail -n +2 tmp/bin/kosmorro)" > tmp/bin/kosmorro
cp -r tmp/kosmorro kosmorro-deb/usr/lib/python3/dist-packages
cp -r tmp/kosmorro-$(KOSMORRO_VERSION).dist-info kosmorro-deb/usr/lib/python3/dist-packages
cp tmp/bin/kosmorro kosmorro-deb/usr/bin/kosmorro
curl https://raw.githubusercontent.com/Kosmorro/kosmorro/refs/tags/v$(KOSMORRO_VERSION)/manpage/kosmorro.1.md | ronn --roff | gzip -9 > kosmorro-deb/usr/share/man/man1/kosmorro.1.gz
curl https://raw.githubusercontent.com/Kosmorro/kosmorro/refs/tags/v$(KOSMORRO_VERSION)/CHANGELOG.md | python deb/mkchangelogs.py python3-kosmorro Deuchnord "jerome@deuchnord.fr" | gzip -9 > kosmorro-deb/usr/share/doc/kosmorro/changelog.gz
curl https://raw.githubusercontent.com/Kosmorro/kosmorro/refs/tags/v$(KOSMORRO_VERSION)/LICENSE.md > kosmorro-deb/usr/share/doc/kosmorro/copyright
cp deb/kosmorro/control kosmorro-deb/DEBIAN/control
chmod +x kosmorro-deb/usr/bin/kosmorro
sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/python3/' kosmorro-deb/usr/bin/kosmorro
sed -i "s/Version: __VERSION__/Version: $(KOSMORRO_VERSION)/" kosmorro-deb/DEBIAN/control
fakeroot dpkg-deb --build kosmorro-deb
mv kosmorro-deb.deb kosmorro_$(KOSMORRO_VERSION)_all.deb
rm -rf kosmorro-deb tmp