Skip to content

Commit 1fabdf8

Browse files
committed
add package's files
1 parent 240b6dd commit 1fabdf8

File tree

5 files changed

+181
-0
lines changed

5 files changed

+181
-0
lines changed

package/build.sh

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/sh
2+
#
3+
# This script builds RPM and DEB package for mydumper.
4+
# To compile binaries look at https://github.com/maxbube/mydumper_builder
5+
# Requirements: yum install rpm-build dpkg dpkg-devel fakeroot
6+
7+
SOURCE=/opt/src/mydumper
8+
TARGET=/opt/PKGS
9+
WORK_DIR=/tmp/pkgbuild-`date +%s`
10+
YUM_REPO=/usr/share/nginx/html/rpm-contrib
11+
APT_REPO=/usr/share/nginx/html/deb-contrib
12+
13+
set -e
14+
15+
PROJECT=mydumper
16+
WORKSPACE=$(dirname "$(readlink -f "$0")")
17+
18+
if [ "$#" = 2 ]; then
19+
VERSION=$1
20+
RELEASE=$2
21+
else
22+
echo "USAGE: sh build.sh <version> <revision>"
23+
exit 1
24+
fi
25+
26+
build_rpm() {
27+
ARCH=x86_64
28+
SUBDIR=$1
29+
DISTRO=$2
30+
31+
mkdir -p $WORK_DIR/{BUILD,BUILDROOT,RPMS,SOURCES,SRPMS} $WORK_DIR/SOURCES/$PROJECT-$VERSION $TARGET
32+
cp -r $SOURCE/$SUBDIR/* $WORK_DIR/SOURCES/$PROJECT-$VERSION
33+
cd $WORK_DIR/SOURCES
34+
tar czf $PROJECT-$VERSION.tar.gz $PROJECT-$VERSION/
35+
cd ..
36+
37+
rpmbuild -ba $WORKSPACE/rpm/$PROJECT.spec \
38+
--define "_topdir $WORK_DIR" \
39+
--define "version $VERSION" \
40+
--define "release $RELEASE" \
41+
--define "distro $DISTRO"
42+
PKG=$PROJECT-$VERSION-$RELEASE.$DISTRO.$ARCH.rpm
43+
mv RPMS/$PKG $TARGET
44+
45+
rpm -qpil --requires $TARGET/$PKG
46+
echo
47+
echo "RPM done: $TARGET/$PKG"
48+
echo
49+
rm -rf $WORK_DIR
50+
}
51+
52+
build_deb() {
53+
ARCH=amd64
54+
SUBDIR=$1
55+
DISTRO=$2
56+
57+
mkdir -p $WORK_DIR/${PROJECT}_$VERSION/DEBIAN $TARGET
58+
cd $WORK_DIR
59+
cp $WORKSPACE/deb/* $WORK_DIR/${PROJECT}_$VERSION/DEBIAN/
60+
sed -i "s/%{version}/$VERSION-$RELEASE/" $WORK_DIR/${PROJECT}_$VERSION/DEBIAN/control
61+
$WORKSPACE/deb/files $SOURCE/$SUBDIR $WORK_DIR/${PROJECT}_$VERSION
62+
63+
fakeroot dpkg --build ${PROJECT}_$VERSION
64+
PKG=${PROJECT}_$VERSION-${RELEASE}.${DISTRO}_${ARCH}.deb
65+
mv ${PROJECT}_$VERSION.deb $TARGET/$PKG
66+
67+
echo
68+
dpkg -I $TARGET/$PKG
69+
dpkg -c $TARGET/$PKG
70+
echo
71+
echo "DEB done: $TARGET/$PKG"
72+
echo
73+
rm -rf $WORK_DIR
74+
}
75+
76+
# function "source dir" "distro"
77+
build_rpm "el6" "el6"
78+
build_rpm "el7" "el7"
79+
build_deb "trusty" "trusty"
80+
build_deb "xenial" "xenial"
81+
build_deb "wheezy" "wheezy"
82+
build_deb "jessie" "jessie"
83+
build_deb "stretch" "stretch"
84+
build_deb "bionic" "bionic"
85+
86+
# Building from Jenkins
87+
if [ -n "${JOB_NAME}" ]; then
88+
cd $TARGET
89+
mv *.el6.x86_64.rpm $YUM_REPO/6
90+
mv *.el7.x86_64.rpm $YUM_REPO/7
91+
createrepo --update $YUM_REPO/6
92+
createrepo --update $YUM_REPO/7
93+
createrepo --update $YUM_REPO
94+
echo "YUM repo updated."
95+
echo
96+
for DISTRO in {trusty,xenial,wheezy,jessie,stretch,bionic}; do
97+
cd $TARGET
98+
mv *.${DISTRO}_amd64.deb $APT_REPO/$DISTRO/
99+
cd $APT_REPO/$DISTRO
100+
dpkg-scanpackages -m . | gzip -9c > Packages.gz; gunzip -c Packages.gz > Packages
101+
done
102+
echo "APT repo updated."
103+
echo
104+
fi
105+
106+
exit 0

package/deb/control

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Source: mydumper
2+
Section: utils
3+
Priority: optional
4+
Maintainer: Max Bubenick <[email protected]>
5+
Homepage: https://github.com/maxbube/mydumper
6+
Package: mydumper
7+
Version: %{version}
8+
Architecture: amd64
9+
Description: mydumper and myloader MySQL backup tools
10+
This package provides mydumper and myloader MySQL backup tools.
11+
.
12+
mydumper is a tool used for backing up MySQL database servers much
13+
faster than the mysqldump tool distributed with MySQL. It also has the
14+
capability to retrieve the binary logs from the remote server at the same time
15+
as the dump itself. The advantages of mydumper are: parallelism,
16+
easier to manage output, consistency, manageability.
17+
.
18+
myloader is a tool used for multi-threaded restoration of mydumper backups.

package/deb/copyright

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: mydumper
3+
4+
Files: *
5+
Copyright: 2013-2020 Max Bubenick <[email protected]>
6+
License: GPL

package/deb/files

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
SOURCE=$1
3+
BUILD_ROOT=$2
4+
cd $SOURCE
5+
install -m 0755 -d ${BUILD_ROOT}/usr/bin/
6+
install -m 0555 mydumper ${BUILD_ROOT}/usr/bin/
7+
install -m 0555 myloader ${BUILD_ROOT}/usr/bin/

package/rpm/mydumper.spec

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Name: mydumper
2+
Summary: mydumper and myloader MySQL backup tools
3+
Version: %{version}
4+
Release: %{release}
5+
Group: Applications/Databases
6+
License: GPL
7+
Vendor: Max Bubenick
8+
URL: https://github.com/maxbube/mydumper
9+
Source: mydumper-%{version}.tar.gz
10+
BuildArch: x86_64
11+
AutoReq: no
12+
%define _rpmfilename %{name}-%{version}-%{release}.%{distro}.%{arch}.rpm
13+
14+
%description
15+
This package provides mydumper and myloader MySQL backup tools.
16+
17+
mydumper is a tool used for backing up MySQL database servers much
18+
faster than the mysqldump tool distributed with MySQL. It also has the
19+
capability to retrieve the binary logs from the remote server at the same time
20+
as the dump itself. The advantages of mydumper are: parallelism,
21+
easier to manage output, consistency, manageability.
22+
23+
myloader is a tool used for multi-threaded restoration of mydumper backups.
24+
25+
%prep
26+
%setup -q
27+
28+
%build
29+
%define debug_package %{nil}
30+
31+
%install
32+
install -m 0755 -d ${RPM_BUILD_ROOT}%{_bindir}
33+
install -m 0555 mydumper ${RPM_BUILD_ROOT}%{_bindir}
34+
install -m 0555 myloader ${RPM_BUILD_ROOT}%{_bindir}
35+
36+
%clean
37+
rm -rf ${RPM_BUILD_ROOT}
38+
39+
%files
40+
%defattr(-,root,root,-)
41+
%{_bindir}/*
42+
43+
%changelog
44+

0 commit comments

Comments
 (0)