bundix 2.1.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bundix +1 -0
- data/lib/bundix/fetchurl-force.nix +27 -0
- data/lib/bundix/source.rb +8 -7
- data/lib/bundix/version.rb +1 -1
- data/lib/bundix.rb +10 -2
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4a1f9e593fc6268d9cbeed7ff01b5385e31ed5c
|
4
|
+
data.tar.gz: c11ee93310970e0bbe33ec266c4c9f1d3a644d45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b76ba25369c18f7fb22e8658ba796514aafabfa965ee1b14469b6d81fd28b8df3437f24dd57aee4b127fd36ba5df9cdb64c30d21756b87c23027a7fe2f37f427
|
7
|
+
data.tar.gz: 1bd4b88b09ab7ebf5170c1da2585ab6ca01df9ffe43d93b2585bc5ab102d70ff8ba1fc073bed790eacce29f8381dafcf1ea8f587d74e21e090cbbd3a4ce09edc
|
data/bin/bundix
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
{ nixpkgs ? import <nixpkgs> {}
|
2
|
+
, url
|
3
|
+
}:
|
4
|
+
|
5
|
+
with nixpkgs;
|
6
|
+
|
7
|
+
# (ab)use fetchurl to download a URL and add it to the nix store
|
8
|
+
# *without* already knowing its hash.
|
9
|
+
fetchurl {
|
10
|
+
inherit url;
|
11
|
+
sha256 = "0000000000000000000000000000000000000000000000000000";
|
12
|
+
downloadToTemp = true;
|
13
|
+
postFetch = ''
|
14
|
+
PATH="$PATH:${stdenv.lib.makeBinPath [ nix ]}"
|
15
|
+
|
16
|
+
sha256="$(nix-hash --base32 --type sha256 --flat "$downloadedFile")"
|
17
|
+
printf "%s\n" "$sha256"
|
18
|
+
|
19
|
+
file="$(dirname "$downloadedFile")/$(basename "$url")"
|
20
|
+
mv "$downloadedFile" "$file"
|
21
|
+
echo "adding to nix store..."
|
22
|
+
nix-store --add "$file"
|
23
|
+
|
24
|
+
echo "success! failing outer nix build..."
|
25
|
+
exit 1
|
26
|
+
'';
|
27
|
+
}
|
data/lib/bundix/source.rb
CHANGED
@@ -12,13 +12,13 @@ class Bundix
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def sh(*args)
|
16
|
-
Bundix.sh(*args)
|
15
|
+
def sh(*args, &block)
|
16
|
+
Bundix.sh(*args, &block)
|
17
17
|
end
|
18
18
|
|
19
|
-
def nix_prefetch_url(
|
20
|
-
sh(
|
21
|
-
|
19
|
+
def nix_prefetch_url(url)
|
20
|
+
sh(NIX_BUILD, '--argstr', 'url', url, FETCHURL_FORCE, &FETCHURL_FORCE_CHECK)
|
21
|
+
.force_encoding('UTF-8')
|
22
22
|
rescue
|
23
23
|
nil
|
24
24
|
end
|
@@ -53,8 +53,9 @@ class Bundix
|
|
53
53
|
|
54
54
|
def fetch_remote_hash(spec, remote)
|
55
55
|
uri = "#{remote}/gems/#{spec.name}-#{spec.version}.gem"
|
56
|
-
result = nix_prefetch_url(uri)
|
57
|
-
result
|
56
|
+
result = nix_prefetch_url(uri)
|
57
|
+
return unless result
|
58
|
+
result.force_encoding('UTF-8')[SHA256_32]
|
58
59
|
rescue => e
|
59
60
|
puts "ignoring error during fetching: #{e}"
|
60
61
|
puts e.backtrace
|
data/lib/bundix/version.rb
CHANGED
data/lib/bundix.rb
CHANGED
@@ -11,9 +11,15 @@ class Bundix
|
|
11
11
|
NIX_INSTANTIATE = 'nix-instantiate'
|
12
12
|
NIX_PREFETCH_URL = 'nix-prefetch-url'
|
13
13
|
NIX_PREFETCH_GIT = 'nix-prefetch-git'
|
14
|
+
NIX_BUILD = 'nix-build'
|
14
15
|
NIX_HASH = 'nix-hash'
|
15
16
|
NIX_SHELL = 'nix-shell'
|
16
17
|
|
18
|
+
FETCHURL_FORCE = File.expand_path('../bundix/fetchurl-force.nix', __FILE__)
|
19
|
+
FETCHURL_FORCE_CHECK = lambda do |_, out|
|
20
|
+
out =~ /success! failing outer nix build.../
|
21
|
+
end
|
22
|
+
|
17
23
|
SHA256_32 = %r(^[a-z0-9]{52}$)
|
18
24
|
SHA256_16 = %r(^[a-f0-9]{64}$)
|
19
25
|
|
@@ -57,10 +63,12 @@ class Bundix
|
|
57
63
|
|
58
64
|
case spec_source = spec.source
|
59
65
|
when Bundler::Source::Git
|
66
|
+
next unless cached_source['type'] == 'git'
|
60
67
|
next unless cached_rev = cached_source['rev']
|
61
68
|
next unless spec_rev = spec_source.options['revision']
|
62
69
|
spec_rev == cached_rev
|
63
70
|
when Bundler::Source::Rubygems
|
71
|
+
next unless cached_source['type'] == 'gem'
|
64
72
|
v['version'] == spec.version.to_s
|
65
73
|
end
|
66
74
|
}
|
@@ -110,9 +118,9 @@ class Bundix
|
|
110
118
|
end
|
111
119
|
end
|
112
120
|
|
113
|
-
def self.sh(*args)
|
121
|
+
def self.sh(*args, &block)
|
114
122
|
out, status = Open3.capture2e(*args)
|
115
|
-
unless status.success?
|
123
|
+
unless block_given? ? block.call(status, out) : status.success?
|
116
124
|
puts "$ #{args.join(' ')}" if $VERBOSE
|
117
125
|
puts out if $VERBOSE
|
118
126
|
fail "command execution failed: #{status}"
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael 'manveru' Fellinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.11'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.11'
|
27
27
|
description: Creates Nix packages from Gemfiles.
|
@@ -32,9 +32,10 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- bin/bundix
|
35
|
+
- lib/bundix.rb
|
36
|
+
- lib/bundix/fetchurl-force.nix
|
35
37
|
- lib/bundix/source.rb
|
36
38
|
- lib/bundix/version.rb
|
37
|
-
- lib/bundix.rb
|
38
39
|
homepage: https://github.com/manveru/bundix
|
39
40
|
licenses:
|
40
41
|
- MIT
|
@@ -45,17 +46,17 @@ require_paths:
|
|
45
46
|
- lib
|
46
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
48
|
requirements:
|
48
|
-
- -
|
49
|
+
- - ">="
|
49
50
|
- !ruby/object:Gem::Version
|
50
51
|
version: '0'
|
51
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
53
|
requirements:
|
53
|
-
- -
|
54
|
+
- - ">="
|
54
55
|
- !ruby/object:Gem::Version
|
55
56
|
version: '0'
|
56
57
|
requirements: []
|
57
58
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.6.10
|
59
60
|
signing_key:
|
60
61
|
specification_version: 4
|
61
62
|
summary: Creates Nix packages from Gemfiles.
|