Files
Reagan Lopez 874ee1dfad Introduces option for upstream bundles url
Currently, the bundle defintions are downloaded from the default
clr-bundles repo https://github.com/clearlinux/clr-bundles/archive/.

The user can now specify a different upstream bundles url using a mixer init flag or mixer
config parameter.

E.g. mixer init --upstream-bundles-url=https://github.com/reaganlo/clr-bundles/archive/
E.g. mixer config set Swupd.UPSTREAM_BUNDLES_URL https://github.com/reaganlo/clr-bundles/archive/

Since there is a tight coupling between the --upstream-version and bundles
repo, the user should ensure that the bundles repo has the same structure as the
clr-bundles repo and the tar.gz files should be named after an upstream
version. i.e. If the mix is based on an upstream-version 31300, the bundles repo
should have a file 31300.tar.gz

Fixes #614
Note: Setting this value using `mixer config set` will only update it in builder.conf.
It does not fetch the upstream bundles. A dedicated command for that purpose
will have to be implemented instead.

Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2019-11-07 17:18:37 +01:00

52 lines
1.1 KiB
Go

package builder
import (
"io/ioutil"
"os"
"testing"
)
func mustExist(t *testing.T, name string) {
t.Helper()
_, err := os.Stat(name)
if err != nil {
t.Fatal(err)
}
}
func cleanup(path string) {
_ = os.RemoveAll(path)
}
func TestNewDNFConfOnInit(t *testing.T) {
testDir, err := ioutil.TempDir("", "dnf-testdir-")
if err != nil {
t.Fatalf("couldn't create temporary directory to write test cases: %s", err)
}
defer cleanup(testDir)
conf := testDir + "/builder.conf"
b := New()
b.Config.LoadDefaultsForPath(testDir)
if err = b.Config.InitConfigPath(conf); err != nil {
t.Errorf("Failed to init default config: %s", err)
}
if err = b.Config.SaveConfig(); err != nil {
t.Errorf("Failed to create default config: %s", err)
}
if err = b.Config.LoadConfig(conf); err != nil {
t.Errorf("Failed to load default builder.conf: %s", err)
}
Offline = true
err = b.InitMix("latest", "10", false, false, true, "https://cdn.download.clearlinux.org", false)
if err != nil {
t.Errorf("Failed to initialize mix: %s", err)
}
mustExist(t, testDir+"/.yum-mix.conf")
}