royw-qt-rebuild 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.rdoc +54 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/bin/qt-rebuild +8 -0
- data/lib/qt-rebuild.rb +9 -0
- data/lib/qt-rebuild/cli.rb +88 -0
- data/lib/qt-rebuild/exit_codes.rb +9 -0
- data/lib/qt-rebuild/qt-rebuild.rb +83 -0
- data/qt-rebuild.gemspec +52 -0
- data/spec/qt-rebuild_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -0
- metadata +68 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Roy Wright
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
= qt-rebuild
|
2
|
+
|
3
|
+
This is a utility for gentoo (http://gentoo.org) linux.
|
4
|
+
|
5
|
+
When QT is upgraded, you may have to rebuild any QT plugins. This utility
|
6
|
+
attempts to find and rebuild packages with QT plugins.
|
7
|
+
|
8
|
+
Here's the discussion thread:
|
9
|
+
http://archives.gentoo.org/gentoo-user/msg_d9357c6f26dec67492b794f8f66db29d.xml
|
10
|
+
|
11
|
+
== Installation
|
12
|
+
|
13
|
+
$ emerge ruby rubygems
|
14
|
+
$ sudo gem install royw-qt-rebuild --source http://gems.github.com
|
15
|
+
|
16
|
+
== Usage
|
17
|
+
|
18
|
+
$ qt-rebuild -h
|
19
|
+
OPTIONS
|
20
|
+
|
21
|
+
--version,-v
|
22
|
+
This version of qt-rebuild
|
23
|
+
|
24
|
+
--help,-h
|
25
|
+
Print usage.
|
26
|
+
|
27
|
+
--quiet,-q
|
28
|
+
Display error messages only.
|
29
|
+
|
30
|
+
--debug,-d
|
31
|
+
Display debug messages.
|
32
|
+
|
33
|
+
--set,-s
|
34
|
+
Output in portage's set format.
|
35
|
+
|
36
|
+
--nocolor,-C
|
37
|
+
Turn off colored output. (This option is also passed to
|
38
|
+
portage.)
|
39
|
+
|
40
|
+
--pretend,-p
|
41
|
+
Do a dry-run.
|
42
|
+
|
43
|
+
It is recommended to do a dry run first:
|
44
|
+
|
45
|
+
$ qt-rebuild -p
|
46
|
+
|
47
|
+
To create a set file:
|
48
|
+
|
49
|
+
$ qt-rebuild -s -p > /etc/portage/sets/qt-rebuild
|
50
|
+
|
51
|
+
|
52
|
+
== Copyright
|
53
|
+
|
54
|
+
Copyright (c) 2009 Roy Wright. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "qt-rebuild"
|
8
|
+
gem.summary = " This utility attempts to find and rebuild packages with QT plugins on gentoo linux."
|
9
|
+
gem.email = "roy@wright.org"
|
10
|
+
gem.homepage = "http://github.com/royw/qt-rebuild"
|
11
|
+
gem.authors = ["Roy Wright"]
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
|
+
end
|
14
|
+
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'spec/rake/spectask'
|
20
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
21
|
+
spec.libs << 'lib' << 'spec'
|
22
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
23
|
+
end
|
24
|
+
|
25
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
26
|
+
spec.libs << 'lib' << 'spec'
|
27
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
28
|
+
spec.rcov = true
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
task :default => :spec
|
33
|
+
|
34
|
+
require 'rake/rdoctask'
|
35
|
+
Rake::RDocTask.new do |rdoc|
|
36
|
+
if File.exist?('VERSION.yml')
|
37
|
+
config = YAML.load(File.read('VERSION.yml'))
|
38
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
39
|
+
else
|
40
|
+
version = ""
|
41
|
+
end
|
42
|
+
|
43
|
+
rdoc.rdoc_dir = 'rdoc'
|
44
|
+
rdoc.title = "qt-rebuild #{version}"
|
45
|
+
rdoc.rdoc_files.include('README*')
|
46
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
47
|
+
end
|
48
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.3
|
data/bin/qt-rebuild
ADDED
data/lib/qt-rebuild.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'commandline/optionparser'
|
2
|
+
|
3
|
+
# == Synopsis
|
4
|
+
# The Command Line Interface
|
5
|
+
class CLI
|
6
|
+
|
7
|
+
# == Synopsis
|
8
|
+
# Here's the main execution loop
|
9
|
+
def self.execute(stdout, arguments=[])
|
10
|
+
exit_code = ExitCode::OK
|
11
|
+
|
12
|
+
begin
|
13
|
+
# parse the command line
|
14
|
+
options = setup_parser()
|
15
|
+
od = options.parse(arguments)
|
16
|
+
|
17
|
+
skip_execution = false
|
18
|
+
%w(--help --version).each {|flag| skip_execution = true if od[flag] }
|
19
|
+
unless skip_execution
|
20
|
+
# create and execute class instance here
|
21
|
+
app = QtRebuild.new()
|
22
|
+
app.scan
|
23
|
+
if od["--set"]
|
24
|
+
puts app.to_set.join("\n")
|
25
|
+
elsif !od["--quiet"]
|
26
|
+
puts app.to_s
|
27
|
+
end
|
28
|
+
app.emerge(od["--pretend"], od['--nocolor'])
|
29
|
+
end
|
30
|
+
rescue ArgumentError => argErr
|
31
|
+
STDERR.puts argErr.to_s
|
32
|
+
STDERR.puts options.to_s
|
33
|
+
STDERR.puts argErr.backtrace.join("\n")
|
34
|
+
exit_code = ExitCode::CRITICAL
|
35
|
+
rescue Exception => eMsg
|
36
|
+
STDERR.puts eMsg.to_s
|
37
|
+
STDERR.puts options.to_s
|
38
|
+
STDERR.puts eMsg.backtrace.join("\n")
|
39
|
+
exit_code = ExitCode::CRITICAL
|
40
|
+
end
|
41
|
+
exit_code
|
42
|
+
end
|
43
|
+
|
44
|
+
# == Synopsis
|
45
|
+
# Setup the command line option parser
|
46
|
+
# Returns:: OptionParser instances
|
47
|
+
def self.setup_parser()
|
48
|
+
options = CommandLine::OptionParser.new()
|
49
|
+
|
50
|
+
# flag options
|
51
|
+
[
|
52
|
+
{
|
53
|
+
:names => %w(--version -v),
|
54
|
+
:opt_found => lambda {puts QtRebuild.version; true },
|
55
|
+
:opt_description => "This version of qt-rebuild"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
:names => %w(--help -h),
|
59
|
+
:opt_found => lambda {puts options.to_s; true},
|
60
|
+
:opt_description => "Print usage."
|
61
|
+
},
|
62
|
+
{
|
63
|
+
:names => %w(--quiet -q),
|
64
|
+
:opt_description => 'Display error messages only.'
|
65
|
+
},
|
66
|
+
{
|
67
|
+
:names => %w(--debug -d),
|
68
|
+
:opt_description => 'Display debug messages.'
|
69
|
+
},
|
70
|
+
{
|
71
|
+
:names => %w(--set -s),
|
72
|
+
:opt_description => "Output in portage's set format."
|
73
|
+
},
|
74
|
+
{
|
75
|
+
:names => %w(--nocolor -C),
|
76
|
+
:opt_description => "Turn off colored output. (This option is also passed to portage.)"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
:names => %w(--pretend -p),
|
80
|
+
:opt_description => "Do a dry-run."
|
81
|
+
},
|
82
|
+
].each { |opt| options << CommandLine::Option.new(:flag, opt) }
|
83
|
+
|
84
|
+
options
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
class QtRebuild
|
4
|
+
attr_reader :pkgs_to_build_keys, :build_keys_to_pkgs
|
5
|
+
|
6
|
+
def self.version
|
7
|
+
IO.read(File.join(File.dirname(__FILE__), '../../VERSION')).strip
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@pkgs_to_build_keys = {}
|
12
|
+
@build_keys_to_pkgs = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
# scan the installed packages looking for qt dependents that
|
16
|
+
# have build keys. These are the files than should be rebuilt
|
17
|
+
# whenever qt's API changes.
|
18
|
+
def scan
|
19
|
+
qt_packages = `qlist -IC x11-libs/qt:4`.split("\n")
|
20
|
+
|
21
|
+
dependents = []
|
22
|
+
qt_packages.each do |pkg|
|
23
|
+
dependents += `equery -q depends \"#{pkg}\"`.split("\n")
|
24
|
+
end
|
25
|
+
dependents = dependents.uniq.compact.sort
|
26
|
+
|
27
|
+
dependents.each do |pkg|
|
28
|
+
build_keys = []
|
29
|
+
so_files = `qlist -Co #{pkg}`.split("\n").select{|file| file =~ /\.so(\..+|)$/}
|
30
|
+
so_files.each do |file|
|
31
|
+
if `strings #{file} | grep buildkey` =~ /^build\s*key[=:\s]\s*(\S.*)\s*$/i
|
32
|
+
build_keys << $1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
build_keys = build_keys.compact.uniq
|
36
|
+
unless build_keys.empty?
|
37
|
+
@pkgs_to_build_keys[pkg] = build_keys
|
38
|
+
build_keys.each do |key|
|
39
|
+
@build_keys_to_pkgs[key] ||= []
|
40
|
+
@build_keys_to_pkgs[key] << pkg
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_set
|
47
|
+
buf = []
|
48
|
+
@build_keys_to_pkgs.keys.sort.each do |key|
|
49
|
+
pkgs = @build_keys_to_pkgs[key]
|
50
|
+
pkgs.each do |pkg|
|
51
|
+
buf << '=' + pkg
|
52
|
+
end
|
53
|
+
end
|
54
|
+
buf.compact.uniq
|
55
|
+
end
|
56
|
+
|
57
|
+
def emerge(pretend, nocolor)
|
58
|
+
buf = []
|
59
|
+
buf << 'emerge'
|
60
|
+
buf << '--oneshot'
|
61
|
+
buf << '--pretend' if pretend
|
62
|
+
buf << '--nocolor' if nocolor
|
63
|
+
buf += to_set
|
64
|
+
puts `#{buf.join(' ')}`
|
65
|
+
end
|
66
|
+
|
67
|
+
def to_s
|
68
|
+
buf = []
|
69
|
+
@build_keys_to_pkgs.keys.sort.each do |key|
|
70
|
+
buf << "# Build key: #{key}"
|
71
|
+
pkgs = @build_keys_to_pkgs[key]
|
72
|
+
pkgs.each do |pkg|
|
73
|
+
buf << pkg
|
74
|
+
end
|
75
|
+
end
|
76
|
+
buf.compact.uniq.sort.join("\n")
|
77
|
+
end
|
78
|
+
|
79
|
+
def build_keys
|
80
|
+
@build_keys_to_pkgs.keys
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
data/qt-rebuild.gemspec
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{qt-rebuild}
|
5
|
+
s.version = "0.1.3"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Roy Wright"]
|
9
|
+
s.date = %q{2009-06-30}
|
10
|
+
s.default_executable = %q{qt-rebuild}
|
11
|
+
s.email = %q{roy@wright.org}
|
12
|
+
s.executables = ["qt-rebuild"]
|
13
|
+
s.extra_rdoc_files = [
|
14
|
+
"LICENSE",
|
15
|
+
"README.rdoc"
|
16
|
+
]
|
17
|
+
s.files = [
|
18
|
+
".document",
|
19
|
+
".gitignore",
|
20
|
+
"LICENSE",
|
21
|
+
"README.rdoc",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"bin/qt-rebuild",
|
25
|
+
"lib/qt-rebuild.rb",
|
26
|
+
"lib/qt-rebuild/cli.rb",
|
27
|
+
"lib/qt-rebuild/exit_codes.rb",
|
28
|
+
"lib/qt-rebuild/qt-rebuild.rb",
|
29
|
+
"qt-rebuild.gemspec",
|
30
|
+
"spec/qt-rebuild_spec.rb",
|
31
|
+
"spec/spec_helper.rb"
|
32
|
+
]
|
33
|
+
s.homepage = %q{http://github.com/royw/qt-rebuild}
|
34
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.3.3}
|
37
|
+
s.summary = %q{This utility attempts to find and rebuild packages with QT plugins on gentoo linux.}
|
38
|
+
s.test_files = [
|
39
|
+
"spec/spec_helper.rb",
|
40
|
+
"spec/qt-rebuild_spec.rb"
|
41
|
+
]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
48
|
+
else
|
49
|
+
end
|
50
|
+
else
|
51
|
+
end
|
52
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: royw-qt-rebuild
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roy Wright
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-30 00:00:00 -07:00
|
13
|
+
default_executable: qt-rebuild
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: roy@wright.org
|
18
|
+
executables:
|
19
|
+
- qt-rebuild
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- LICENSE
|
29
|
+
- README.rdoc
|
30
|
+
- Rakefile
|
31
|
+
- VERSION
|
32
|
+
- bin/qt-rebuild
|
33
|
+
- lib/qt-rebuild.rb
|
34
|
+
- lib/qt-rebuild/cli.rb
|
35
|
+
- lib/qt-rebuild/exit_codes.rb
|
36
|
+
- lib/qt-rebuild/qt-rebuild.rb
|
37
|
+
- qt-rebuild.gemspec
|
38
|
+
- spec/qt-rebuild_spec.rb
|
39
|
+
- spec/spec_helper.rb
|
40
|
+
has_rdoc: false
|
41
|
+
homepage: http://github.com/royw/qt-rebuild
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options:
|
44
|
+
- --charset=UTF-8
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: "0"
|
52
|
+
version:
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
version:
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.2.0
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: This utility attempts to find and rebuild packages with QT plugins on gentoo linux.
|
66
|
+
test_files:
|
67
|
+
- spec/spec_helper.rb
|
68
|
+
- spec/qt-rebuild_spec.rb
|