mock
mock copied to clipboard
[RFE] Handle chainbuilds in presence of cycles and make sure the result is self-hosting
Mockchain is very nice and useful. However it only handles simple cases without any complex dependency cycles. Also, it does not check that the resulting packages still build (one of the packages could have built, from another package, that was upgraded to an incompatible package later in the chain).
Unfortunately I'm deep in such cases and I had to write a quick and dirty script to replace mockchain that proved a lifesaver. However, this is just me and a shared tool others could use in Fedora, or via copr or koji would help the distribution a lot more.
A more robust and correct chainbuild algorithm would be:
- rev every spec release to release.0 (without taking into account release decorations such as .el7 or git commits)
newrelease=$(grep '^Release:' "$fromspec" |\
sed 's+^\(Release:\s*\)\([0-9.]*\.\)\?\([0-9]*\)\([^0-9].*\)\?$+\1\2\3|\4+g' |\
awk -v bump="$bump" -F '|' '{ print $1 "." bump $2 }')
sed "s+^Release:.*$+$newrelease+g" "$fromspec" > "$tospec"
-
try to chain build every spec as-is, in normal mode, till there is no progress (the remaining specs won't build regardless of the build order)
-
try to chain build every spec that didn't build in bootstrap mode:
--with bootstrapor
sed -i 's+^%{\(?\|!?\)_\(with\|without\)_bootstrap:\s*%global\s*bootstrap\s*.*}+%{!?_without_bootstrap: %global bootstrap 1}+g' "$newspec"
- if that succeeds (every spec built in normal or bootstrap mode) rev up every spec that built in bootstrap mode
newrelease=$(grep '^Release:' "$tobump" |\
sed 's+^\(Release:\s*\)\([0-9.]*\.\)\?\([0-9]*\)\([^0-9].*\)\?$+\1\2|\3|\4+g' |\
awk -F '|' '{ print $1 $2+1 $3 }')
sed -i "s+^Release:.*$+$newrelease+g" "$tobump"
- try to chain rebuild every spec that built in bootstrap mode in normal mode
--without bootstrapor
sed -i 's+^%{\(?\|!?\)_\(with\|without\)_bootstrap:\s*%global\s*bootstrap\s*.*}+%{?_with_bootstrap: %global bootstrap 1}+g' "$newspec"
- if that succeeds (every spec built in normal mode, with some via a first boostrap step) rev up every spec
newrelease=$(grep '^Release:' "$tobump" |\
sed 's+^\(Release:\s*\)\([0-9.]*\.\)\?\([0-9]*\)\([^0-9].*\)\?$+\1\2|\3|\4+g' |\
awk -F '|' '{ print $1 $2+1 $3 }')
sed -i "s+^Release:.*$+$newrelease+g" "$tobump"
- try to chain rebuild every spec in normal mode, to make sure the final state is still consistent (every spec can build against the final build result of the other specs)
This should be a lot more robust than mockchain and be able to build any spec chain that does not need human changes.
This would probably require integration with libsolv in some way, similar to how obs-build uses perl-BSSolv to be able to solve this problem. @ignatenkobrain has some experience trying to do this, and might have some insight...
And @mlschroe might have some useful info (as the author of obs-build and perl-BSSolv)...