Permalink
Browse files

fix: sync with latest Fedora (#637)

* rpm: sync with latest fedora

* make the 'rpm_ci' working outside from travis

- fix issues with umask 0077 Dockerfile
- export PARENT_VERSION in travis_build.sh, the substitution is
  now done in 'rpm_ci' itself
- add 'repo' feature into srpmgen (so we could potentially
  generate pgjdbc-parent-poms from git in future, too)
- use :Z flag for volume for docker run (SELinux)
  • Loading branch information...
praiskup authored and vlsi committed Nov 14, 2016
1 parent b4604cd commit a29ad80bcfdd65d11257f6339eb6bf2512612eed
@@ -3,8 +3,7 @@ set -x -e
if [[ "${FEDORA_CI}" == *"Y" ]];
then
PARENT_VERSION=$(mvn -B -N org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.parent.version | grep -v '\[')
sed -i "s/^%global parent_ver .*/%global parent_ver ${PARENT_VERSION}/" packaging/rpm/postgresql-jdbc.spec.tpl
export PARENT_VERSION=$(mvn -B -N org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.parent.version | grep -v '\[')
exec ./packaging/rpm_ci
fi
@@ -15,6 +15,7 @@ RUN dnf -y --setopt=tsflags=nodocs install \
&& dnf -y update copr-cli python-copr --enablerepo updates-testing
ADD build_local copr-ci-git srpmgen /usr/bin/
RUN chmod +rx /usr/bin/{build_local,copr-ci-git,srpmgen}
WORKDIR /rpm
@@ -6,6 +6,8 @@ copr_fe_url=https://copr.fedorainfracloud.org/coprs/g/pgjdbc/pgjdbc-travis/build
copr_be_link=https://copr-be.cloud.fedoraproject.org/results/@pgjdbc/pgjdbc-travis/fedora-rawhide-x86_64/
status_file=copr_build_id
test -z "$PARENT_VERSION" && exit 1
copr_wrapper ()
(
set +x
@@ -29,7 +31,9 @@ cd "$1"
git_rev=$(git rev-parse --short=7 HEAD)
date_rev=$(date +%Y%m%d_%H%M%S)
release=${date_rev}.git$git_rev
sed "s!^Release:.*\$!Release: 1.$release%{?dist}!" "$2".spec.tpl > "$2".spec
sed -e "s!^Release:.*\$!Release: 1.$release%{?dist}!" \
-e "s!%global parent_ver.*!%global parent_ver $PARENT_VERSION!" \
"$2".spec.tpl > "$2".spec
srpmgen
build_local -bs "$2".spec --define "dist %nil"
copr_wrapper --config "$1"/copr-token build --nowait @pgjdbc/pgjdbc-travis "$2-$3-1.$release.src.rpm"
@@ -1,11 +1,12 @@
#! /bin/perl
use YAML;
use Cwd;
use File::Basename;
open (my $config_file, "<", ".srpmgen") or die "Couldn't open file: $!";
open (my $config_file, "<", ".srpmgen") or die "Couldn't open file: $!";
my ($config) = Load( join('', <$config_file>));
my ($config) = Load(join('', <$config_file>));
sub info
{
@@ -20,10 +21,28 @@ if ($? >> 8) {
sub obtain_source
{
my ($id, $config) = @_;
my $tarball_dir = cwd();
if (defined ($config->{git_archive})) {
my $srcdir = ".";
if (defined ($config->{repo}))
{
# This is not going to be cloned from the "main" git repo, but
# rather from separate one.
if (!defined $config->{repo}->{address} ||
!defined $config->{repo}->{subdir}) {
die ("'repo' argument in .srpmdir requires 'address' and 'subdir' sub-parameters");
}
$srcdir = $config->{repo}->{address};
system ("git clone $config->{repo}->{address} ${config}->{repo}->{subdir}");
if ($? >> 8) {
die ("can't clone $config->{repo}->{address}");
}
}
$config = $config->{git_archive};
my $topleveldir = `git rev-parse --show-toplevel`;
my $topleveldir = `cd "$srcdir" && git rev-parse --show-toplevel`;
if ($? >> 8) {
die ("can't get git top level directory");
}
@@ -35,7 +54,7 @@ sub obtain_source
if (defined ($config->{tarball_base})) {
$tarball_base = $config->{tarball_base};
}
system ("git archive --remote $topleveldir --prefix $pfx/ HEAD | gzip > $tarball_base.tar.gz");
system ("cd '$srcdir' && git archive --remote '$topleveldir' --prefix $pfx/ HEAD | gzip > '$tarball_dir/$tarball_base.tar.gz'");
if ($? >> 8) {
die ("can't generate tarball $tarball_base.tar.gz");
}
@@ -38,7 +38,7 @@
%global upstreamrel git
%global upstreammajor 9.5
%global source_path pgjdbc/src/main/java/org/postgresql
%global parent_ver 1.1.0
%global parent_ver GENERATED
%global parent_poms_builddir ./pgjdbc-parent-poms
%global pgjdbc_mvn_options -DwaffleEnabled=false -DosgiEnabled=false \\\
@@ -47,17 +47,16 @@
Summary: JDBC driver for PostgreSQL
Name: postgresql-jdbc
Version: %upstreammajor.%{upstreamrel}
Release: 1%{?dist}
Release: GENERATED
License: BSD
URL: http://jdbc.postgresql.org/
Source0: REL%{version}.tar.gz
Source1: postgres-testing.sh
# Upstream moved parent pom.xml into separate project (even though there is only
# one dependant project on it?). Let's try to not complicate packaging by
# having separate spec file for it, too.
Source2: https://github.com/pgjdbc/pgjdbc-parent-poms/archive/REL%parent_ver.tar.gz
Source1: https://github.com/pgjdbc/pgjdbc-parent-poms/archive/REL%parent_ver.tar.gz
BuildArch: noarch
BuildRequires: java-devel >= 1.8
@@ -70,8 +69,9 @@ BuildRequires: maven-plugin-build-helper
BuildRequires: classloader-leak-test-framework
%if %runselftest
BuildRequires: postgresql-server
BuildRequires: postgresql-contrib
BuildRequires: postgresql-devel
BuildRequires: postgresql-server
%endif
# gettext is only needed if we try to update translations
@@ -99,7 +99,7 @@ This package contains the API Documentation for %{name}.
%prep
%setup -c -q -a 2 -n pgjdbc-REL%version
%setup -c -q -a 1 -n pgjdbc-REL%version
mv pgjdbc-REL%version/* .
mv pgjdbc-parent-poms-REL%parent_ver pgjdbc-parent-poms
@@ -139,7 +139,7 @@ mkdir -p pgjdbc/target/generated-sources/annotations
# Include PostgreSQL testing methods and variables.
%if %runselftest
. %{SOURCE1}
%pgtests_init
PGTESTS_LOCALE=C.UTF-8
@@ -157,14 +157,15 @@ protocolVersion=0
EOF
# Start the local PG cluster.
pgtests_start
%pgtests_start
%else
# -f is equal to -Dmaven.test.skip=true
opts="-f"
%endif
%mvn_build $opts -- %pgjdbc_mvn_options
%install
%mvn_install
@@ -184,7 +185,7 @@ opts="-f"
%changelog
* Mon Aug 29 2016 Pavel Raiskup <praiskup@redhat.com> - 9.4.1209-6
* Thu Nov 03 2016 Pavel Raiskup <praiskup@redhat.com> - 9.5.git-1
- sync with latest Fedora
* Wed Jun 01 2016 Pavel Raiskup <praiskup@redhat.com> - 9.5.git-1
@@ -10,10 +10,6 @@ cd "$(dirname "$0")"
echo "$copr_token_password" | gpg --batch --passphrase-fd 0 rpm/copr-token.gpg
) || exit 0
# If we have SELinux box, setup correct docker label
if test -x /bin/chcon ; then
chcon -R -t svirt_sandbox_file_t ..
fi
docker run -e HOME=/git -u `id -u` -ti --rm -v `pwd`/..:/git praiskup/copr-and-jdbc-ci \
docker run -e HOME=/git -e PARENT_VERSION \
-u `id -u` -ti --rm -v `pwd`/..:/git:Z praiskup/copr-and-jdbc-ci \
copr-ci-git /git/packaging/rpm postgresql-jdbc 9.5.git

0 comments on commit a29ad80

Please sign in to comment.