internal/rosa/git: git clone helper

For obtaining sources of projects that stubbornly refuse to provide release tarballs.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-02-06 21:10:59 +09:00
parent fa94155f42
commit 3f7b8b4332

View File

@@ -76,3 +76,26 @@ make \
)
}
func init() { artifactsF[Git] = Toolchain.newGit }
// NewViaGit returns a [pkg.Artifact] for cloning a git repository.
func (t Toolchain) NewViaGit(
name, url, rev string,
checksum pkg.Checksum,
) pkg.Artifact {
return t.New(name+"-"+rev, 0, []pkg.Artifact{
t.Load(NSSCACert),
t.Load(OpenSSL),
t.Load(Libpsl),
t.Load(Curl),
t.Load(Libexpat),
t.Load(Git),
}, &checksum, nil, `
git \
-c advice.detachedHead=false \
clone \
--revision=`+rev+` \
`+url+` \
/work
rm -rf /work/.git
`, resolvconf())
}