Split packages into separate _multibuild specs

OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/protobuf?expand=0&rev=182
This commit is contained in:
Dirk Mueller 2024-10-18 08:41:16 +00:00 committed by Git OBS Bridge
parent ab748f354e
commit c4c52bad43
13 changed files with 4449 additions and 130 deletions

5
_multibuild Normal file
View File

@ -0,0 +1,5 @@
<multibuild>
<package>python-protobuf</package>
<package>protobuf-java</package>
</multibuild>

View File

@ -1,3 +1,3 @@
libprotobuf25_4_0
libprotoc25_4_0
libprotobuf-lite25_4_0
libprotobuf28_2_0
libprotoc28_2_0
libprotobuf-lite28_2_0

View File

@ -1,9 +0,0 @@
Manifest-Version: 1.0
Created-By: stick@gk2.sk
Name: com/google/protobuf/
Specification-Title: Google Protocol Buffers
Specification-Version: @VERSION@
Specification-Vendor: stick@gk2.sk
Implementation-Title: com.google.protobuf
Implementation-Version: @VERSION@
Implementation-Vendor: stick@gk2.sk

5
pre_checkin.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
cp protobuf.changes protobuf-java.changes
cp protobuf.changes python-protobuf.changes
osc service runall format_spec_file

41
protobuf-java-4.28.2.pom Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>4.28.2</version>
</parent>
<artifactId>protobuf-java</artifactId>
<packaging>jar</packaging>
<name>Protocol Buffers [Core]</name>
<description>
Core Protocol Buffers library. Protocol Buffers are a way of encoding structured data in an
efficient yet extensible format.
</description>
<dependencies>
</dependencies>
<build>
<plugins>
<!-- OSGI bundle configuration -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Automatic-Module-Name>com.google.protobuf</Automatic-Module-Name> <!-- Java9+ Jigsaw module name -->
<Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL>
<Bundle-SymbolicName>com.google.protobuf</Bundle-SymbolicName>
<Export-Package>com.google.protobuf;version=${project.version}</Export-Package>
<Import-Package>sun.misc;resolution:=optional,*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>4.28.2</version>
</parent>
<artifactId>protobuf-java-util</artifactId>
<packaging>jar</packaging>
<name>Protocol Buffers [Util]</name>
<description>Utilities for Protocol Buffers</description>
<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>4.28.2</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.1-jre</version>
</dependency>
<dependency>
<groupId>com.google.j2objc</groupId>
<artifactId>j2objc-annotations</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- OSGI bundle configuration -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Automatic-Module-Name>com.google.protobuf.util</Automatic-Module-Name> <!-- Java9+ Jigsaw module name -->
<Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL>
<Bundle-SymbolicName>com.google.protobuf.util</Bundle-SymbolicName>
<Export-Package>com.google.protobuf.util;version=${project.version}</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

2004
protobuf-java.changes Normal file

File diff suppressed because it is too large Load Diff

152
protobuf-java.spec Normal file
View File

@ -0,0 +1,152 @@
#
# spec file for package protobuf-java
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2024 Andreas Stieger <Andreas.Stieger@gmx.de>
#
# 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/
#
%define tarname protobuf
%define baseversion 28.2
Name: protobuf-java
Version: 4.%{baseversion}
Release: 0
Summary: Java Bindings for Google Protocol Buffers
License: BSD-3-Clause
Group: Development/Libraries/Java
URL: https://github.com/protocolbuffers/protobuf
Source0: https://github.com/protocolbuffers/protobuf/releases/download/v%{baseversion}/%{tarname}-%{baseversion}.tar.gz
Source1: https://repo1.maven.org/maven2/com/google/protobuf/%{name}/%{version}/%{name}-%{version}.pom
Source2: https://repo1.maven.org/maven2/com/google/protobuf/%{name}lite/%{version}/%{name}lite-%{version}.pom
Source3: https://repo1.maven.org/maven2/com/google/protobuf/%{name}-util/%{version}/%{name}-util-%{version}.pom
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: maven-local
BuildRequires: protobuf-devel >= %{baseversion}
BuildRequires: mvn(com.google.code.findbugs:jsr305)
BuildRequires: mvn(com.google.code.gson:gson)
BuildRequires: mvn(com.google.errorprone:error_prone_annotations)
BuildRequires: mvn(com.google.guava:guava)
BuildRequires: mvn(com.google.j2objc:j2objc-annotations)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
Requires: java >= 1.8
Requires: protobuf-devel >= %{baseversion}
BuildArch: noarch
%description
Protocol Buffers are a way of encoding structured data in an efficient yet
extensible format. Google uses Protocol Buffers for almost all of its internal
RPC protocols and file formats.
This package contains the Java bindings.
%package parent
Summary: Java Bindings for Google Protocol Buffers (parent pom)
%description parent
Protocol Buffers are a way of encoding structured data in an efficient yet
extensible format. Google uses Protocol Buffers for almost all of its internal
RPC protocols and file formats.
This package contains the parent pom of the Java bindings.
%package bom
Summary: Java Bindings for Google Protocol Buffers (bom)
%description bom
Protocol Buffers are a way of encoding structured data in an efficient yet
extensible format. Google uses Protocol Buffers for almost all of its internal
RPC protocols and file formats.
This package contains the bill-of-materials pom of the Java bindings.
%package javadoc
Summary: Javadoc for %{name}
Group: Documentation/HTML
%description javadoc
This package contains the API documentation for %{name}.
%prep
%autosetup -p1 -n %{tarname}-%{baseversion}
# The previous blank line is crucial for older system being able
# to use the autosetup macro
pushd java
cp %{SOURCE1} core/pom.xml
cp %{SOURCE2} lite/pom.xml
cp %{SOURCE3} util/pom.xml
%pom_disable_module kotlin
%pom_disable_module kotlin-lite
%pom_disable_module lite
%pom_remove_plugin :animal-sniffer-maven-plugin
%pom_xpath_set "pom:plugin[pom:artifactId[text()='maven-compiler-plugin']]/pom:configuration/pom:source" "1.8"
%pom_xpath_set "pom:plugin[pom:artifactId[text()='maven-compiler-plugin']]/pom:configuration/pom:target" "1.8"
%{mvn_package} :{*}-parent parent
%{mvn_package} :{*}-bom bom
%{mvn_file} :{*} @1
%{mvn_file} :%{name} %{tarname}
popd
%build
pushd java
protoc \
--java_out=core/src/main/java \
--proto_path=../src \
--proto_path=core/src/main/resources/google/protobuf \
core/src/main/resources/google/protobuf/java_features.proto
for i in \
../src/google/protobuf/any.proto \
../src/google/protobuf/api.proto \
../src/google/protobuf/descriptor.proto \
../src/google/protobuf/duration.proto \
../src/google/protobuf/empty.proto \
../src/google/protobuf/field_mask.proto \
../src/google/protobuf/source_context.proto \
../src/google/protobuf/struct.proto \
../src/google/protobuf/timestamp.proto \
../src/google/protobuf/type.proto \
../src/google/protobuf/wrappers.proto; do
protoc \
--java_out=core/src/main/java \
--proto_path=../src \
--proto_path=core/src/main/resources/google/protobuf \
${i}
cp ${i} core/src/main/resources/google/protobuf/
done
%{mvn_build} -f -- -Dprotoc=$(type -p protoc)
popd
%install
pushd java
%mvn_install
%fdupes -s %{buildroot}%{_javadocdir}
popd
%files -f java/.mfiles
%license LICENSE
%files bom -f java/.mfiles-bom
%files parent -f java/.mfiles-parent
%files javadoc -f java/.mfiles-javadoc
%license LICENSE
%changelog

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>4.28.2</version>
</parent>
<artifactId>protobuf-javalite</artifactId>
<packaging>jar</packaging>
<name>Protocol Buffers [Lite]</name>
<description>
Lite version of Protocol Buffers library. This version is optimized for code size, but does
not guarantee API/ABI stability.
</description>
<dependencies>
</dependencies>
<build>
<plugins>
<!-- OSGI bundle configuration -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Automatic-Module-Name>com.google.protobuf</Automatic-Module-Name> <!-- Java9+ Jigsaw module name -->
<Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL>
<Bundle-SymbolicName>com.google.protobuf</Bundle-SymbolicName>
<Export-Package>com.google.protobuf;version=${project.version}</Export-Package>
<Import-Package>sun.misc;resolution:=optional,*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue Oct 15 13:49:20 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Splitting the java and python parts into separate packages
* allows much more readable and simple spec files
* allows disabling bindings separately from the main package
- Build protobuf-java with the upstream version that is currently
4.28.2
- Add a pre_checkin.sh script to synchronize the changes files
-------------------------------------------------------------------
Mon Oct 7 10:46:17 UTC 2024 - Adrian Schröter <adrian@suse.de>

View File

@ -18,32 +18,26 @@
%define tarname protobuf
%define extra_java_flags -source 8 -target 8
# see cmake/abseil-cpp.cmake and src/google/protobuf/port_def.inc
%define abseil_min_version 20230125.3
%global sover 28_2_0
%if 0%{?gcc_version} < 11
%define with_gcc 11
%endif
# requires gmock, which is not yet in the distribution
%bcond_with check
%bcond_without java
%bcond_without python3
%{?sle15_python_module_pythons}
Name: protobuf
Version: 28.2
%global sover 28_2_0
Release: 0
Summary: Protocol Buffers - Google's data interchange format
License: BSD-3-Clause
Group: Development/Libraries/C and C++
URL: https://github.com/protocolbuffers/protobuf
Source0: https://github.com/protocolbuffers/protobuf/releases/download/v%{version}/%{tarname}-%{version}.tar.gz
Source1: manifest.txt.in
Source2: baselibs.conf
BuildRequires: %{python_module abseil}
BuildRequires: %{python_module devel >= 3.7}
BuildRequires: %{python_module python-dateutil}
BuildRequires: %{python_module setuptools}
BuildRequires: c++_compiler
Source1: baselibs.conf
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc%{?with_gcc}-c++
BuildRequires: pkgconfig
BuildRequires: python-rpm-macros
# see cmake/abseil-cpp.cmake
@ -85,20 +79,6 @@ BuildRequires: pkgconfig(zlib)
%if %{with check}
BuildRequires: libgmock-devel >= 1.7.0
%endif
%if %{with java}
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local >= 6
%endif
%if 0%{?suse_version} >= 1500
# generate subpackages for every python3 flavor
%define python_subpackage_only 1
%python_subpackages
%else
# same "defaults" for all distributions, used in files section
%define python_files() -n python3-%{**}
%define python_sitearch %{python3_sitearch}
%endif
%description
Protocol Buffers are a way of encoding structured data in an efficient yet
@ -135,85 +115,35 @@ RPC protocols and file formats.
%package devel
Summary: Header files, libraries and development documentation for %{name}
Group: Development/Libraries/C and C++
Requires: libprotobuf%{sover} = %{VERSION}
Requires: libprotobuf%{sover} = %{version}
Requires: libprotobuf-lite%{sover}
Conflicts: protobuf2-devel
Conflicts: protobuf21-devel
Provides: libprotobuf-devel = %{VERSION}
Provides: libprotobuf-devel = %{version}
%description devel
Protocol Buffers are a way of encoding structured data in an efficient yet
extensible format. Google uses Protocol Buffers for almost all of its internal
RPC protocols and file formats.
%if 0%{?python_subpackage_only}
%package -n python-%{name}
Version: 5.%{VERSION}
Summary: Python Bindings for Google Protocol Buffers
Group: Development/Libraries/Python
%description -n python-%{name}
This package contains the Python bindings for Google Protocol Buffers.
%else
%package -n python3-%{name}
Version: 5.%{VERSION}
Summary: Python3 Bindings for Google Protocol Buffers
Group: Development/Libraries/Python
%description -n python3-%{name}
This package contains the Python bindings for Google Protocol Buffers.
%endif
%package -n %{name}-java
Summary: Java Bindings for Google Protocol Buffers
Group: Development/Libraries/Java
Requires: java >= 1.6.0
%description -n %{name}-java
This package contains the Java bindings for Google Protocol Buffers.
%prep
%autosetup -p1 -n %{tarname}-%{VERSION}
%autosetup -p1 -n %{tarname}-%{version}
# python module have their own version specified in python/google/protobuf/__init__.py
grep -qF "'5.%{VERSION}'" python/google/protobuf/__init__.py
# The previous blank line is crucial for older system being able
# to use the autosetup macro
mkdir gmock
# kill shebang that we do not really want
sed -i -e '/env python/d' python/google/protobuf/internal/*.py
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
# tests are not part of offical tar ball
%if 0%{?with_gcc}
export CXX=g++-%{with_gcc}
export CC=gcc-%{with_gcc}
%endif
%cmake \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package
%cmake_build
%if %{with java}
pushd ../java
../build/protoc --java_out=core/src/main/java -I../src ../src/google/protobuf/descriptor.proto
../build/protoc --java_out=core/src/main/java -I../src -I./core/src/main/resources/google/protobuf/ \
./core/src/main/resources/google/protobuf/java_features.proto
mkdir classes
javac %{extra_java_flags} -d classes core/src/main/java/com/google/protobuf/*.java
sed -e 's/@VERSION@/%{version}/' < %{SOURCE1} > manifest.txt
jar cfm %{name}-java-%{version}.jar manifest.txt -C classes com
popd
%endif
pushd ../python
export PROTOC=../build/protoc
%define py_setup dist/setup.py
%python_build
popd
%if %{with check}
%check
%make_build check
@ -223,40 +153,33 @@ popd
%cmake_install
install -Dm 0644 editors/proto.vim %{buildroot}%{_datadir}/vim/site/syntax/proto.vim
%if %{with java}
pushd java
install -d -m 0755 %{buildroot}%{_javadir}
install -p -m 0644 %{name}-java-%{version}.jar %{buildroot}%{_javadir}/%{name}-java.jar
ln -s %{name}-java.jar %{buildroot}%{_javadir}/%{name}.jar
install -d -m 0755 %{buildroot}%{_mavenpomdir}
%{mvn_install_pom} pom.xml %{buildroot}%{_mavenpomdir}/%{name}-java.pom
%add_maven_depmap %{name}-java.pom %{name}-java.jar
popd
%endif
pushd python
export PROTOC=../build/protoc
%python_install
popd
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%fdupes %{buildroot}%{_prefix}
# SLE12 does not define this macro
%if %{undefined ldconfig_scriptlets}
%post -n libprotobuf%{sover} -p /sbin/ldconfig
%postun -n libprotobuf%{sover} -p /sbin/ldconfig
%post -n libprotoc%{sover} -p /sbin/ldconfig
%postun -n libprotoc%{sover} -p /sbin/ldconfig
%post -n libprotobuf-lite%{sover} -p /sbin/ldconfig
%postun -n libprotobuf-lite%{sover} -p /sbin/ldconfig
%else
%ldconfig_scriptlets -n libprotobuf%{sover}
%ldconfig_scriptlets -n libprotoc%{sover}
%ldconfig_scriptlets -n libprotobuf-lite%{sover}
%endif
%files -n libprotobuf%{sover}
%license LICENSE
%{_libdir}/libprotobuf.so.%{VERSION}.0
%{_libdir}/libprotobuf.so.%{version}.0
%files -n libprotoc%{sover}
%license LICENSE
%{_libdir}/libprotoc.so.%{VERSION}.0
%{_libdir}/libprotoc.so.%{version}.0
%files -n libprotobuf-lite%{sover}
%license LICENSE
%{_libdir}/libprotobuf-lite.so.%{VERSION}.0
%{_libdir}/libprotobuf-lite.so.%{version}.0
%files devel
%license LICENSE
@ -286,19 +209,4 @@ popd
%{_libdir}/libutf8_validity.so
%{_datadir}/vim
%if %{with java}
%files -n %{name}-java -f java/.mfiles
%license LICENSE
%{_javadir}/%{name}.jar
%endif
%if %{with python3}
%files %{python_files %{name}}
%license LICENSE
%dir %{python_sitearch}/google
%{python_sitearch}/google/protobuf
%{python_sitearch}/protobuf*nspkg.pth
%{python_sitearch}/protobuf*info
%endif
%changelog

2004
python-protobuf.changes Normal file

File diff suppressed because it is too large Load Diff

91
python-protobuf.spec Normal file
View File

@ -0,0 +1,91 @@
#
# spec file for package python-protobuf
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2024 Andreas Stieger <Andreas.Stieger@gmx.de>
#
# 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/
#
%define tarname protobuf
%define baseversion 28.2
%if 0%{?gcc_version} < 11
%define with_gcc 11
%endif
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-protobuf
Version: 5.%{baseversion}
Release: 0
Summary: Python Bindings for Google Protocol Buffers
License: BSD-3-Clause
Group: Development/Libraries/Python
URL: https://github.com/protocolbuffers/protobuf
Source0: https://github.com/protocolbuffers/protobuf/releases/download/v%{baseversion}/%{tarname}-%{baseversion}.tar.gz
BuildRequires: %{python_module abseil}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module python-dateutil}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: gcc%{?with_gcc}-c++
BuildRequires: protobuf-devel >= %{baseversion}
Requires: protobuf-devel >= %{baseversion}
%python_subpackages
%description
Protocol Buffers are a way of encoding structured data in an efficient yet
extensible format. Google uses Protocol Buffers for almost all of its internal
RPC protocols and file formats.
This package contains the Python bindings for Google Protocol Buffers.
%prep
%autosetup -p1 -n %{tarname}-%{baseversion}
# The previous blank line is crucial for older system being able
# to use the autosetup macro
grep -qF "'%{version}'" python/google/protobuf/__init__.py
# kill shebang that we do not really want
sed -i -e '/env python/d' python/google/protobuf/internal/*.py
%build
%if 0%{?with_gcc}
export CXX=g++-%{with_gcc}
export CC=gcc-%{with_gcc}
%endif
pushd python
export PROTOC=$(type -p protoc)
%define py_setup dist/setup.py
%python_build
popd
%install
pushd python
export PROTOC=$(type -p protoc)
%python_install
popd
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%fdupes %{buildroot}%{_prefix}
%files %{python_files}
%license LICENSE
%dir %{python_sitearch}/google
%{python_sitearch}/google/protobuf
%{python_sitearch}/protobuf*nspkg.pth
%{python_sitearch}/protobuf*info
%changelog