Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lang): Fix user-defined packages #168

Merged
merged 2 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/envd/testdata/build.envd
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ base(os="ubuntu20.04", language="python3")
pip_package(name = [
"ormb",
])
install_package(name = ["screenfetch"])
3 changes: 1 addition & 2 deletions cmd/envd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ var CommandUp = &cli.Command{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "tag",
Usage: "Name and optionally a tag in the 'name:tag' format",
Usage: "Name and optionally a tag in the 'name:tag' format (default: PROJECT:dev)",
Aliases: []string{"t"},
Value: "envd:dev",
},
&cli.PathFlag{
Name: "path",
Expand Down
6 changes: 3 additions & 3 deletions pkg/lang/ir/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ func (g Graph) compilePyPIPackages(root llb.State) llb.State {
}

cacheDir := "/home/envd/.cache/pip"

run := root.Run(llb.Shlex(sb.String()), llb.WithCustomNamef("pip install %s",
cmd := sb.String()
run := root.Run(llb.Shlex(cmd), llb.WithCustomNamef("pip install %s",
strings.Join(g.PyPIPackages, " ")))
run.AddMount(cacheDir, llb.Scratch(),
llb.AsPersistentCacheDir("/"+cacheDir, llb.CacheMountShared))
Expand Down Expand Up @@ -214,7 +214,7 @@ func (g Graph) compileSystemPackages(root llb.State) llb.State {

// Compose the package install command.
var sb strings.Builder
sb.WriteString("apt-get install -y --no-install-recommends")
sb.WriteString("sudo apt-get install -y --no-install-recommends")

for _, pkg := range g.SystemPackages {
sb.WriteString(fmt.Sprintf(" %s", pkg))
Expand Down