Bug 1071080 - build fails after an architecture change
build fails after an architecture change
Status: NEW
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other
PC openSUSE Factory
: P5 - None : Normal (vote)
: ---
Assigned To: Adrian Schröter
E-mail List
Depends on:
  Show dependency treegraph
Reported: 2017-12-04 15:08 UTC by Giacomo Comes
Modified: 2018-02-21 15:32 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---

successful and failed build logs (12.26 KB, application/x-xz)
2017-12-04 15:08 UTC, Giacomo Comes

Note You need to log in before you can comment on or make changes to this bug.
Description Giacomo Comes 2017-12-04 15:08:33 UTC
Created attachment 751313 [details]
successful and failed build logs

I often use build to rebuild locally some packages. The normal workflow is:
1) unpack the src.rpm
2) apply my changes
3) run: build --ccache *.spec 
4) save 64-bit rpm
6) run: linux32 build --ccache --baselibs --arch=i586 *.spec
7) save 32-bit rpm

With build-20171128 this workflow doesn't work anymore. When I change architecture the build system keeps the old rpm (with the wrong architecture) and the build fails.

Attached there are two build logs. One using build-20171117 (successfully build  thttpd 64-bit after a previous 32-bit build) and another using build-20171128 (failure to build thttpd 64-bit after a previous 32-bit build)

I tracked the source of the issue to commit 441a3b1631e4a155230ef3a0894a208992324c29

Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date:   Mon Nov 13 19:54:59 2017 +0100

    Keep preinstalled packages
    when building in KVM we need the preinstalled packages (e.g. rpm)
    to install packages, because once we uninstall them, we cannot get them back.
    Closes #377

diff --git a/init_buildsystem b/init_buildsystem
index 1b7c17b..1bbfa5c 100755
--- a/init_buildsystem
+++ b/init_buildsystem
@@ -951,7 +951,7 @@ for PKG in $MAIN_LIST ; do
     if test -f "$BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG" ; then
        read OLDPKGID < "$BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG"
-       if test "$PKGID" != "$OLDPKGID" ; then
+       if test "$PKGID" != "$OLDPKGID" && ! test -e "$BUILD_ROOT/.init_b_cache/preinstalls/$PKG" ; then
            echo "deleting unwanted ${OLDPKGID%% *}"
Comment 1 Adrian Schröter 2018-02-21 08:52:45 UTC
Is it a problem to use --clean in this situation in 6)? I am a bit surprised that an architecture switch actually worked ...
Comment 2 Giacomo Comes 2018-02-21 15:32:57 UTC
When I was using opensuse 13.2 the architecture switch was not working. It was necessary to use --clean in step 3 and 6. Then for a year or more I used only 64-bit build (leap).
Recently, in order to have an updated 32-bit os I started to use tumbleweed.
With my big surprise and pleasure, the architecture switch was functional, until the commit I reported.
A build that works with architecture switch makes things faster. If you use --clean the build process takes longer in case of two consecutive builds of the same architecture. Of course, if you do the second build immediately after the first, you know that there is no architecture change and you can omit --clean, but if the second build happens some time later, it is hard to remember what kind of build you did previously. If the architecture was the same and you add --clean, the build takes longer, if the architecture was different and you forget --clean it takes even longer.
So this is just a feature very convenient to have and that was already working.