Skip to content

Commit b0e7be7

Browse files
benschermelJohnSully
authored andcommitted
add deb/rpm/docker support
1 parent 026ab4c commit b0e7be7

File tree

111 files changed

+1645
-2745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1645
-2745
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ core
88
dump.rdb
99
src/keydb-server
1010
bin/keydb-server
11+
app/keydb-server
1112
*.deb
1213
*.rpm
1314
keydb-pro-server
1415
src/keydb-cli
1516
bin/keydb-cli
17+
app/keydb-cli
1618
src/keydb-sentinel
1719
bin/keydb-sentinel
20+
app/keydb-sentinel
1821
redis-benchmark
1922
keydb-benchmark
2023
redis-check-aof
@@ -24,11 +27,8 @@ keydb-check-rdb
2427
redis-check-dump
2528
keydb-check-dump
2629
redis-cli
27-
keydb-cli
2830
redis-sentinel
29-
keydb-sentinel
3031
redis-server
31-
keydb-server
3232
doc-tools
3333
release
3434
misc/*

pkg/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### KeyDB Packaging
2+
3+
The following directories contain packaging code used to create rpm and deb packages as well as docker images.

pkg/deb/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
## Deb Packaging
1+
### KeyDB DEB Package Source Builds
22

3-
The deb packages for open source KeyDB contain the KeyDB-Pro binary as well. As such we are generating deb packages using prebuilt binaries.
4-
Scripts update the appropriate files for the build and `dkpg-deb -b` is used to create the package. Dependencies for Pro are also included. This script modifies the same package rather than having many duplicates to ensure modifications made are pushed accross builds.
3+
This directpry contains all information to build a deb package for any distribution.
54

6-
If you want to generate your own deb packages following running `make` and generating new binaries you can generate deb packages with the following command:
5+
You will need to install pbuilder `sudo apt install pbuilder`
76

7+
You can now run the command:
88
```
9-
$ cd KeyDB/pkg/deb
10-
$ deb-builder.sh <version-tag>
9+
$ ./deb-buildsource.sh
1110
```
1211

13-
The generated deb packages will be output to the directory "deb_files_generated". Update the changelog prior to generating the deb package if you would like a record.
12+
You will now generate a directory structure, .dsc file, original.tar.gz, .changes files and new changelog for the distribution and architecture installed.
1413

15-
Github CI will generate packages on each build versioned 0.0.0.0 and will contain open source binaries only. On tagged releases, deb packages with the appropriate version as well as the pro binary will be generated.
16-
14+
When complete the produced debian packages will be located in deb_files_generated directory.
15+
16+
Arguments for the deb-buildsource.sh script that can be passed are either 'None' or '"your custom comments"'. 'None' assumes a permanent changelog entry has been made listing the correct build for the version. If you quote and enter your own comment string, it will be appended to the changelog for that deb package. If no argument is passed a default comment is generated saying that this deb package was generated by this script.
17+
18+
This script has been tested on xenial/bionic/disco/stretch/buster

pkg/deb/deb-builder.sh

Lines changed: 0 additions & 185 deletions
This file was deleted.

pkg/deb/deb-buildsource.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#! /bin/bash
2+
3+
# define parameters used in this deb package build
4+
# enter comments as an argument string quoted. If you do not want comments to be added (ie. you have updated in git repo) type None
5+
if [ $# -eq 0 ]; then
6+
changelog_comments="This is a new source build generated from the deb_build_source.sh script"
7+
else
8+
changelog_comments=$1
9+
fi
10+
echo $changelog_comments
11+
build=1 #change if updated build number required. Default is 1 as convention for keydb is to update minor version
12+
version=$(grep KEYDB_REAL_VERSION ../../../src/version.h | awk '{ printf $3 }' | tr -d \")
13+
majorv="${version:0:1}"
14+
distributor=$(lsb_release --id --short)
15+
if [ "$distributor" == "Debian" ]; then
16+
distname=+deb$(lsb_release --release --short | cut -d. -f1)u1
17+
elif [ "$distributor" == "Ubuntu" ]; then
18+
distname=~$(lsb_release --codename --short)1
19+
fi
20+
codename=$(lsb_release --codename --short)
21+
date=$(date +%a," "%d" "%b" "%Y" "%T)
22+
pkg_name=keydb-$version$distname
23+
24+
# create build tree
25+
cd ../../../
26+
tar -czvf keydb_$version.orig.tar.gz --force-local KeyDB
27+
cd KeyDB/pkg/deb/
28+
mkdir -p $pkg_name/tmp
29+
cp -r debian $pkg_name/tmp
30+
cp master_changelog $pkg_name/tmp/debian/changelog
31+
mv ../../../keydb_$version.orig.tar.gz ./$pkg_name
32+
cd $pkg_name/tmp
33+
changelog_str="keydb ($version-$build$distname) $codename; urgency=medium\n\n * $version $changelog_comments \n\n -- Ben Schermel <[email protected]> $date +0000\n\n"
34+
if [ $# -eq 0 ]; then
35+
sed -i "1s/^/$changelog_str\n/" debian/changelog
36+
elif [ $# -eq 1 ] && [ "$1" != "None" ]; then
37+
sed -i "1s/^/$changelog_str\n/" debian/changelog
38+
fi
39+
sed -i "s/distribution_placeholder/$distname/g" debian/changelog
40+
sed -i "s/codename_placeholder/$codename/g" debian/changelog
41+
42+
# generate required files and structure for pbuilder including .dsc file
43+
debuild -S -sa
44+
cd ../
45+
46+
# create pbuilder chrooted environment and build the deb package
47+
sudo pbuilder create --distribution $codename
48+
sudo pbuilder --update
49+
sudo pbuilder --build *.dsc
50+
51+
# move new packages to deb_files_generated and clean up
52+
cp /var/cache/pbuilder/result/*$version*.deb ../deb_files_generated
53+
sudo pbuilder --autocleanaptcache
54+
cd ../
55+
rm -rf $pkg_name

pkg/deb/deb_files_generated/.gitkeep

100755100644
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# keep this directory in git tree

0 commit comments

Comments
 (0)