librarian-puppet-pr328 2.2.2 → 2.2.4

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjE2YWY1YWJlOWE0MWI0NmE5N2VkODAxMzM3ODQwOGRhNzFjYzRhMQ==
4
+ NjY5YWUwMmJkZDgwMjU0NDE4Zjk3Yzg5YTBjZDA3ODQ1NTVhNzUyYg==
5
5
  data.tar.gz: !binary |-
6
- NmQ1M2ZlZjY3YzIxMjE1MjM1NTkwZGEyN2FiMGM5MzQzMjI1ZjM4Mw==
6
+ YmE4MDA0NmU4NTdjZDc4YjExNDU5ZjUzYmI3ZmJlZWQyNTVlMDkzNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWRiMWZhN2YxN2FmMTZlMDUyNTdlMGVlZTdjYmJiOTE4ZjFjYjYwMWUyMDg4
10
- OTFmNzUzMjBiNDY2ZWQ0YjIwMjI0M2E5YTZiYmRhYmUxMjA4MmUzNDliYWI3
11
- Zjc0NDRlYmVhODVjZjdkYzk0YTFiZTNmY2M2NjkzMzkxOThkMjU=
9
+ NzQxM2VmNzNkZmY0OWFmY2EzMzlkNjcwZWVlNDJjMTljZDQ1YTI3ZTA2ZDMy
10
+ MjBiNzE2ODNhYTA5NzQ0YTkxN2M0MDczN2Y4YzBmMGM5YTEyZjczNDlmZTY2
11
+ YTZmYzkzZTdiYWQzYzdiODU4NGNjZmVkMzMzMjFhNjEyYmFlN2Q=
12
12
  data.tar.gz: !binary |-
13
- MDJmNzkwYmIyY2VmMDljMzZiYmQ4ZjE2ZDc4NzY2MDI0OGZhODkxM2FhMmUz
14
- ZGYwNGE1NTIxMjcwMWFiYTczNzc4YTkxYTM5NjdhYWY0ZDQ2NjBkODU4ZWUw
15
- MWI3Y2YyMWIzN2RkMTUyMWI2MTIzZjkxMzA0NTQwOTZmYmIwYWM=
13
+ MzZhOTIyMGE2MWZiMTg1NDFkZGVmOTU2ODMxNzgyZjM2ZTgxYjNlNmEzYTVl
14
+ MDhmNDU0NmY1OGFmMGIxOGVhNTYxMTI0ZGMwMDVmYjcwZmQzZGM3NjJjNzAx
15
+ NzM0MjU2ZjczZDMzNzE5MTA2YmEzMmQ1NGM3OTRjMWM5YjVlNTM=
@@ -48,6 +48,7 @@ module Librarian
48
48
  option "local", :type => :boolean, :default => false
49
49
  option "use-v1-api", :type => :boolean, :default => true
50
50
  option "use-forge", :type => :boolean
51
+ option "git-destructive", :type => :boolean
51
52
  def install
52
53
 
53
54
  ensure!
@@ -67,6 +68,9 @@ module Librarian
67
68
  unless options["use-forge"].nil?
68
69
  environment.config_db.local['use-forge'] = options['use-forge'].to_s
69
70
  end
71
+ unless options["git-destructive"].nil?
72
+ environment.config_db.local['git-destructive'] = options['git-destructive'].to_s
73
+ end
70
74
  environment.config_db.local['mode'] = options['local'] ? 'local' : nil
71
75
 
72
76
  resolve!
@@ -89,6 +93,7 @@ module Librarian
89
93
  option "path", :type => :string
90
94
  option "destructive", :type => :boolean, :default => false
91
95
  option "use-forge", :type => :boolean
96
+ option "git-destructive", :type => :boolean
92
97
  def package
93
98
  environment.vendor!
94
99
  install
@@ -61,6 +61,14 @@ module Librarian
61
61
  def use_forge
62
62
  config_db['use-forge'].to_s == 'false' ? false : true
63
63
  end
64
+
65
+ def git_destructive
66
+ config_db['git-destructive'].to_s == 'false' ? false : true
67
+ end
68
+
69
+ def verbose?
70
+ config_db['verbose'].to_s == 'false' ? false : true
71
+ end
64
72
  end
65
73
  end
66
74
  end
@@ -6,6 +6,7 @@ module Librarian
6
6
  class Git
7
7
  class Repository
8
8
  def hash_from(remote, reference)
9
+
9
10
  branch_names = remote_branch_names[remote]
10
11
  if branch_names.include?(reference)
11
12
  reference = "#{remote}/#{reference}"
@@ -14,6 +15,57 @@ module Librarian
14
15
  command = %W(rev-parse #{reference}^{commit} --quiet)
15
16
  run!(command, :chdir => true).strip
16
17
  end
18
+
19
+ # Return true if the repository has local modifications, false otherwise.
20
+ def dirty?
21
+ # Ignore anything that's not a git repository
22
+ # This is relevant for testing scenarios
23
+ return false unless self.git?
24
+
25
+ status = false
26
+ _path = relative_path_to(path).to_s
27
+ begin
28
+ Librarian::Posix.run!(%W{git update-index -q --ignore-submodules --refresh}, :chdir => _path)
29
+ rescue Librarian::Posix::CommandFailure => e
30
+ status = "Could not update git index for '#{path}'"
31
+ end
32
+
33
+ unless status
34
+ begin
35
+ Librarian::Posix.run!(%W{git diff-files --quiet --ignore-submodules --}, :chdir => _path)
36
+ rescue Librarian::Posix::CommandFailure => e
37
+ status = "'#{_path}' has unstaged changes"
38
+ end
39
+ end
40
+
41
+ unless status
42
+ begin
43
+ Librarian::Posix.run!(%W{git diff-index --cached --quiet HEAD --ignore-submodules --}, :chdir => _path)
44
+ rescue Librarian::Posix::CommandFailure => e
45
+ status = "'#{_path}' has uncommitted changes"
46
+ end
47
+ end
48
+
49
+ unless status
50
+ begin
51
+ untracked_files = Librarian::Posix.run!(%W{git ls-files -o -d --exclude-standard}, :chdir => _path)
52
+
53
+ unless untracked_files.empty?
54
+ untracked_files.strip!
55
+
56
+ if untracked_files.lines.count > 0
57
+ status = "'#{_path}' has untracked files"
58
+ end
59
+ end
60
+
61
+ rescue Librarian::Posix::CommandFailure => e
62
+ # We should never get here
63
+ raise Error, "Failure running 'git ls-files -o -d --exclude-standard' at '#{_path}'"
64
+ end
65
+ end
66
+
67
+ status
68
+ end
17
69
  end
18
70
  end
19
71
  end
@@ -9,6 +9,10 @@ module Librarian
9
9
  def install!(manifest)
10
10
  manifest.source == self or raise ArgumentError
11
11
 
12
+ if environment.verbose?
13
+ info { "Processing #{manifest.name}" }
14
+ end
15
+
12
16
  debug { "Installing #{manifest}" }
13
17
 
14
18
  name, version = manifest.name, manifest.version
@@ -30,12 +34,71 @@ module Librarian
30
34
  install_path = environment.project_path + path.to_s
31
35
  end
32
36
 
33
- if install_path.exist? && rsync? != true
34
- debug { "Deleting #{relative_path_to(install_path)}" }
35
- install_path.rmtree
36
- end
37
+ install_repo = Git::Repository.new(environment,install_path)
38
+
39
+ if install_repo.git?
40
+ _install_path = relative_path_to(install_path)
41
+
42
+ if environment.git_destructive
43
+ debug { "Performing git hard reset of '#{_install_path}'" }
44
+
45
+ install_repo.reset_hard!
46
+ install_repo.clean!
47
+ end
48
+
49
+ if install_repo.dirty?
50
+ warn { "#{install_repo.dirty?}, skipping..." }
51
+ else
52
+ # Try to do nicer git operations when possible
53
+ _remote_repo = 'librarian_origin'
54
+
55
+ begin
56
+ Librarian::Posix.run!(%W{git remote add #{_remote_repo} #{repository_cache_path}}, :chdir => _install_path)
57
+ rescue Librarian::Posix::CommandFailure => e
58
+ unless e.to_s =~ /already exists/
59
+ raise Error, "Could not update git repository at #{_install_path}"
60
+ end
61
+ end
62
+
63
+ install_repo.fetch!(_remote_repo)
64
+
65
+ if environment.verbose?
66
+ warn "Checking out #{ref} in #{_install_path}"
67
+ end
68
+ install_repo.checkout!(ref)
37
69
 
38
- install_perform_step_copy!(found_path, install_path)
70
+ begin
71
+ _target_ref = ref
72
+
73
+ # Handle branches vs absolute refs
74
+ if repository.remote_branch_names[repository.default_remote].include?(_target_ref)
75
+ _target_ref = "#{repository.default_remote}/#{_target_ref}"
76
+ end
77
+
78
+ ff_output = Librarian::Posix.run!(%W{git pull --ff-only #{_remote_repo} #{_target_ref}}, :chdir => _install_path)
79
+
80
+ if ff_output =~ /Updating\s+.*\.\.(.*)\s*$/
81
+ warn { "Updated '#{_install_path}' to #{$1}" }
82
+ end
83
+ rescue Librarian::Posix::CommandFailure => e
84
+ warn { "Fast forward of git repo at '#{_install_path}' failed...skipping" }
85
+ end
86
+
87
+ begin
88
+ Librarian::Posix.run!(%W{git remote rm #{_remote_repo}}, :chdir => _install_path)
89
+ rescue Librarian::Posix::CommandFailure => e
90
+ # We don't really care if this fails.
91
+ debug { "Removal of the '#{_remote_repo}' git remote failed" }
92
+ end
93
+ end
94
+ else
95
+ if install_path.exist? && rsync? != true
96
+ debug { "Deleting #{relative_path_to(install_path)}" }
97
+ install_path.rmtree
98
+ end
99
+
100
+ install_perform_step_copy!(found_path, install_path)
101
+ end
39
102
  end
40
103
 
41
104
  def fetch_version(name, extra)
@@ -1,5 +1,5 @@
1
1
  module Librarian
2
2
  module Puppet
3
- VERSION = "2.2.2"
3
+ VERSION = "2.2.4"
4
4
  end
5
5
  end
@@ -0,0 +1,11 @@
1
+ module Librarian
2
+ module Puppet
3
+ <<<<<<< HEAD
4
+ VERSION = "2.2.3"
5
+ ||||||| parent of 97225be... (SIMP-690) Changed binary name
6
+ VERSION = "2.2.1"
7
+ =======
8
+ VERSION = "2.2.2"
9
+ >>>>>>> 97225be... (SIMP-690) Changed binary name
10
+ end
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian-puppet-pr328
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Sharpe
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-10 00:00:00.000000000 Z
13
+ date: 2015-12-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: librarianp
@@ -206,6 +206,7 @@ files:
206
206
  - lib/librarian/puppet/templates/Puppetfile
207
207
  - lib/librarian/puppet/util.rb
208
208
  - lib/librarian/puppet/version.rb
209
+ - lib/librarian/puppet/version.rb.orig
209
210
  homepage: https://github.com/simp/librarian-puppet
210
211
  licenses:
211
212
  - MIT