File tree Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,11 @@ def fetch-package [
207
207
throw-error $' No package matching version `($version )`'
208
208
}
209
209
210
+ if $pkg.hash_mismatch != true {
211
+ throw-error ($' Content of package file ($pkg.path )'
212
+ + $' does not match expected hash' )
213
+ }
214
+
210
215
print $pkg
211
216
212
217
if $pkg.type == ' git' {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export def main [
10
10
-- pkg-version(-v) : string # Package version to install
11
11
-- exact-match(-e) # Match package name exactly
12
12
]: nothing -> table {
13
- search-package $package -- registry $registry -- exact-match=$exact_match -- skip-dirty-pkg
13
+ let result = search-package $package -- registry $registry -- exact-match=$exact_match
14
14
| flatten
15
15
| each {|row |
16
16
{
@@ -24,4 +24,6 @@ export def main [
24
24
}
25
25
}
26
26
| filter-by-version $pkg_version
27
+
28
+ return $result
27
29
}
Original file line number Diff line number Diff line change @@ -8,14 +8,13 @@ use misc.nu [check-cols url hash-file]
8
8
export const REG_COLS = [ name path hash ]
9
9
10
10
# Columns of a registry package file
11
- export const REG_PKG_COLS = [ name version path type info ]
11
+ export const REG_PKG_COLS = [ name version path type info hash_mismatch ]
12
12
13
13
# Search for a package in a registry
14
14
export def search-package [
15
15
package : string # Name of the package
16
16
-- registry : string # Which registry to use (name or path)
17
17
-- exact-match # Searched package name must match exactly
18
- -- skip-dirty-pkg # Skip packages with failed hash checks
19
18
] -> table {
20
19
let registries = if (not ($registry | is-empty )) and ($registry in $env .NUPM_REGISTRIES ) {
21
20
# If $registry is a valid column in $env.NUPM_REGISTRIES, use that
@@ -87,17 +86,7 @@ export def search-package [
87
86
88
87
let new_hash = $pkg_file_path | hash-file
89
88
90
- let dirty = $new_hash != $row.hash
91
- if $new_hash != $row.hash {
92
- if $skip_dirty_pkg {
93
- null
94
- } else {
95
- throw-error ($' Content of package file `($url_or_path )'
96
- + $' does not match expected hash `($row.hash )`.' )
97
- }
98
- } else {
99
- open $pkg_file_path | insert dirty $dirty
100
- }
89
+ open $pkg_file_path | insert hash_mismatch ($new_hash != $row.hash )
101
90
}
102
91
| compact
103
92
| flatten
You can’t perform that action at this time.
0 commit comments