The Debian ghetto

Today, I tried to build an existing package on the new Debian Jessie (debian 8). It builds perfectly well on Wheezy (debian 7). On Debian 8, the build process stops with the following error message:

dpkg-source: error: can't build with source format '3.0 (native)': native package version may not have a revision

Even now that I have solved the issue, I still have serious difficulties understanding what exactly this message means. If Googling for the solution does not help, I know of only one way to figure it out:

print("---- A (I came through this place) ---------\n");
die(" --- stop here to put an end to the confusion ---\n");

So, I started putting these print-and-die instructions in /usr/bin/dpkg-buildpackage and then in /usr/bin/dpkg-source until I ended up in the very middle of some kind of Perl ghetto in /usr/share/perl5/Dpkg/Source/Package/V3/Native.pm/usr/share/perl5/Dpkg/Source/Package/V3/Native.pm, where it says:

sub can_build {
    my ($self, $dir) = @_;
    my $v = Dpkg::Version->new($self->{fields}->{'Version'});
    warning (_g('native package version may not have a revision'))
        unless $v->is_native();
    return 1;
}

That is when I realized that my otherwise freely-chosen version number may not be “native”. Debian did not care about this kind of things in previous versions, but now version numbers must be “native”.

So, contrary to what we may think, it is not the “native package” of which the version may not have a revision in the error message, but it is about the “native version” (of the package). So, what they actually meant to say, is:

version must not have a revision

A quick grep on the is_native() function shows where in the Perl ghetto they define it. We can find the culprit in /usr/share/perl5/Dpkg/Version:

sub is_native {
    my $self = shift;
    return $self->{no_revision};
}

So, now we get confirmation for what we suspected. A version number is “native”, if it has no “revision”. But what is a revision. So, let’s grep for the symbol no_revision:

    if ($ver =~ /(.*)-(.*)$/) {
    $self->{version} = $1;
    $self->{revision} = $2;
    } else {
    $self->{version} = $ver;
    $self->{revision} = 0;
    $self->{no_revision} = 1;
    }

So, now we understand that it is all about satisfying the regular expression above:

/(.*)-(.*)$/

In the Debian ghetto, a version number containing a dash is one with a “revision”, and therefore not “native”. So, for example, 1.5-3 is considered to be version 1.5 with revision 3, and is therefore not a native version number. Version 6.4, however, has no revision and is therefore a “native” version.

Therefore, we could translate the original error message:

dpkg-source: error: can't build with source format '3.0 (native)': native package version may not have a revision

as following:

dpkg-source: error: Do not use a hyphen ('-') in your version.

This solution will not work, however. They will never adopt this change. The Debian team will obviously argue: We may forbid additional characters in the future. So, we do not want to mention the hyphen specifically in the error message.

Therefore, the design-by-committee compromise in the Debian ghetto will probably look like this:

dpkg-source: error: Do not use a further unspecified list of forbidden characters in your version.

In fact, Debian may not be that bad. Seriously, the other distros are often even worse. They tend to retrench behind this kind of dialogue:

  • Distro: You should not desire that. It is wrong.
  • You: But I desire it!
  • Distro: You shouldn’t.

Ubuntu has also adopted Debian’s old-fashioned, idiosyncratic and often mysterious package management, along with its quirks and its warts. So, the madness has become quite widespread. Therefore, I have concluded for myself that I will just have to suffer it. Let’s stay compatible with all the miracles and all the horrors of the past!

Advertisements

Published by

eriksank

I mostly work on an alternative bitcoin marketplace -and exchange applications. I am sometimes available for new commercial projects but rather unlikely right now.

One thought on “The Debian ghetto”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s