Let’s start with the test result:
Having sb2 -t "$OPT_TARGET" -m sdk-install -R zypper "${args[@]}" in "${deps[@]}"
before zypper dup
and later followed with zypper in
will solve my issue. In my case, the last zypper in
would be no-op.
Re “dup is considered harmful in my case”:
As it is in released mb2
(before your patch or a patch allowing to disable zypper dup), resetting snapshot is insufficient in my case. If you look into details of Mb2 shared output directory: allow to disable zypper distribution update, zypper dup
can install into the clean snapshot the package that will conflict with the buildrequirement package. That what happened in my case.
As with OBS, TBuilder starts with a clean snapshot and it looks to be an only sane way to ensure consistency of the environment. So, regardless to how zypper dup
is resolved, I will keep it that way.
Re snapshots.snapshots and packages:
Very clever. In this case, it would be possible to use, but not from the start. Some of the preferred packages are built within that project (libhybris for example) and they fail to install at the start of the build. This failure is reported by tbuilder but considered OK and the build continues. Later, after libhybris is available, it is installed to replace Mesa libs, similar to OBS.
So, I could use your suggestion if I track the status of installation. In addition, I would have to track all packages that were installed during these operations (libhybris and all dependencies). The snapshot with these installed packages would have to be reset as soon as one of them is rebuilt for one reason or another. Which would make it non-trivial to implement, unfortunately.