4 task default: %w[build]
7 repo = Rugged::Repository.new('.')
8 commit = repo.head.target
9 parent = commit.parents.first
10 pkgs = commit.diff(parent).deltas.map { |d| d.new_file[:path] }
11 # Split paths into arrays
12 pkgs.map! { |p| Pathname.new(p).each_filename.to_a }
13 # looking for [disabled-]packages/(package_name)/...
14 pkgs.select! { |p| p.length > 2 and p[0] =~ /(?<disabled->)packages/ }
16 pkgs.map! { |p| p[1] }
17 # Remove duplicate packages
20 puts "Building #{pkg}"
22 # Start blocking build loop
23 PTY.spawn("./scripts/run-docker.sh ./build-package.sh #{pkg}") do |stdout, stdin, pid|
25 stdout.each { |line| print line }
29 rescue PTY::ChildExited
32 # Exit if PTY return a non-zero code
34 STDERR.puts("Error building #{pkg}")