mirror of
https://github.com/rocky-linux/srpmproc.git
synced 2024-12-04 18:36:26 +00:00
More cleanup from feedback
- Removed extra lines - Externalized Lookaside struct{} -Skip Grube
This commit is contained in:
parent
2cc3bcc3a3
commit
0ea6123b6e
@ -49,6 +49,15 @@ type remoteTarget struct {
|
|||||||
when time.Time
|
when time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Struct to define the possible template values ( {{.Value}} in CDN URL strings:
|
||||||
|
type Lookaside struct {
|
||||||
|
Name string
|
||||||
|
Branch string
|
||||||
|
Hash string
|
||||||
|
Hashtype string
|
||||||
|
Filename string
|
||||||
|
}
|
||||||
|
|
||||||
type remoteTargetSlice []remoteTarget
|
type remoteTargetSlice []remoteTarget
|
||||||
|
|
||||||
func (p remoteTargetSlice) Len() int {
|
func (p remoteTargetSlice) Len() int {
|
||||||
@ -487,16 +496,6 @@ func (g *GitMode) ImportName(pd *data.ProcessData, md *data.ModeData) string {
|
|||||||
// Given a cdnUrl string as input, return same string, but with substituted
|
// Given a cdnUrl string as input, return same string, but with substituted
|
||||||
// template values ( {{.Name}} , {{.Hash}}, {{.Filename}}, etc. )
|
// template values ( {{.Name}} , {{.Hash}}, {{.Filename}}, etc. )
|
||||||
func ProcessUrl(cdnUrl string, name string, branch string, hash string, hashtype string, filename string) (string, bool) {
|
func ProcessUrl(cdnUrl string, name string, branch string, hash string, hashtype string, filename string) (string, bool) {
|
||||||
|
|
||||||
// These 5 {{ .Value }} items are possible in our templated string:
|
|
||||||
type Lookaside struct {
|
|
||||||
Name string
|
|
||||||
Branch string
|
|
||||||
Hash string
|
|
||||||
Hashtype string
|
|
||||||
Filename string
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpUrl := Lookaside{name, branch, hash, hashtype, filename}
|
tmpUrl := Lookaside{name, branch, hash, hashtype, filename}
|
||||||
|
|
||||||
// If we run into trouble with our template parsing, we'll just return the cdnUrl, exactly as we found it
|
// If we run into trouble with our template parsing, we'll just return the cdnUrl, exactly as we found it
|
||||||
|
@ -121,7 +121,6 @@ func gitlabify(str string) string {
|
|||||||
// List of distros and their lookaside patterns
|
// List of distros and their lookaside patterns
|
||||||
// If we find one of these passed as --cdn (ex: "--cdn fedora"), then we override, and assign this URL to be our --cdn-url
|
// If we find one of these passed as --cdn (ex: "--cdn fedora"), then we override, and assign this URL to be our --cdn-url
|
||||||
func StaticLookasides() []LookasidePath {
|
func StaticLookasides() []LookasidePath {
|
||||||
|
|
||||||
centos := LookasidePath{
|
centos := LookasidePath{
|
||||||
Distro: "centos",
|
Distro: "centos",
|
||||||
Url: "https://git.centos.org/sources/{{.Name}}/{{.Branch}}/{{.Hash}}",
|
Url: "https://git.centos.org/sources/{{.Name}}/{{.Branch}}/{{.Hash}}",
|
||||||
@ -163,7 +162,6 @@ func FindDistro(cdn string) (string, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewProcessData(req *ProcessDataRequest) (*data.ProcessData, error) {
|
func NewProcessData(req *ProcessDataRequest) (*data.ProcessData, error) {
|
||||||
|
|
||||||
// Build the logger to use for the data import
|
// Build the logger to use for the data import
|
||||||
var writer io.Writer = os.Stdout
|
var writer io.Writer = os.Stdout
|
||||||
if req.LogWriter != nil {
|
if req.LogWriter != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user