-
Notifications
You must be signed in to change notification settings - Fork 1
/
pybombs2ebuild.rb
executable file
·57 lines (43 loc) · 1.59 KB
/
pybombs2ebuild.rb
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
#!/usr/bin/env ruby
require 'pp'
require 'yaml'
dir="#{__dir__}/gr-recipes"
files = Dir.entries(dir).grep_v(/^\./).grep_v(/^README/).map {|f| "#{dir}/#{f}" }
files = Hash[*files.map {|f| [f, YAML.load_file(f)] }.flatten]
files = files.select {|k,v| v['source'] and v['source'] =~ /github\.com\/[^\/]+\/gr-/}
files = files.select {|k,v| v['depends'] and (v['depends'] == 'gnuradio' or v['depends'] == ['gnuradio'] ) }
Dir.mkdir("#{__dir__}/net-wireless") rescue nil
files.each do |k,v|
name = File.basename(k)[/(.*)(\.[^.]*)/,1]
source = v['source'][/^(git\+)?(.+?)(\.git)?$/,2]
desc = v['description']
dir = "#{__dir__}/net-wireless/#{name}"
file = "#{dir}/#{name}-9999.ebuild"
Dir.mkdir(dir) rescue nil
File.write(file, <<~EBUILD
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
DESCRIPTION="#{desc}"
HOMEPAGE="#{source}"
EGIT_REPO_URI="#{source}"
KEYWORDS=""
inherit gnuradio git-r3
EBUILD
)
github = source[/github\.com\/([^\/]+\/[^\/]+)/,1]
File.write("#{dir}/metadata.xml", <<~METADATA
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>hololeap</name>
</maintainer>
<upstream>
<remote-id type="github">#{github}</remote-id>
</upstream>
</pkgmetadata>
METADATA
)
end