Store build failure while trying to include dmidecode on s390x & ppc64el

I setup glpi-agent to being automatically built by the new store building system. Because of intel based arch, I include dmidecode to parse its output. So dmidecode is listed in my stage-packages list. I understand this package is not available for s390x & ppc64el as these arch are not providing any dmi informations.

So is there a simple way to exclude this package for s390x & ppc64el or do I have to handle that package installation into a override-stage scriptlet ?

Of course, I still can exclude these arch from the builds as they are not our primary arch target and I don’t even know if anyone could be interested to install glpi-agent on these archs.

Sorry if I opened this topic in the wrong place.

I’d certainly suppress building on unneeded architectures. It’s a waste of resources to spin up a machine, get it all prepared and then throw the build away half way through because it’s the wrong architecture.

However, that said, it’s possible to dpkg --print-architecture in your override-stage or whatever, to detect what arch you’re on and do conditional things as a result. We use this a lot in override-pull to grab the correct assets in building snaps.

Nice, I’ll try that way.

I’ll probably disable these archs after I manage to figure out this problem to avoid wasting resources but I’m still interested to know if we can have support for them in the case someone needs it.

Thank you.

you can use try: to allow snapcraft to carry on if it can’t find the package:

parts:
  foo:
    ...
    stage-packages:
      ...
      - try:
        - dmidecode

Oh yes, I still saw that syntax in the doc and I didn’t think about it.

Thank you !

1 Like

Indeed, this seems not working.

I tries the following:

...
    stage-packages:
     - pciutils
     - usbutils
     - hdparm
     - try:
       - dmidecode

But I’m facing a YAML syntax error on GH build and, sorry, I don’t see what is wrong:

/usr/bin/sg lxd -c snapcraft
Issues while validating snap/snapcraft.yaml: did not find expected '-' indicator on line 184, column 7
Error: The process '/usr/bin/sg' failed with exit code 2

I also tried locally different syntaxes and didn’t figure out what is wrong.

the syntax should be fine according to https://snapcraft.io/docs/snapcraft-advanced-grammar which snapcraft version are you using ?

I’m locally using 4.4.4:

[gbougard@here glpi-agent]$ snapcraft --version
snapcraft, version 4.4.4

And I guess this is also what is used by the snapcore/action-build@v1 GH action I use in the GH workflow.

hmm, that should be fine, perhaps @sergiusens or @cjp256 have a hint then …

Humpf, my humble fault :innocent: And I apologize for the noise.

Indeed, my commit was wrong as just one space was missing. I saw that early, but I was facing some cache issue locally with my snapcraft --debug --lxd that was still failing as it didn’t update the snapcraft.yaml… I finally find how to make a LXD clean build. Then after running snapcraft clean --debug --lxd, I finally saw the error fixed locally and it builds actually on GH.

1 Like