File gerrit.spec of Package gerrit
#
# spec file for package gerrit
#
# Copyright (c) 2021 Samu Voutilainen
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# NOTE: Build currently only works on amd64, due nodejs stuff. I don’t know what I should do about it...
%define guice_version 4.2.3
Name: gerrit
Version: 3.4.1
Release: 0
Summary: Gerrit Code Review
License: Apache-2.0
Group: Development/Tools/Version Control
URL: https://www.gerritcodereview.com
Source0: %{name}-%{version}.tar.xz
# Upstream has its own modified version of rules_closure for some bug squenching, so going through easy route here.
Source1: %{name}_rules_closure-V0.31.tar.gz
Source2: node_modules.tpxz
Source10: guice-%{guice_version}-no_aop.jar
# TODO: This is just wrong... But this packaging system is pure annoyance.
Source11: node-v12.13.0-linux-x64.tar.xz
Source12: yarn-v1.19.1.tar.gz
Source13: protobufjs-6.8.8.tgz
Source14: rollup-1.2.0.tgz
BuildArch: noarch
BuildRequires: java >= 1.8.0
BuildRequires: bazel >= 3.1
BuildRequires: bazel-rules-java-source
# I don’t know exact required version, but at least it needs to be newer than 2.0.0.
BuildRequires: bazel-toolchains-source > 2.0.0
BuildRequires: bazel-rules-go-source
BuildRequires: bazel-rules-proto-source
BuildRequires: bazel-rules-nodejs-source >= 1.5.0
BuildRequires: bazel-gazelle-source
BuildRequires: protobuf-source
Requires: java >= 1.8.0
# Testing, if I can get system nodejs working properly
#BuildRequires: nodejs-packaging
BuildRequires: nodejs
# Debug:
#BuildRequires:
%description
Gerrit makes reviews easier by showing changes in a side-by-side display, and
allowing inline comments to be added by any reviewer.
Gerrit simplifies Git based project maintainership by permitting any
authorized user to submit changes to the master Git repository, rather than
requiring all approved changes to be merged in by hand by the project
maintainer.
%prep
%setup -q
cd %{_builddir}
tar xfp %{S:1}
# nodejs copy required by bazel’s rules_nodejs for some bad reason.
tar xfp %{S:11}
cd %{name}-%{version}
tar xfp %{S:2}
%build
# SUSE 15.3’s Bazel 3.4 doesn’t support this flag it seems.
sed -i 's/build --experimental_worker_multiplex=false//' .bazelrc
# --linkopt="-Wl,-soname,lib%{name}_lib.so.%{sover}"
bazel build \
-c dbg \
--color=no \
%(for opt in %{optflags}; do echo -e "--copt=${opt} \c"; done) \
--curses=no \
--distdir=%{_sourcedir} \
--genrule_strategy=standalone \
--host_javabase=@local_jdk//:jdk \
--spawn_strategy=standalone \
--override_repository="bazel_gazelle=/usr/src/bazel-gazelle" \
--override_repository="bazel_toolchains=/usr/src/bazel-toolchains" \
--override_repository="build_bazel_rules_nodejs=/usr/src/bazel-rules-nodejs" \
--override_repository="com_google_protobuf=/usr/src/protobuf" \
--override_repository="io_bazel_rules_closure=%{_builddir}/rules_closure-0.31" \
--override_repository="io_bazel_rules_go=/usr/src/bazel-rules-go" \
--override_repository="io_bazel_rules_nodejs=/usr/src/bazel-rules-nodejs" \
--override_repository="rules_java=/usr/src/bazel-rules-java" \
--override_repository="rules_proto=/usr/src/bazel-rules-proto" \
--strip=never \
--verbose_failures \
--nofetch \
release
bazel shutdown
%install
%files
%changelog