pray-cli 1.21.0 → 1.22.0
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 +4 -4
- data/CHANGELOG.md +18 -0
- data/lib/pray/cli/commands/distribution.rb +34 -3
- data/lib/pray/cli/commands/packages.rb +9 -7
- data/lib/pray/cli/commands/update_latest.rb +11 -4
- data/lib/pray/cli/commands/workflow.rb +4 -2
- data/lib/pray/cli/help.rb +7 -0
- data/lib/pray/cli.rb +14 -0
- data/lib/pray/derived_metadata.rb +194 -0
- data/lib/pray/git_cache.rb +46 -19
- data/lib/pray/git_legacy.rb +36 -0
- data/lib/pray/git_materialize.rb +204 -38
- data/lib/pray/git_store.rb +101 -14
- data/lib/pray/package_spec.rb +6 -1
- data/lib/pray/package_spec_paths.rb +18 -0
- data/lib/pray/publish.rb +49 -5
- data/lib/pray/registry.rb +10 -7
- data/lib/pray/sync.rb +1 -4
- data/lib/pray/tar_validation.rb +2 -0
- data/lib/pray/terminal.rb +28 -0
- data/lib/pray/upstream_merge.rb +6 -2
- data/lib/pray/upstream_plan.rb +84 -0
- data/lib/pray/version.rb +2 -2
- data/lib/pray.rb +3 -0
- metadata +6 -2
data/lib/pray/registry.rb
CHANGED
|
@@ -15,15 +15,17 @@ require_relative "git_materialize"
|
|
|
15
15
|
module Pray
|
|
16
16
|
RegistryPackageVersion = Struct.new(
|
|
17
17
|
:version, :artifact, :artifact_hash, :tree_hash, :yanked, :targets, :exports,
|
|
18
|
-
:signer, :signer_fingerprint, :published_at, :signature
|
|
18
|
+
:signer, :signer_fingerprint, :published_at, :signature, :derived_metadata
|
|
19
19
|
) do
|
|
20
20
|
def initialize(
|
|
21
21
|
artifact_hash: nil, tree_hash: nil, yanked: false, targets: [], exports: [],
|
|
22
|
-
signer: nil, signer_fingerprint: nil, published_at: nil, signature: nil,
|
|
22
|
+
signer: nil, signer_fingerprint: nil, published_at: nil, signature: nil,
|
|
23
|
+
derived_metadata: nil, **kwargs
|
|
23
24
|
)
|
|
24
25
|
super(**kwargs, artifact_hash: artifact_hash, tree_hash: tree_hash, yanked: yanked,
|
|
25
26
|
targets: targets, exports: exports, signer: signer,
|
|
26
|
-
signer_fingerprint: signer_fingerprint, published_at: published_at,
|
|
27
|
+
signer_fingerprint: signer_fingerprint, published_at: published_at,
|
|
28
|
+
signature: signature, derived_metadata: derived_metadata)
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
|
|
@@ -118,7 +120,7 @@ module Pray
|
|
|
118
120
|
|
|
119
121
|
raise Error.resolution(offline_package_error(declaration.name, selected.version)) if offline
|
|
120
122
|
|
|
121
|
-
artifact_bytes = read_local_artifact_bytes(source_root, selected.artifact)
|
|
123
|
+
artifact_bytes = read_local_artifact_bytes(source_root, selected.artifact, offline: offline)
|
|
122
124
|
RegistryInstall.install_artifact_to_cache(
|
|
123
125
|
cache_directory, declaration, selected, artifact_bytes, source_url: source_root
|
|
124
126
|
)
|
|
@@ -159,7 +161,8 @@ module Pray
|
|
|
159
161
|
signer: entry["signer"],
|
|
160
162
|
signer_fingerprint: entry["signer_fingerprint"],
|
|
161
163
|
published_at: entry.key?("published_at") ? publish_timestamp_from_value(entry["published_at"]) : nil,
|
|
162
|
-
signature: entry["signature"]
|
|
164
|
+
signature: entry["signature"],
|
|
165
|
+
derived_metadata: entry["derived_metadata"]
|
|
163
166
|
)
|
|
164
167
|
end
|
|
165
168
|
|
|
@@ -206,8 +209,8 @@ module Pray
|
|
|
206
209
|
Gem::Version.new(left) <=> Gem::Version.new(right)
|
|
207
210
|
end
|
|
208
211
|
|
|
209
|
-
def read_local_artifact_bytes(source_root, artifact)
|
|
210
|
-
GitMaterialize.read_local_artifact_bytes(source_root, artifact)
|
|
212
|
+
def read_local_artifact_bytes(source_root, artifact, offline: false)
|
|
213
|
+
GitMaterialize.read_local_artifact_bytes(source_root, artifact, offline: offline)
|
|
211
214
|
end
|
|
212
215
|
|
|
213
216
|
def read_artifact_bytes(source_url, artifact)
|
data/lib/pray/sync.rb
CHANGED
|
@@ -205,10 +205,7 @@ module Pray
|
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
def fetch_bytes(peer_source, artifact)
|
|
208
|
-
|
|
209
|
-
return Registry.http_get(artifact).b
|
|
210
|
-
end
|
|
211
|
-
|
|
208
|
+
Registry.reject_absolute_artifact!(artifact)
|
|
212
209
|
Registry.http_get("#{trim_slash(peer_source)}/#{artifact.delete_prefix("/")}").b
|
|
213
210
|
end
|
|
214
211
|
|
data/lib/pray/tar_validation.rb
CHANGED
|
@@ -38,6 +38,8 @@ module Pray
|
|
|
38
38
|
|
|
39
39
|
def process_entry(header, data, size, state, output_directory)
|
|
40
40
|
type = header.byteslice(156, 1)
|
|
41
|
+
# git archive emits a pax global header (`g`); ignore without applying path.
|
|
42
|
+
return if type == "g"
|
|
41
43
|
if type == "x"
|
|
42
44
|
state.pending_path = pax_path(data)
|
|
43
45
|
return
|
data/lib/pray/terminal.rb
CHANGED
|
@@ -20,6 +20,34 @@ module Pray
|
|
|
20
20
|
env_truthy?("PRAY_NO_INPUT")
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def quiet?
|
|
24
|
+
env_truthy?("PRAY_QUIET")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def verbose?
|
|
28
|
+
level = ENV.fetch("PRAY_VERBOSE", "0").to_i
|
|
29
|
+
level > 0
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def configure_output!(quiet:, verbose:)
|
|
33
|
+
ENV["PRAY_QUIET"] = "1" if quiet
|
|
34
|
+
if verbose > 0
|
|
35
|
+
ENV["PRAY_VERBOSE"] = verbose.to_s
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def println_stdout(message)
|
|
40
|
+
return if quiet?
|
|
41
|
+
|
|
42
|
+
puts message
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def println_verbose(message)
|
|
46
|
+
return if quiet? || !verbose?
|
|
47
|
+
|
|
48
|
+
puts message
|
|
49
|
+
end
|
|
50
|
+
|
|
23
51
|
def env_truthy?(name)
|
|
24
52
|
value = ENV.fetch(name, nil)
|
|
25
53
|
return false if value.nil?
|
data/lib/pray/upstream_merge.rb
CHANGED
|
@@ -39,13 +39,15 @@ module Pray
|
|
|
39
39
|
when [false, true, false]
|
|
40
40
|
(local == old) ? :omit : :conflict
|
|
41
41
|
when [false, false, true]
|
|
42
|
-
(old == new) ? :omit :
|
|
42
|
+
(old == new) ? :omit : :conflict
|
|
43
43
|
when [true, false, true]
|
|
44
44
|
new
|
|
45
45
|
when [true, true, false]
|
|
46
46
|
local
|
|
47
47
|
when [true, false, false]
|
|
48
48
|
(local == new) ? new : :conflict
|
|
49
|
+
when [false, true, true]
|
|
50
|
+
:omit
|
|
49
51
|
else
|
|
50
52
|
:conflict
|
|
51
53
|
end
|
|
@@ -67,7 +69,9 @@ module Pray
|
|
|
67
69
|
|
|
68
70
|
def merge_conflict_message(fork, upstream_name, old_version, new_version, paths)
|
|
69
71
|
"upstream merge conflict in #{fork} while refreshing #{upstream_name} " \
|
|
70
|
-
"#{old_version} to #{new_version}: #{paths.join(", ")}"
|
|
72
|
+
"#{old_version} to #{new_version}: #{paths.join(", ")}. " \
|
|
73
|
+
"Reset those content files to the locked upstream tree, run `pray update --latest`, " \
|
|
74
|
+
"re-apply intentional overlays, then bump the fork version (upstream_merge_conflict)."
|
|
71
75
|
end
|
|
72
76
|
|
|
73
77
|
def next_upstream_constraint(current, new_version)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pray
|
|
4
|
+
module Upstream
|
|
5
|
+
PathUpstreamConflict = Struct.new(
|
|
6
|
+
:package_name,
|
|
7
|
+
:upstream_name,
|
|
8
|
+
:old_version,
|
|
9
|
+
:new_version,
|
|
10
|
+
:paths,
|
|
11
|
+
keyword_init: true
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
module_function
|
|
15
|
+
|
|
16
|
+
def plan_path_upstream_conflicts(project, previous, selected, options)
|
|
17
|
+
user_config = Config.load_user_config
|
|
18
|
+
git_sources = GitSources.prepare_git_sources(
|
|
19
|
+
project.project_root,
|
|
20
|
+
project.manifest.sources,
|
|
21
|
+
previous,
|
|
22
|
+
refresh: options.refresh || options.refresh_source_revisions,
|
|
23
|
+
offline: options.offline
|
|
24
|
+
)
|
|
25
|
+
sources = Resolve.source_map(project.manifest.sources)
|
|
26
|
+
conflicts = []
|
|
27
|
+
project.packages.each do |package|
|
|
28
|
+
next if selected && package.declaration.name != selected
|
|
29
|
+
|
|
30
|
+
conflict = plan_one_path_upstream_conflict(
|
|
31
|
+
project, package, previous, sources, git_sources, user_config, options
|
|
32
|
+
)
|
|
33
|
+
conflicts << conflict if conflict
|
|
34
|
+
end
|
|
35
|
+
conflicts
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def report_path_upstream_would_conflicts(project, previous, selected, options)
|
|
39
|
+
conflicts = plan_path_upstream_conflicts(project, previous, selected, options)
|
|
40
|
+
return if conflicts.empty?
|
|
41
|
+
|
|
42
|
+
messages = conflicts.map do |conflict|
|
|
43
|
+
puts "would-conflict #{conflict.package_name}: #{conflict.paths.join(", ")}"
|
|
44
|
+
merge_conflict_message(
|
|
45
|
+
conflict.package_name,
|
|
46
|
+
conflict.upstream_name,
|
|
47
|
+
conflict.old_version,
|
|
48
|
+
conflict.new_version,
|
|
49
|
+
conflict.paths
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
raise Error.resolution(messages.join("\n"))
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def plan_one_path_upstream_conflict(project, package, previous, sources, git_sources, user_config, options)
|
|
56
|
+
new_upstream = package.upstream
|
|
57
|
+
return nil unless new_upstream && package.declaration.path
|
|
58
|
+
|
|
59
|
+
local_content = local_content_for_refresh(package.root, package.spec)
|
|
60
|
+
return nil if local_content.empty?
|
|
61
|
+
|
|
62
|
+
old_upstream = previous&.package&.find { |entry| entry.name == package.declaration.name }&.upstream
|
|
63
|
+
return nil unless old_upstream
|
|
64
|
+
return nil if old_upstream.version == new_upstream.version && old_upstream.tree_hash == new_upstream.tree_hash
|
|
65
|
+
|
|
66
|
+
old_package, new_package = resolve_upstream_pair(
|
|
67
|
+
project, previous, sources, git_sources, user_config, options, old_upstream, new_upstream
|
|
68
|
+
)
|
|
69
|
+
old_content = content_file_bytes(old_package.root, old_package.spec)
|
|
70
|
+
new_content = content_file_bytes(new_package.root, new_package.spec)
|
|
71
|
+
_merged, conflict_paths = try_merge_content_files(old_content, new_content, local_content)
|
|
72
|
+
return nil if conflict_paths.empty?
|
|
73
|
+
|
|
74
|
+
PathUpstreamConflict.new(
|
|
75
|
+
package_name: package.declaration.name,
|
|
76
|
+
upstream_name: old_upstream.name,
|
|
77
|
+
old_version: old_upstream.version,
|
|
78
|
+
new_version: new_upstream.version,
|
|
79
|
+
paths: conflict_paths
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
private_class_method :plan_one_path_upstream_conflict
|
|
83
|
+
end
|
|
84
|
+
end
|
data/lib/pray/version.rb
CHANGED
data/lib/pray.rb
CHANGED
|
@@ -13,6 +13,7 @@ require_relative "pray/manifest"
|
|
|
13
13
|
require_relative "pray/format_serialize"
|
|
14
14
|
require_relative "pray/format_manifest"
|
|
15
15
|
require_relative "pray/package_spec"
|
|
16
|
+
require_relative "pray/package_spec_paths"
|
|
16
17
|
require_relative "pray/package_spec_version"
|
|
17
18
|
require_relative "pray/local_prayer"
|
|
18
19
|
require_relative "pray/lockfile"
|
|
@@ -38,6 +39,7 @@ require_relative "pray/upstream"
|
|
|
38
39
|
require_relative "pray/upstream_merge"
|
|
39
40
|
require_relative "pray/package_spec_render"
|
|
40
41
|
require_relative "pray/upstream_refresh"
|
|
42
|
+
require_relative "pray/upstream_plan"
|
|
41
43
|
require_relative "pray/upstream_drift"
|
|
42
44
|
require_relative "pray/upstream_latest"
|
|
43
45
|
require_relative "pray/compose_dest"
|
|
@@ -57,6 +59,7 @@ require_relative "pray/http_body"
|
|
|
57
59
|
require_relative "pray/registry_install"
|
|
58
60
|
require_relative "pray/registry_integrity"
|
|
59
61
|
require_relative "pray/registry"
|
|
62
|
+
require_relative "pray/derived_metadata"
|
|
60
63
|
require_relative "pray/archive_unpack"
|
|
61
64
|
require_relative "pray/archive"
|
|
62
65
|
require_relative "pray/plan"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pray-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.22.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Makarov
|
|
@@ -129,6 +129,7 @@ files:
|
|
|
129
129
|
- lib/pray/config.rb
|
|
130
130
|
- lib/pray/constraint.rb
|
|
131
131
|
- lib/pray/dependency_graph.rb
|
|
132
|
+
- lib/pray/derived_metadata.rb
|
|
132
133
|
- lib/pray/destination.rb
|
|
133
134
|
- lib/pray/distribution.rb
|
|
134
135
|
- lib/pray/dotenv.rb
|
|
@@ -138,6 +139,7 @@ files:
|
|
|
138
139
|
- lib/pray/format_serialize.rb
|
|
139
140
|
- lib/pray/git_cache.rb
|
|
140
141
|
- lib/pray/git_clone.rb
|
|
142
|
+
- lib/pray/git_legacy.rb
|
|
141
143
|
- lib/pray/git_materialize.rb
|
|
142
144
|
- lib/pray/git_refresh.rb
|
|
143
145
|
- lib/pray/git_run.rb
|
|
@@ -160,6 +162,7 @@ files:
|
|
|
160
162
|
- lib/pray/manifest_parser_publish.rb
|
|
161
163
|
- lib/pray/materialize.rb
|
|
162
164
|
- lib/pray/package_spec.rb
|
|
165
|
+
- lib/pray/package_spec_paths.rb
|
|
163
166
|
- lib/pray/package_spec_render.rb
|
|
164
167
|
- lib/pray/package_spec_version.rb
|
|
165
168
|
- lib/pray/path_safety.rb
|
|
@@ -209,6 +212,7 @@ files:
|
|
|
209
212
|
- lib/pray/upstream_drift.rb
|
|
210
213
|
- lib/pray/upstream_latest.rb
|
|
211
214
|
- lib/pray/upstream_merge.rb
|
|
215
|
+
- lib/pray/upstream_plan.rb
|
|
212
216
|
- lib/pray/upstream_refresh.rb
|
|
213
217
|
- lib/pray/verify.rb
|
|
214
218
|
- lib/pray/verify_locked_dest.rb
|
|
@@ -240,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
240
244
|
- !ruby/object:Gem::Version
|
|
241
245
|
version: '0'
|
|
242
246
|
requirements: []
|
|
243
|
-
rubygems_version:
|
|
247
|
+
rubygems_version: 4.0.20
|
|
244
248
|
specification_version: 4
|
|
245
249
|
summary: Package manager for the language placed before inference (Prayfile)
|
|
246
250
|
test_files: []
|