Skip to content

build: fix build when repos do not have changes

Kevin Daudt requested to merge fix-when-repos-without-changes into master

The changed_repos function determines what repos have changes so that it only builds repos that actually have changes. But this function just does a plain diff against the target branch. This means if the target branch has any changes compared to the source branch, it would consider that branch as well.

This was never a real issue, because the changed_aports function correctly returns the changed aports for a give repo, which would be empty in case there are no changed aports for that repo. This is also no a problem in general, because the other repositories always have aports. This would break when a repository does not have any aports, because ap builddirs would throw an error.

New functionality has been added that determines how many aports have changed and tries to select only a subset. To do that, it needs to convert a space delimited list into a new-line delimited list. It uses xargs -n1 echo for that. The problem is that by default, xargs runs echo as well even if there are no items passed, resulting in a single newline being returned. Passing that to wc -l returns '1' while no aport was changed. This throws off the accounting for limiting the packages being built.

Fix this by both properly doing an asymmetric diff against the target branch in changed_repos and by adding -r to xargs so that it returns nothing when there are no changed aports.

Merge request reports

Loading