File: source.go

package info (click to toggle)
golang-github-juju-utils 0.0~git20171220.f38c0b0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,748 kB
  • sloc: makefile: 20
file content (28 lines) | stat: -rw-r--r-- 879 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2015 Canonical Ltd.
// Copyright 2015 Cloudbase Solutions SRL
// Licensed under the LGPLv3, see LICENCE file for details.

// Package packaging abstracts away differences between package managers like
// apt and yum and allows for easy extension for other package managers/distros.
package packaging

import (
	"text/template"
)

// PackageSource contains all the data required for a package source.
type PackageSource struct {
	Name string `yaml:"-"`
	URL  string `yaml:"source"`
	Key  string `yaml:"key,omitempty"`
}

// KeyFileName returns the name of this source's keyfile.
func (s *PackageSource) KeyFileName() string {
	return s.Name + ".key"
}

// RenderSourceFile renders the current source based on a template it recieves.
func (s *PackageSource) RenderSourceFile(fileTemplate *template.Template) (string, error) {
	return renderTemplate(fileTemplate, s)
}