summarylogtreecommitdiffstats
path: root/parse_manifest.rb
blob: 98fa9f1623c690a3d02822e3fb2bc3a3f189608e (plain)
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
#!/usr/bin/ruby

# Jiri build system uses jiri to checkout its dependencies :(
# https://fuchsia.googlesource.com/manifest/+/refs/heads/master/jiri
# to avoid this chicken-egg problem we parse the manifest and generate
# the dependencies that easy to use in the PKGBUILD file

require 'open-uri'
require 'xmlsimple'

deps = []

doc = XmlSimple.xml_in(open('https://raw.githubusercontent.com/fuchsia-mirror/manifest/master/jiri'))
for pr in doc['projects'][0]['project']
  name = pr['name']
  remote = pr['remote']
  rev = pr['revision']
  path = pr['path']

  url = "git+#{remote}"
  url += "#commit=#{rev}" if rev

  deps << [url, remote, path]
end

puts "Sources:"
for d in deps
  puts "  #{d[0]}"
end

puts "Prepare:"
for d in deps
  url, remote, path = *d

  puts "  mkdir -p #{File.dirname(path)}"
  puts "  rm -rf #{path}"
  puts "  ln -sfT $srcdir/#{File.basename(remote)} #{path}"
end