mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Add CentOS/RHEL package builds.
This commit is contained in:
parent
f9c1a3b156
commit
5b491b3035
@ -28,6 +28,14 @@
|
||||
</release-item>
|
||||
</release-development-list>
|
||||
</release-core-list>
|
||||
|
||||
<release-test-list>
|
||||
<release-feature-list>
|
||||
<release-item>
|
||||
<p>Add CentOS/RHEL package builds.</p>
|
||||
</release-item>
|
||||
</release-feature-list>
|
||||
</release-test-list>
|
||||
</release>
|
||||
|
||||
<release date="2018-02-23" version="2.00" title="Performance Improvements for Archive Push">
|
||||
|
@ -577,7 +577,19 @@ sub containerBuild
|
||||
}
|
||||
else
|
||||
{
|
||||
$strScript = '';
|
||||
$strScript = sectionHeader() .
|
||||
"# Install package build tools\n" .
|
||||
" yum install -y rpm-build";
|
||||
|
||||
$strScript .= sectionHeader() .
|
||||
"# Install pgBackRest package source\n" .
|
||||
" mkdir /root/package-src && \\\n" .
|
||||
" wget -O /root/package-src/pgbackrest-conf.patch " .
|
||||
"'https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;" .
|
||||
"f=rpm/redhat/master/pgbackrest/master/pgbackrest-conf.patch;hb=refs/heads/master' && \\\n" .
|
||||
" wget -O /root/package-src/pgbackrest.spec " .
|
||||
"'https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob_plain;" .
|
||||
"f=rpm/redhat/master/pgbackrest/master/pgbackrest.spec;hb=refs/heads/master'";
|
||||
}
|
||||
|
||||
containerWrite($oStorageDocker, $strTempPath, $strOS, 'Build', $strImageParent, $strImage, $strCopy,$strScript, $bVmForce);
|
||||
|
41
test/patch/rhel-package.patch
Normal file
41
test/patch/rhel-package.patch
Normal file
@ -0,0 +1,41 @@
|
||||
--- pgbackrest.spec
|
||||
+++ pgbackrest.spec
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Summary: Reliable PostgreSQL Backup & Restore
|
||||
Name: pgbackrest
|
||||
-Version: 1.28
|
||||
+Version: 2.00
|
||||
Release: 1%{?dist}
|
||||
License: MIT
|
||||
Group: Applications/Databases
|
||||
@@ -33,6 +33,10 @@
|
||||
%{__make}
|
||||
popd
|
||||
|
||||
+pushd src
|
||||
+%{__make}
|
||||
+popd
|
||||
+
|
||||
%install
|
||||
%{__install} -D -d -m 0755 %{buildroot}%{perl_vendorlib} %{buildroot}%{_bindir}
|
||||
%{__install} -D -d -m 0700 %{buildroot}/%{_sharedstatedir}/%{name}
|
||||
@@ -46,7 +50,7 @@
|
||||
%{__cp} -a libc/blib/lib/auto/pgBackRest/LibC/* %{buildroot}%{perl_vendorarch}/auto/pgBackRest/LibC
|
||||
%{__mkdir} -p %{buildroot}%{perl_vendorarch}/pgBackRest
|
||||
%{__cp} -a libc/blib/lib/pgBackRest/* %{buildroot}%{perl_vendorarch}/pgBackRest
|
||||
-%{__cp} -a bin/%{name} %{buildroot}%{_bindir}/%{name}
|
||||
+%{__cp} -a src/%{name} %{buildroot}%{_bindir}/%{name}
|
||||
|
||||
%clean
|
||||
%{__rm} -rf %{buildroot}
|
||||
@@ -68,6 +72,9 @@
|
||||
%attr(-,postgres,postgres) /var/spool/%{name}
|
||||
|
||||
%changelog
|
||||
+* Mon Feb 26 2018 - David Steele <david@pgbackrest.org> 2.00-1
|
||||
+- Build C pgbackrest bin, remove Perl bin
|
||||
+
|
||||
* Sun Feb 4 2018 - Devrim Gündüz <devrim@gunduz.org> 1.28-1
|
||||
- Update to 1.28, per #3078
|
||||
|
60
test/test.pl
60
test/test.pl
@ -766,6 +766,66 @@ eval
|
||||
|
||||
executeTest("docker rm -f test-build");
|
||||
}
|
||||
|
||||
if (!$oStorageBackRest->pathExists($strBuildPath) && $oVm->{$strBuildVM}{&VM_OS_BASE} eq VM_OS_BASE_RHEL)
|
||||
{
|
||||
&log(INFO, "build package for ${strBuildVM} (${strBuildPath})");
|
||||
|
||||
# Create build container
|
||||
executeTest(
|
||||
"docker run -itd -h test-build --name=test-build" .
|
||||
" -v ${strBackRestBase}:${strBackRestBase} " . containerRepo() . ":${strBuildVM}-build",
|
||||
{bSuppressStdErr => true});
|
||||
|
||||
# Create build directories
|
||||
$oStorageBackRest->pathCreate($strBuildPath, {bIgnoreExists => true, bCreateParent => true});
|
||||
$oStorageBackRest->pathCreate("${strBuildPath}/SOURCES", {bIgnoreExists => true, bCreateParent => true});
|
||||
$oStorageBackRest->pathCreate("${strBuildPath}/SPECS", {bIgnoreExists => true, bCreateParent => true});
|
||||
$oStorageBackRest->pathCreate("${strBuildPath}/RPMS", {bIgnoreExists => true, bCreateParent => true});
|
||||
$oStorageBackRest->pathCreate("${strBuildPath}/BUILD", {bIgnoreExists => true, bCreateParent => true});
|
||||
|
||||
# Copy source files
|
||||
executeTest(
|
||||
"tar --transform='s_^_pgbackrest-release-${strVersionBase}/_'" .
|
||||
" -czf ${strBuildPath}/SOURCES/${strVersionBase}.tar.gz -C ${strBackRestBase}" .
|
||||
" lib libc src LICENSE");
|
||||
|
||||
# Copy package files
|
||||
executeTest(
|
||||
"docker exec -i test-build bash -c '" .
|
||||
"ln -s ${strBuildPath} /root/rpmbuild && " .
|
||||
"cp /root/package-src/pgbackrest.spec ${strBuildPath}/SPECS && " .
|
||||
"cp /root/package-src/*.patch ${strBuildPath}/SOURCES && " .
|
||||
"sudo chown -R " . TEST_USER . " ${strBuildPath}'");
|
||||
|
||||
# Patch files in RHEL package builds
|
||||
#
|
||||
# Use these commands to create a new patch (may need to modify first line):
|
||||
# BRDIR=/backrest;BRVM=co7;BRPATCHFILE=${BRDIR?}/test/patch/rhel-package.patch
|
||||
# PKDIR=${BRDIR?}/test/.vagrant/package/${BRVM}/src/SPECS
|
||||
# diff -Naur ${PKDIR?}.old ${PKDIR}.new > ${BRPATCHFILE?}
|
||||
my $strPackagePatch = "${strBackRestBase}/test/patch/rhel-package.patch";
|
||||
|
||||
if ($oStorageBackRest->exists($strPackagePatch))
|
||||
{
|
||||
executeTest("cp -r ${strBuildPath}/SPECS ${strBuildPath}/SPECS.old");
|
||||
executeTest("patch -d ${strBuildPath}/SPECS < ${strPackagePatch}");
|
||||
executeTest("cp -r ${strBuildPath}/SPECS ${strBuildPath}/SPECS.new");
|
||||
}
|
||||
|
||||
# Update version number to match current version
|
||||
my $strSpec = ${$oStorageBackRest->get("${strBuildPath}/SPECS/pgbackrest.spec")};
|
||||
$strSpec =~ s/^Version\:.*$/Version\:\t${strVersionBase}/gm;
|
||||
$oStorageBackRest->put("${strBuildPath}/SPECS/pgbackrest.spec", $strSpec);
|
||||
|
||||
# Build package
|
||||
executeTest(
|
||||
"docker exec -i test-build rpmbuild -v -bb --clean root/rpmbuild/SPECS/pgbackrest.spec",
|
||||
{bSuppressStdErr => true});
|
||||
|
||||
# Remove build container
|
||||
executeTest("docker rm -f test-build");
|
||||
}
|
||||
}
|
||||
|
||||
# Write files to indicate the last time a build was successful
|
||||
|
Loading…
Reference in New Issue
Block a user