packaging: github.com/juju/packaging/config Index | Files

package config

import "github.com/juju/packaging/config"

The config package defines an interface which returns packaging-related configuration options and operations depending on the desired package-management system.

Index

Package Files

apt_constants.go centos_constants.go configurer.go configurer_apt.go configurer_yum.go configurer_zypper.go functions.go global_constants.go interface.go opensuse_constants.go ubuntu_constants.go utils.go yum_constants.go zypper_constants.go

Constants

const (
    // AptSourcesFile is the default file which list all core
    // sources for apt packages on an apt-based system.
    AptSourcesFile = "/etc/apt/sources.list"

    // AptListsDirectory is the location of the APT sources list.
    AptListsDirectory = "/var/lib/apt/lists"

    // AptConfigDirectory is the default directory in which
    // apt configuration files are stored.
    AptConfigDirectory = "/etc/apt/apt.conf.d"

    // ExtractAptSource is a shell command that will extract the
    // currently configured APT source location. We assume that
    // the first source for "main" in the file is the one that
    // should be replaced throughout the file.
    ExtractAptSource = `awk "/^deb .* $(lsb_release -sc) .*main.*\$/{print \$2;exit}" ` + AptSourcesFile

    // AptSourceListPrefix is a shell program that translates an
    // APT source (piped from stdin) to a file prefix. The algorithm
    // involves stripping up to one trailing slash, stripping the
    // URL scheme prefix, and finally translating slashes to
    // underscores.
    AptSourceListPrefix = `sed 's,.*://,,' | sed 's,/$,,' | tr / _`
)
const (

    // CentOSSourcesFile is the default file which lists all core sources
    // for yum packages on CentOS.
    CentOSSourcesFile = "/etc/yum/repos.d/CentOS-Base.repo"

    // ReplaceCentOSMirror is a mini-script which replaces the default CentOS
    // mirros with the one formatted in.
    ReplaceCentOSMirror = "sed -r -i -e 's|^mirrorlist|#mirrorlist|g' -e 's|#baseurl=.*|baseurl=%s|g' " +
        CentOSSourcesFile
)
const (
    UbuntuCloudArchiveUrl = "http://ubuntu-cloud.archive.canonical.com/ubuntu"

    UbuntuCloudToolsPrefsPath = "/etc/apt/preferences.d/50-cloud-tools"

    UbuntuCloudArchiveSigningKey = "" /* 3161 byte string literal not displayed */

)
const (
    // YumSourcesDir is the default directory in which yum sourcefiles are located.
    YumSourcesDir = "/etc/yum/repos.d"

    // YumKeyfileDir is the default directory for yum repository keys.
    YumKeyfileDir = "/etc/pki/rpm-gpg/"
)
const (

    // OpenSUSESourcesFile is the default file which lists all core sources
    // for zypper packages on OpenSUSE.
    OpenSUSESourcesFile = "/etc/zypp/repos.d/repo-oss.repo"
)
const (
    PackageManagerLoopFunction = "" /* 286 byte string literal not displayed */

)
const (
    // ZypperSourcesDir is the default directory in which yum sourcefiles are located.
    ZypperSourcesDir = "/etc/zypp/repos.d"
)

Variables

var (
    // AptProxyConfigFile is the full file path for the proxy settings that are
    // written by cloudinit and the machine environ worker.
    AptProxyConfigFile = AptConfigDirectory + "/95-juju-proxy-settings"

    // AptPreferenceTemplate is the template specific to an apt preference file.
    AptPreferenceTemplate = template.Must(template.New("").Parse(`
Explanation: {{.Explanation}}
Package: {{.Package}}
Pin: {{.Pin}}
Pin-Priority: {{.Priority}}
`[1:]))

    // AptSourceTemplate is the template specific to an apt source file.
    AptSourceTemplate = template.Must(template.New("").Parse(`
# {{.Name}} (added by Juju)
deb {{.URL}} %s main
# deb-src {{.URL}} %s main
`[1:]))
)
var CentOSDefaultPackages = append(DefaultPackages, []string{

    "epel-release",
    "yum-utils",
}...)

CentOSDefaultPackages is the default package set we'd like installed on all CentOS machines.

var (

    // DefaultPackages is a list of the default packages Juju'd like to see
    // installed on all it's machines.
    DefaultPackages = []string{

        "curl",
    }
)
var OpenSUSEDefaultPackages = append(DefaultPackages, []string{
    "nano",
    "lsb-release",
}...)

OpenSUSEDefaultPackages is the default package set we'd like installed on all OpenSUSE machines.

var UbuntuDefaultPackages = append(DefaultPackages, []string{

    "python-software-properties",
}...)

UbuntuDefaultPackages is the default package set we'd like to installed on all Ubuntu machines.

var UbuntuDefaultRepositories = []string{}

UbuntuDefaultRepositories is the default repository set we'd like to enable on all Ubuntu machines.

var YumSourceTemplate = template.Must(template.New("").Parse(`
[{{.Name}}]
name={{.Name}} (added by Juju)
baseurl={{.URL}}
{{if .Key}}gpgcheck=1
gpgkey=%s{{end}}
enabled=1
`[1:]))

YumSourceTemplate is the template specific to a yum source file.

var ZypperSourceTemplate = template.Must(template.New("").Parse(`
[{{.Name}}]
name={{.Name}} (added by Juju)
baseurl={{.URL}}
{{if .Key}}gpgcheck=1
gpgkey=%s{{end}}
autorefresh=0
enabled=1
`[1:]))

ZypperSourceTemplate is the template specific to a yum source file.

func GetCloudArchiveSource Uses

func GetCloudArchiveSource(series string) (packaging.PackageSource, packaging.PackagePreferences)

GetCloudArchiveSource returns the PackageSource and associated PackagePreferences for the cloud archive for the given series.

func RequiresBackports Uses

func RequiresBackports(series string, pkg string) bool

func SeriesRequiresCloudArchiveTools Uses

func SeriesRequiresCloudArchiveTools(series string) bool

SeriesRequiresCloudArchiveTools signals whether the given series requires the configuration of cloud archive cloud tools.

type PackagingConfigurer Uses

type PackagingConfigurer interface {
    // DefaultPackages returns a list of default packages whcih should be
    // installed the vast majority of cases on any specific machine
    DefaultPackages() []string

    // GetPackageNameForSeries returns the equivalent package name of the
    // specified package for the given series or an error if no mapping
    // for it exists.
    GetPackageNameForSeries(pack string, series string) (string, error)

    // IsCloudArchivePackage signals whether the given package is a
    // cloud archive package and thus should be set as such.
    IsCloudArchivePackage(pack string) bool

    // ApplyCloudArchiveTarget returns the package with the required target
    // release bits preceding it.
    ApplyCloudArchiveTarget(pack string) []string

    // RenderSource returns the os-specific full file contents
    // of a given PackageSource.
    RenderSource(src packaging.PackageSource) (string, error)

    // RenderPreferences returns the os-specific full file contents of a given
    // set of PackagePreferences.
    RenderPreferences(prefs packaging.PackagePreferences) (string, error)
}

PackagingConfigurer is an interface which handles various packaging-related configuration functions for the specific distribution it represents.

func NewAptPackagingConfigurer Uses

func NewAptPackagingConfigurer(series string) PackagingConfigurer

NewAptPackagingConfigurer returns a PackagingConfigurer for apt-based systems.

func NewPackagingConfigurer Uses

func NewPackagingConfigurer(series string) (PackagingConfigurer, error)

func NewYumPackagingConfigurer Uses

func NewYumPackagingConfigurer(series string) PackagingConfigurer

NewYumPackagingConfigurer returns a PackagingConfigurer for yum-based systems.

func NewZypperPackagingConfigurer Uses

func NewZypperPackagingConfigurer(series string) PackagingConfigurer

Package config imports 4 packages (graph) and is imported by 18 packages. Updated 2019-10-06. Refresh now. Tools for package owners.