Bug#981083: protobuf: support build profiles

2021-05-29 Thread Helmut Grohne
Control: tags -1 - moreinfo

Hi GCS,

On Sat, May 29, 2021 at 05:32:59PM +0200, László Böszörményi (GCS) wrote:
>  Might you have some time to check if I correctly forward ported your
> patch [1] to the new protobuf release?

Sure.

* Given that you depend on dh-sequence-python3 now, I think you can drop
  the dh-python dependency.

* The dh-sequence-python3 dependency also means
  that you can drop --with python3, which simplifies your d/rules.

* The conditional CXX assignment can be replaced with:
  include /usr/share/dpkg/buildtools.mk

* dh_auto_configure -- --host=... seems suboptimal to me as more flags
  depend on the architecture. I recommend using this variant:
  dpkg-architecture -f -a$(DEB_BUILD_ARCH) -c dh_auto_configure

* There is now is an alternative to profile conditionals. Instead of
  ifneq (,$(filter someprofile,$(DEB_BUILD_PROFILES)))
  you may write:
  ifneq (,$(filter somepackage,$(shell dh_listpackages)))
  The latter makes the steps conditional to the relevant binary
  packages, which can be inhibited by either build profiles or by doing
  an arch-only/indep-only build. Neither is inherently wrong. I'm just
  giving an alternative.

All of the items above are nitpicks. None undermines the usability of
the implementation. Use the ones that make sense to you and ignore the
others.

Helmut



Bug#981083: protobuf: support build profiles

2021-05-29 Thread GCS
Control: tags -1 + moreinfo pending

Hi Helmut,

On Tue, Jan 26, 2021 at 7:21 AM Helmut Grohne  wrote:
> protobuf participates in dependency loops relevant to architecture
> bootstrap. I noticed that protobuf's Build-Depends are well organized.
> Thank you! There is not much room for trimming them, but using build
> profiles one can cut certain cycles. The most useful profile likely is
> nocheck. Beyond that, I'm proposing profiles nopython and noruby. Please
> consider applying the attached patch. Note that #981014 needs to before
> you can ship the nopython and noruby profiles.
 Might you have some time to check if I correctly forward ported your
patch [1] to the new protobuf release?

Thanks anyway,
Laszlo/GCS
[1] dget -x https://people.debian.org/~gcs/protobuf_3.17.1-1.dsc



Bug#981083: protobuf: support build profiles

2021-01-25 Thread Helmut Grohne
Source: protobuf
Version: 3.12.4-1
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap
Control: block -1 by 981014

protobuf participates in dependency loops relevant to architecture
bootstrap. I noticed that protobuf's Build-Depends are well organized.
Thank you! There is not much room for trimming them, but using build
profiles one can cut certain cycles. The most useful profile likely is
nocheck. Beyond that, I'm proposing profiles nopython and noruby. Please
consider applying the attached patch. Note that #981014 needs to before
you can ship the nopython and noruby profiles.

Helmut
diff --minimal -Nru protobuf-3.12.4/debian/changelog 
protobuf-3.12.4/debian/changelog
--- protobuf-3.12.4/debian/changelog2021-01-16 23:12:54.0 +0100
+++ protobuf-3.12.4/debian/changelog2021-01-25 14:24:12.0 +0100
@@ -1,3 +1,10 @@
+protobuf (3.12.4-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Support build profiles nocheck, nopython and noruby. (Closes: #-1)
+
+ -- Helmut Grohne   Mon, 25 Jan 2021 14:24:12 +0100
+
 protobuf (3.12.4-1) unstable; urgency=medium
 
   * New upstream release.
diff --minimal -Nru protobuf-3.12.4/debian/control 
protobuf-3.12.4/debian/control
--- protobuf-3.12.4/debian/control  2021-01-16 23:12:54.0 +0100
+++ protobuf-3.12.4/debian/control  2021-01-25 14:24:12.0 +0100
@@ -8,21 +8,22 @@
  , dh-elpa
 # C/C++
  , zlib1g-dev
- , libgmock-dev
- , libgtest-dev
+ , libgmock-dev 
+ , libgtest-dev 
 # Python
- , dh-python
- , python3-all:any
- , libpython3-all-dev
- , python3-setuptools
- , python3-six
+ , dh-python 
+ , dh-sequence-python3 
+ , python3-all:any 
+ , libpython3-all-dev 
+ , python3-setuptools 
+ , python3-six 
 # Manpage generator
  , xmlto
 # Tests
- , unzip
+ , unzip 
 # Ruby
- , rake-compiler
- , gem2deb
+ , rake-compiler 
+ , gem2deb 
 Build-Depends-Indep:
 # Java
ant
@@ -41,6 +42,7 @@
 Package: ruby-google-protobuf
 Architecture: any
 Multi-Arch: same
+Build-Profiles: 
 Section: ruby
 X-DhRuby-Root: ruby
 XB-Ruby-Versions: ${ruby:Versions}
@@ -191,6 +193,7 @@
 
 Package: python3-protobuf
 Architecture: any
+Build-Profiles: 
 Section: python
 Depends: ${shlibs:Depends}, ${python3:Depends}, ${misc:Depends}
 Description: Python 3 bindings for protocol buffers
diff --minimal -Nru protobuf-3.12.4/debian/rules protobuf-3.12.4/debian/rules
--- protobuf-3.12.4/debian/rules2021-01-16 23:12:54.0 +0100
+++ protobuf-3.12.4/debian/rules2021-01-25 14:24:06.0 +0100
@@ -21,7 +21,7 @@
 API_VERSION=$(SONAME)-0
 
 %:
-   dh $@ --with autoreconf,elpa,python3
+   dh $@ --with autoreconf,elpa
 
 ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
 override_dh_auto_configure:
@@ -57,14 +57,18 @@
# Generate the manpage
xmlto man debian/protoc.xml
 
+ifeq (,$(filter nopython,$(DEB_BUILD_PROFILES)))
# Python3 build
cp -rv python python3
set -e; cd python3 && for pv in $(shell py3versions -vr); do \
$(PYTHON_CROSS_VARS) python$$pv setup.py build 
--cpp_implementation; \
done
+endif
 
+ifeq (,$(filter noruby,$(DEB_BUILD_PROFILES)))
# Ruby build
cd ruby && rake package genproto
+endif
 
 override_dh_auto_build-indep:
dh_auto_build --indep
@@ -74,7 +78,9 @@
 
 override_dh_clean:
$(RM) -rv gmock
+ifeq (,$(filter noruby,$(DEB_BUILD_PROFILES)))
cd ruby && rake clobber
+endif
dh_clean
$(RM) config.h config.log config.status
$(RM) *.pc
@@ -94,7 +100,7 @@
 override_dh_auto_test-arch:
dh_auto_test --arch
 
-ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))$(filter 
nopython,$(DEB_BUILD_PROFILES)))
 # Python3 test
set -e; \
export LD_LIBRARY_PATH=$(CURDIR)/src/.libs; \
@@ -122,6 +128,7 @@
 override_dh_auto_install-arch:
dh_auto_install --arch
 
+ifeq (,$(filter nopython,$(DEB_BUILD_PROFILES)))
# Python3 install
set -e; \
cd python3 && for pv in $(shell py3versions -vr); do \
@@ -130,13 +137,16 @@
--root=$(CURDIR)/debian/python3-protobuf; \
done
find $(CURDIR)/debian/python3-protobuf -name 'protobuf-*-nspkg.pth' 
-delete
+endif
 
+ifeq (,$(filter noruby,$(DEB_BUILD_PROFILES)))
# Ruby install
 sed 's|ext/|ruby/ext/|' $(CURDIR)/ruby/google-protobuf.gemspec \
 >$(CURDIR)/google-protobuf.gemspec
dh_auto_install -O--buildsystem=ruby -O--package=ruby-google-protobuf 
--destdir=$(CURDIR)/debian/ruby-google-protobuf
find $(CURDIR)/debian/ruby-google-protobuf/usr/lib/ \
-name well_known_types.rb -exec chmod a+x {} \;
+endif
 
 override_dh_auto_install-indep:
dh_auto_install --indep