facter 1.6.13.rc1 → 1.6.13
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of facter might be problematic. Click here for more details.
- data/lib/facter/version.rb +1 -1
- metadata +20 -59
- data/ext/packaging/README-Solaris.md +0 -117
- data/ext/packaging/README.md +0 -89
- data/ext/packaging/tasks/00_utils.rb +0 -282
- data/ext/packaging/tasks/10_setupvars.rake +0 -63
- data/ext/packaging/tasks/apple.rake +0 -201
- data/ext/packaging/tasks/clean.rake +0 -5
- data/ext/packaging/tasks/deb.rake +0 -103
- data/ext/packaging/tasks/gem.rake +0 -52
- data/ext/packaging/tasks/ips.rake +0 -80
- data/ext/packaging/tasks/mock.rake +0 -88
- data/ext/packaging/tasks/release.rake +0 -54
- data/ext/packaging/tasks/rpm.rake +0 -39
- data/ext/packaging/tasks/ship.rake +0 -36
- data/ext/packaging/tasks/sign.rake +0 -78
- data/ext/packaging/tasks/tag.rake +0 -8
- data/ext/packaging/tasks/tar.rake +0 -20
- data/ext/packaging/tasks/version.rake +0 -20
data/lib/facter/version.rb
CHANGED
metadata
CHANGED
@@ -1,34 +1,23 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: facter
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 6
|
9
|
-
- 13
|
10
|
-
- rc
|
11
|
-
- 1
|
12
|
-
version: 1.6.13.rc1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.6.13
|
5
|
+
prerelease:
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Puppet Labs
|
16
9
|
autorequire:
|
17
10
|
bindir: bin
|
18
11
|
cert_chain: []
|
19
|
-
|
20
|
-
date: 2012-09-26 00:00:00 Z
|
12
|
+
date: 2012-10-04 00:00:00.000000000 Z
|
21
13
|
dependencies: []
|
22
|
-
|
23
14
|
description: You can prove anything with facts!
|
24
15
|
email: info@puppetlabs.com
|
25
|
-
executables:
|
16
|
+
executables:
|
26
17
|
- facter
|
27
18
|
extensions: []
|
28
|
-
|
29
19
|
extra_rdoc_files: []
|
30
|
-
|
31
|
-
files:
|
20
|
+
files:
|
32
21
|
- CONTRIBUTING.md
|
33
22
|
- Gemfile
|
34
23
|
- Gemfile.lock
|
@@ -56,23 +45,6 @@ files:
|
|
56
45
|
- ext/osx/PackageInfo.plist
|
57
46
|
- ext/osx/preflight.erb
|
58
47
|
- ext/osx/prototype.plist.erb
|
59
|
-
- ext/packaging/README-Solaris.md
|
60
|
-
- ext/packaging/README.md
|
61
|
-
- ext/packaging/tasks/00_utils.rb
|
62
|
-
- ext/packaging/tasks/10_setupvars.rake
|
63
|
-
- ext/packaging/tasks/apple.rake
|
64
|
-
- ext/packaging/tasks/clean.rake
|
65
|
-
- ext/packaging/tasks/deb.rake
|
66
|
-
- ext/packaging/tasks/gem.rake
|
67
|
-
- ext/packaging/tasks/ips.rake
|
68
|
-
- ext/packaging/tasks/mock.rake
|
69
|
-
- ext/packaging/tasks/release.rake
|
70
|
-
- ext/packaging/tasks/rpm.rake
|
71
|
-
- ext/packaging/tasks/ship.rake
|
72
|
-
- ext/packaging/tasks/sign.rake
|
73
|
-
- ext/packaging/tasks/tag.rake
|
74
|
-
- ext/packaging/tasks/tar.rake
|
75
|
-
- ext/packaging/tasks/version.rake
|
76
48
|
- ext/project_data.yaml
|
77
49
|
- ext/redhat/facter.spec.erb
|
78
50
|
- ext/solaris/pkginfo
|
@@ -300,40 +272,29 @@ files:
|
|
300
272
|
- spec/watchr.rb
|
301
273
|
homepage: https://github.com/puppetlabs/facter
|
302
274
|
licenses: []
|
303
|
-
|
304
275
|
post_install_message:
|
305
276
|
rdoc_options: []
|
306
|
-
|
307
|
-
require_paths:
|
277
|
+
require_paths:
|
308
278
|
- lib
|
309
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
279
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
310
280
|
none: false
|
311
|
-
requirements:
|
312
|
-
- -
|
313
|
-
- !ruby/object:Gem::Version
|
314
|
-
|
315
|
-
|
316
|
-
- 0
|
317
|
-
version: "0"
|
318
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
281
|
+
requirements:
|
282
|
+
- - ! '>='
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: '0'
|
285
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
319
286
|
none: false
|
320
|
-
requirements:
|
321
|
-
- -
|
322
|
-
- !ruby/object:Gem::Version
|
323
|
-
|
324
|
-
segments:
|
325
|
-
- 1
|
326
|
-
- 3
|
327
|
-
- 1
|
328
|
-
version: 1.3.1
|
287
|
+
requirements:
|
288
|
+
- - ! '>='
|
289
|
+
- !ruby/object:Gem::Version
|
290
|
+
version: '0'
|
329
291
|
requirements: []
|
330
|
-
|
331
292
|
rubyforge_project:
|
332
293
|
rubygems_version: 1.8.24
|
333
294
|
signing_key:
|
334
295
|
specification_version: 3
|
335
296
|
summary: Facter, a system inventory tool
|
336
|
-
test_files:
|
297
|
+
test_files:
|
337
298
|
- spec/fixtures/cpuinfo/amd64dual
|
338
299
|
- spec/fixtures/cpuinfo/amd64quad
|
339
300
|
- spec/fixtures/cpuinfo/amd64solo
|
@@ -1,117 +0,0 @@
|
|
1
|
-
## Create self signed certificate
|
2
|
-
|
3
|
-
- Generate the key pair
|
4
|
-
|
5
|
-
| keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
|
6
|
-
|
7
|
-
|
8
|
-
- Extract Certificate
|
9
|
-
|
10
|
-
| keytool -export -rfc -keystore keystore.jks -storepass password -alias selfsigned -file mycert.pem
|
11
|
-
|
12
|
-
- Extract Cert Key to PEM format
|
13
|
-
|
14
|
-
| keytool -importkeystore -srcstoretype JKS -srckeystore keystore.jks -deststoretype PKCS12 -destkeystore mykey.der
|
15
|
-
| openssl pkcs12 -in mykey.der -nodes -out mykey.pem
|
16
|
-
|
17
|
-
## For installation.
|
18
|
-
|
19
|
-
- Check the publishers
|
20
|
-
|
21
|
-
| pkg publisher
|
22
|
-
solaris origin online http://pkg.oracle.com/solaris/release/
|
23
|
-
|
24
|
-
- Add puppetlabs.com as a publisher
|
25
|
-
|
26
|
-
| pkg set-publisher -p http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net puppetlabs.com
|
27
|
-
|
28
|
-
- Check that we have it correct
|
29
|
-
|
30
|
-
| pkg publisher
|
31
|
-
solaris origin online http://pkg.oracle.com/solaris/release/
|
32
|
-
puppetlabs.com origin online http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
|
33
|
-
|
34
|
-
- Verify that puppetlabs.com was set correctly,
|
35
|
-
|
36
|
-
| pkg publisher puppetlabs.com
|
37
|
-
Publisher: puppetlabs.com
|
38
|
-
Alias:
|
39
|
-
Origin URI: http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
|
40
|
-
SSL Key: None
|
41
|
-
SSL Cert: None
|
42
|
-
Client UUID: 37084c4a-fdc6-11e1-832b-8800273bd610
|
43
|
-
Catalog Updated: September 13, 2012 08:31:25 PM
|
44
|
-
Enabled: Yes
|
45
|
-
Signature Policy: verify
|
46
|
-
|
47
|
-
- Try installing puppet
|
48
|
-
|
49
|
-
| pkg install puppet
|
50
|
-
Creating Plan |
|
51
|
-
pkg install: Chain was rooted in an untrusted self-signed certificate.
|
52
|
-
The package involved is:pkg://puppetlabs.com/system/management/puppet@3.0.0,5.11-6.192:20120913T212942Z
|
53
|
-
|
54
|
-
- We have two choices here, first, to ignore the signature policy for both publisher and image
|
55
|
-
|
56
|
-
| pkg set-publisher --set-property=signature-policy=ignore puppetlabs.com
|
57
|
-
| pkg publisher puppetlabs.com
|
58
|
-
Publisher: puppetlabs.com
|
59
|
-
Alias:
|
60
|
-
Origin URI: http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
|
61
|
-
SSL Key: None
|
62
|
-
SSL Cert: None
|
63
|
-
Client UUID: 140bb5c8-fe62-11e1-af70-8800273bd610
|
64
|
-
Catalog Updated: September 14, 2012 05:11:45 PM
|
65
|
-
Enabled: Yes
|
66
|
-
Signature Policy: ignore
|
67
|
-
| pkg set-property signature-policy ignore
|
68
|
-
| pkg install puppet
|
69
|
-
|
70
|
-
- Or trust the self signed certificate from puppetlabs.com (this certificate needs to be published in our web site)
|
71
|
-
|
72
|
-
| pkg set-publisher --approve-ca-cert /root/mycert.pem puppetlabs.com
|
73
|
-
|
74
|
-
- Verify that approve cert went well.
|
75
|
-
|
76
|
-
| pkg publisher puppetlabs.com
|
77
|
-
|
78
|
-
Publisher: puppetlabs.com
|
79
|
-
Alias:
|
80
|
-
Origin URI: http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
|
81
|
-
SSL Key: None
|
82
|
-
SSL Cert: None
|
83
|
-
Client UUID: 37084c4a-fdc6-11e1-832b-8800273bd610
|
84
|
-
Catalog Updated: September 13, 2012 08:31:25 PM
|
85
|
-
Approved CAs: 791b5791a81e9c2eb3fb9f84f4f86f8ea6fcd672
|
86
|
-
Enabled: Yes
|
87
|
-
Signature Policy: verify
|
88
|
-
|
89
|
-
| pkg install puppet
|
90
|
-
|
91
|
-
- Checking about information on the package (See the human readable version string)
|
92
|
-
|
93
|
-
| pkg info -r puppet
|
94
|
-
Name: system/management/puppet
|
95
|
-
Summary: Puppet, an automated configuration management tool
|
96
|
-
Description: Puppet, an automated configuration management tool
|
97
|
-
Category: System/Administration and Configuration
|
98
|
-
State: Not installed
|
99
|
-
Publisher: puppetlabs.com
|
100
|
-
Version: 3.0.0 (3.0.0-rc6)
|
101
|
-
Build Release: 5.11
|
102
|
-
Branch: 6.170
|
103
|
-
Packaging Date: September 14, 2012 06:11:05 PM
|
104
|
-
Size: 2.43 MB
|
105
|
-
FMRI: pkg://puppetlabs.com/system/management/puppet@3.0.0,5.11-6.170:20120914T181105Z
|
106
|
-
|
107
|
-
- Check license
|
108
|
-
|
109
|
-
| pkg info -r --license puppet
|
110
|
-
Puppet - Automating Configuration Management.
|
111
|
-
|
112
|
-
Copyright (C) 2005-2012 Puppet Labs Inc
|
113
|
-
|
114
|
-
|
115
|
-
- Reference
|
116
|
-
|
117
|
-
http://docs.oracle.com/cd/E19963-01/html/820-6572/managepkgs.html
|
data/ext/packaging/README.md
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
Packaging
|
2
|
-
|
3
|
-
This is a repository for packaging artifacts for Puppet Labs software.
|
4
|
-
The goal is to abstract and automate packaging processes beyond individual
|
5
|
-
software projects to a level where this repo can be cloned inside any
|
6
|
-
project and used to build Debian and Redhat packages.
|
7
|
-
|
8
|
-
It expects the following directory structure in the project
|
9
|
-
* ext/{debian,redhat,osx}
|
10
|
-
|
11
|
-
each of which contains templated erb files using the instance variables
|
12
|
-
specified in the setupvars task. These include a debian changelog, a
|
13
|
-
redhat spec file, and an osx preflight and plist.
|
14
|
-
|
15
|
-
The top level Rakefile in the project should have the following added:
|
16
|
-
```ruby
|
17
|
-
Dir['ext/packaging/tasks/**/*'].sort.each { |t| load t }
|
18
|
-
begin
|
19
|
-
@build_defaults ||= YAML.load_file('ext/build_defaults.yaml')
|
20
|
-
@packaging_url = @build_defaults['packaging_url']
|
21
|
-
@packaging_repo = @build_defaults['packaging_repo']
|
22
|
-
rescue
|
23
|
-
STDERR.puts "Unable to read the packaging repo from ext/build_defaults.yaml"
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
namespace :package do
|
28
|
-
desc "Bootstrap packaging automation, e.g. clone into packaging repo"
|
29
|
-
task :bootstrap do
|
30
|
-
cd 'ext' do
|
31
|
-
%x{git clone #{@packaging_url}}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
desc "Remove all cloned packaging automation"
|
36
|
-
task :implode do
|
37
|
-
rm_rf "ext/#{@packaging_repo}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
```
|
41
|
-
|
42
|
-
Also in ext should be two files, build_defaults.yaml and project_data.yaml.
|
43
|
-
|
44
|
-
This is the sample build_defaults.yaml file from Hiera:
|
45
|
-
```yaml
|
46
|
-
---
|
47
|
-
packaging_url: 'git@github.com:puppetlabs/packaging --branch=master'
|
48
|
-
packaging_repo: 'packaging'
|
49
|
-
default_cow: 'base-squeeze-i386.cow'
|
50
|
-
cows: 'base-lucid-amd64.cow base-lucid-i386.cow base-natty-amd64.cow base-natty-i386.cow base-oneiric-amd64.cow base-oneiric-i386.cow base-precise-amd64.cow base-precise-i386.cow base-sid-amd64.cow base-sid-i386.cow base-squeeze-amd64.cow base-squeeze-i386.cow base-testing-amd64.cow base-testing-i386.cow base-wheezy-i386.cow'
|
51
|
-
pbuild_conf: '/etc/pbuilderrc'
|
52
|
-
packager: 'puppetlabs'
|
53
|
-
gpg_name: 'info@puppetlabs.com'
|
54
|
-
gpg_key: '4BD6EC30'
|
55
|
-
sign_tar: FALSE
|
56
|
-
# a space separated list of mock configs
|
57
|
-
final_mocks: 'pl-5-i386 pl-5-x86_64 pl-6-i386 pl-6-x86_64 fedora-15-i386 fedora-15-x86_64 fedora-16-i386 fedora-16-x86_64 fedora-17-i386 fedora-17-x86_64'
|
58
|
-
rc_mocks: 'pl-5-i386-dev pl-5-x86_64-dev pl-6-i386-dev pl-6-x86_64-dev fedora-15-i386-dev fedora-15-x86_64-dev fedora-16-i386-dev fedora-16-x86_64-dev fedora-17-i386-dev fedora-17-x86_64-dev'
|
59
|
-
yum_host: 'burji.puppetlabs.com'
|
60
|
-
yum_repo_path: '~/repo/'
|
61
|
-
apt_host: 'burji.puppetlabs.com'
|
62
|
-
apt_repo_url: 'http://apt.puppetlabs.com'
|
63
|
-
apt_repo_path: '/opt/repository/incoming'
|
64
|
-
# Whether to present the gem and apple tasks
|
65
|
-
build_gem: TRUE
|
66
|
-
build_dmg: TRUE
|
67
|
-
```
|
68
|
-
This is the sample project_data.yaml file:
|
69
|
-
```yaml
|
70
|
-
---
|
71
|
-
project: 'hiera'
|
72
|
-
author: 'Puppet Labs'
|
73
|
-
email: 'info@puppetlabs.com'
|
74
|
-
homepage: 'https://github.com/puppetlabs/hiera'
|
75
|
-
summary: 'Light weight hierarchical data store'
|
76
|
-
description: 'A pluggable data store for hierarcical data'
|
77
|
-
version_file: '/lib/hiera.rb'
|
78
|
-
# files and gem_files are space separated lists
|
79
|
-
files: '[A-Z]* ext lib bin spec acceptance_tests'
|
80
|
-
gem_files: '{bin,lib}/**/* CHANGELOG COPYING README.md LICENSE'
|
81
|
-
gem_require_path: 'lib'
|
82
|
-
gem_test_files: 'spec/**/*'
|
83
|
-
gem_executables: 'hiera'
|
84
|
-
gem_default_executables: 'hiera'
|
85
|
-
# To add gem dependencies, indent.
|
86
|
-
# This is an example only, hiera doesn't really depend on hiera-puppet
|
87
|
-
gem_dependencies:
|
88
|
-
hiera-puppet: '1.0.0rc'
|
89
|
-
```
|
@@ -1,282 +0,0 @@
|
|
1
|
-
# Utility methods used by the various rake tasks
|
2
|
-
|
3
|
-
def check_tool(tool)
|
4
|
-
%x{which #{tool}}
|
5
|
-
unless $?.success?
|
6
|
-
STDERR.puts "#{tool} tool not found...exiting"
|
7
|
-
exit 1
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def find_tool(tool)
|
12
|
-
location = %x{which #{tool}}.chomp
|
13
|
-
location if $?.success?
|
14
|
-
end
|
15
|
-
|
16
|
-
def check_file(file)
|
17
|
-
unless File.exist?(file)
|
18
|
-
STDERR.puts "#{file} file not found...exiting"
|
19
|
-
exit 2
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def check_var(varname,var=nil)
|
24
|
-
if var.nil?
|
25
|
-
STDERR.puts "Requires #{varname} be set...exiting"
|
26
|
-
exit 3
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def check_host(host)
|
31
|
-
unless host == %x{hostname}.chomp!
|
32
|
-
STDERR.puts "Requires host to be #{host}...exiting"
|
33
|
-
exit 5
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def erb(erbfile, outfile)
|
38
|
-
template = File.read(erbfile)
|
39
|
-
message = ERB.new(template, nil, "-")
|
40
|
-
output = message.result(binding)
|
41
|
-
File.open(outfile, 'w') { |f| f.write output }
|
42
|
-
puts "Generated: #{outfile}"
|
43
|
-
end
|
44
|
-
|
45
|
-
def cp_pr(src, dest, options={})
|
46
|
-
mandatory = {:preserve => true}
|
47
|
-
cp_r(src, dest, options.merge(mandatory))
|
48
|
-
end
|
49
|
-
|
50
|
-
def cp_p(src, dest, options={})
|
51
|
-
mandatory = {:preserve => true}
|
52
|
-
cp(src, dest, options.merge(mandatory))
|
53
|
-
end
|
54
|
-
|
55
|
-
def mv_f(src, dest, options={})
|
56
|
-
force = {:force => true}
|
57
|
-
mv(src, dest, options.merge(mandatory))
|
58
|
-
end
|
59
|
-
|
60
|
-
def git_co(dist)
|
61
|
-
%x{git reset --hard ; git checkout #{dist}}
|
62
|
-
unless $?.success?
|
63
|
-
STDERR.puts 'Could not checkout #{dist} git branch to build package from...exiting'
|
64
|
-
exit 1
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def get_temp
|
69
|
-
temp = `mktemp -d -t tmpXXXXXX`.strip
|
70
|
-
end
|
71
|
-
|
72
|
-
def remote_ssh_cmd target, command
|
73
|
-
check_tool('ssh')
|
74
|
-
puts "Executing '#{command}' on #{target}"
|
75
|
-
%x{ssh #{target} '#{command}'}
|
76
|
-
end
|
77
|
-
|
78
|
-
def rsync_to *args
|
79
|
-
check_tool('rsync')
|
80
|
-
flags = "-Havxl -O --no-perms --no-owner --no-group"
|
81
|
-
source = args[0]
|
82
|
-
target = args[1]
|
83
|
-
dest = args[2]
|
84
|
-
puts "rsyncing #{source} to #{target}"
|
85
|
-
%x{rsync #{flags} #{source} #{ENV['USER']}@#{target}:#{dest}}
|
86
|
-
end
|
87
|
-
|
88
|
-
def scp_file_from(host,path,file)
|
89
|
-
%x{scp #{ENV['USER']}@#{host}:#{path}/#{file} #{@tempdir}/#{file}}
|
90
|
-
end
|
91
|
-
|
92
|
-
def scp_file_to(host,path,file)
|
93
|
-
%x{scp #{@tempdir}/#{file} #{ENV['USER']}@#{host}:#{path}}
|
94
|
-
end
|
95
|
-
|
96
|
-
def timestamp
|
97
|
-
Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
98
|
-
end
|
99
|
-
|
100
|
-
def get_dash_version
|
101
|
-
if File.exists?('.git')
|
102
|
-
%x{git describe}.chomp.split('-')[0..1].join('-').gsub('v','')
|
103
|
-
else
|
104
|
-
get_pwd_version
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def get_ips_version
|
109
|
-
if File.exists?('.git')
|
110
|
-
desc = %x{git describe}.chomp.split(/[.-]/)
|
111
|
-
commits = %x{git log --oneline --no-merges | wc -l}.chomp.strip
|
112
|
-
osrelease = %x{uname -r}.chomp
|
113
|
-
"%s.%s.%s,#{osrelease}-%s" % [ desc[0],desc[1], desc[2], commits]
|
114
|
-
else
|
115
|
-
get_pwd_version
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def get_dot_version
|
120
|
-
if File.exists?('.git')
|
121
|
-
%x{git describe}.chomp.gsub('-', '.').split('.')[0..3].join('.').gsub('v', '')
|
122
|
-
else
|
123
|
-
get_pwd_version
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def get_pwd_version
|
128
|
-
%x{pwd}.strip.split('.')[-1]
|
129
|
-
end
|
130
|
-
|
131
|
-
def get_debversion
|
132
|
-
(@version.include?("rc") ? @version.sub(/rc[0-9]+/, '0.1\0') : "#{@version.gsub('-','.')}-1") + "#{@packager}#{get_debrelease}"
|
133
|
-
end
|
134
|
-
|
135
|
-
def get_origversion
|
136
|
-
@debversion.split('-')[0]
|
137
|
-
end
|
138
|
-
|
139
|
-
def get_rpmversion
|
140
|
-
@version.match(/^([0-9.]+)/)[1]
|
141
|
-
end
|
142
|
-
|
143
|
-
def get_version_file_version
|
144
|
-
# Match version files containing 'VERSION = "x.x.x"' and just x.x.x
|
145
|
-
contents = IO.read(@version_file)
|
146
|
-
if version_string = contents.match(/VERSION =.*/)
|
147
|
-
version_string.to_s.split()[-1]
|
148
|
-
else
|
149
|
-
contents
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
def get_debrelease
|
154
|
-
ENV['RELEASE'] || '1'
|
155
|
-
end
|
156
|
-
|
157
|
-
def get_rpmrelease
|
158
|
-
ENV['RELEASE'] ||
|
159
|
-
if @version.include?("rc")
|
160
|
-
"0.1" + @version.gsub('-', '_').match(/rc[0-9]+.*/)[0]
|
161
|
-
else
|
162
|
-
"1"
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
def restart_keychain
|
167
|
-
kill_keychain
|
168
|
-
start_keychain
|
169
|
-
end
|
170
|
-
|
171
|
-
def kill_keychain
|
172
|
-
%x{keychain -k mine}
|
173
|
-
end
|
174
|
-
|
175
|
-
def start_keychain
|
176
|
-
keychain = %x{/usr/bin/keychain -q --agents gpg --eval #{@gpg_key}}.chomp
|
177
|
-
new_env = keychain.match(/(GPG_AGENT_INFO)=([^;]*)/)
|
178
|
-
ENV[new_env[1]] = new_env[2]
|
179
|
-
end
|
180
|
-
|
181
|
-
def gpg_sign_file(file)
|
182
|
-
gpg ||= find_tool('gpg')
|
183
|
-
|
184
|
-
if gpg
|
185
|
-
sh "#{gpg} --armor --detach-sign -u #{@gpg_key} #{file}"
|
186
|
-
else
|
187
|
-
STDERR.puts "No gpg available. Cannot sign tarball. Exiting..."
|
188
|
-
exit 1
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
def mkdir_pr *args
|
193
|
-
args.each do |arg|
|
194
|
-
mkdir_p arg
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
def set_cow_envs(cow)
|
199
|
-
elements = cow.split('-')
|
200
|
-
if elements.size != 3
|
201
|
-
STDERR.puts "Expecting a cow name split on hyphens, e.g. 'base-squeeze-i386'"
|
202
|
-
exit 1
|
203
|
-
else
|
204
|
-
dist = elements[1]
|
205
|
-
arch = elements[2]
|
206
|
-
if dist.nil? or arch.nil?
|
207
|
-
STDERR.puts "Couldn't get the arg and dist from cow name. Expecting something like 'base-dist-arch'"
|
208
|
-
exit 1
|
209
|
-
end
|
210
|
-
arch = arch.split('.')[0] if arch.include?('.')
|
211
|
-
end
|
212
|
-
|
213
|
-
ENV['DIST'] = dist
|
214
|
-
ENV['ARCH'] = arch
|
215
|
-
end
|
216
|
-
|
217
|
-
def ln(target, name)
|
218
|
-
%x{ln -f #{target} #{name}}
|
219
|
-
end
|
220
|
-
|
221
|
-
def git_commit_file(file)
|
222
|
-
%x{which git &> /dev/null}
|
223
|
-
if $?.success? and File.exist?('.git')
|
224
|
-
%x{git commit #{file} -m "Commit changes to #{file}" &> /dev/null}
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
def ship_gem(file)
|
229
|
-
%x{gem push #{file}}
|
230
|
-
end
|
231
|
-
|
232
|
-
def x(v)
|
233
|
-
puts %[#{v}]
|
234
|
-
print %x[#{v}]
|
235
|
-
end
|
236
|
-
|
237
|
-
def ask_yes_or_no
|
238
|
-
answer = STDIN.gets.downcase.chomp
|
239
|
-
return TRUE if answer =~ /^y$|^yes$/
|
240
|
-
return FALSE if answer =~ /^n$|^no$/
|
241
|
-
puts "Nope, try something like yes or no or y or n, etc:"
|
242
|
-
ask_yes_or_no
|
243
|
-
end
|
244
|
-
|
245
|
-
def handle_method_failure(method, args)
|
246
|
-
STDERR.puts "There was an error running the method #{method} with the arguments:"
|
247
|
-
args.each { |param, arg| STDERR.puts "\t#{param} => #{arg}\n" }
|
248
|
-
STDERR.puts "The rake session is paused. Would you like to retry #{method} with these args and continue where you left off? [y,n]"
|
249
|
-
if ask_yes_or_no
|
250
|
-
send(method, args)
|
251
|
-
else
|
252
|
-
exit 1
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
def invoke_task(task, args=nil)
|
257
|
-
Rake::Task[task].reenable
|
258
|
-
Rake::Task[task].invoke(args)
|
259
|
-
end
|
260
|
-
|
261
|
-
def confirm_ship(files)
|
262
|
-
STDOUT.puts "The following files have been built and are ready to ship:"
|
263
|
-
files.each { |file| STDOUT.puts "\t#{file}\n" }
|
264
|
-
STDOUT.puts "Ship these files??"
|
265
|
-
ask_yes_or_no
|
266
|
-
end
|
267
|
-
|
268
|
-
def boolean_value(var)
|
269
|
-
return TRUE if (var == TRUE || ( var.is_a?(String) && var.downcase == 'true' ))
|
270
|
-
FALSE
|
271
|
-
end
|
272
|
-
|
273
|
-
def git_tag(version)
|
274
|
-
begin
|
275
|
-
sh "git tag -s -u #{@gpg_key} -m '#{version}' #{version}"
|
276
|
-
rescue Exception => e
|
277
|
-
STDERR.puts e
|
278
|
-
STDERR.puts "Unable to tag repo at #{version}"
|
279
|
-
exit 1
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|