Skip to content

Commit 02366b1

Browse files
committed
[Issue #135] deb/rpm repository infrastructure
1 parent 9fb03e9 commit 02366b1

File tree

15 files changed

+840
-37
lines changed

15 files changed

+840
-37
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ __pycache__
88
tags
99
dist
1010
build
11+
packaging/repo/gnupg/*
12+
packaging/repo/rpmmacros
1113

1214
*.deb
1315
*.rpm

Makefile.pkg

+122-33
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
TOKEN ?= $(PACKAGECLOUD_TOKEN)
1+
# TOKEN ?= $(PACKAGECLOUD_TOKEN)
22
# Check for SUSE and alt linux which need specific spec file
33
ifeq "$(wildcard /etc/SuSE-rel*)" ""
44
ifeq "$(wildcard /etc/altlinux-rel*)" ""
@@ -30,12 +30,12 @@ rpm: prepare_builddir $(BUILDDIR)/packaging/rpm/SPECS/$(SPEC)
3030
$(BUILDDIR)/packaging/rpm/SPECS/$(SPEC)
3131
cp -av $(BUILDDIR)/packaging/rpm/RPMS/noarch/mamonsu*.rpm .
3232

33-
pkg: build/prepare build/all
34-
docker run -v "$(WORKDIR)":/src --rm debian:wheezy bash -exc " \
35-
cp /src/packaging/push.rb /src/build/out && cd /src/build/out && \
36-
(apt-get update -m || apt-get update -m || apt-get update -m) && \
37-
apt-get install -y ruby-dev && gem install --no-ri --no-rdoc package_cloud -v 0.2.37 && \
38-
TOKEN=$(TOKEN) ruby push.rb"
33+
#pkg: build/prepare build/all
34+
# docker run -v "$(WORKDIR)":/src --rm debian:wheezy bash -exc " \
35+
# cp /src/packaging/push.rb /src/build/out && cd /src/build/out && \
36+
# (apt-get update -m || apt-get update -m || apt-get update -m) && \
37+
# apt-get install -y ruby-dev && gem install --no-ri --no-rdoc package_cloud -v 0.2.37 && \
38+
# TOKEN=$(TOKEN) ruby push.rb"
3939

4040
build/prepare:
4141
mkdir -p build
@@ -45,64 +45,153 @@ build/all: build/pkg_debian build/pkg_ubuntu build/pkg_centos
4545
@echo Build for all platform: done
4646
touch build/all
4747

48-
build/pkg_debian: build/pkg_debian_7 build/pkg_debian_8 build/pkg_debian_9
48+
build/pkg_debian: build/pkg_debian_8 build/pkg_debian_9 build/pkg_debian_10
4949
@echo Debian: done
5050

51-
build/pkg_ubuntu: build/pkg_ubuntu_14_04 build/pkg_ubuntu_16_04 build/pkg_ubuntu_17_10 build/pkg_ubuntu_18_04
51+
build/pkg_ubuntu: build/pkg_ubuntu_16_04 build/pkg_ubuntu_18_04 build/pkg_ubuntu_18_10
5252
@echo Ubuntu: done
5353

54-
build/pkg_centos: build/pkg_centos_6 build/pkg_centos_7
54+
build/pkg_centos: build/pkg_centos_6 build/pkg_centos_7 build/rpm_repo_package_centos
5555
@echo Centos: done
5656

5757
define build_deb
58-
docker run -v "$(WORKDIR)":/src --rm $1:$2 bash -exc " \
59-
cp -a /src /var/build && \
60-
find /var/build -type d -exec chmod 0755 {} \; && find /var/build -type f -exec chmod 0644 {} \; && \
61-
cd /var/build && (apt-get update -m || apt-get update -m || apt-get update -m) && \
62-
apt-get install -y make dpkg-dev debhelper python-dev python-setuptools && make deb && \
63-
mkdir -p /src/build/out/$1/$2 && cp *.deb /src/build/out/$1/$2"
58+
docker run -v "$(WORKDIR)":/app/in \
59+
-v "$(WORKDIR)/build/pkg/$1/$2/mamonsu/$(VERSION)":/app/out \
60+
-e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" \
61+
--rm $1:$2 /app/in/packaging/scripts/deb.sh
6462
endef
6563

6664
define build_rpm
67-
docker run -v "$(WORKDIR)":/src --rm $1:$2 bash -exc " \
68-
cp -a /src /var/build && \
69-
find /var/build -type d -exec chmod 0755 {} \; && find /var/build -type f -exec chmod 0644 {} \; && \
70-
cd /var/build && yum install -y tar make rpm-build python2-devel python-setuptools && make rpm && \
71-
mkdir -p /src/build/out/el/$2 && cp *.rpm /src/build/out/el/$2"
65+
docker run -v "$(WORKDIR)":/app/in \
66+
-v "$(WORKDIR)/build/pkg/$1/$2/mamonsu/$(VERSION)":/app/out \
67+
-e "VERSION=$(VERSION)" -e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" \
68+
--rm $1:$2 /app/in/packaging/scripts/rpm.sh
7269
endef
7370

74-
build/pkg_debian_7:
75-
$(call build_deb,debian,wheezy)
76-
touch build/pkg_debian_7
71+
define build_rpm_repo_pkg
72+
docker run -v "$(WORKDIR)":/app/in \
73+
-v "$(WORKDIR)/build/pkg/keys":/app/out \
74+
-e "VERSION=$(VERSION)" -e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" \
75+
--rm $1:$2 /app/in/packaging/scripts/repo_rpm.sh
76+
endef
77+
78+
build/rpm_repo_package_centos:
79+
$(call build_rpm_repo_pkg,centos,7)
80+
touch build/rpm_repo_package_centos
7781

7882
build/pkg_debian_8:
79-
$(call build_deb,debian,jessie)
83+
$(call build_deb,debian,8,jessie)
8084
touch build/pkg_debian_8
8185

8286
build/pkg_debian_9:
83-
$(call build_deb,debian,stretch)
87+
$(call build_deb,debian,9,stretch)
8488
touch build/pkg_debian_9
8589

90+
build/pkg_debian_10:
91+
$(call build_deb,debian,10,buster)
92+
touch build/pkg_debian_10
93+
8694
build/pkg_ubuntu_14_04:
87-
$(call build_deb,ubuntu,trusty)
95+
$(call build_deb,ubuntu,14.04,trusty)
8896
touch build/pkg_ubuntu_14_04
8997

9098
build/pkg_ubuntu_16_04:
91-
$(call build_deb,ubuntu,xenial)
99+
$(call build_deb,ubuntu,16.04,xenial)
92100
touch build/pkg_ubuntu_16_04
93101

94-
build/pkg_ubuntu_17_10:
95-
$(call build_deb,ubuntu,artful)
96-
touch build/pkg_ubuntu_17_10
97-
98102
build/pkg_ubuntu_18_04:
99-
$(call build_deb,ubuntu,bionic)
103+
$(call build_deb,ubuntu,18.04,bionic)
100104
touch build/pkg_ubuntu_18_04
101105

106+
build/pkg_ubuntu_18_10:
107+
$(call build_deb,ubuntu,18.10,cosmic)
108+
touch build/pkg_ubuntu_18_10
109+
102110
build/pkg_centos_6:
103111
$(call build_rpm,centos,6)
104112
touch build/pkg_centos_6
105113

106114
build/pkg_centos_7:
107115
$(call build_rpm,centos,7)
108116
touch build/pkg_centos_7
117+
118+
#build/pkg_centos_8:
119+
# $(call build_rpm,centos,8)
120+
# touch build/pkg_centos_8
121+
122+
repo/all: repo/debian repo/ubuntu repo/centos repo/finish
123+
@echo Build repo for all platform: done
124+
touch build/repo_all
125+
126+
repo/debian: repo/debian_8 repo/debian_9 repo/debian_10
127+
@echo Build repo for debian platforms: done
128+
touch build/repo_debian
129+
130+
repo/ubuntu: repo/ubuntu_16_04 repo/ubuntu_18_04 repo/ubuntu_18_10
131+
@echo Build repo for ubuntu platforms: done
132+
touch build/repo_ubuntu
133+
134+
repo/centos: repo/centos_6 repo/centos_7
135+
@echo Build repo for centos platforms: done
136+
touch build/repo_centos
137+
138+
repo/centos_6:
139+
$(call build_repo_rpm,centos,6,6)
140+
touch build/repo_centos_6
141+
142+
repo/centos_7:
143+
$(call build_repo_rpm,centos,7,7)
144+
touch build/repo_centos_7
145+
146+
repo/debian_8:
147+
$(call build_repo_deb,debian,8,jessie)
148+
touch build/repo_debian_8
149+
150+
repo/debian_9:
151+
$(call build_repo_deb,debian,9,stretch)
152+
touch build/repo_debian_9
153+
154+
repo/debian_10:
155+
$(call build_repo_deb,debian,10,buster)
156+
touch build/repo_debian_10
157+
158+
repo/ubuntu_14_04:
159+
$(call build_repo_deb,ubuntu,14.04,trusty)
160+
touch build/repo_ubuntu_14_04
161+
162+
repo/ubuntu_16_04:
163+
$(call build_repo_deb,ubuntu,16.04,xenial)
164+
touch build/repo_ubuntu_16_04
165+
166+
repo/ubuntu_18_04:
167+
$(call build_repo_deb,ubuntu,18.04,bionic)
168+
touch build/repo_ubuntu_18_04
169+
170+
repo/ubuntu_18_10:
171+
$(call build_repo_deb,ubuntu,18.10,cosmic)
172+
touch build/repo_ubuntu_18_10
173+
174+
repo/finish:
175+
$(call repo_finish,centos,7)
176+
touch build/repo_finish
177+
178+
define build_repo_deb
179+
docker run -v $(WORKDIR)/build/pkg/$1/$2:/app/in -v $(WORKDIR)/packaging/repo:/app/repo \
180+
-v $(WORKDIR)/packaging/repo:/app/repo -v $(WORKDIR)/build/www:/app/www \
181+
-e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" -e "CODENAME=$3" \
182+
--rm $1:$2 /app/repo/scripts/deb.sh
183+
endef
184+
185+
define build_repo_rpm
186+
docker run -v $(WORKDIR)/build/pkg/$1/$2:/app/in -v $(WORKDIR)/packaging/repo:/app/repo \
187+
-v $(WORKDIR)/packaging/repo:/app/repo -v $(WORKDIR)/build/www:/app/www \
188+
-e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" -e "CODENAME=$3" \
189+
--rm $1:$2 /app/repo/scripts/rpm.sh
190+
endef
191+
192+
define repo_finish
193+
docker run -v $(WORKDIR)/build/pkg/keys:/app/in -v $(WORKDIR)/build/www:/app/www \
194+
-e "DISTRIB=$1" -e "DISTRIB_VERSION=$2" -e "CODENAME=$3" \
195+
--rm $1:$2 bash -exc "cp -av /app/in/*rpm /app/www/mamonsu/keys && cd /app/www/mamonsu/ && \
196+
ln -s $(VERSION) latest"
197+
endef

README.rst

+17-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@ Development version, available on github, released under BSD 3-clause.
1818
Installation
1919
============
2020

21-
Pre-Build packages for:
21+
DEB packages for Debian|Ubuntu:
22+
.. code-block:: bash
23+
24+
echo "deb [arch=amd64] http://repo.postgrespro.ru/mamonsu/latest/deb/ $(lsb_release -cs) main-$(lsb_release -cs)" > /etc/apt/sources.list.d/mamonsu.list
25+
wget -O - http://repo.postgrespro.ru/mamonsu/keys/GPG-KEY-MAMONSU | sudo apt-key add - && sudo apt-get update
26+
sudo apt-get install mamonsu
2227
23-
Linux distros: https://packagecloud.io/postgrespro/mamonsu
28+
RPM packages for Centos:
29+
.. code-block:: bash
2430
25-
`Windows installers <https://oc.postgrespro.ru/index.php/s/qu7YsFvOE55LdXo>`_
31+
rpm -ivh https://repo.postgrespro.ru/mamonsu/keys/mamonsu-repo-centos.noarch.rpm
32+
yum install mamonsu
2633
27-
NOTE: pre-build packages on packagecloud only for mamonsu 2.3.4
34+
Pre-Build packages for Windows: `Windows installers <https://oc.postgrespro.ru/index.php/s/qu7YsFvOE55LdXo>`_
2835

2936
Install via pip:
3037

@@ -52,6 +59,12 @@ Build rpm:
5259
$ yum install make rpm-build python2-devel python-setuptools
5360
$ git clone ... && cd mamonsu && make rpm && rpm -i mamonsu*.rpm
5461
62+
Build repository, `./packaging/repo/gnupg` and `./packaging/repo/rpmmacros` must be provided by caller:
63+
64+
.. code-block:: bash
65+
66+
$ make -j2 build/all && make -j1 repo/all
67+
5568
Build win32 exe: (worked with python v3.{4,5}: py2exe v0.9.2.2 and pywin32 v220 or python v2.7: py2exe v0.6.9 and pywin32 v220):
5669

5770
.. code-block:: bash

packaging/repo/autosign.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/expect -f
2+
3+
# Copyright Notice:
4+
# © (C) Postgres Professional 2015-2016 http://www.postgrespro.ru/
5+
# Distributed under Apache License 2.0
6+
# Распространяется по лицензии Apache 2.0
7+
8+
set rpmfile [lindex $argv 0]
9+
spawn rpm --addsign $rpmfile
10+
expect "Enter pass phrase:"
11+
send -- "\r"
12+
expect eof

0 commit comments

Comments
 (0)