meta/debianize: do not create compat file when new style is in control

Message ID 20210713140933.16216-1-henning.schild@siemens.com
State Changes Requested
Headers show
Series meta/debianize: do not create compat file when new style is in control | expand

Commit Message

Henning Schild July 13, 2021, 6:09 a.m. UTC
The modern way to set the compat level is a Build-Depends on
debhelper-compat, in which case a compat file must not exist.

So if there is a control file using that new way, skip the creation of a
compat file.

Reported-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/debianize.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Henning Schild July 13, 2021, 1:22 p.m. UTC | #1
Am Tue, 13 Jul 2021 16:09:33 +0200
schrieb Henning Schild <henning.schild@siemens.com>:

> The modern way to set the compat level is a Build-Depends on
> debhelper-compat, in which case a compat file must not exist.
> 
> So if there is a control file using that new way, skip the creation
> of a compat file.
> 
> Reported-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  meta/classes/debianize.bbclass | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/debianize.bbclass
> b/meta/classes/debianize.bbclass index dad1cb48fa40..878aaca89543
> 100644 --- a/meta/classes/debianize.bbclass
> +++ b/meta/classes/debianize.bbclass
> @@ -89,7 +89,11 @@ deb_debianize() {
>  	if [ -f ${WORKDIR}/compat ]; then
>  		install -v -m 644 ${WORKDIR}/compat
> ${S}/debian/compat else
> -		deb_create_compat
> +		# new style compat level could be in control
> +		# do not create a compat file in that case
> +		if ! grep "debhelper-compat" ${WORKDIR}/control; then

In fact we would also need to look for that in DEBIAN_BUILD_DEPENDS

will send a v2.

Henning

> +			deb_create_compat
> +		fi
>  	fi
>  	# create the control-file if there is no control-file in
> WORKDIR if [ -f ${WORKDIR}/control ]; then
Jan Kiszka July 13, 2021, 10:43 p.m. UTC | #2
On 13.07.21 23:22, Henning Schild wrote:
> Am Tue, 13 Jul 2021 16:09:33 +0200
> schrieb Henning Schild <henning.schild@siemens.com>:
> 
>> The modern way to set the compat level is a Build-Depends on
>> debhelper-compat, in which case a compat file must not exist.
>>
>> So if there is a control file using that new way, skip the creation
>> of a compat file.
>>
>> Reported-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
>> Signed-off-by: Henning Schild <henning.schild@siemens.com>
>> ---
>>  meta/classes/debianize.bbclass | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/debianize.bbclass
>> b/meta/classes/debianize.bbclass index dad1cb48fa40..878aaca89543
>> 100644 --- a/meta/classes/debianize.bbclass
>> +++ b/meta/classes/debianize.bbclass
>> @@ -89,7 +89,11 @@ deb_debianize() {
>>  	if [ -f ${WORKDIR}/compat ]; then
>>  		install -v -m 644 ${WORKDIR}/compat
>> ${S}/debian/compat else
>> -		deb_create_compat
>> +		# new style compat level could be in control
>> +		# do not create a compat file in that case
>> +		if ! grep "debhelper-compat" ${WORKDIR}/control; then
> 
> In fact we would also need to look for that in DEBIAN_BUILD_DEPENDS
> 

Maybe just reorder so that DEBIAN_BUILD_DEPENDS is already merged into a
generated control file.

Jan

> will send a v2.
> 
> Henning
> 
>> +			deb_create_compat
>> +		fi
>>  	fi
>>  	# create the control-file if there is no control-file in
>> WORKDIR if [ -f ${WORKDIR}/control ]; then
>
Henning Schild July 14, 2021, 3:22 a.m. UTC | #3
Am Wed, 14 Jul 2021 08:43:17 +0200
schrieb Jan Kiszka <jan.kiszka@siemens.com>:

> On 13.07.21 23:22, Henning Schild wrote:
> > Am Tue, 13 Jul 2021 16:09:33 +0200
> > schrieb Henning Schild <henning.schild@siemens.com>:
> >   
> >> The modern way to set the compat level is a Build-Depends on
> >> debhelper-compat, in which case a compat file must not exist.
> >>
> >> So if there is a control file using that new way, skip the creation
> >> of a compat file.
> >>
> >> Reported-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> >> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> >> ---
> >>  meta/classes/debianize.bbclass | 6 +++++-
> >>  1 file changed, 5 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/meta/classes/debianize.bbclass
> >> b/meta/classes/debianize.bbclass index dad1cb48fa40..878aaca89543
> >> 100644 --- a/meta/classes/debianize.bbclass
> >> +++ b/meta/classes/debianize.bbclass
> >> @@ -89,7 +89,11 @@ deb_debianize() {
> >>  	if [ -f ${WORKDIR}/compat ]; then
> >>  		install -v -m 644 ${WORKDIR}/compat
> >> ${S}/debian/compat else
> >> -		deb_create_compat
> >> +		# new style compat level could be in control
> >> +		# do not create a compat file in that case
> >> +		if ! grep "debhelper-compat" ${WORKDIR}/control;
> >> then  
> > 
> > In fact we would also need to look for that in DEBIAN_BUILD_DEPENDS
> >   
> 
> Maybe just reorder so that DEBIAN_BUILD_DEPENDS is already merged
> into a generated control file.

There is kind of cyclic dependency here. When using the compat file its
content needs to go into the generator of the control file.

In fact i found that the control file generator would also need to
react on DEBIAN_BUILD_DEPENDS ... not including "debhelper (>= compat)"
when "debhelper-compat (= compat)" is there.

I am getting the feeling that he corner-case i wanted to address is
better left open. "deb_debianize" is giving people a scaffold and does
not, can not, fully automate the task of debianization. Especially when
parts come in as static bits that it should integrate. It does a good
enough job on that end, and taking care of such corner cases will
probably cause more issues than it would solve.

So i would say ... do not merge. Unless anyone else sees value to
continue here.

Henning

> Jan
> 
> > will send a v2.
> > 
> > Henning
> >   
> >> +			deb_create_compat
> >> +		fi
> >>  	fi
> >>  	# create the control-file if there is no control-file in
> >> WORKDIR if [ -f ${WORKDIR}/control ]; then  
> >   
>

Patch

diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index dad1cb48fa40..878aaca89543 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -89,7 +89,11 @@  deb_debianize() {
 	if [ -f ${WORKDIR}/compat ]; then
 		install -v -m 644 ${WORKDIR}/compat ${S}/debian/compat
 	else
-		deb_create_compat
+		# new style compat level could be in control
+		# do not create a compat file in that case
+		if ! grep "debhelper-compat" ${WORKDIR}/control; then
+			deb_create_compat
+		fi
 	fi
 	# create the control-file if there is no control-file in WORKDIR
 	if [ -f ${WORKDIR}/control ]; then