* [gentoo-commits] proj/api:master commit in: bin/, /
@ 2015-07-03 9:42 Alex Legler
0 siblings, 0 replies; only message in thread
From: Alex Legler @ 2015-07-03 9:42 UTC (permalink / raw
To: gentoo-commits
commit: 3d0ecf32542ece3ab4893694e1a83028d043a75f
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Fri Jul 3 09:41:10 2015 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Fri Jul 3 09:41:10 2015 +0000
URL: https://gitweb.gentoo.org/proj/api.git/commit/?id=3d0ecf32
Add USE flag list generator, ignore result file
.gitignore | 1 +
bin/use-index.rb | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..31a33a0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+files/packages/use.json
diff --git a/bin/use-index.rb b/bin/use-index.rb
new file mode 100755
index 0000000..c0a968b
--- /dev/null
+++ b/bin/use-index.rb
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+
+require 'json'
+
+GLOBAL = '/usr/portage/profiles/use.desc'
+LOCAL = '/usr/portage/profiles/use.local.desc'
+
+output = { 'global' => {}, 'local' => {} }
+
+File.readlines(GLOBAL).each do |line|
+ next if line =~ /^(|#.*)$/
+
+ flag, desc = line.strip.split(' - ', 2)
+ output['global'][flag] = desc
+end
+
+File.readlines(LOCAL).each do |line|
+ next if line =~ /^(|#.*)$/
+
+ atom_flag, desc = line.strip.split(' - ', 2)
+ atom, flag = atom_flag.split(':', 2)
+ cat, pkg = atom.split('/', 2)
+
+ output['local'][cat] ||= {}
+ output['local'][cat][pkg] ||= {}
+ output['local'][cat][pkg][flag] = desc
+end
+
+puts output.to_json
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-03 9:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-03 9:42 [gentoo-commits] proj/api:master commit in: bin/, / Alex Legler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox