simp-metadata 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bec880fc1d3eb1dbeeeca61855155cf4000d9b5a381cb2cb76c77d6585fb3bd
4
- data.tar.gz: 4e5536c319838d8fc3eeef7a7be23a46c0d55568d8f5b24e4831214d0a148ee5
3
+ metadata.gz: 1c26b66ce33c640c85459dca30dbf959aac04cfaef12e643b9af387f014ea96d
4
+ data.tar.gz: fb8e5ebfd80322c61ac0743338bb45a0dcaffdbb36c647e7b147be485b116239
5
5
  SHA512:
6
- metadata.gz: 938e43f4ad4718f87ae86b123eb0406cced1a6432c51baf1accbf2996a4594f2261f813109dfa88fbf770a1947aa153dbbe7c49b7c8060817db360d2fcc4f923
7
- data.tar.gz: 8489605639a7e0e828c44b31bf591777b7051cf1772a322f402a586426df62c3b7d536b0e3df821f189c2a337f6aacc74acc00a7b9f58ffc199987bea8704f76
6
+ metadata.gz: ea96c778fac89114e4a5f4efefe15f40324f4433e53a1c01b0448a7f59cdc86a93f70a430e1a49018e038cb6cbae647dd5c25b4a41e44a7f269b12cd9c702b3d
7
+ data.tar.gz: 84b346be679cc9a48babbe3dd2546d3a48050acb17e1b005e339f8815d34f3df05eb3f45f84741d7f1490876164dac75caff12b76f15429108571996b6d4e690
data/Rakefile CHANGED
@@ -64,3 +64,50 @@ begin
64
64
  end
65
65
  rescue LoadError
66
66
  end
67
+ task :update_version, [:version] do |task, args|
68
+ require 'erb'
69
+ gem_version = args[:version]
70
+ renderer = ERB.new(File.read('lib/simp/metadata/version.erb'))
71
+ res = renderer.result(binding)
72
+ File.open("lib/simp/metadata/version.rb", "w+") do |f|
73
+ f.write(res)
74
+ end
75
+ end
76
+
77
+ task :prerelease, [:version] do |task, args|
78
+ Rake::Task["update_version"].invoke(args[:version])
79
+ end
80
+
81
+ namespace :release do
82
+ desc "Build a Release"
83
+ task :build, [:version] do |task, args|
84
+ branch=`git rev-parse --abbrev-ref HEAD`.chomp
85
+ version = args[:version]
86
+ if (branch != "develop")
87
+ puts "CRITICAL: releases must be made off of develop"
88
+ else
89
+ puts `git fetch origin`
90
+ messagelog = []
91
+ messagelog << "Release #{version}"
92
+ messagelog << ""
93
+ `git log --pretty="%s" origin/master...develop`.gsub("'", "\"").chomp.split("\n").each { |l| messagelog << l }
94
+ releasemessage = messagelog.join("\n")
95
+ puts `git pull origin`
96
+ puts `git checkout master`
97
+ puts `git pull origin`
98
+ puts `git merge -m '#{releasemessage}' --no-ff develop`
99
+ Rake::Task["prerelease"].invoke(version)
100
+ puts `git add -A`
101
+ puts `git commit --amend -m '#{releasemessage}'`
102
+ puts `git tag -s -m 'Release #{version}' #{version}`
103
+ puts `git checkout develop`
104
+ puts `git merge master`
105
+ end
106
+ end
107
+ task :push do
108
+ puts `git push origin --tags`
109
+ puts `git push origin develop:develop`
110
+ puts `git push origin master:master`
111
+ end
112
+ end
113
+
@@ -76,7 +76,11 @@ module Simp
76
76
  else
77
77
  urlspec = component.primary
78
78
  end
79
- fetch_from_url(urlspec, retval['path'], component, options)
79
+ if component.method == 'file'
80
+ FileUtils.cp_r component.url, directory_name
81
+ else
82
+ fetch_from_url(urlspec, retval['path'], component, options)
83
+ end
80
84
  else
81
85
  raise "component.class=#{component.class}, #{component.class} is not in ['String', 'Simp::Metadata::Component']"
82
86
  end
@@ -57,7 +57,7 @@ module Simp
57
57
  opts.on('-p', '--platform [platform]', 'el_version to use', 'valid platforms:', ' - el6', ' - el7') do |opt|
58
58
  options['platform'] = opt
59
59
  end
60
- yield(opts) if block_given?
60
+ yield(opts,options) if block_given?
61
61
  end
62
62
  option_parser.parse!(argv)
63
63
  options
@@ -4,7 +4,7 @@ module Simp
4
4
  module Commands
5
5
  class Clone < Simp::Metadata::Commands::Base
6
6
  def run(argv, engine = nil)
7
- options = defaults(argv) do |opts|
7
+ options = defaults(argv) do |opts,options|
8
8
  opts.banner = 'Usage: simp-metadata clone <source_release> <target_release>'
9
9
  end
10
10
 
@@ -8,18 +8,18 @@ module Simp
8
8
 
9
9
  case subcommand
10
10
  when '--help', '-h'
11
- options = defaults(argv) do |opts|
11
+ options = defaults(argv) do |opts,options|
12
12
  opts.banner = 'Usage: simp-metadata component [ view | diff | download | build | update | create ]'
13
13
  end
14
14
 
15
15
  when 'create'
16
- options = defaults(argv) do |opts|
16
+ options = defaults(argv) do |opts,options|
17
17
  opts.banner = 'Usage: simp-metadata component create <component_name> name=<value>'
18
18
  end
19
19
  engine, root = get_engine(engine, options)
20
20
  component = argv[1]
21
21
  argv.shift
22
- data = { 'locations' => [{ 'primary' => true }] }
22
+ data = {'locations' => [{'primary' => true}]}
23
23
  argv.each do |argument|
24
24
  splitted = argument.split('=')
25
25
  name = splitted[0]
@@ -40,7 +40,7 @@ module Simp
40
40
  engine.components.create(component, data)
41
41
 
42
42
  when 'update'
43
- options = defaults(argv) do |opts|
43
+ options = defaults(argv) do |opts,options|
44
44
  opts.banner = 'Usage: simp-metadata component update <component> <setting> <value>'
45
45
  end
46
46
  engine, root = get_engine(engine, options)
@@ -59,8 +59,32 @@ module Simp
59
59
  exit 6
60
60
  end
61
61
 
62
+ when 'find_release'
63
+ options = defaults(argv) do |opts, options|
64
+ opts.banner = "Usage: simp-metadata component find_release <component> <attribute> <value>\n"
65
+ opts.banner << " Output releases where specified components <attribute> matches <value>"
66
+ opts.on('-s', '--show-all', 'Shows all release matches, including unstable and nightlies') do |show_all|
67
+ options['show_all'] = show_all
68
+ end
69
+ end
70
+ engine, root = get_engine(engine, options)
71
+ component = argv[1]
72
+ attribute = argv[2]
73
+ value = argv[3]
74
+
75
+ releases = engine.releases.keys - ['test-stub','test-diff','test-nightly-2018-02-08','5.1.0-2','5.1.0-1','5.1.0-0','4.2.0-0','5.1.0-RC1','5.1.0-Beta','4.2.0-RC1','4.2.0-Beta2']
76
+ matches = releases.select{ |release| puts "true" if engine.releases[release].components[component].version?; engine.releases[release].components[component][attribute] == value}
77
+ if options['show_all']
78
+ output = matches
79
+ else
80
+ delete = ['unstable']
81
+ matches.each{ |match| delete.push(match) if match =~ /nightly-/ }
82
+ output = matches - delete
83
+ end
84
+ puts output
85
+
62
86
  when 'view'
63
- options = defaults(argv) do |opts|
87
+ options = defaults(argv) do |opts,options|
64
88
  opts.banner = 'Usage: simp-metadata component view <component> [attribute]'
65
89
  end
66
90
  engine, root = get_engine(engine, options)
@@ -80,7 +104,7 @@ module Simp
80
104
  end
81
105
 
82
106
  when 'diff'
83
- options = defaults(argv) do |opts|
107
+ options = defaults(argv) do |opts,options|
84
108
  opts.banner = 'Usage: simp-metadata component diff <release1> <release2> <component> [attribute]'
85
109
  end
86
110
  engine, root = get_engine(engine, options)
@@ -94,13 +118,20 @@ module Simp
94
118
  puts diff.to_yaml
95
119
 
96
120
  when 'download'
97
- options = defaults(argv) do |opts|
98
- opts.banner = 'Usage: simp-metadata component download -v <version> <component> [destination] [source]'
121
+ options = defaults(argv) do |opts,options|
122
+ opts.banner = 'Usage: simp-metadata component download [-v <version>] [-d <destination>] [-s <source>] <component>'
123
+ options['source'] = []
124
+ opts.on('-s', '--source [path/url]', 'URL or path to grab RPMs from (can be passed more than once)') do |opt|
125
+ options['source'] << opt
126
+ end
127
+ opts.on('-d', '--destination [path]', 'folder to build RPMs in') do |opt|
128
+ options['destination'] = opt
129
+ end
99
130
  end
100
131
  engine, root = get_engine(engine, options)
101
132
  component = argv[1]
102
- destination = argv[2]
103
- source = argv[3]
133
+ destination = options['destination']
134
+ source = options['source']
104
135
  if engine.components.key?(component)
105
136
  if options['release'].nil?
106
137
  comp = engine.components[component]
@@ -114,12 +145,15 @@ module Simp
114
145
  end
115
146
 
116
147
  when 'build'
117
- options = defaults(argv) do |opts|
118
- opts.banner = 'Usage: simp-metadata component build <component> [destination]'
148
+ options = defaults(argv) do |opts,options|
149
+ opts.banner = 'Usage: simp-metadata component build [-v <version>] [-d <destination>] [-s <source>] <component>'
150
+ opts.on('-d', '--destination [path]', 'folder to build RPMs in') do |opt|
151
+ options['destination'] = opt
152
+ end
119
153
  end
120
154
  engine, root = get_engine(engine, options)
121
155
  component = argv[1]
122
- destination = argv[2]
156
+ destination = options['destination']
123
157
  if engine.components.key?(component)
124
158
  if options['release'].nil?
125
159
  comp = engine.components[component]
@@ -4,7 +4,7 @@ module Simp
4
4
  module Commands
5
5
  class Delete < Simp::Metadata::Commands::Base
6
6
  def run(argv, engine = nil)
7
- options = defaults(argv) do |opts|
7
+ options = defaults(argv) do |opts,options|
8
8
  opts.banner = 'Usage: simp-metadata delete <component_name>'
9
9
  end
10
10
 
@@ -4,7 +4,7 @@ module Simp
4
4
  module Commands
5
5
  class Pry < Simp::Metadata::Commands::Base
6
6
  def run(argv, engine = nil)
7
- options = defaults(argv) do |opts|
7
+ options = defaults(argv) do |opts,options|
8
8
  opts.banner = 'Usage: simp-metadata pry'
9
9
  end
10
10
 
@@ -4,7 +4,7 @@ module Simp
4
4
  module Commands
5
5
  class Release < Simp::Metadata::Commands::Base
6
6
  def run(argv, engine = nil)
7
- options = defaults(argv) do |opts|
7
+ options = defaults(argv) do |opts,options|
8
8
  opts.banner = 'Usage: simp-metadata release <release_name> [components]'
9
9
  opts.banner = ' simp-metadata release diff <release1> <release2>'
10
10
  end
@@ -4,7 +4,7 @@ module Simp
4
4
  module Commands
5
5
  class Releases < Simp::Metadata::Commands::Base
6
6
  def run(argv, engine = nil)
7
- options = defaults(argv) do |opts|
7
+ options = defaults(argv) do |opts,options|
8
8
  opts.banner = 'Usage: simp-metadata releases'
9
9
  end
10
10
 
@@ -4,7 +4,7 @@ module Simp
4
4
  module Commands
5
5
  class Save < Simp::Metadata::Commands::Base
6
6
  def run(argv, engine = nil)
7
- options = defaults(argv) do |opts|
7
+ options = defaults(argv) do |opts,options|
8
8
  opts.banner = 'Usage: simp-metadata save [options] [message]'
9
9
  end
10
10
 
@@ -6,7 +6,7 @@ module Simp
6
6
  module Commands
7
7
  class Script < Simp::Metadata::Commands::Base
8
8
  def run(argv, engine = nil)
9
- options = defaults(argv) do |opts|
9
+ options = defaults(argv) do |opts,options|
10
10
  opts.banner = 'Usage: simp-metadata script [options] <filename>'
11
11
  end
12
12
 
@@ -6,7 +6,7 @@ module Simp
6
6
  module Commands
7
7
  class Search < Simp::Metadata::Commands::Base
8
8
  def run(argv, engine = nil)
9
- options = defaults(argv) do |opts|
9
+ options = defaults(argv) do |opts,options|
10
10
  opts.banner = "Usage: simp-metadata search <attribute>=<value>\n(supports multiple attributes as well as encoded URLs)"
11
11
  end
12
12
 
@@ -4,7 +4,7 @@ module Simp
4
4
  module Commands
5
5
  class Set_write_url < Simp::Metadata::Commands::Base
6
6
  def run(argv, engine = nil)
7
- options = defaults(argv) do |opts|
7
+ options = defaults(argv) do |opts,options|
8
8
  opts.banner = 'Usage: simp-metadata set-write-url <repo_name> <url>'
9
9
  end
10
10
 
@@ -4,7 +4,7 @@ module Simp
4
4
  module Commands
5
5
  class Set_write < Simp::Metadata::Commands::Base
6
6
  def run(argv, engine = nil)
7
- options = defaults(argv) do |opts|
7
+ options = defaults(argv) do |opts,options|
8
8
  opts.banner = 'Usage: simp-metadata set-write [options]'
9
9
  end
10
10
 
@@ -4,7 +4,7 @@ module Simp
4
4
  module Commands
5
5
  class Update < Simp::Metadata::Commands::Base
6
6
  def run(argv, engine = nil)
7
- options = defaults(argv) do |opts|
7
+ options = defaults(argv) do |opts,options|
8
8
  opts.banner = 'Usage: simp-metadata update <component> <setting> <value>'
9
9
  end
10
10
 
@@ -303,6 +303,22 @@ module Simp
303
303
  ver
304
304
  end
305
305
 
306
+ def version?
307
+ Dir.mktmpdir do |dir|
308
+ Dir.chdir(dir) do
309
+ system("git clone #{url} > /dev/null 2>&1")
310
+ Dir.chdir("./#{module_name}") do
311
+ exitcode = Simp::Metadata.run("git checkout #{version} > /dev/null 2>&1")
312
+ if exitcode == 0
313
+ true
314
+ else
315
+ false
316
+ end
317
+ end
318
+ end
319
+ end
320
+ end
321
+
306
322
  def rpm_basename
307
323
  if component_type == 'puppet-module'
308
324
  if name =~ /pupmod-*/
@@ -522,10 +538,10 @@ module Simp
522
538
  rpm_name = self.rpm_name
523
539
  return if File.exist?("#{destination}/#{rpm_name}")
524
540
  el_version = platform.split('el')[1]
525
- if src.nil?
526
- sources = ["https://download.simp-project.com/SIMP/yum/simp6/el/#{el_version}/x86_64", "https://download.simp-project.com/SIMP/yum/unstable/el/#{el_version}/x86_64"]
541
+ if src.any?
542
+ sources = src
527
543
  else
528
- sources = [source.to_s]
544
+ sources = ["https://download.simp-project.com/SIMP/yum/simp6/el/#{el_version}/x86_64", "https://download.simp-project.com/SIMP/yum/unstable/el/#{el_version}/x86_64"]
529
545
  end
530
546
  sources.each do |source|
531
547
  if source =~ /^https?:/
@@ -537,7 +553,7 @@ module Simp
537
553
  puts "Copied #{rpm_name} from #{source}" if File.exist?("#{destination}/#{rpm_name}")
538
554
  return if File.exist?("#{destination}/#{rpm_name}")
539
555
  end
540
- puts "Unable to fine #{rpm_name} from #{sources}"
556
+ puts "Unable to find #{rpm_name} from #{sources}"
541
557
  end
542
558
  end
543
559
  end
@@ -20,12 +20,19 @@ module Simp
20
20
  bootstrap_source = Simp::Metadata::Bootstrap_source.new(edition)
21
21
  if metadatarepos.class.to_s == 'Hash'
22
22
  metadatarepos.each do |reponame, url|
23
+ if url.match?(/https?:/)
24
+ method = 'git'
25
+ extract = false
26
+ else
27
+ method = 'file'
28
+ extract = true
29
+ end
23
30
  # XXX: ToDo replace with better logic once Simp::Metadata.download_component gets refactored.
24
31
  # MUCH LAYERING VIOLATIONS
25
32
  next unless bootstrap_source.components.key?(reponame)
26
33
  bootstrap_source.components[reponame]['locations'][0]['url'] = url
27
- bootstrap_source.components[reponame]['locations'][0]['method'] = 'git'
28
- bootstrap_source.components[reponame]['locations'][0]['extract'] = false
34
+ bootstrap_source.components[reponame]['locations'][0]['method'] = method
35
+ bootstrap_source.components[reponame]['locations'][0]['extract'] = extract
29
36
  end
30
37
  end
31
38
  @sources[bootstrap_source.name] = bootstrap_source
@@ -0,0 +1,10 @@
1
+ module Simp
2
+ module Metadata
3
+ class Version
4
+ def self.version
5
+ '<%= gem_version %>'.freeze
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -2,8 +2,9 @@ module Simp
2
2
  module Metadata
3
3
  class Version
4
4
  def self.version
5
- '0.5.2'.freeze
5
+ '0.5.3'.freeze
6
6
  end
7
7
  end
8
8
  end
9
9
  end
10
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Riden
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-09-06 00:00:00.000000000 Z
12
+ date: 2018-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
@@ -219,6 +219,7 @@ files:
219
219
  - lib/simp/metadata/release.rb
220
220
  - lib/simp/metadata/releases.rb
221
221
  - lib/simp/metadata/source.rb
222
+ - lib/simp/metadata/version.erb
222
223
  - lib/simp/metadata/version.rb
223
224
  - spec/simp/media/command_spec.rb
224
225
  - spec/simp/media/engine_spec.rb
@@ -255,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
256
  version: '0'
256
257
  requirements: []
257
258
  rubyforge_project:
258
- rubygems_version: 2.7.7
259
+ rubygems_version: 2.7.8
259
260
  signing_key:
260
261
  specification_version: 4
261
262
  summary: SIMP Metadata Library