Re: DEB_BUILD_OPTIONS vs DEB_BUILD_PROFILES: What is right and what is wrong?

2019-01-08 Thread Bastien ROUCARIES
Hi,

On Sun, Jan 6, 2019 at 1:45 AM Axel Beckert  wrote:
>
> Hi,
>
> while trying to get the nocheck build profile working, I stumbled over
> some discrepancies between
>
> * Debian Policy §4.9.1,
> * dpkg-buildflags (behaviour + man page), and
> * lintian's long description of the tag
>   override_dh_auto_test-does-not-check-DEB_BUILD_OPTIONS.
>
> lintian recommends, e.g. at
> https://lintian.debian.org/tags/override_dh_auto_test-does-not-check-DEB_BUILD_OPTIONS.html:
>
> > The debian/rules file for this package has an override_dh_auto_test
> > target that does not appear to check DEB_BUILD_OPTIONS against
> > nocheck.
> >
> > As this check is not automatically performed by debhelper(1), the
> > specified testsuite is run regardless of another maintainer using the
> > nocheck build profile.
> >
> > Please add a check such as:
> >
> >  override_dh_auto_test:
> >  ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
> >  ./run-upstream-testsuite
> >  endif

I personnaly use:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES))
 ./run-upstream-testsuite
endif

I believe it is policy compliant and burn proof...

Maybe a footnote on policy or debref ?

Bastien



Re: DEB_BUILD_OPTIONS vs DEB_BUILD_PROFILES: What is right and what is wrong?

2019-01-06 Thread Axel Beckert
Hi Mattia,

Mattia Rizzolo wrote:
> On Sun, Jan 06, 2019 at 02:55:30AM +0100, Axel Beckert wrote:
> > Johannes Schauer wrote:
> > > > A) lintian by mixing up build tags and build profiles? (Maybe this
> > > >mentioning of build profiles was overseen when fixing #889746.)
> > > 
> > > I assume this to be the case.
> > 
> > Would be happy to hear, if Mattia sees this the same way.
> 
> Yes, it's an oversight.  ISTR you have commit rights for lintian, I
> think you should just commit an s/profile/option/ in that description.

Thanks! Done now.

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Re: DEB_BUILD_OPTIONS vs DEB_BUILD_PROFILES: What is right and what is wrong?

2019-01-06 Thread Mattia Rizzolo
On Sun, Jan 06, 2019 at 02:55:30AM +0100, Axel Beckert wrote:
> Johannes Schauer wrote:
> > > A) lintian by mixing up build tags and build profiles? (Maybe this
> > >mentioning of build profiles was overseen when fixing #889746.)
> > 
> > I assume this to be the case.
> 
> Would be happy to hear, if Mattia sees this the same way.

Yes, it's an oversight.  ISTR you have commit rights for lintian, I
think you should just commit an s/profile/option/ in that description.

> > > If I want to build something with the build-profile nocheck, do I
> > > really have to set DEB_BUILD_OPTIONS myself separately to "nocheck" in
> > > addition to "-Pnocheck"? That sounds very counterintuitive to me…
> > 
> > I fear you currently have to manually set DEB_BUILD_OPTIONS=nocheck in 
> > addition
> > to -Pnocheck. The reason is, that currently no tool sets
> > DEB_BUILD_OPTIONS=nocheck if the nocheck build profile is active. This 
> > could be
> > changed in the future but I know of no such efforts right now.
> 
> Ok, this is really not what I expected to be the case, especially
> after #889746.

The reason for referring to _OPTIONS is that that's the one defined by
policy, and what everybody has been accustomed for many years.

But josch explained quite a few things already… :)

-- 
regards,
Mattia Rizzolo

GPG Key: 66AE 2B4A FCCF 3F52 DA18  4D18 4B04 3FCD B944 4540  .''`.
more about me:  https://mapreri.org : :'  :
Launchpad user: https://launchpad.net/~mapreri  `. `'`
Debian QA page: https://qa.debian.org/developer.php?login=mattia  `-


signature.asc
Description: PGP signature


Re: DEB_BUILD_OPTIONS vs DEB_BUILD_PROFILES: What is right and what is wrong?

2019-01-05 Thread Axel Beckert
Hi Johannes,

thanks for the quick response.

Johannes Schauer wrote:
> > A) lintian by mixing up build tags and build profiles? (Maybe this
> >mentioning of build profiles was overseen when fixing #889746.)
> 
> I assume this to be the case.

Would be happy to hear, if Mattia sees this the same way.

> > B) dpkg-buildpackages by not setting nocheck in DEB_BUILD_OPTIONS?
> 
> This could be brought to the dpkg maintainers.

Guillem? (If you need the full context:
https://lists.debian.org/debian-devel/2019/01/msg00039.html)

> > If I want to build something with the build-profile nocheck, do I
> > really have to set DEB_BUILD_OPTIONS myself separately to "nocheck" in
> > addition to "-Pnocheck"? That sounds very counterintuitive to me…
> 
> I fear you currently have to manually set DEB_BUILD_OPTIONS=nocheck in 
> addition
> to -Pnocheck. The reason is, that currently no tool sets
> DEB_BUILD_OPTIONS=nocheck if the nocheck build profile is active. This could 
> be
> changed in the future but I know of no such efforts right now.

Ok, this is really not what I expected to be the case, especially
after #889746.

> Also refer to the current documentation of the nocheck build profile under 
> [1].
> It says:
> 
> > No test suite should be run, and build dependencies used only for that
> > purpose should be ignored. Builds that set this profile must also add 
> > nocheck
> > to DEB_BUILD_OPTIONS
[…]
> [1] https://wiki.debian.org/BuildProfileSpec

Thanks for that pointer!

> The only alternative I see that would make this more convenient, would be if 
> we
> rewrite all affected d/rules file to check DEB_BUILD_OPTIONS *and*
> DEB_BUILD_PROFILES when deciding whether or not to run the test
> suite.

This is actually what I just implemented for the package with which I
ran into that issue:

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
[…]

> You already discovered that this would be *a lot* of them.

*nod* So if this should be made easier, it's probably at
dpkg-buildpackage or close-by.

> There is a similar issue with the nodoc build profile where one must also
> currently manually supply DEB_BUILD_OPTIONS=nodoc additionally.

That was quiet likely, yes: different color, same issue. :-)

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Re: DEB_BUILD_OPTIONS vs DEB_BUILD_PROFILES: What is right and what is wrong?

2019-01-05 Thread Johannes Schauer
Hi,

Quoting Axel Beckert (2019-01-06 01:39:09)
> while trying to get the nocheck build profile working, I stumbled over
> some discrepancies between
> 
> * Debian Policy §4.9.1,
> * dpkg-buildflags (behaviour + man page), and
> * lintian's long description of the tag
>   override_dh_auto_test-does-not-check-DEB_BUILD_OPTIONS.
> 
> [...]
> 
> So now I wonder: what is wrong and needs to be fixed?
> 
> A) lintian by mixing up build tags and build profiles? (Maybe this
>mentioning of build profiles was overseen when fixing #889746.)

I assume this to be the case.

> B) dpkg-buildpackages by not setting nocheck in DEB_BUILD_OPTIONS?

This could be brought to the dpkg maintainers.

> C) debian-policy (and #889746 + lintian as a followup issue) by
>documenting DEB_BUILD_OPTIONS and DEB_BUILD_PROFILES both mixed
>under DEB_BUILD_OPTIONS?
> D) Something completely different like dh or so?
> 
> Or am I just missing something totally essential and don't see the
> forest for the trees?
> 
> And a more general question, especially in case A:
> 
> If I want to build something with the build-profile nocheck, do I
> really have to set DEB_BUILD_OPTIONS myself separately to "nocheck" in
> addition to "-Pnocheck"? That sounds very counterintuitive to me…

I fear you currently have to manually set DEB_BUILD_OPTIONS=nocheck in addition
to -Pnocheck. The reason is, that currently no tool sets
DEB_BUILD_OPTIONS=nocheck if the nocheck build profile is active. This could be
changed in the future but I know of no such efforts right now.

Also refer to the current documentation of the nocheck build profile under [1].
It says:

> No test suite should be run, and build dependencies used only for that
> purpose should be ignored. Builds that set this profile must also add nocheck
> to DEB_BUILD_OPTIONS

The only alternative I see that would make this more convenient, would be if we
rewrite all affected d/rules file to check DEB_BUILD_OPTIONS *and*
DEB_BUILD_PROFILES when deciding whether or not to run the test suite. You
already discovered that this would be *a lot* of them.

There is a similar issue with the nodoc build profile where one must also
currently manually supply DEB_BUILD_OPTIONS=nodoc additionally.

Thanks!

cheers, josch

[1] https://wiki.debian.org/BuildProfileSpec


signature.asc
Description: signature


DEB_BUILD_OPTIONS vs DEB_BUILD_PROFILES: What is right and what is wrong?

2019-01-05 Thread Axel Beckert
Hi,

while trying to get the nocheck build profile working, I stumbled over
some discrepancies between

* Debian Policy §4.9.1,
* dpkg-buildflags (behaviour + man page), and
* lintian's long description of the tag
  override_dh_auto_test-does-not-check-DEB_BUILD_OPTIONS.

lintian recommends, e.g. at
https://lintian.debian.org/tags/override_dh_auto_test-does-not-check-DEB_BUILD_OPTIONS.html:

> The debian/rules file for this package has an override_dh_auto_test
> target that does not appear to check DEB_BUILD_OPTIONS against
> nocheck.
> 
> As this check is not automatically performed by debhelper(1), the
> specified testsuite is run regardless of another maintainer using the
> nocheck build profile.
> 
> Please add a check such as:
> 
>  override_dh_auto_test:
>  ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
>  ./run-upstream-testsuite
>  endif

Please note that lintian explicitly mentions the "nocheck build
_profile_". (Emphasis is mine.)

The Debian Policy says at §4.9.1 respectively at
https://www.debian.org/doc/debian-policy/ch-source.html#debian-rules-and-deb-build-options:

> 4.9.1. debian/rules and DEB_BUILD_OPTIONS
> 
> Supporting the standardized environment variable DEB_BUILD_OPTIONS is
> recommended. This variable can contain several flags to change how a
> package is compiled and built. Each flag must be in the form flag or
> flag=options. If multiple flags are given, they must be separated by
> whitespace. [14] flag must start with a lowercase letter (a-z) and
> consist only of lowercase letters, numbers (0-9), and the characters -
> and _ (hyphen and underscore). options must not contain whitespace.
> The same tag should not be given multiple times with conflicting
> values. Package maintainers may assume that DEB_BUILD_OPTIONS will not
> contain conflicting tags.
> 
> The meaning of the following tags has been standardized:
> 
> nocheck
>
> This tag says to not run any build-time test suite provided by the package.

Please note that the Debian Policy talks about "tags" and not about
"profiles".

And dpkg-buildpackage(1) says:

> -P, --build-profiles=profile[,...]
>
>Specify the profile(s) we build, as a comma-separated
>list (since dpkg 1.17.2, long option since dpkg 1.18.8).
>The default behavior is to build for no specific
>profile. Also sets them (as a space separated list) as
>the DEB_BUILD_PROFILES environment variable which
>allows, for example, debian/rules files to use this
>information for conditional builds.

DEB_BUILD_OPTIONS is primarily (if not only) mentioned for parallel
building:

> -j, --jobs[=jobs|auto]
>
>[…] Also adds parallel=jobs or parallel to the
>DEB_BUILD_OPTIONS environment variable which allows
>debian/rules files to use this information for their own
>purposes. […]

So if I now use the code recommended by lintian to check for the
nocheck build _profile_ and build with "dpkg-buildpackage -Pnocheck",
my build fails, because DEB_BUILD_OPTIONS (as used by Lintian and
documented in the Debian Policy at 4.9.1) does _not_ contain "nocheck"
but just some "parallel=" as documented by dpkg-buildpackage(1).

But the build profile name can be found in DEB_BUILD_PROFILES as
documented by dpkg-buildpackage(1).

To make easier to understand where my problem lays, here's a (more or
less real-world) example:

Given this code in debian/rules:

> override_dh_auto_test:
> ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
>   echo "$(DEB_BUILD_OPTIONS)"
>   echo "$(DEB_BUILD_PROFILES)"
>   exit 2
> endif

The first two lines and the last line are copy and paste from the
mentioned lintian tag's long description.

If I now build this package with "dpkg-buildpackage -Pnocheck", it
should IMHO build fine without running the tests, but it fails as
follows:

>   debian/rules override_dh_auto_test
> make[1]: Entering directory '/home/abe//'
> echo "parallel=4"
> parallel=4
> echo "nocheck"
> nocheck
> exit 2
> make[1]: *** [debian/rules:50: override_dh_auto_test] Error 2
> make[1]: Leaving directory '/home/abe//'
> make: *** [debian/rules:24: binary] Error 2
> dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 
> 2

Please note that nocheck and parallel=4 are not echoed by the same
echo statement, i.e. are in separate DEB_BUILD_* variables.

So my first guess was that lintian's documentation and tag name was
wrong and that DEB_BUILD_PROFILES should have been meant. That would
affect 1135 source packages:

https://codesearch.debian.net/search?q=nocheck%2C%5C%24%5C%28DEB_BUILD_OPTIONS%5C%29

Ugh. (65 are using DEB_BUILD_PROFILES instead.)

But then I found https://bugs.debian.org/889746 which exactly demanded
earlier this year the opposite of what I had in my mind to fix this:
to rename override_dh_auto_test-does-not-check-DEB_BUILD_PROFILES to