#962848 dpkg-architecture: please add aliases for 32-bit 64-bit bad-endian

#962848#5
Date:
2020-06-15 01:04:54 UTC
From:
To:
Hi!
More and more software has dropped (or never implemented) support for
32-bit.  Likewise, the endian wars have been decisively won by LE,
leaving s390x as the only BE release architecture -- and it doesn't
exactly have many users.

Declaring the list of architectures by mentioning every one of them
is tedious, error-prone and incomplete.  Thus: could you please add
the following for aliases?:
* 32-bit
* 64-bit
* big-endian
* little-endian

dpkg-architecture already has some code for that (-B, -E), but that's
not usable in Architecture: fields nor in {Build-,}{Depends,...} []
stanzas.

Of course, being actually usable requires waiting a release cycle or two,
but the only way to get that is to have support before Bullseye's freeze.


Meow!

#962848#10
Date:
2026-10-10 22:38:14 UTC
From:
To:
Hi!

To avoid hardcoding arch lists in theory you could use one of the virtual
packages from architecture-properties in build dependencies, such as:

  architecture-is-64-bit | foo-for-32-bit,
  architecture-is-little-endian | bar-for-big-endian,

But this is rather hackish, and in addition it should not work on Debian
buildds where (AFAIR) only the first alternative is ever considered.

For run-time dependencies you could inject the arch list via a substvar,
by fetching the values from something like:

  dpkg-architecture --match-bits 64 --list-known
  dpkg-architecture --match-endian little --list-known

I think it would be nice, alongside bitness, but not by using the same
namespaces as architectures. This same thing was requested in #962848,
(and I thought I replied, but perhaps only on IRC or private mail or
something? Or maybe in conversations with Niels, that ended up with the
current architecture-properties approach). I also now just found
references to something like this in #630342.

Reusing the arch namespace means that declaring these dependencies will
silently not get satisfied until all resolvers get updated, which I
think would be rather bad. To me this calls for a breaking change, by
adding some new syntax that hopefully separates this notation from
existing arch names. I've just not been sure what to use here, and I
shudder at this type of "update all resolvers" kind of change. And the
existing approach while a bit cumbersome (and TBH a workaround for a
limitation in the base tools), just works for most stuff right now (but
not your first case) and requires no ecosystem-wide changes to the
syntax.

If our arch tuples were a bit more rich, then we could probably match
on those attributes, but then there are other attributes that we might
eventually also want to match on that would not be present anyway.

The first thing that comes to mind might be something like:

  arch:32-bit
  arch:64-bit
  arch:little-endian
  arch:big-endian

or perhaps:

  arch:bits:32
  arch:bits:64
  arch:endian:little
  arch:endian:big

or variations on that, perhaps arch:<attr>=<value>, dunno. Where this
could make it possible to extend to other arch attributes (although I'm
not sure any other attributes might be very useful), such as for
example:

  arch:char:signed
  arch:char:unsigned
  arch:exec:elf
  arch:exec:mach-o
  …

In any case there might be other/better ways to represent this. And the
prefix at least feels a bit redundant when used in an Architecture field.

I guess another problem is that resolvers would need (ideally) to get
the information about these attributes from the dpkg arch tables, but
that might be annoying to deploy or rely on. Thus this might need input
from at least the major resolver implementations.

Probably, and I actually had implemented this some time ago, but was not
sure whether it was worth it, so ended up not merging it:

https://git.hadrons.org/cgit/debian/dpkg/dpkg.git/commit/?h=next/substvars-arch&id=87b68cee48a3ce66cd93c145d78491c67e9ed8aa

But if there's demand, I'm happy to merge it, after I've cleaned this
a bit.

Thanks,
Guillem

#962848#15
Date:
2026-10-11 04:35:47 UTC
From:
To:
Hi,

Indeed, that's one of the reasons I don't like architecture-properties. :>

Gladly, I don't need that at this time, but this generates a massive list.

Presumably I could also substitute

dpkg-architecture --match-endian big --list-known \
     | sed -e 's/.*-/any-/' -e '/-/!s/^/any-/' \
     | sort \
     | uniq

to get it down a bit (but that also feels like a hack).

BTW, combining "--is" and "--list-known" doesn't work for me, is that
supposed to work?

$ dpkg-architecture --is any-amd64 --list-known
[...]
solaris-sparc64
mint-m68k

To me, it behaves like an architecture wildcard, and inventing a new
syntax would require additional resolver rules on how to do
intersections and unions, when we already have those for the existing
wildcards.

Maybe we could make this more clear with [any-bigendian] or [any-64bit].

We could list the wildcard along the known architectures in Debian for
whatever transition period there is. Porters will probably be the first
to update their resolvers then.

We're a bit limited in punctuation if it needs to work inside a
dependency spec, otherwise something like

     any(endian=little)

might work, but round, square and angle brackets already have another
meaning. Curly braces might work, but this feels wrong, and is also a
lot more work to add to resolvers than just a bunch of new wildcards.

Well, for certain values of "demand" (one package). Right now, I get by with

     echo "Endian!=`dpkg-architecture -qDEB_HOST_ARCH_ENDIAN`" \
         | tee -a debian/nextpnr-ice40.substvars \
         | tee -a debian/nextpnr-ice40-qt.substvars \
         | tee -a debian/nextpnr-ecp5.substvars \
         | tee -a debian/nextpnr-ecp5-qt.substvars \
         | tee -a debian/nextpnr-himbaechel-gowin.substvars \
         | tee -a debian/nextpnr-himbaechel-gowin-qt.substvars \
         | tee -a debian/nextpnr-himbaechel-gatemate.substvars \
         | tee -a debian/nextpnr-himbaechel-gatemate-qt.substvars \
         | tee -a debian/nextpnr-himbaechel-xilinx.substvars \
         | tee -a debian/nextpnr-himbaechel-xilinx-qt.substvars

and I would need to keep some compatibility code around for a few
releases, but eventually I'd like to get rid of that.

Thanks,
    Simon