Commit graph

26 commits

Author SHA1 Message Date
Pierre-Yves Chibon
5480ad2988 Add a little debugging info to the get_sources script
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>
2022-03-03 09:56:28 +01:00
Pierre-Yves Chibon
04de770669 Adjust get_sources.sh to allow empty sources file
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>
2022-03-03 09:53:43 +01:00
Pierre-Yves Chibon
014e3890be Add support for a different lookaside structure
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>
2022-03-03 09:52:58 +01:00
Fabian Arrotin
ae9a7e62f9 Backported alphacc's fix for el7/cbs and bash 4.2 (ca63b53c8b)
Signed-off-by: Fabian Arrotin <arrfab@centos.org>
2022-02-17 13:25:45 +01:00
Pierre-Yves Chibon
518994fd59 Make the get_sources shell script support flat layout
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>
2022-02-01 10:59:12 +01:00
Brian Stinson
b2f5375fcf add a grep to be sure we only check the origin remote (no forks) 2019-04-16 13:10:24 -05:00
Brian Stinson
7707c61e83 A WHICH! BURN IT 2019-04-16 13:10:19 -05:00
Brian Stinson
9857597bf6 add some quotes to make shellcheck happier 2019-04-16 13:06:51 -05:00
Brian Stinson
fd37ab5810 use command instead of which. this is more portable and doesn\'t require another dep 2019-04-16 10:03:11 -05:00
Brian Stinson
3382beadcc Get the proper branch name from the remote instead of the local branch
name.

This allows you to clone a commit directly by its hash, and not be
required to set up a tracking branch (with a matching name) to its
upstream.
2019-04-16 09:59:13 -05:00
Colin Walters
1ad34919a1 get_sources: Print the URL we're fetching
Just for better debugging.
2016-12-14 09:46:35 -06:00
Colin Walters
552ca48e93 get_sources: Follow redirects
This is general best practice, and would have avoided the
need for 696c29f5c9
(I tested with that commit reverted)
2016-12-14 09:46:35 -06:00
Tuomo Soini
bd83a7926b get_sources: download source again if file checksum has changed
This functionality requires use of option -c.

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2016-11-15 08:47:05 -06:00
Johnny Hughes
696c29f5c9 fix for git.c.o redirect 2016-07-06 14:11:13 -05:00
Pat Riehecky
7520e4b130 Send these errors to stderr 2014-07-22 10:01:28 -05:00
Tyler Parsons
d96c00fa0f Allow get_sources.sh hash verification to work with hashes other than sha1 2014-06-27 13:06:10 -05:00
Pat Riehecky
64562123ea Refactor to use getopt for arg parsing 2014-06-26 14:38:49 -05:00
Mike McLean
da2660e784 don't assume specfile name matches package name in get_sources 2014-06-25 14:49:32 -05:00
Pat Riehecky
061172c484 Added optional check for sha1sum of downloaded source file 2014-06-25 12:27:07 -05:00
Pat Riehecky
4258078ef3 Added -q to get_sources for less chatty operation 2014-06-25 12:25:28 -05:00
Mike McLean
c61c1ca391 handle detached branch case handle alternate directory name case cmdline args to override branch and source url 2014-06-12 21:36:41 +01:00
Pat Riehecky
f3a920b627 Fixed so it works on kpatch golang-* 2014-06-11 18:31:34 +01:00
Pat Riehecky
1842fe9505 Added simple override file for altering top level vars. 2014-06-10 15:13:15 +01:00
Pat Riehecky
a4a7af33ae Fixed inconsistent use of ${} notation 2014-06-10 15:13:10 +01:00
Pat Riehecky
c19d26d752 moved url to var for easier customization over time 2014-06-10 15:13:01 +01:00
Karanbir Singh
afa935ac9b add the get_sources.sh file so people can get non-text sources 2014-06-07 01:25:31 +01:00