This will tell which part of the script is being considered when it is
retrieving the sources from the lookaside cache.
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
There are situations in which one will want to use a `sources` file to
indicate that they wish to use the flat dist-git layout.
However, until now we did not allow empty `sources` file in flat dist-git
layout.
With this change we allow empty `sources` file and we will just echo
something in the logs saying that this file is empty and bail.
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
There is a will to offer SIGs the possibility to use a similar lookaside
structure as the one used by CentOS Stream and Fedora which is not tied
to the name of the archive but to its hash.
The idea though is to offer the new structure as opt-in and thus keep
the old structure working.
We thus need to adjust the get_sources.sh script to support both
structure.
This commit makes it so, it allows both exploded-srpm and flat dist-git
structures to use either the old or new lookaside cache structure. The
way this is achieved is simply to first call the URL corresponding to
the old lookaside structure. If that call returns a http code in the 200
range, then the script stops, otherwise, the script will call the URL
corresponding to the new lookaside structure.
This commit also makes consistent the different curl calls and add
--retry 5 on all of them (which does not work for 404 replies, so
using the new structure will not results in 6 requests to the old one
before moving on, but just 1).
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
The idea of this commit is to make get_sources.sh support both the
'traditional' git layout used on dist-git for CentOS Linux where the
spec files are stored in a SPECS folder and the patches in a SOURCES
folder with the sha of the tarball being in a '.<pkg_name>.metadata'
file as well as the 'flat' git layout that have adopted Fedora as well
as CentOS-Stream (9+) where the spec files and patches are all stored
at the top level directory of the repository and the sha of the tarball
is present in a 'sources' file.
This commit re-uses code from the fedpkg-minimal project which is
license under the GPL (so the License field of the spec file for
centpkg-minimal may need to be adjusted to MIT and GPL).
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Currently, it only checks the size of the http object returned but it
may happen that the size of the 404 error page match the size of the
tarball. You may think this is a corner case we'll never hit... well, we
hit it, :)
This patch it's adding a check based on the http code, so to give it as
already uploaded we need it to return 200 code and match the actual
size.