-
Notifications
You must be signed in to change notification settings - Fork 5
/
felixbuild-ps
executable file
·58 lines (52 loc) · 1.62 KB
/
felixbuild-ps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/ruby
`ps aww`.split(/\n/).each do |line|
pid = line.split[0]
if line.include? 'felixbuild '
cwd = File.readlink("/proc/#{pid}/cwd")
server = line.split("felixbuild ")[1].split[0].match(/[a-zA-Z.@]+/)[0].split("@")[-1]
begin
buildcmd = line.split("felixbuild ")[1]
maincmd = buildcmd.split[1]
if maincmd == "pkgctl"
# New pkgctl
begin
arch = buildcmd.split("--arch ")[1].split[0]
rescue
arch = "x86_64"
end
begin
repo = buildcmd.split("--repo ")[1].split[0]
rescue
repo = "stable"
if buildcmd.split[-1] == "--staging"
repo = "staging"
elsif buildcmd.split[-1] == "--testing"
repo = "testing"
end
end
else
# Legacy #repo-#arch-build
repo, arch = maincmd.match(/([\w-]+)-(\w+)-build/)[1..]
end
rescue
repo, arch = "unknown", "unknown"
end
if File.exist? "#{cwd}/PKGBUILD"
pkgbase = cwd.split("/")[-1]
else
pkgbase = "unknown"
end
puts "[Arch/#{repo}] #{pkgbase} #{arch} on #{server}"
elsif line.include? 'aoscbuild'
arch, package, branch = line.split("aoscbuild ")[1].split
branch = "stable" if branch.nil?
begin
child = File.read("/proc/#{pid}/task/#{pid}/children").strip
childcmdline = File.read("/proc/#{child}/cmdline").chomp
port = childcmdline.split("\0").join(" ").split(".aosc")[0].split("@")[1]
puts "[AOSC/#{branch}] #{package} #{arch} on #{port}"
rescue
puts "[AOSC/#{branch}] #{package} #{arch} uploading..."
end
end
end