File: functions.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 (44 lines) | stat: -rw-r--r-- 1,330 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2015 Canonical Ltd.
// Copyright 2015 Cloudbase Solutions SRL
// Licensed under the LGPLv3, see LICENCE file for details.

package config

import (
	"github.com/juju/utils/packaging"
)

// SeriesRequiresCloudArchiveTools signals whether the given series
// requires the configuration of cloud archive cloud tools.
func SeriesRequiresCloudArchiveTools(series string) bool {
	return seriesRequiringCloudTools[series]
}

// GetCloudArchiveSource returns the PackageSource and associated
// PackagePreferences for the cloud archive for the given series.
func GetCloudArchiveSource(series string) (packaging.PackageSource, packaging.PackagePreferences) {
	// TODO (aznashwan): find a more deterministic way of filtering series that
	// does not imply importing version from core.
	switch series {
	case "centos7":
		// NOTE: as of yet, the below function does nothing for CentOS.
		return configureCloudArchiveSourceCentOS(series)
	case "opensuseleap":
		// NOTE: do the sam that CentOS case
		return configureCloudArchiveSourceOpenSUSE(series)
	default:
		return configureCloudArchiveSourceUbuntu(series)
	}
}

func RequiresBackports(series string, pkg string) bool {
	backportPkgs := backportsBySeries[series]

	for _, backportPkg := range backportPkgs {
		if pkg == backportPkg {
			return true
		}
	}

	return false
}