tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
Merge master into staging-next
Frederik Rietdijk
7 years ago
e0950ae9
12e8ec04
+716
-427
28 changed files
expand all
collapse all
unified
split
maintainers
scripts
update-python-libraries
nixos
modules
services
databases
mysql.nix
pkgs
applications
altcoins
monero-gui
default.nix
audio
opus-tools
default.nix
misc
aminal
default.nix
networking
cluster
cni
default.nix
plugins.nix
instant-messengers
bitlbee-discord
default.nix
vnstat
default.nix
office
todoman
default.nix
science
astronomy
gildas
default.nix
build-support
agda
default.nix
data
icons
elementary-icon-theme
default.nix
development
compilers
ghc
8.6.3.nix
interpreters
python
build-python-package.nix
mk-python-derivation.nix
update-python-libraries
default.nix
update-python-libraries.py
ruby-modules
bundix
default.nix
tools
misc
elfinfo
default.nix
skaffold
default.nix
misc
emulators
wine
base.nix
default.nix
servers
uwsgi
default.nix
tools
X11
grobi
default.nix
top-level
all-packages.nix
haskell-packages.nix
wine-packages.nix
+2
-360
maintainers/scripts/update-python-libraries
···
1
1
-
#! /usr/bin/env nix-shell
2
2
-
#! nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ packaging requests toolz ])" -p git
3
3
-
4
4
-
"""
5
5
-
Update a Python package expression by passing in the `.nix` file, or the directory containing it.
6
6
-
You can pass in multiple files or paths.
7
7
-
8
8
-
You'll likely want to use
9
9
-
``
10
10
-
$ ./update-python-libraries ../../pkgs/development/python-modules/*
11
11
-
``
12
12
-
to update all libraries in that folder.
13
13
-
"""
14
14
-
15
15
-
import argparse
16
16
-
import logging
17
17
-
import os
18
18
-
import re
19
19
-
import requests
20
20
-
import toolz
21
21
-
from concurrent.futures import ThreadPoolExecutor as Pool
22
22
-
from packaging.version import Version as _Version
23
23
-
from packaging.version import InvalidVersion
24
24
-
from packaging.specifiers import SpecifierSet
25
25
-
import collections
26
26
-
import subprocess
27
27
-
28
28
-
INDEX = "https://pypi.io/pypi"
29
29
-
"""url of PyPI"""
30
30
-
31
31
-
EXTENSIONS = ['tar.gz', 'tar.bz2', 'tar', 'zip', '.whl']
32
32
-
"""Permitted file extensions. These are evaluated from left to right and the first occurance is returned."""
33
33
-
34
34
-
PRERELEASES = False
35
35
-
36
36
-
import logging
37
37
-
logging.basicConfig(level=logging.INFO)
38
38
-
39
39
-
40
40
-
class Version(_Version, collections.abc.Sequence):
41
41
-
42
42
-
def __init__(self, version):
43
43
-
super().__init__(version)
44
44
-
# We cannot use `str(Version(0.04.21))` because that becomes `0.4.21`
45
45
-
# https://github.com/avian2/unidecode/issues/13#issuecomment-354538882
46
46
-
self.raw_version = version
47
47
-
48
48
-
def __getitem__(self, i):
49
49
-
return self._version.release[i]
50
50
-
51
51
-
def __len__(self):
52
52
-
return len(self._version.release)
53
53
-
54
54
-
def __iter__(self):
55
55
-
yield from self._version.release
56
56
-
57
57
-
58
58
-
def _get_values(attribute, text):
59
59
-
"""Match attribute in text and return all matches.
60
60
-
61
61
-
:returns: List of matches.
62
62
-
"""
63
63
-
regex = '{}\s+=\s+"(.*)";'.format(attribute)
64
64
-
regex = re.compile(regex)
65
65
-
values = regex.findall(text)
66
66
-
return values
67
67
-
68
68
-
def _get_unique_value(attribute, text):
69
69
-
"""Match attribute in text and return unique match.
70
70
-
71
71
-
:returns: Single match.
72
72
-
"""
73
73
-
values = _get_values(attribute, text)
74
74
-
n = len(values)
75
75
-
if n > 1:
76
76
-
raise ValueError("found too many values for {}".format(attribute))
77
77
-
elif n == 1:
78
78
-
return values[0]
79
79
-
else:
80
80
-
raise ValueError("no value found for {}".format(attribute))
81
81
-
82
82
-
def _get_line_and_value(attribute, text):
83
83
-
"""Match attribute in text. Return the line and the value of the attribute."""
84
84
-
regex = '({}\s+=\s+"(.*)";)'.format(attribute)
85
85
-
regex = re.compile(regex)
86
86
-
value = regex.findall(text)
87
87
-
n = len(value)
88
88
-
if n > 1:
89
89
-
raise ValueError("found too many values for {}".format(attribute))
90
90
-
elif n == 1:
91
91
-
return value[0]
92
92
-
else:
93
93
-
raise ValueError("no value found for {}".format(attribute))
94
94
-
95
95
-
96
96
-
def _replace_value(attribute, value, text):
97
97
-
"""Search and replace value of attribute in text."""
98
98
-
old_line, old_value = _get_line_and_value(attribute, text)
99
99
-
new_line = old_line.replace(old_value, value)
100
100
-
new_text = text.replace(old_line, new_line)
101
101
-
return new_text
102
102
-
103
103
-
def _fetch_page(url):
104
104
-
r = requests.get(url)
105
105
-
if r.status_code == requests.codes.ok:
106
106
-
return r.json()
107
107
-
else:
108
108
-
raise ValueError("request for {} failed".format(url))
109
109
-
110
110
-
111
111
-
SEMVER = {
112
112
-
'major' : 0,
113
113
-
'minor' : 1,
114
114
-
'patch' : 2,
115
115
-
}
116
116
-
117
117
-
118
118
-
def _determine_latest_version(current_version, target, versions):
119
119
-
"""Determine latest version, given `target`.
120
120
-
"""
121
121
-
current_version = Version(current_version)
122
122
-
123
123
-
def _parse_versions(versions):
124
124
-
for v in versions:
125
125
-
try:
126
126
-
yield Version(v)
127
127
-
except InvalidVersion:
128
128
-
pass
129
129
-
130
130
-
versions = _parse_versions(versions)
131
131
-
132
132
-
index = SEMVER[target]
133
133
-
134
134
-
ceiling = list(current_version[0:index])
135
135
-
if len(ceiling) == 0:
136
136
-
ceiling = None
137
137
-
else:
138
138
-
ceiling[-1]+=1
139
139
-
ceiling = Version(".".join(map(str, ceiling)))
140
140
-
141
141
-
# We do not want prereleases
142
142
-
versions = SpecifierSet(prereleases=PRERELEASES).filter(versions)
143
143
-
144
144
-
if ceiling is not None:
145
145
-
versions = SpecifierSet(f"<{ceiling}").filter(versions)
146
146
-
147
147
-
return (max(sorted(versions))).raw_version
148
148
-
149
149
-
150
150
-
def _get_latest_version_pypi(package, extension, current_version, target):
151
151
-
"""Get latest version and hash from PyPI."""
152
152
-
url = "{}/{}/json".format(INDEX, package)
153
153
-
json = _fetch_page(url)
154
154
-
155
155
-
versions = json['releases'].keys()
156
156
-
version = _determine_latest_version(current_version, target, versions)
157
157
-
158
158
-
try:
159
159
-
releases = json['releases'][version]
160
160
-
except KeyError as e:
161
161
-
raise KeyError('Could not find version {} for {}'.format(version, package)) from e
162
162
-
for release in releases:
163
163
-
if release['filename'].endswith(extension):
164
164
-
# TODO: In case of wheel we need to do further checks!
165
165
-
sha256 = release['digests']['sha256']
166
166
-
break
167
167
-
else:
168
168
-
sha256 = None
169
169
-
return version, sha256
170
170
-
171
171
-
172
172
-
def _get_latest_version_github(package, extension, current_version, target):
173
173
-
raise ValueError("updating from GitHub is not yet supported.")
174
174
-
175
175
-
176
176
-
FETCHERS = {
177
177
-
'fetchFromGitHub' : _get_latest_version_github,
178
178
-
'fetchPypi' : _get_latest_version_pypi,
179
179
-
'fetchurl' : _get_latest_version_pypi,
180
180
-
}
181
181
-
182
182
-
183
183
-
DEFAULT_SETUPTOOLS_EXTENSION = 'tar.gz'
184
184
-
185
185
-
186
186
-
FORMATS = {
187
187
-
'setuptools' : DEFAULT_SETUPTOOLS_EXTENSION,
188
188
-
'wheel' : 'whl'
189
189
-
}
190
190
-
191
191
-
def _determine_fetcher(text):
192
192
-
# Count occurences of fetchers.
193
193
-
nfetchers = sum(text.count('src = {}'.format(fetcher)) for fetcher in FETCHERS.keys())
194
194
-
if nfetchers == 0:
195
195
-
raise ValueError("no fetcher.")
196
196
-
elif nfetchers > 1:
197
197
-
raise ValueError("multiple fetchers.")
198
198
-
else:
199
199
-
# Then we check which fetcher to use.
200
200
-
for fetcher in FETCHERS.keys():
201
201
-
if 'src = {}'.format(fetcher) in text:
202
202
-
return fetcher
203
203
-
204
204
-
205
205
-
def _determine_extension(text, fetcher):
206
206
-
"""Determine what extension is used in the expression.
1
1
+
#!/bin/sh
2
2
+
exec nix-shell -p "python3.withPackages(ps: with ps; [ packaging requests toolz ])" -p git --run pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py
207
3
208
208
-
If we use:
209
209
-
- fetchPypi, we check if format is specified.
210
210
-
- fetchurl, we determine the extension from the url.
211
211
-
- fetchFromGitHub we simply use `.tar.gz`.
212
212
-
"""
213
213
-
if fetcher == 'fetchPypi':
214
214
-
try:
215
215
-
src_format = _get_unique_value('format', text)
216
216
-
except ValueError as e:
217
217
-
src_format = None # format was not given
218
218
-
219
219
-
try:
220
220
-
extension = _get_unique_value('extension', text)
221
221
-
except ValueError as e:
222
222
-
extension = None # extension was not given
223
223
-
224
224
-
if extension is None:
225
225
-
if src_format is None:
226
226
-
src_format = 'setuptools'
227
227
-
elif src_format == 'flit':
228
228
-
raise ValueError("Don't know how to update a Flit package.")
229
229
-
extension = FORMATS[src_format]
230
230
-
231
231
-
elif fetcher == 'fetchurl':
232
232
-
url = _get_unique_value('url', text)
233
233
-
extension = os.path.splitext(url)[1]
234
234
-
if 'pypi' not in url:
235
235
-
raise ValueError('url does not point to PyPI.')
236
236
-
237
237
-
elif fetcher == 'fetchFromGitHub':
238
238
-
raise ValueError('updating from GitHub is not yet implemented.')
239
239
-
240
240
-
return extension
241
241
-
242
242
-
243
243
-
def _update_package(path, target):
244
244
-
245
245
-
# Read the expression
246
246
-
with open(path, 'r') as f:
247
247
-
text = f.read()
248
248
-
249
249
-
# Determine pname.
250
250
-
pname = _get_unique_value('pname', text)
251
251
-
252
252
-
# Determine version.
253
253
-
version = _get_unique_value('version', text)
254
254
-
255
255
-
# First we check how many fetchers are mentioned.
256
256
-
fetcher = _determine_fetcher(text)
257
257
-
258
258
-
extension = _determine_extension(text, fetcher)
259
259
-
260
260
-
new_version, new_sha256 = FETCHERS[fetcher](pname, extension, version, target)
261
261
-
262
262
-
if new_version == version:
263
263
-
logging.info("Path {}: no update available for {}.".format(path, pname))
264
264
-
return False
265
265
-
elif Version(new_version) <= Version(version):
266
266
-
raise ValueError("downgrade for {}.".format(pname))
267
267
-
if not new_sha256:
268
268
-
raise ValueError("no file available for {}.".format(pname))
269
269
-
270
270
-
text = _replace_value('version', new_version, text)
271
271
-
text = _replace_value('sha256', new_sha256, text)
272
272
-
273
273
-
with open(path, 'w') as f:
274
274
-
f.write(text)
275
275
-
276
276
-
logging.info("Path {}: updated {} from {} to {}".format(path, pname, version, new_version))
277
277
-
278
278
-
result = {
279
279
-
'path' : path,
280
280
-
'target': target,
281
281
-
'pname': pname,
282
282
-
'old_version' : version,
283
283
-
'new_version' : new_version,
284
284
-
#'fetcher' : fetcher,
285
285
-
}
286
286
-
287
287
-
return result
288
288
-
289
289
-
290
290
-
def _update(path, target):
291
291
-
292
292
-
# We need to read and modify a Nix expression.
293
293
-
if os.path.isdir(path):
294
294
-
path = os.path.join(path, 'default.nix')
295
295
-
296
296
-
# If a default.nix does not exist, we quit.
297
297
-
if not os.path.isfile(path):
298
298
-
logging.info("Path {}: does not exist.".format(path))
299
299
-
return False
300
300
-
301
301
-
# If file is not a Nix expression, we quit.
302
302
-
if not path.endswith(".nix"):
303
303
-
logging.info("Path {}: does not end with `.nix`.".format(path))
304
304
-
return False
305
305
-
306
306
-
try:
307
307
-
return _update_package(path, target)
308
308
-
except ValueError as e:
309
309
-
logging.warning("Path {}: {}".format(path, e))
310
310
-
return False
311
311
-
312
312
-
313
313
-
def _commit(path, pname, old_version, new_version, **kwargs):
314
314
-
"""Commit result.
315
315
-
"""
316
316
-
317
317
-
msg = f'python: {pname}: {old_version} -> {new_version}'
318
318
-
319
319
-
try:
320
320
-
subprocess.check_call(['git', 'add', path])
321
321
-
subprocess.check_call(['git', 'commit', '-m', msg])
322
322
-
except subprocess.CalledProcessError as e:
323
323
-
subprocess.check_call(['git', 'checkout', path])
324
324
-
raise subprocess.CalledProcessError(f'Could not commit {path}') from e
325
325
-
326
326
-
return True
327
327
-
328
328
-
329
329
-
def main():
330
330
-
331
331
-
parser = argparse.ArgumentParser()
332
332
-
parser.add_argument('package', type=str, nargs='+')
333
333
-
parser.add_argument('--target', type=str, choices=SEMVER.keys(), default='major')
334
334
-
parser.add_argument('--commit', action='store_true', help='Create a commit for each package update')
335
335
-
336
336
-
args = parser.parse_args()
337
337
-
target = args.target
338
338
-
339
339
-
packages = list(map(os.path.abspath, args.package))
340
340
-
341
341
-
logging.info("Updating packages...")
342
342
-
343
343
-
# Use threads to update packages concurrently
344
344
-
with Pool() as p:
345
345
-
results = list(p.map(lambda pkg: _update(pkg, target), packages))
346
346
-
347
347
-
logging.info("Finished updating packages.")
348
348
-
349
349
-
# Commits are created sequentially.
350
350
-
if args.commit:
351
351
-
logging.info("Committing updates...")
352
352
-
list(map(lambda x: _commit(**x), filter(bool, results)))
353
353
-
logging.info("Finished committing updates")
354
354
-
355
355
-
count = sum(map(bool, results))
356
356
-
logging.info("{} package(s) updated".format(count))
357
357
-
358
358
-
359
359
-
360
360
-
if __name__ == '__main__':
361
361
-
main()
+17
-17
nixos/modules/services/databases/mysql.nix
···
29
29
installOptions =
30
30
"${mysqldAndInstallOptions} ${lib.optionalString isMysqlAtLeast57 "--insecure"}";
31
31
32
32
-
myCnf = pkgs.writeText "my.cnf"
33
33
-
''
34
34
-
[mysqld]
35
35
-
port = ${toString cfg.port}
36
36
-
datadir = ${cfg.dataDir}
37
37
-
${optionalString (cfg.bind != null) "bind-address = ${cfg.bind}" }
38
38
-
${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "log-bin=mysql-bin"}
39
39
-
${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "server-id = ${toString cfg.replication.serverId}"}
40
40
-
${optionalString (cfg.ensureUsers != [])
41
41
-
''
42
42
-
plugin-load-add = auth_socket.so
43
43
-
''}
44
44
-
${cfg.extraOptions}
45
45
-
'';
46
46
-
47
32
in
48
33
49
34
{
···
242
227
243
228
environment.systemPackages = [mysql];
244
229
230
230
+
environment.etc."my.cnf".text =
231
231
+
''
232
232
+
[mysqld]
233
233
+
port = ${toString cfg.port}
234
234
+
datadir = ${cfg.dataDir}
235
235
+
${optionalString (cfg.bind != null) "bind-address = ${cfg.bind}" }
236
236
+
${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "log-bin=mysql-bin"}
237
237
+
${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "server-id = ${toString cfg.replication.serverId}"}
238
238
+
${optionalString (cfg.ensureUsers != [])
239
239
+
''
240
240
+
plugin-load-add = auth_socket.so
241
241
+
''}
242
242
+
${cfg.extraOptions}
243
243
+
'';
244
244
+
245
245
systemd.services.mysql = let
246
246
hasNotify = (cfg.package == pkgs.mariadb);
247
247
in {
···
263
263
if ! test -e ${cfg.dataDir}/mysql; then
264
264
mkdir -m 0700 -p ${cfg.dataDir}
265
265
chown -R ${cfg.user} ${cfg.dataDir}
266
266
-
${mysql}/bin/mysql_install_db ${installOptions}
266
266
+
${mysql}/bin/mysql_install_db --defaults-file=/etc/my.cnf ${installOptions}
267
267
touch /tmp/mysql_init
268
268
fi
269
269
···
274
274
serviceConfig = {
275
275
Type = if hasNotify then "notify" else "simple";
276
276
RuntimeDirectory = "mysqld";
277
277
-
ExecStart = "${mysql}/bin/mysqld --defaults-extra-file=${myCnf} ${mysqldOptions}";
277
277
+
ExecStart = "${mysql}/bin/mysqld --defaults-file=/etc/my.cnf ${mysqldOptions}";
278
278
};
279
279
280
280
postStart = ''
+1
-1
pkgs/applications/altcoins/monero-gui/default.nix
···
60
60
name = "monero-wallet-gui";
61
61
exec = "monero-wallet-gui";
62
62
icon = "monero";
63
63
-
desktopName = "Monero Wallet";
63
63
+
desktopName = "Monero";
64
64
genericName = "Wallet";
65
65
categories = "Application;Network;Utility;";
66
66
};
+4
-4
pkgs/applications/audio/opus-tools/default.nix
···
1
1
-
{stdenv, fetchurl, libogg, libao, pkgconfig, libopus, flac}:
1
1
+
{stdenv, fetchurl, libogg, libao, pkgconfig, flac, opusfile, libopusenc}:
2
2
3
3
stdenv.mkDerivation rec {
4
4
-
name = "opus-tools-0.1.10";
4
4
+
name = "opus-tools-0.2";
5
5
src = fetchurl {
6
6
url = "http://downloads.xiph.org/releases/opus/${name}.tar.gz";
7
7
-
sha256 = "135jfb9ny3xvd27idsxj7j5ns90lslbyrq70cq3bfwcls4r7add2";
7
7
+
sha256 = "11pzl27s4vcz4m18ch72nivbhww2zmzn56wspb7rll1y1nq6rrdl";
8
8
};
9
9
10
10
nativeBuildInputs = [ pkgconfig ];
11
11
-
buildInputs = [ libogg libao libopus flac ];
11
11
+
buildInputs = [ libogg libao flac opusfile libopusenc ];
12
12
13
13
meta = {
14
14
description = "Tools to work with opus encoded audio streams";
+2
-2
pkgs/applications/misc/aminal/default.nix
···
12
12
13
13
buildGoPackage rec {
14
14
name = "aminal-${version}";
15
15
-
version = "0.7.8";
15
15
+
version = "0.7.12";
16
16
17
17
goPackagePath = "github.com/liamg/aminal";
18
18
···
36
36
owner = "liamg";
37
37
repo = "aminal";
38
38
rev = "v${version}";
39
39
-
sha256 = "02gamvvs56w4zwqdvalbsgb2gbh0398gl7qk36pgyqkcgj3bcwv8";
39
39
+
sha256 = "1ak5g2i4ggi00b4q7qigfwsrwb5rvswjjbr2hp9kyxd45nycb0g4";
40
40
};
41
41
42
42
preBuild = ''
+8
-2
pkgs/applications/networking/cluster/cni/default.nix
···
1
1
-
{ stdenv, fetchFromGitHub, go }:
1
1
+
{ stdenv, fetchFromGitHub, go, removeReferencesTo }:
2
2
3
3
stdenv.mkDerivation rec {
4
4
name = "cni-${version}";
···
11
11
sha256 = "00ajs2r5r2z3l0vqwxrcwhjfc9px12qbcv5vnvs2mdipvvls1y2y";
12
12
};
13
13
14
14
-
buildInputs = [ go ];
14
14
+
buildInputs = [ removeReferencesTo go ];
15
15
+
16
16
+
GOCACHE = "off";
15
17
16
18
buildPhase = ''
17
19
patchShebangs build.sh
···
21
23
installPhase = ''
22
24
mkdir -p $out/bin
23
25
mv bin/cnitool $out/bin
26
26
+
'';
27
27
+
28
28
+
preFixup = ''
29
29
+
find $out/bin -type f -exec remove-references-to -t ${go} '{}' +
24
30
'';
25
31
26
32
meta = with stdenv.lib; {
+8
-2
pkgs/applications/networking/cluster/cni/plugins.nix
···
1
1
-
{ stdenv, lib, fetchFromGitHub, go }:
1
1
+
{ stdenv, lib, fetchFromGitHub, go, removeReferencesTo }:
2
2
3
3
stdenv.mkDerivation rec {
4
4
name = "cni-plugins-${version}";
···
11
11
sha256 = "1sywllwnr6lc812sgkqjdd3y10r82shl88dlnwgnbgzs738q2vp2";
12
12
};
13
13
14
14
-
buildInputs = [ go ];
14
14
+
buildInputs = [ removeReferencesTo go ];
15
15
+
16
16
+
GOCACHE = "off";
15
17
16
18
buildPhase = ''
17
19
patchShebangs build.sh
···
21
23
installPhase = ''
22
24
mkdir -p $out/bin
23
25
mv bin/* $out/bin
26
26
+
'';
27
27
+
28
28
+
preFixup = ''
29
29
+
find $out/bin -type f -exec remove-references-to -t ${go} '{}' +
24
30
'';
25
31
26
32
meta = with lib; {
+2
-2
pkgs/applications/networking/instant-messengers/bitlbee-discord/default.nix
···
3
3
with stdenv.lib;
4
4
stdenv.mkDerivation rec {
5
5
name = "bitlbee-discord-${version}";
6
6
-
version = "0.4.1";
6
6
+
version = "0.4.2";
7
7
8
8
src = fetchFromGitHub {
9
9
rev = version;
10
10
owner = "sm00th";
11
11
repo = "bitlbee-discord";
12
12
-
sha256 = "1n3xw5mcmg7224r09gbm39bd6h2158dwl6jx21290636b4345f4c";
12
12
+
sha256 = "02pigk2vbz0jdz11f96sygdvp1j762yjn62h124fkcsc070g7a2f";
13
13
};
14
14
15
15
nativeBuildInputs = [ autoreconfHook pkgconfig ];
+4
-4
pkgs/applications/networking/vnstat/default.nix
···
1
1
-
{ stdenv, fetchurl, gd, ncurses }:
1
1
+
{ stdenv, fetchurl, gd, ncurses, sqlite }:
2
2
3
3
stdenv.mkDerivation rec {
4
4
name = "vnstat-${version}";
5
5
-
version = "1.18";
5
5
+
version = "2.1";
6
6
7
7
src = fetchurl {
8
8
-
sha256 = "1mc7qqvrnl0zyhgh8n7wx1g1cbwq74xpvbz8rfjmyi77p693a6fp";
8
8
+
sha256 = "0yk0x6bg9f36dsslhayyyi8fg04yvzjzqkjmlrcsrv6nnggchb6i";
9
9
url = "https://humdi.net/vnstat/${name}.tar.gz";
10
10
};
11
11
12
12
-
buildInputs = [ gd ncurses ];
12
12
+
buildInputs = [ gd ncurses sqlite ];
13
13
14
14
postPatch = ''
15
15
substituteInPlace src/cfg.c --replace /usr/local $out
+2
-9
pkgs/applications/office/todoman/default.nix
···
5
5
in
6
6
buildPythonApplication rec {
7
7
pname = "todoman";
8
8
-
version = "3.4.1";
8
8
+
version = "3.5.0";
9
9
name = "${pname}-${version}";
10
10
11
11
src = fetchPypi {
12
12
inherit pname version;
13
13
-
sha256 = "1rvid1rklvgvsf6xmxd91j2fi46v4fzn5z6zbs5yn0wpb0k605r5";
13
13
+
sha256 = "051qjdpwif06x7qspnb4pfwdhb8nnmz99yqcp4kla5hv0n3jh0w9";
14
14
};
15
15
16
16
LOCALE_ARCHIVE = stdenv.lib.optionalString stdenv.isLinux
···
28
28
29
29
makeWrapperArgs = [ "--set LOCALE_ARCHIVE ${glibcLocales}/lib/locale/locale-archive"
30
30
"--set CHARSET en_us.UTF-8" ];
31
31
-
32
32
-
patches = [
33
33
-
(fetchpatch {
34
34
-
url = "https://github.com/pimutils/todoman/commit/3e191111b72df9ec91a773befefa291799374422.patch";
35
35
-
sha256 = "12mskbp0d8p2lllkxm3m9wyy2hsbnz2qs297civsc3ly2l5bcrag";
36
36
-
})
37
37
-
];
38
31
39
32
preCheck = ''
40
33
# Remove one failing test that only checks whether the command line works
+3
-3
pkgs/applications/science/astronomy/gildas/default.nix
···
7
7
in
8
8
9
9
stdenv.mkDerivation rec {
10
10
-
srcVersion = "nov18a";
11
11
-
version = "20181101_a";
10
10
+
srcVersion = "dec18a";
11
11
+
version = "20181201_a";
12
12
name = "gildas-${version}";
13
13
14
14
src = fetchurl {
···
16
16
# source code of the previous release to a different directory
17
17
urls = [ "http://www.iram.fr/~gildas/dist/gildas-src-${srcVersion}.tar.gz"
18
18
"http://www.iram.fr/~gildas/dist/archive/gildas/gildas-src-${srcVersion}.tar.gz" ];
19
19
-
sha256 = "1dl2v8y6vrwaxm3b7nf6dv3ipzybhlhy2kxwnwgc7gqz5704251v";
19
19
+
sha256 = "f295b5b7f999c0d746a52b307af7b7bdbed0d9b3d87100a6a102e0cc64f3a9bd";
20
20
};
21
21
22
22
enableParallelBuilding = true;
+3
-3
pkgs/build-support/agda/default.nix
···
3
3
# Contact: stdenv.lib.maintainers.fuuzetsu
4
4
5
5
{ stdenv, Agda, glibcLocales
6
6
-
, writeScriptBin
6
6
+
, writeShellScriptBin
7
7
, extension ? (self: super: {})
8
8
}:
9
9
···
77
77
buildInputs = let
78
78
# Makes a wrapper available to the user. Very useful in
79
79
# nix-shell where all dependencies are -i'd.
80
80
-
agdaWrapper = writeScriptBin "agda" ''
81
81
-
${self.agdaWithArgs} "$@"
80
80
+
agdaWrapper = writeShellScriptBin "agda" ''
81
81
+
exec ${self.agdaWithArgs} "$@"
82
82
'';
83
83
in [agdaWrapper] ++ self.buildDepends;
84
84
};
+7
-2
pkgs/data/icons/elementary-icon-theme/default.nix
···
2
2
3
3
stdenv.mkDerivation rec {
4
4
name = "elementary-icon-theme-${version}";
5
5
-
version = "5.0";
5
5
+
version = "5.0.1";
6
6
7
7
src = fetchFromGitHub {
8
8
owner = "elementary";
9
9
repo = "icons";
10
10
rev = version;
11
11
-
sha256 = "146s26q4bb5sag35iv42hrnbdciam2ajl7s5s5jayli5vp8bw08w";
11
11
+
sha256 = "1rw924b3ixfdff368dpv4vgsykwncmrvj9a6yfss0cf236xnvr9b";
12
12
};
13
13
14
14
nativeBuildInputs = [ meson ninja python3 gtk3 ];
15
15
+
16
16
+
# Disable installing gimp and inkscape palette files
17
17
+
mesonFlags = [
18
18
+
"-Dpalettes=false"
19
19
+
];
15
20
16
21
postPatch = ''
17
22
chmod +x meson/symlink.py
+232
pkgs/development/compilers/ghc/8.6.3.nix
···
1
1
+
{ stdenv, targetPackages
2
2
+
3
3
+
# build-tools
4
4
+
, bootPkgs
5
5
+
, autoconf, automake, coreutils, fetchurl, fetchpatch, perl, python3, m4, sphinx
6
6
+
7
7
+
, libiconv ? null, ncurses
8
8
+
9
9
+
, useLLVM ? !stdenv.targetPlatform.isx86 || (stdenv.targetPlatform.isMusl && stdenv.hostPlatform != stdenv.targetPlatform)
10
10
+
, # LLVM is conceptually a run-time-only depedendency, but for
11
11
+
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
12
12
+
# build-time dependency too.
13
13
+
buildLlvmPackages, llvmPackages
14
14
+
15
15
+
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
16
16
+
# library instead of the faster but GPLed integer-gmp library.
17
17
+
enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp
18
18
+
19
19
+
, # If enabled, use -fPIC when compiling static libs.
20
20
+
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
21
21
+
22
22
+
, # Whether to build dynamic libs for the standard library (on the target
23
23
+
# platform). Static libs are always built.
24
24
+
enableShared ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.useiOSPrebuilt
25
25
+
26
26
+
, # Whetherto build terminfo.
27
27
+
enableTerminfo ? !stdenv.targetPlatform.isWindows
28
28
+
29
29
+
, # What flavour to build. An empty string indicates no
30
30
+
# specific flavour and falls back to ghc default values.
31
31
+
ghcFlavour ? stdenv.lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) "perf-cross"
32
32
+
}:
33
33
+
34
34
+
assert !enableIntegerSimple -> gmp != null;
35
35
+
36
36
+
let
37
37
+
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
38
38
+
39
39
+
inherit (bootPkgs) ghc;
40
40
+
41
41
+
# TODO(@Ericson2314) Make unconditional
42
42
+
targetPrefix = stdenv.lib.optionalString
43
43
+
(targetPlatform != hostPlatform)
44
44
+
"${targetPlatform.config}-";
45
45
+
46
46
+
buildMK = ''
47
47
+
BuildFlavour = ${ghcFlavour}
48
48
+
ifneq \"\$(BuildFlavour)\" \"\"
49
49
+
include mk/flavours/\$(BuildFlavour).mk
50
50
+
endif
51
51
+
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
52
52
+
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
53
53
+
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
54
54
+
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
55
55
+
CrossCompilePrefix = ${targetPrefix}
56
56
+
HADDOCK_DOCS = NO
57
57
+
BUILD_SPHINX_HTML = NO
58
58
+
BUILD_SPHINX_PDF = NO
59
59
+
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
60
60
+
GhcLibHcOpts += -fPIC
61
61
+
GhcRtsHcOpts += -fPIC
62
62
+
'' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt ''
63
63
+
EXTRA_CC_OPTS += -std=gnu99
64
64
+
'';
65
65
+
66
66
+
# Splicer will pull out correct variations
67
67
+
libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ]
68
68
+
++ stdenv.lib.optional (!enableIntegerSimple) gmp
69
69
+
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
70
70
+
71
71
+
toolsForTarget =
72
72
+
if hostPlatform == buildPlatform then
73
73
+
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm
74
74
+
else assert targetPlatform == hostPlatform; # build != host == target
75
75
+
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
76
76
+
77
77
+
targetCC = builtins.head toolsForTarget;
78
78
+
79
79
+
in
80
80
+
stdenv.mkDerivation (rec {
81
81
+
version = "8.6.3";
82
82
+
name = "${targetPrefix}ghc-${version}";
83
83
+
84
84
+
src = fetchurl {
85
85
+
url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
86
86
+
sha256 = "08vzq0dpg4a39bs61j6rq4z0n7jby5mc69h4m25xhd8rjyvkg7lz";
87
87
+
};
88
88
+
89
89
+
enableParallelBuilding = true;
90
90
+
91
91
+
outputs = [ "out" "doc" ];
92
92
+
93
93
+
patches = [(fetchpatch rec { # https://phabricator.haskell.org/D5123
94
94
+
url = "http://tarballs.nixos.org/sha256/${sha256}";
95
95
+
name = "D5123.diff";
96
96
+
sha256 = "0nhqwdamf2y4gbwqxcgjxs0kqx23w9gv5kj0zv6450dq19rji82n";
97
97
+
})];
98
98
+
99
99
+
postPatch = "patchShebangs .";
100
100
+
101
101
+
# GHC is a bit confused on its cross terminology.
102
102
+
preConfigure = ''
103
103
+
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
104
104
+
export "''${env#TARGET_}=''${!env}"
105
105
+
done
106
106
+
# GHC is a bit confused on its cross terminology, as these would normally be
107
107
+
# the *host* tools.
108
108
+
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
109
109
+
export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx"
110
110
+
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
111
111
+
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString targetPlatform.isAarch32 ".gold"}"
112
112
+
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
113
113
+
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
114
114
+
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
115
115
+
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
116
116
+
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
117
117
+
export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
118
118
+
119
119
+
echo -n "${buildMK}" > mk/build.mk
120
120
+
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
121
121
+
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
122
122
+
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
123
123
+
'' + stdenv.lib.optionalString stdenv.isDarwin ''
124
124
+
export NIX_LDFLAGS+=" -no_dtrace_dof"
125
125
+
'' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt ''
126
126
+
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
127
127
+
'' + stdenv.lib.optionalString targetPlatform.isMusl ''
128
128
+
echo "patching llvm-targets for musl targets..."
129
129
+
echo "Cloning these existing '*-linux-gnu*' targets:"
130
130
+
grep linux-gnu llvm-targets | sed 's/^/ /'
131
131
+
echo "(go go gadget sed)"
132
132
+
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
133
133
+
echo "llvm-targets now contains these '*-linux-musl*' targets:"
134
134
+
grep linux-musl llvm-targets | sed 's/^/ /'
135
135
+
136
136
+
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
137
137
+
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
138
138
+
for x in configure aclocal.m4; do
139
139
+
substituteInPlace $x \
140
140
+
--replace '*-android*|*-gnueabi*)' \
141
141
+
'*-android*|*-gnueabi*|*-musleabi*)'
142
142
+
done
143
143
+
'';
144
144
+
145
145
+
# TODO(@Ericson2314): Always pass "--target" and always prefix.
146
146
+
configurePlatforms = [ "build" "host" ]
147
147
+
++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
148
148
+
# `--with` flags for libraries needed for RTS linker
149
149
+
configureFlags = [
150
150
+
"--datadir=$doc/share/doc/ghc"
151
151
+
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
152
152
+
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && !enableIntegerSimple) [
153
153
+
"--with-gmp-includes=${targetPackages.gmp.dev}/include" "--with-gmp-libraries=${targetPackages.gmp.out}/lib"
154
154
+
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
155
155
+
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
156
156
+
] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [
157
157
+
"--enable-bootstrap-with-devel-snapshot"
158
158
+
] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [
159
159
+
"CFLAGS=-fuse-ld=gold"
160
160
+
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
161
161
+
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
162
162
+
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
163
163
+
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
164
164
+
"--disable-large-address-space"
165
165
+
];
166
166
+
167
167
+
# Make sure we never relax`$PATH` and hooks support for compatability.
168
168
+
strictDeps = true;
169
169
+
170
170
+
nativeBuildInputs = [
171
171
+
perl autoconf automake m4 python3 sphinx
172
172
+
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
173
173
+
];
174
174
+
175
175
+
# For building runtime libs
176
176
+
depsBuildTarget = toolsForTarget;
177
177
+
178
178
+
buildInputs = [ perl ] ++ (libDeps hostPlatform);
179
179
+
180
180
+
propagatedBuildInputs = [ targetPackages.stdenv.cc ]
181
181
+
++ stdenv.lib.optional useLLVM llvmPackages.llvm;
182
182
+
183
183
+
depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform);
184
184
+
depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") (libDeps targetPlatform);
185
185
+
186
186
+
# required, because otherwise all symbols from HSffi.o are stripped, and
187
187
+
# that in turn causes GHCi to abort
188
188
+
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
189
189
+
190
190
+
checkTarget = "test";
191
191
+
192
192
+
hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie";
193
193
+
194
194
+
postInstall = ''
195
195
+
for bin in "$out"/lib/${name}/bin/*; do
196
196
+
isELF "$bin" || continue
197
197
+
paxmark m "$bin"
198
198
+
done
199
199
+
200
200
+
# Install the bash completion file.
201
201
+
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
202
202
+
203
203
+
# Patch scripts to include "readelf" and "cat" in $PATH.
204
204
+
for i in "$out/bin/"*; do
205
205
+
test ! -h $i || continue
206
206
+
egrep --quiet '^#!' <(head -n 1 $i) || continue
207
207
+
sed -i -e '2i export PATH="$PATH:${stdenv.lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i
208
208
+
done
209
209
+
'';
210
210
+
211
211
+
passthru = {
212
212
+
inherit bootPkgs targetPrefix;
213
213
+
214
214
+
inherit llvmPackages;
215
215
+
inherit enableShared;
216
216
+
217
217
+
# Our Cabal compiler name
218
218
+
haskellCompilerName = "ghc-8.6.3";
219
219
+
};
220
220
+
221
221
+
meta = {
222
222
+
homepage = http://haskell.org/ghc;
223
223
+
description = "The Glasgow Haskell Compiler";
224
224
+
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
225
225
+
inherit (ghc.meta) license platforms;
226
226
+
};
227
227
+
228
228
+
} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
229
229
+
dontStrip = true;
230
230
+
dontPatchELF = true;
231
231
+
noAuditTmpdir = true;
232
232
+
})
+4
-1
pkgs/development/interpreters/python/build-python-package.nix
···
12
12
, namePrefix
13
13
, bootstrapped-pip
14
14
, flit
15
15
+
, writeScript
16
16
+
, update-python-libraries
15
17
}:
16
18
17
19
let
···
20
22
wheel-specific = import ./build-python-package-wheel.nix { };
21
23
common = import ./build-python-package-common.nix { inherit python bootstrapped-pip; };
22
24
mkPythonDerivation = import ./mk-python-derivation.nix {
23
23
-
inherit lib config python wrapPython setuptools unzip ensureNewerSourcesForZipFilesHook toPythonModule namePrefix;
25
25
+
inherit lib config python wrapPython setuptools unzip ensureNewerSourcesForZipFilesHook;
26
26
+
inherit toPythonModule namePrefix writeScript update-python-libraries;
24
27
};
25
28
in
26
29
+14
-2
pkgs/development/interpreters/python/mk-python-derivation.nix
···
10
10
# Whether the derivation provides a Python module or not.
11
11
, toPythonModule
12
12
, namePrefix
13
13
+
, writeScript
14
14
+
, update-python-libraries
13
15
}:
14
16
15
17
{ name ? "${attrs.pname}-${attrs.version}"
···
64
66
then throw "${name} not supported for interpreter ${python.executable}"
65
67
else
66
68
67
67
-
toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
69
69
+
let self = toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
68
70
"disabled" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts"
69
71
] // {
70
72
···
106
108
platforms = python.meta.platforms;
107
109
isBuildPythonPackage = python.meta.platforms;
108
110
} // meta;
109
109
-
}))
111
111
+
}));
112
112
+
113
113
+
passthru = {
114
114
+
updateScript = let
115
115
+
filename = builtins.head (lib.splitString ":" self.meta.position);
116
116
+
in writeScript "update-python" ''
117
117
+
#!${python.stdenv.shell}
118
118
+
${update-python-libraries} ${filename}
119
119
+
'';
120
120
+
};
121
121
+
in lib.extendDerivation true passthru self
+12
pkgs/development/interpreters/python/update-python-libraries/default.nix
···
1
1
+
{ python3, runCommand, git }:
2
2
+
3
3
+
runCommand "update-python-libraries" {
4
4
+
buildInputs = [
5
5
+
(python3.withPackages(ps: with ps; [ packaging requests toolz ]))
6
6
+
git
7
7
+
];
8
8
+
} ''
9
9
+
cp ${./update-python-libraries.py} $out
10
10
+
patchShebangs $out
11
11
+
substituteInPlace $out --replace 'GIT = "git"' 'GIT = "${git}/bin/git"'
12
12
+
''
+362
pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py
···
1
1
+
#!/usr/bin/env python3
2
2
+
3
3
+
"""
4
4
+
Update a Python package expression by passing in the `.nix` file, or the directory containing it.
5
5
+
You can pass in multiple files or paths.
6
6
+
7
7
+
You'll likely want to use
8
8
+
``
9
9
+
$ ./update-python-libraries ../../pkgs/development/python-modules/*
10
10
+
``
11
11
+
to update all libraries in that folder.
12
12
+
"""
13
13
+
14
14
+
import argparse
15
15
+
import logging
16
16
+
import os
17
17
+
import re
18
18
+
import requests
19
19
+
import toolz
20
20
+
from concurrent.futures import ThreadPoolExecutor as Pool
21
21
+
from packaging.version import Version as _Version
22
22
+
from packaging.version import InvalidVersion
23
23
+
from packaging.specifiers import SpecifierSet
24
24
+
import collections
25
25
+
import subprocess
26
26
+
27
27
+
INDEX = "https://pypi.io/pypi"
28
28
+
"""url of PyPI"""
29
29
+
30
30
+
EXTENSIONS = ['tar.gz', 'tar.bz2', 'tar', 'zip', '.whl']
31
31
+
"""Permitted file extensions. These are evaluated from left to right and the first occurance is returned."""
32
32
+
33
33
+
PRERELEASES = False
34
34
+
35
35
+
GIT = "git"
36
36
+
37
37
+
import logging
38
38
+
logging.basicConfig(level=logging.INFO)
39
39
+
40
40
+
41
41
+
class Version(_Version, collections.abc.Sequence):
42
42
+
43
43
+
def __init__(self, version):
44
44
+
super().__init__(version)
45
45
+
# We cannot use `str(Version(0.04.21))` because that becomes `0.4.21`
46
46
+
# https://github.com/avian2/unidecode/issues/13#issuecomment-354538882
47
47
+
self.raw_version = version
48
48
+
49
49
+
def __getitem__(self, i):
50
50
+
return self._version.release[i]
51
51
+
52
52
+
def __len__(self):
53
53
+
return len(self._version.release)
54
54
+
55
55
+
def __iter__(self):
56
56
+
yield from self._version.release
57
57
+
58
58
+
59
59
+
def _get_values(attribute, text):
60
60
+
"""Match attribute in text and return all matches.
61
61
+
62
62
+
:returns: List of matches.
63
63
+
"""
64
64
+
regex = '{}\s+=\s+"(.*)";'.format(attribute)
65
65
+
regex = re.compile(regex)
66
66
+
values = regex.findall(text)
67
67
+
return values
68
68
+
69
69
+
def _get_unique_value(attribute, text):
70
70
+
"""Match attribute in text and return unique match.
71
71
+
72
72
+
:returns: Single match.
73
73
+
"""
74
74
+
values = _get_values(attribute, text)
75
75
+
n = len(values)
76
76
+
if n > 1:
77
77
+
raise ValueError("found too many values for {}".format(attribute))
78
78
+
elif n == 1:
79
79
+
return values[0]
80
80
+
else:
81
81
+
raise ValueError("no value found for {}".format(attribute))
82
82
+
83
83
+
def _get_line_and_value(attribute, text):
84
84
+
"""Match attribute in text. Return the line and the value of the attribute."""
85
85
+
regex = '({}\s+=\s+"(.*)";)'.format(attribute)
86
86
+
regex = re.compile(regex)
87
87
+
value = regex.findall(text)
88
88
+
n = len(value)
89
89
+
if n > 1:
90
90
+
raise ValueError("found too many values for {}".format(attribute))
91
91
+
elif n == 1:
92
92
+
return value[0]
93
93
+
else:
94
94
+
raise ValueError("no value found for {}".format(attribute))
95
95
+
96
96
+
97
97
+
def _replace_value(attribute, value, text):
98
98
+
"""Search and replace value of attribute in text."""
99
99
+
old_line, old_value = _get_line_and_value(attribute, text)
100
100
+
new_line = old_line.replace(old_value, value)
101
101
+
new_text = text.replace(old_line, new_line)
102
102
+
return new_text
103
103
+
104
104
+
def _fetch_page(url):
105
105
+
r = requests.get(url)
106
106
+
if r.status_code == requests.codes.ok:
107
107
+
return r.json()
108
108
+
else:
109
109
+
raise ValueError("request for {} failed".format(url))
110
110
+
111
111
+
112
112
+
SEMVER = {
113
113
+
'major' : 0,
114
114
+
'minor' : 1,
115
115
+
'patch' : 2,
116
116
+
}
117
117
+
118
118
+
119
119
+
def _determine_latest_version(current_version, target, versions):
120
120
+
"""Determine latest version, given `target`.
121
121
+
"""
122
122
+
current_version = Version(current_version)
123
123
+
124
124
+
def _parse_versions(versions):
125
125
+
for v in versions:
126
126
+
try:
127
127
+
yield Version(v)
128
128
+
except InvalidVersion:
129
129
+
pass
130
130
+
131
131
+
versions = _parse_versions(versions)
132
132
+
133
133
+
index = SEMVER[target]
134
134
+
135
135
+
ceiling = list(current_version[0:index])
136
136
+
if len(ceiling) == 0:
137
137
+
ceiling = None
138
138
+
else:
139
139
+
ceiling[-1]+=1
140
140
+
ceiling = Version(".".join(map(str, ceiling)))
141
141
+
142
142
+
# We do not want prereleases
143
143
+
versions = SpecifierSet(prereleases=PRERELEASES).filter(versions)
144
144
+
145
145
+
if ceiling is not None:
146
146
+
versions = SpecifierSet(f"<{ceiling}").filter(versions)
147
147
+
148
148
+
return (max(sorted(versions))).raw_version
149
149
+
150
150
+
151
151
+
def _get_latest_version_pypi(package, extension, current_version, target):
152
152
+
"""Get latest version and hash from PyPI."""
153
153
+
url = "{}/{}/json".format(INDEX, package)
154
154
+
json = _fetch_page(url)
155
155
+
156
156
+
versions = json['releases'].keys()
157
157
+
version = _determine_latest_version(current_version, target, versions)
158
158
+
159
159
+
try:
160
160
+
releases = json['releases'][version]
161
161
+
except KeyError as e:
162
162
+
raise KeyError('Could not find version {} for {}'.format(version, package)) from e
163
163
+
for release in releases:
164
164
+
if release['filename'].endswith(extension):
165
165
+
# TODO: In case of wheel we need to do further checks!
166
166
+
sha256 = release['digests']['sha256']
167
167
+
break
168
168
+
else:
169
169
+
sha256 = None
170
170
+
return version, sha256
171
171
+
172
172
+
173
173
+
def _get_latest_version_github(package, extension, current_version, target):
174
174
+
raise ValueError("updating from GitHub is not yet supported.")
175
175
+
176
176
+
177
177
+
FETCHERS = {
178
178
+
'fetchFromGitHub' : _get_latest_version_github,
179
179
+
'fetchPypi' : _get_latest_version_pypi,
180
180
+
'fetchurl' : _get_latest_version_pypi,
181
181
+
}
182
182
+
183
183
+
184
184
+
DEFAULT_SETUPTOOLS_EXTENSION = 'tar.gz'
185
185
+
186
186
+
187
187
+
FORMATS = {
188
188
+
'setuptools' : DEFAULT_SETUPTOOLS_EXTENSION,
189
189
+
'wheel' : 'whl'
190
190
+
}
191
191
+
192
192
+
def _determine_fetcher(text):
193
193
+
# Count occurences of fetchers.
194
194
+
nfetchers = sum(text.count('src = {}'.format(fetcher)) for fetcher in FETCHERS.keys())
195
195
+
if nfetchers == 0:
196
196
+
raise ValueError("no fetcher.")
197
197
+
elif nfetchers > 1:
198
198
+
raise ValueError("multiple fetchers.")
199
199
+
else:
200
200
+
# Then we check which fetcher to use.
201
201
+
for fetcher in FETCHERS.keys():
202
202
+
if 'src = {}'.format(fetcher) in text:
203
203
+
return fetcher
204
204
+
205
205
+
206
206
+
def _determine_extension(text, fetcher):
207
207
+
"""Determine what extension is used in the expression.
208
208
+
209
209
+
If we use:
210
210
+
- fetchPypi, we check if format is specified.
211
211
+
- fetchurl, we determine the extension from the url.
212
212
+
- fetchFromGitHub we simply use `.tar.gz`.
213
213
+
"""
214
214
+
if fetcher == 'fetchPypi':
215
215
+
try:
216
216
+
src_format = _get_unique_value('format', text)
217
217
+
except ValueError as e:
218
218
+
src_format = None # format was not given
219
219
+
220
220
+
try:
221
221
+
extension = _get_unique_value('extension', text)
222
222
+
except ValueError as e:
223
223
+
extension = None # extension was not given
224
224
+
225
225
+
if extension is None:
226
226
+
if src_format is None:
227
227
+
src_format = 'setuptools'
228
228
+
elif src_format == 'flit':
229
229
+
raise ValueError("Don't know how to update a Flit package.")
230
230
+
extension = FORMATS[src_format]
231
231
+
232
232
+
elif fetcher == 'fetchurl':
233
233
+
url = _get_unique_value('url', text)
234
234
+
extension = os.path.splitext(url)[1]
235
235
+
if 'pypi' not in url:
236
236
+
raise ValueError('url does not point to PyPI.')
237
237
+
238
238
+
elif fetcher == 'fetchFromGitHub':
239
239
+
raise ValueError('updating from GitHub is not yet implemented.')
240
240
+
241
241
+
return extension
242
242
+
243
243
+
244
244
+
def _update_package(path, target):
245
245
+
246
246
+
# Read the expression
247
247
+
with open(path, 'r') as f:
248
248
+
text = f.read()
249
249
+
250
250
+
# Determine pname.
251
251
+
pname = _get_unique_value('pname', text)
252
252
+
253
253
+
# Determine version.
254
254
+
version = _get_unique_value('version', text)
255
255
+
256
256
+
# First we check how many fetchers are mentioned.
257
257
+
fetcher = _determine_fetcher(text)
258
258
+
259
259
+
extension = _determine_extension(text, fetcher)
260
260
+
261
261
+
new_version, new_sha256 = FETCHERS[fetcher](pname, extension, version, target)
262
262
+
263
263
+
if new_version == version:
264
264
+
logging.info("Path {}: no update available for {}.".format(path, pname))
265
265
+
return False
266
266
+
elif Version(new_version) <= Version(version):
267
267
+
raise ValueError("downgrade for {}.".format(pname))
268
268
+
if not new_sha256:
269
269
+
raise ValueError("no file available for {}.".format(pname))
270
270
+
271
271
+
text = _replace_value('version', new_version, text)
272
272
+
text = _replace_value('sha256', new_sha256, text)
273
273
+
274
274
+
with open(path, 'w') as f:
275
275
+
f.write(text)
276
276
+
277
277
+
logging.info("Path {}: updated {} from {} to {}".format(path, pname, version, new_version))
278
278
+
279
279
+
result = {
280
280
+
'path' : path,
281
281
+
'target': target,
282
282
+
'pname': pname,
283
283
+
'old_version' : version,
284
284
+
'new_version' : new_version,
285
285
+
#'fetcher' : fetcher,
286
286
+
}
287
287
+
288
288
+
return result
289
289
+
290
290
+
291
291
+
def _update(path, target):
292
292
+
293
293
+
# We need to read and modify a Nix expression.
294
294
+
if os.path.isdir(path):
295
295
+
path = os.path.join(path, 'default.nix')
296
296
+
297
297
+
# If a default.nix does not exist, we quit.
298
298
+
if not os.path.isfile(path):
299
299
+
logging.info("Path {}: does not exist.".format(path))
300
300
+
return False
301
301
+
302
302
+
# If file is not a Nix expression, we quit.
303
303
+
if not path.endswith(".nix"):
304
304
+
logging.info("Path {}: does not end with `.nix`.".format(path))
305
305
+
return False
306
306
+
307
307
+
try:
308
308
+
return _update_package(path, target)
309
309
+
except ValueError as e:
310
310
+
logging.warning("Path {}: {}".format(path, e))
311
311
+
return False
312
312
+
313
313
+
314
314
+
def _commit(path, pname, old_version, new_version, **kwargs):
315
315
+
"""Commit result.
316
316
+
"""
317
317
+
318
318
+
msg = f'python: {pname}: {old_version} -> {new_version}'
319
319
+
320
320
+
try:
321
321
+
subprocess.check_call([GIT, 'add', path])
322
322
+
subprocess.check_call([GIT, 'commit', '-m', msg])
323
323
+
except subprocess.CalledProcessError as e:
324
324
+
subprocess.check_call([GIT, 'checkout', path])
325
325
+
raise subprocess.CalledProcessError(f'Could not commit {path}') from e
326
326
+
327
327
+
return True
328
328
+
329
329
+
330
330
+
def main():
331
331
+
332
332
+
parser = argparse.ArgumentParser()
333
333
+
parser.add_argument('package', type=str, nargs='+')
334
334
+
parser.add_argument('--target', type=str, choices=SEMVER.keys(), default='major')
335
335
+
parser.add_argument('--commit', action='store_true', help='Create a commit for each package update')
336
336
+
337
337
+
args = parser.parse_args()
338
338
+
target = args.target
339
339
+
340
340
+
packages = list(map(os.path.abspath, args.package))
341
341
+
342
342
+
logging.info("Updating packages...")
343
343
+
344
344
+
# Use threads to update packages concurrently
345
345
+
with Pool() as p:
346
346
+
results = list(p.map(lambda pkg: _update(pkg, target), packages))
347
347
+
348
348
+
logging.info("Finished updating packages.")
349
349
+
350
350
+
# Commits are created sequentially.
351
351
+
if args.commit:
352
352
+
logging.info("Committing updates...")
353
353
+
list(map(lambda x: _commit(**x), filter(bool, results)))
354
354
+
logging.info("Finished committing updates")
355
355
+
356
356
+
count = sum(map(bool, results))
357
357
+
logging.info("{} package(s) updated".format(count))
358
358
+
359
359
+
360
360
+
361
361
+
if __name__ == '__main__':
362
362
+
main()
+2
-2
pkgs/development/ruby-modules/bundix/default.nix
···
6
6
7
7
name = "${gemName}-${version}";
8
8
gemName = "bundix";
9
9
-
version = "2.4.0";
9
9
+
version = "2.4.1";
10
10
11
11
src = fetchFromGitHub {
12
12
owner = "manveru";
13
13
repo = "bundix";
14
14
rev = version;
15
15
-
sha256 = "1lq8nday6031mj7ivnk2wd47v2smz6frnb8xh2yhyhpld045v1rz";
15
15
+
sha256 = "175qmv7dj7v50v71b78dzn5pb4a35ml6p15asks9q1rrlkz0n4gn";
16
16
};
17
17
18
18
buildInputs = [ ruby bundler ];
+2
-2
pkgs/development/tools/misc/elfinfo/default.nix
···
2
2
3
3
buildGoPackage rec {
4
4
name = "elfinfo-${version}";
5
5
-
version = "0.7.4";
5
5
+
version = "0.7.5";
6
6
7
7
goPackagePath = "github.com/xyproto/elfinfo";
8
8
src = fetchFromGitHub {
9
9
rev = version;
10
10
owner = "xyproto";
11
11
repo = "elfinfo";
12
12
-
sha256 = "12n86psri9077v7s6b4j7djg5kijf9gybd80f9sfs0xmgkbly3gv";
12
12
+
sha256 = "0b6zyfq0yhpbf03h52q2lgf6ff086gcsbnhm6chx18h0q1g17m96";
13
13
};
14
14
15
15
meta = with stdenv.lib; {
+4
-4
pkgs/development/tools/skaffold/default.nix
···
2
2
3
3
buildGoPackage rec {
4
4
name = "skaffold-${version}";
5
5
-
version = "0.18.0";
6
6
-
# rev is the 0.18.0 commit, mainly for skaffold version command output
7
7
-
rev = "34651689be78b2c6bcfbace5072b00b93661f895";
5
5
+
version = "0.19.0";
6
6
+
# rev is the 0.19.0 commit, mainly for skaffold version command output
7
7
+
rev = "9eb0dfc1bf634b97462c66b4dfb80e4cea378ade";
8
8
9
9
goPackagePath = "github.com/GoogleContainerTools/skaffold";
10
10
subPackages = ["cmd/skaffold"];
···
20
20
owner = "GoogleContainerTools";
21
21
repo = "skaffold";
22
22
rev = "v${version}";
23
23
-
sha256 = "0an3g4jqch7a6ckh8yhia7lykpvb5lvz4kd5kqfmw9479kygv9sa";
23
23
+
sha256 = "0s7dyfdmgslwnmbkzyqvf2622gj5d7vx9igwz3bf6dpaz382mk6h";
24
24
};
25
25
26
26
meta = {
+1
pkgs/misc/emulators/wine/base.nix
···
45
45
++ lib.optional xineramaSupport pkgs.xorg.libXinerama
46
46
++ lib.optional udevSupport pkgs.udev
47
47
++ lib.optional vulkanSupport pkgs.vulkan-loader
48
48
+
++ lib.optional sdlSupport pkgs.SDL2
48
49
++ lib.optionals gstreamerSupport (with pkgs.gst_all_1; [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav ])
49
50
++ lib.optionals gtkSupport [ pkgs.gtk3 pkgs.glib ]
50
51
++ lib.optionals openclSupport [ pkgs.opencl-headers pkgs.ocl-icd ]
+2
-1
pkgs/misc/emulators/wine/default.nix
···
42
42
xineramaSupport ? false,
43
43
xmlSupport ? false,
44
44
vulkanSupport ? false,
45
45
+
sdlSupport ? false,
45
46
}:
46
47
47
48
let wine-build = build: release:
···
53
54
netapiSupport cursesSupport vaSupport pcapSupport v4lSupport saneSupport
54
55
gsmSupport gphoto2Support ldapSupport fontconfigSupport alsaSupport
55
56
pulseaudioSupport xineramaSupport gtkSupport openclSupport xmlSupport tlsSupport
56
56
-
openglSupport gstreamerSupport udevSupport vulkanSupport;
57
57
+
openglSupport gstreamerSupport udevSupport vulkanSupport sdlSupport;
57
58
};
58
59
});
59
60
+1
-1
pkgs/servers/uwsgi/default.nix
···
89
89
${lib.concatMapStringsSep "\n" (x: x.install or "") needed}
90
90
'';
91
91
92
92
-
NIX_CFLAGS_LINK = [ "-lsystemd" ] ++ lib.concatMap (x: x.NIX_CFLAGS_LINK or []) needed;
92
92
+
NIX_CFLAGS_LINK = lib.optional withSystemd "-lsystemd" ++ lib.concatMap (x: x.NIX_CFLAGS_LINK or []) needed;
93
93
94
94
meta = with stdenv.lib; {
95
95
homepage = https://uwsgi-docs.readthedocs.org/en/latest/;
+3
-3
pkgs/tools/X11/grobi/default.nix
···
1
1
{ stdenv, fetchFromGitHub, buildGoPackage }:
2
2
3
3
buildGoPackage rec {
4
4
-
version = "0.3.0";
4
4
+
version = "0.5.1";
5
5
name = "grobi-${version}";
6
6
7
7
goPackagePath = "github.com/fd0/grobi";
8
8
9
9
src = fetchFromGitHub {
10
10
-
rev = "78a0639ffad765933a5233a1c94d2626e24277b8";
10
10
+
rev = "5ddc167b9e4f84755a515828360abda15c54b7de";
11
11
owner = "fd0";
12
12
repo = "grobi";
13
13
-
sha256 = "16q7vnhb1p6ds561832sfdszvlafww67bjn3lc0d18v7lyak2l3i";
13
13
+
sha256 = "0iyxidq60pf6ki52f8fffplf10nl8w9jx1b7igg98csnc6iqxh89";
14
14
};
15
15
16
16
meta = with stdenv.lib; {
+2
pkgs/top-level/all-packages.nix
···
7912
7912
python37Packages = recurseIntoAttrs python37.pkgs;
7913
7913
pypyPackages = pypy.pkgs;
7914
7914
7915
7915
+
update-python-libraries = callPackage ../development/interpreters/python/update-python-libraries { };
7916
7916
+
7915
7917
# Should eventually be moved inside Python interpreters.
7916
7918
python-setup-hook = callPackage ../development/interpreters/python/setup-hook.nix { };
7917
7919
+11
pkgs/top-level/haskell-packages.nix
···
68
68
buildLlvmPackages = buildPackages.llvmPackages_6;
69
69
llvmPackages = pkgs.llvmPackages_6;
70
70
};
71
71
+
ghc863 = callPackage ../development/compilers/ghc/8.6.3.nix {
72
72
+
bootPkgs = packages.ghc822;
73
73
+
inherit (buildPackages.python3Packages) sphinx;
74
74
+
buildLlvmPackages = buildPackages.llvmPackages_6;
75
75
+
llvmPackages = pkgs.llvmPackages_6;
76
76
+
};
71
77
ghcHEAD = callPackage ../development/compilers/ghc/head.nix {
72
78
bootPkgs = packages.ghc822Binary;
73
79
inherit (buildPackages.python3Packages) sphinx;
···
128
134
ghc862 = callPackage ../development/haskell-modules {
129
135
buildHaskellPackages = bh.packages.ghc862;
130
136
ghc = bh.compiler.ghc862;
137
137
+
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.6.x.nix { };
138
138
+
};
139
139
+
ghc863 = callPackage ../development/haskell-modules {
140
140
+
buildHaskellPackages = bh.packages.ghc863;
141
141
+
ghc = bh.compiler.ghc863;
131
142
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.6.x.nix { };
132
143
};
133
144
ghcHEAD = callPackage ../development/haskell-modules {
+1
pkgs/top-level/wine-packages.nix
···
25
25
udevSupport = true;
26
26
xineramaSupport = true;
27
27
xmlSupport = true;
28
28
+
sdlSupport = true;
28
29
};
29
30
30
31
full = base.override {