dpkg-genchanges -D option bails out when used with Section field

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

dpkg-genchanges -D option bails out when used with Section field

sandro.bordacchini
Hello everyone.

I am trying to build a custom debian package with some Zabbix template and configuration files for a software of mine.
My development server is a Debian7 and i am using dpkg 1.16.12.
I need to pass the "Section" field as a dpkg-genchanges -D option. If i read correctly, -D options allows to add/override a field in the control file.
I tried both:
* to not add any Section field in the originating control file
* to add a dummy Section field "tobereplaced"
In both cases i get an error. This is the case with the dummy section field:

>> starting dpkg-buildpackage with options: --changes-option=-DSection=java  -b -us -uc -rfakeroot -i
dpkg-buildpackage: source package foo-zabbix
[...]
dh_gencontrol -- -Vmisc:Depends=zabbix-agent,libzbxpgsql,sudo,bc,unzip -DSection=java
dh_md5sums
dh_builddeb
dpkg-deb: building package `foo-zabbix' in `../foo-zabbix_1.0~n20180509T160051Z_all.deb'.
 dpkg-genchanges -DSection=java -b >../foo-zabbix_1.0~n20180509T160051Z_amd64.changes
dpkg-genchanges: error: package foo-zabbix has section tobereplaced in control file but java in files list
dpkg-buildpackage: error: dpkg-genchanges gave error exit status 255

Please note that in the temp building directory the DEBIAN/control file actually contains "Section: java" and files file has not been generated yet.
If i do the same thing with another field, like "Origin", for example, all works smoothly, as you can see below:

>> starting dpkg-buildpackage with options: --changes-option=-DOrigin=zabbix  -b -us -uc -rfakeroot -i
dpkg-buildpackage: source package foo-zabbix
[...]
dh_gencontrol -- -Vmisc:Depends=zabbix-agent,libzbxpgsql,sudo,bc,unzip -DOrigin=zabbix
dh_md5sums
dh_builddeb
dpkg-deb: building package `foo-zabbix' in `../foo-zabbix_1.0~n20180509T155323Z_all.deb'.
 dpkg-genchanges -DOrigin=zabbix -b >../foo-zabbix_1.0~n20180509T155323Z_amd64.changes
dpkg-genchanges: binary-only upload - not including any source code
 dpkg-source -i --after-build foo-zabbix
dpkg-buildpackage: binary only upload (no source included)

My hypotesis is that this snippet of code of dpkg-genchanges:

        my $sec = $f2seccf{$f};
        $sec ||= $sourcedefault{'Section'};
        if (!defined($sec)) {
            $sec = '-';
            warning(_g("missing Section for binary package %s; using '-'"), $p);
        }
        $sec eq $f2sec{$f} || error(_g("package %s has section %s in " .
                                       "control file but %s in files list"),
                                    $p, $sec, $f2sec{$f});


does not take into consideration fields passed with a command line option.
Am I right? Can anyone point me in the right direction to find a solution?

Thank you a lot in advance.
Sandro.