cue modules: move stdlib to pkg/alpha.dagger.io

In preparation for Europa, we will vendor multiple CUE modules:

- `pkg/alpha.dagger.io`: legacy non-europa packages
- `pkg/dagger.io`: core Europa packages
- `pkg/universe.dagger.io`: Europa universe

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2022-01-11 12:40:02 -08:00
parent e5316f3a1e
commit 282759c0e5
277 changed files with 33 additions and 31 deletions

View File

@@ -13,8 +13,8 @@ import (
"github.com/gofrs/flock"
"github.com/rs/zerolog/log"
"go.dagger.io/dagger/keychain"
"go.dagger.io/dagger/pkg"
"go.dagger.io/dagger/plancontext"
"go.dagger.io/dagger/stdlib"
"gopkg.in/yaml.v3"
)
@@ -421,7 +421,7 @@ func VendorUniverse(ctx context.Context, p string) error {
// add universe and lock file to `.gitignore`
if err := os.WriteFile(
path.Join(p, "cue.mod", "pkg", ".gitignore"),
[]byte(fmt.Sprintf("# generated by dagger\n%s\ndagger.lock\n", stdlib.ModuleName)),
[]byte(fmt.Sprintf("# generated by dagger\n%s\ndagger.lock\n", pkg.AlphaModule)),
0600,
); err != nil {
return err
@@ -434,7 +434,7 @@ func VendorUniverse(ctx context.Context, p string) error {
if err != nil {
return err
}
if err := stdlib.Vendor(ctx, tmp); err != nil {
if err := pkg.Vendor(ctx, tmp); err != nil {
// FIXME(samalba): disabled install remote stdlib temporarily
// if _, err := mod.Install(ctx, p, stdlib.ModuleName, ""); err != nil {
return err
@@ -446,7 +446,7 @@ func VendorUniverse(ctx context.Context, p string) error {
// mv cue.mod/pkg/MODULE cue.mod/pkg/MODULE.old
// mv VENDOR cue.mod/pkg/MODULE
// rm -rf cue.mod/pkg/MODULE.old
newStdlib := path.Join(p, stdlib.Path)
newStdlib := path.Join(p, "cue.mod", "pkg", pkg.AlphaModule)
oldStdlib := newStdlib + ".old"
if err := os.RemoveAll(oldStdlib); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
@@ -456,7 +456,7 @@ func VendorUniverse(ctx context.Context, p string) error {
}
defer os.RemoveAll(oldStdlib)
if err := os.Rename(tmp, newStdlib); err != nil {
if err := os.Rename(path.Join(tmp, pkg.AlphaModule), newStdlib); err != nil {
return err
}