// ensureDependencies creates a set of install packages using // apt.GetPreparePackages and runs each set of packages through // apt.GetInstall. func ensureDependencies(series string) error { if series == "precise" { return fmt.Errorf("LXD is not supported in precise.") } pacman, err := getPackageManager(series) if err != nil { return err } pacconfer, err := getPackagingConfigurer(series) if err != nil { return err } for _, pack := range requiredPackages { pkg := pack if config.SeriesRequiresCloudArchiveTools(series) && pacconfer.IsCloudArchivePackage(pack) { pkg = strings.Join(pacconfer.ApplyCloudArchiveTarget(pack), " ") } if config.RequiresBackports(series, pack) { pkg = fmt.Sprintf("--target-release %s-backports %s", series, pkg) } if err := pacman.Install(pkg); err != nil { return err } } if series >= "xenial" { for _, pack := range xenialPackages { pacman.Install(fmt.Sprintf("--no-install-recommends %s", pack)) } } return err }
func (s *FunctionsSuite) TestRequiresBackportsTrustyLXD(c *gc.C) { requiresBackports := config.RequiresBackports("trusty", "lxd") c.Assert(requiresBackports, jc.IsTrue) }