Add config option for writing dist-git build results to a subdirectory
Currently, when using the dist-git layout, build results are written directly
to layout root, since all of builddir, srpmdir and rpmdir are set to
root. This pattern is unnecessarily difficult to cover in gitignore rules and
has led to situation in Fedora where, for many packages, running `fedpkg
local` pollutes `git status`.
Instead of writing to repository root, it is much cleaner to write to a single
subdirectory which is easy to add to ignore rules. To enable this without
interfering with current usage, new config option `results_dir` is added.
Default value preserving current behavior is `root`, whereas setting `subdir`
leads to selecting an alternative dist-git layout that uses subdirectory
`results` instead.
This topic has been discussed in a Fedora mailing list thread:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/FNDBDD5TRXOIUYSC23QV2GN7ZKAHRM3C/
There, it was proposed that the subdirectory would be the same that the
`mockbuild` command uses. Unfortunately, resolving mockbuild results dir name
requires parsing the spec file, whereas layout selection happens before.
Because of this difficulty, a simpler method of fixed name "results" is used
here.
Earlier, layout selection was based solely on directory contents. Since build
results directory is only created after something is built, that method is not
adequate. Thus, additional `hint` input is added to layout `from_path` method,
allowing selecting the subdir variant from standard dist-git structure.
To keep the build result directory as simple as possible, and as similar to
mockbuild results, architecture specific subdirectories are not created. This
requires adding new member to layouts: rpmfilename. It is passed directly to
rpmdefines.
From the viewpoint of easy writing of ignore rules, it would make sense to set
also sourcedir to the new `results` directory. However, patches are stored in
repository root everywhere and rpmbuild expects to find them in the sourcedir.
Thus, sourcedir must be set to repository root like it is in the standard
dist-git layout.
Signed-off-by: Otto Urpelainen <oturpe@iki.fi>