Browse Source

Improve make call and add recipes and isolate within the jail directory

Bernhard Fröhlich 1 month ago
parent
commit
86f81c3b6b
Signed by: Bernhard Froehlich <decke@bluelife.at> GPG Key ID: 4DD88C3F9F3B8333
2 changed files with 20 additions and 2 deletions
  1. 19
    1
      main.go
  2. 1
    1
      work/poudriere.mk

+ 19
- 1
main.go View File

@@ -14,6 +14,7 @@ import (
14 14
 	"os"
15 15
 	"os/exec"
16 16
 	"path"
17
+	"path/filepath"
17 18
 	"regexp"
18 19
 	"strings"
19 20
 	"sync"
@@ -160,7 +161,22 @@ func (c *controller) startWorker(workChan chan worker, qidx int) {
160 161
 				fmt.Sprintf("JAIL=%s", queue.Jailname),
161 162
 				fmt.Sprintf("PORTSTREE=%s", queue.Portstree),
162 163
 			)
163
-			cmd := exec.Cmd{Dir: c.cfg.Base.Workdir, Env: env, Path: "/usr/bin/make", Args: []string{"all"}}
164
+
165
+			workdir := fmt.Sprintf("%s/%s", c.cfg.Base.Workdir, queue.Jailname)
166
+			os.MkdirAll(workdir, os.ModePerm)
167
+
168
+			cmd := exec.Cmd{
169
+				Dir: workdir,
170
+				Env: env,
171
+				Path: "/usr/bin/make",
172
+				Args: []string{
173
+					"make",
174
+					"-C", workdir,
175
+					"-f", fmt.Sprintf("%s.mk", queue.Recipe),
176
+					"-I", c.cfg.Base.Workdir,
177
+					"all",
178
+				},
179
+			}
164 180
 			output, err := cmd.CombinedOutput()
165 181
 			if err != nil {
166 182
 				wrk.Status = "failure"
@@ -309,6 +325,8 @@ func ParseConfig(file string) Config {
309 325
 		log.Fatalf("Error: %v", err)
310 326
 	}
311 327
 
328
+	cfg.Base.Workdir, _ = filepath.Abs(cfg.Base.Workdir)
329
+	cfg.Base.Logdir, _ = filepath.Abs(cfg.Base.Logdir)
312 330
 	cfg.Server.BaseURL = strings.TrimSuffix(cfg.Server.BaseURL, "/")
313 331
 	cfg.Repository.APIURL = strings.TrimSuffix(cfg.Repository.APIURL, "/")
314 332
 

work/Makefile → work/poudriere.mk View File

@@ -30,7 +30,7 @@ JAIL?=
30 30
 #
31 31
 # Poudriere portstree used for building
32 32
 #
33
-PORTSTREE?=	default
33
+PORTSTREE?=	
34 34
 
35 35
 
36 36
 # DON'T TOUCH ANYTHING BELOW HERE

Loading…
Cancel
Save