alibuild 1.17.13__tar.gz → 1.17.15__tar.gz

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.
Files changed (94) hide show
  1. {alibuild-1.17.13 → alibuild-1.17.15}/.github/workflows/pr-check.yml +11 -7
  2. {alibuild-1.17.13 → alibuild-1.17.15}/PKG-INFO +8 -3
  3. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild.egg-info/PKG-INFO +8 -3
  4. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild.egg-info/requires.txt +1 -1
  5. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/_version.py +2 -2
  6. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/utilities.py +43 -10
  7. {alibuild-1.17.13 → alibuild-1.17.15}/codecov.yml +3 -0
  8. {alibuild-1.17.13 → alibuild-1.17.15}/docs/docs/reference.md +5 -2
  9. {alibuild-1.17.13 → alibuild-1.17.15}/docs/docs/troubleshooting.md +1 -1
  10. {alibuild-1.17.13 → alibuild-1.17.15}/pyproject.toml +2 -1
  11. alibuild-1.17.15/requirements.txt +7 -0
  12. {alibuild-1.17.13 → alibuild-1.17.15}/setup.py +1 -1
  13. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_args.py +19 -12
  14. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_build.py +4 -4
  15. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_deps.py +8 -5
  16. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_doctor.py +40 -36
  17. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_init.py +14 -10
  18. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_packagelist.py +62 -41
  19. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_utilities.py +91 -8
  20. {alibuild-1.17.13 → alibuild-1.17.15}/tox.ini +1 -1
  21. alibuild-1.17.13/requirements.txt +0 -9
  22. {alibuild-1.17.13 → alibuild-1.17.15}/.flake8 +0 -0
  23. {alibuild-1.17.13 → alibuild-1.17.15}/.github/workflows/documentation.yml +0 -0
  24. {alibuild-1.17.13 → alibuild-1.17.15}/.github/workflows/release.yml +0 -0
  25. {alibuild-1.17.13 → alibuild-1.17.15}/.gitignore +0 -0
  26. {alibuild-1.17.13 → alibuild-1.17.15}/.pylintrc +0 -0
  27. {alibuild-1.17.13 → alibuild-1.17.15}/ANALYTICS.md +0 -0
  28. {alibuild-1.17.13 → alibuild-1.17.15}/DESIGN.md +0 -0
  29. {alibuild-1.17.13 → alibuild-1.17.15}/LICENSE.md +0 -0
  30. {alibuild-1.17.13 → alibuild-1.17.15}/MANIFEST.in +0 -0
  31. {alibuild-1.17.13 → alibuild-1.17.15}/PACKAGING.md +0 -0
  32. {alibuild-1.17.13 → alibuild-1.17.15}/README.rst +0 -0
  33. {alibuild-1.17.13 → alibuild-1.17.15}/alfaBuild +0 -0
  34. {alibuild-1.17.13 → alibuild-1.17.15}/aliBuild +0 -0
  35. {alibuild-1.17.13 → alibuild-1.17.15}/aliDeps +0 -0
  36. {alibuild-1.17.13 → alibuild-1.17.15}/aliDoctor +0 -0
  37. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild.egg-info/SOURCES.txt +0 -0
  38. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild.egg-info/dependency_links.txt +0 -0
  39. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild.egg-info/top_level.txt +0 -0
  40. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/__init__.py +0 -0
  41. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/analytics.py +0 -0
  42. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/args.py +0 -0
  43. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/build.py +0 -0
  44. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/build_template.sh +0 -0
  45. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/clean.py +0 -0
  46. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/cmd.py +0 -0
  47. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/deps.py +0 -0
  48. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/doctor.py +0 -0
  49. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/git.py +0 -0
  50. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/init.py +0 -0
  51. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/log.py +0 -0
  52. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/scm.py +0 -0
  53. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/sl.py +0 -0
  54. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/sync.py +0 -0
  55. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/templating_plugin.py +0 -0
  56. {alibuild-1.17.13 → alibuild-1.17.15}/alibuild_helpers/workarea.py +0 -0
  57. {alibuild-1.17.13 → alibuild-1.17.15}/alienv +0 -0
  58. {alibuild-1.17.13 → alibuild-1.17.15}/debian/changelog +0 -0
  59. {alibuild-1.17.13 → alibuild-1.17.15}/debian/compat +0 -0
  60. {alibuild-1.17.13 → alibuild-1.17.15}/debian/control +0 -0
  61. {alibuild-1.17.13 → alibuild-1.17.15}/debian/copyright +0 -0
  62. {alibuild-1.17.13 → alibuild-1.17.15}/debian/files +0 -0
  63. {alibuild-1.17.13 → alibuild-1.17.15}/debian/rules +0 -0
  64. {alibuild-1.17.13 → alibuild-1.17.15}/docs/README.md +0 -0
  65. {alibuild-1.17.13 → alibuild-1.17.15}/docs/SUPPORT +0 -0
  66. {alibuild-1.17.13 → alibuild-1.17.15}/docs/docs/alice_logo.png +0 -0
  67. {alibuild-1.17.13 → alibuild-1.17.15}/docs/docs/deps.png +0 -0
  68. {alibuild-1.17.13 → alibuild-1.17.15}/docs/docs/index.md +0 -0
  69. {alibuild-1.17.13 → alibuild-1.17.15}/docs/docs/quick.md +0 -0
  70. {alibuild-1.17.13 → alibuild-1.17.15}/docs/docs/stylesheets/extra.css +0 -0
  71. {alibuild-1.17.13 → alibuild-1.17.15}/docs/docs/user.md +0 -0
  72. {alibuild-1.17.13 → alibuild-1.17.15}/docs/mkdocs.yml +0 -0
  73. {alibuild-1.17.13 → alibuild-1.17.15}/pb +0 -0
  74. {alibuild-1.17.13 → alibuild-1.17.15}/setup.cfg +0 -0
  75. {alibuild-1.17.13 → alibuild-1.17.15}/templates/alibuild_to_please.jnj +0 -0
  76. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_analytics.py +0 -0
  77. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_clean.py +0 -0
  78. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_cmd.py +0 -0
  79. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_git.py +0 -0
  80. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_hashing.py +0 -0
  81. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_log.py +0 -0
  82. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_parseRecipe.py +0 -0
  83. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_sync.py +0 -0
  84. {alibuild-1.17.13 → alibuild-1.17.15}/tests/test_workarea.py +0 -0
  85. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/broken1.sh +0 -0
  86. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/broken2.sh +0 -0
  87. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/broken3.sh +0 -0
  88. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/broken4.sh +0 -0
  89. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/broken5.sh +0 -0
  90. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/broken6.sh +0 -0
  91. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/broken7.sh +0 -0
  92. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/clobber-initdotsh.sh +0 -0
  93. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/defaults-o2.sh +0 -0
  94. {alibuild-1.17.13 → alibuild-1.17.15}/tests/testdist/delete-etc.sh +0 -0
@@ -30,6 +30,7 @@ jobs:
30
30
  - '3.10.6' # ubuntu2204 container
31
31
  - '3.11'
32
32
  - '3.12'
33
+ - '3.13'
33
34
 
34
35
  steps:
35
36
  - uses: actions/checkout@v4
@@ -60,13 +61,13 @@ jobs:
60
61
 
61
62
  - name: Upload coverage information
62
63
  if: ${{ always() && github.event.repository.owner.login == 'alisw' }}
63
- uses: codecov/codecov-action@v3
64
+ uses: codecov/codecov-action@v5
64
65
  with:
65
66
  files: coverage.json
66
67
 
67
68
  mac-unittest:
68
69
  name: mac-python${{ matrix.python-version }}
69
- runs-on: macos-latest
70
+ runs-on: macos-14
70
71
 
71
72
  strategy:
72
73
  fail-fast: false # continue executing other checks if one fails
@@ -75,15 +76,18 @@ jobs:
75
76
  - '3.11'
76
77
 
77
78
  steps:
78
- - uses: actions/checkout@v3
79
+ - uses: actions/checkout@v4
79
80
 
80
81
  - name: Set up Python ${{ matrix.python-version }}
81
- uses: actions/setup-python@v4
82
+ uses: actions/setup-python@v5
82
83
  with:
83
84
  python-version: ${{ matrix.python-version }}
84
85
 
85
86
  - name: Install test dependencies
86
87
  run: |
88
+ # Hack to remove whatever the CI default image brings now, as it
89
+ # conflicts with the one in o2-full-deps [O2-5580]
90
+ brew uninstall --ignore-dependencies --force pkg-config@0.29.2
87
91
  brew install modules alisw/system-deps/o2-full-deps sapling
88
92
  python3 -m pip install --upgrade tox tox-gh-actions coverage
89
93
 
@@ -102,7 +106,7 @@ jobs:
102
106
 
103
107
  - name: Upload coverage information
104
108
  if: ${{ always() && github.event.repository.owner.login == 'alisw' }}
105
- uses: codecov/codecov-action@v3
109
+ uses: codecov/codecov-action@v5
106
110
  with:
107
111
  files: coverage.json
108
112
 
@@ -111,10 +115,10 @@ jobs:
111
115
  runs-on: ubuntu-latest
112
116
 
113
117
  steps:
114
- - uses: actions/checkout@v3
118
+ - uses: actions/checkout@v4
115
119
 
116
120
  - name: Set up Python
117
- uses: actions/setup-python@v4
121
+ uses: actions/setup-python@v5
118
122
  with:
119
123
  python-version: 3.x
120
124
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: alibuild
3
- Version: 1.17.13
3
+ Version: 1.17.15
4
4
  Summary: ALICE Build Tool
5
5
  Home-page: https://alisw.github.io/alibuild
6
6
  Author: Giulio Eulisse
@@ -18,13 +18,18 @@ Classifier: Programming Language :: Python :: 3.9
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
21
22
  Description-Content-Type: text/x-rst
22
23
  License-File: LICENSE.md
23
24
  Requires-Dist: pyyaml
24
25
  Requires-Dist: requests
25
26
  Requires-Dist: distro
26
27
  Requires-Dist: jinja2
27
- Requires-Dist: boto3
28
+ Requires-Dist: boto3==1.23.10
29
+ Dynamic: author
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
28
33
 
29
34
  .. image:: https://badge.fury.io/py/alibuild.svg
30
35
  .. image:: https://github.com/alisw/alibuild/actions/workflows/pr-check.yml/badge.svg?branch=master&event=push
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: alibuild
3
- Version: 1.17.13
3
+ Version: 1.17.15
4
4
  Summary: ALICE Build Tool
5
5
  Home-page: https://alisw.github.io/alibuild
6
6
  Author: Giulio Eulisse
@@ -18,13 +18,18 @@ Classifier: Programming Language :: Python :: 3.9
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
21
22
  Description-Content-Type: text/x-rst
22
23
  License-File: LICENSE.md
23
24
  Requires-Dist: pyyaml
24
25
  Requires-Dist: requests
25
26
  Requires-Dist: distro
26
27
  Requires-Dist: jinja2
27
- Requires-Dist: boto3
28
+ Requires-Dist: boto3==1.23.10
29
+ Dynamic: author
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
28
33
 
29
34
  .. image:: https://badge.fury.io/py/alibuild.svg
30
35
  .. image:: https://github.com/alisw/alibuild/actions/workflows/pr-check.yml/badge.svg?branch=master&event=push
@@ -2,4 +2,4 @@ pyyaml
2
2
  requests
3
3
  distro
4
4
  jinja2
5
- boto3
5
+ boto3==1.23.10
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.17.13'
16
- __version_tuple__ = version_tuple = (1, 17, 13)
15
+ __version__ = version = '1.17.15'
16
+ __version_tuple__ = version_tuple = (1, 17, 15)
@@ -12,6 +12,7 @@ import platform
12
12
  from datetime import datetime
13
13
  from collections import OrderedDict
14
14
  from shlex import quote
15
+ from typing import Optional
15
16
 
16
17
  from alibuild_helpers.cmd import getoutput
17
18
  from alibuild_helpers.git import git
@@ -261,21 +262,29 @@ def detectArch():
261
262
  except:
262
263
  return doDetectArch(hasOsRelease, osReleaseLines, ["unknown", "", ""], "", "")
263
264
 
264
- def filterByArchitecture(arch, requires):
265
+ def filterByArchitectureDefaults(arch, defaults, requires):
265
266
  for r in requires:
266
267
  require, matcher = ":" in r and r.split(":", 1) or (r, ".*")
268
+ if matcher.startswith("defaults="):
269
+ wanted = matcher[len("defaults="):]
270
+ if re.match(wanted, defaults):
271
+ yield require
267
272
  if re.match(matcher, arch):
268
273
  yield require
269
274
 
270
- def disabledByArchitecture(arch, requires):
275
+ def disabledByArchitectureDefaults(arch, defaults, requires):
271
276
  for r in requires:
272
277
  require, matcher = ":" in r and r.split(":", 1) or (r, ".*")
273
- if not re.match(matcher, arch):
278
+ if matcher.startswith("defaults="):
279
+ wanted = matcher[len("defaults="):]
280
+ if not re.match(wanted, defaults):
281
+ yield require
282
+ elif not re.match(matcher, arch):
274
283
  yield require
275
284
 
276
285
  def readDefaults(configDir, defaults, error, architecture):
277
- defaultsFilename = "%s/defaults-%s.sh" % (configDir, defaults)
278
- if not exists(defaultsFilename):
286
+ defaultsFilename = resolveDefaultsFilename(defaults, configDir)
287
+ if not defaultsFilename:
279
288
  error("Default `%s' does not exists. Viable options:\n%s" %
280
289
  (defaults or "<no defaults specified>",
281
290
  "\n".join("- " + basename(x).replace("defaults-", "").replace(".sh", "")
@@ -297,7 +306,7 @@ def readDefaults(configDir, defaults, error, architecture):
297
306
  defaultsBody += "\n# Architecture defaults\n" + archBody
298
307
  return (defaultsMeta, defaultsBody)
299
308
 
300
- # Get the appropriate recipe reader depending on th filename
309
+
301
310
  def getRecipeReader(url, dist=None):
302
311
  m = re.search(r'^dist:(.*)@([^@]+)$', url)
303
312
  if m and dist:
@@ -398,9 +407,30 @@ def parseDefaults(disable, defaultsGetter, log):
398
407
  overrides[f] = dict(**(v or {}))
399
408
  return (None, overrides, taps)
400
409
 
410
+ def checkForFilename(taps: dict, pkg: str, d: str):
411
+ return taps.get(pkg, join(d, f"{pkg}.sh"))
412
+
413
+ def getPkgDirs(configDir):
414
+ configPath = os.environ.get("BITS_PATH", "").rstrip(":") + ":"
415
+ pkgDirs = [join(configDir, d) for d in configPath.lstrip(":").split(":")]
416
+ return pkgDirs
417
+
418
+ def resolveFilename(taps: dict, pkg: str, configDir: str):
419
+ for d in getPkgDirs(configDir):
420
+ filename = checkForFilename(taps, pkg, d)
421
+ if os.path.exists(filename):
422
+ return (filename, os.path.abspath(d))
423
+ return (None, None)
424
+
425
+ def resolveDefaultsFilename(defaults, configDir) -> Optional[str]:
426
+ for d in getPkgDirs(configDir):
427
+ filename = join(d, f"defaults-{defaults}.sh")
428
+ if os.path.exists(filename):
429
+ return filename
430
+
401
431
  def getPackageList(packages, specs, configDir, preferSystem, noSystem,
402
432
  architecture, disable, defaults, performPreferCheck, performRequirementCheck,
403
- performValidateDefaults, overrides, taps, log, force_rebuild=()):
433
+ performValidateDefaults, overrides, taps: dict, log, force_rebuild=()):
404
434
  systemPackages = set()
405
435
  ownPackages = set()
406
436
  failedRequirements = set()
@@ -421,7 +451,9 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem,
421
451
  # "defaults-release" for this to work, since the defaults are a dependency
422
452
  # and all dependencies' names go into a package's hash.
423
453
  pkg_filename = ("defaults-" + defaults) if p == "defaults-release" else p.lower()
424
- filename = taps.get(pkg_filename, "%s/%s.sh" % (configDir, pkg_filename))
454
+
455
+ filename, pkgdir = resolveFilename(taps, pkg_filename, configDir)
456
+
425
457
  err, spec, recipe = parseRecipe(getRecipeReader(filename, configDir))
426
458
  dieOnError(err, err)
427
459
  # Unless there was an error, both spec and recipe should be valid.
@@ -430,6 +462,7 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem,
430
462
  assert(recipe is not None)
431
463
  dieOnError(spec["package"].lower() != pkg_filename,
432
464
  "%s.sh has different package field: %s" % (p, spec["package"]))
465
+ spec["pkgdir"] = pkgdir
433
466
 
434
467
  if p == "defaults-release":
435
468
  # Re-rewrite the defaults' name to "defaults-release". Everything auto-
@@ -543,10 +576,10 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem,
543
576
  validDefaults = None # no valid default works for all current packages
544
577
 
545
578
  # For the moment we treat build_requires just as requires.
546
- fn = lambda what: disabledByArchitecture(architecture, spec.get(what, []))
579
+ fn = lambda what: disabledByArchitectureDefaults(architecture, defaults, spec.get(what, []))
547
580
  spec["disabled"] += [x for x in fn("requires")]
548
581
  spec["disabled"] += [x for x in fn("build_requires")]
549
- fn = lambda what: filterByArchitecture(architecture, spec.get(what, []))
582
+ fn = lambda what: filterByArchitectureDefaults(architecture, defaults, spec.get(what, []))
550
583
  spec["requires"] = [x for x in fn("requires") if not x in disable]
551
584
  spec["build_requires"] = [x for x in fn("build_requires") if not x in disable]
552
585
  if spec["package"] != "defaults-release":
@@ -5,3 +5,6 @@ coverage:
5
5
  # Disable long, annoying overview comment in PRs; only set statuses with links
6
6
  # to codecov.io.
7
7
  comment: false
8
+ ignore:
9
+ - "docs" # ignore folders and all its contents
10
+
@@ -33,7 +33,7 @@ An example recipe for `zlib` is the following:
33
33
  ```yaml
34
34
  package: zlib
35
35
  version: v1.2.8
36
- source: https://github.com/star-externals/zlib
36
+ source: https://github.com/madler/zlib
37
37
  tag: v1.2.8
38
38
  ---
39
39
  #!/bin/bash -ex
@@ -130,7 +130,10 @@ The following entries are optional in the header:
130
130
 
131
131
  The specified dependencies will be built before building the given package.
132
132
  You can specify platform-specific dependencies by appending `:<regexp>` to
133
- the dependency name. Such a regular expression will be matched against the
133
+ the dependency name. Similarly, you can specify build default specific dependencies
134
+ by appending `:defaults=<regex>`.
135
+
136
+ Such a regular expression will be matched against the
134
137
  architecture provided via `--architecture`, and if it does not match, the
135
138
  requirement will not be included. For instance:
136
139
 
@@ -318,7 +318,7 @@ Then, configure git to use SSH to authenticate with CERN GitLab using the follow
318
318
  git config --global 'url.ssh://git@gitlab.cern.ch:7999/.insteadof' 'https://gitlab.cern.ch/'
319
319
  ```
320
320
 
321
- [gitlab-ssh-key]: https://gitlab.cern.ch/-/profile/keys
321
+ [gitlab-ssh-key]: https://gitlab.cern.ch/-/user_settings/ssh_keys
322
322
 
323
323
  #### Caching passwords
324
324
 
@@ -24,6 +24,7 @@ classifiers = [
24
24
  'Programming Language :: Python :: 3.10', # ubuntu2204
25
25
  'Programming Language :: Python :: 3.11', # MacOS
26
26
  'Programming Language :: Python :: 3.12', # MacOS
27
+ 'Programming Language :: Python :: 3.13', # MacOS
27
28
  ]
28
29
 
29
30
  dependencies = [
@@ -31,7 +32,7 @@ dependencies = [
31
32
  'requests',
32
33
  'distro',
33
34
  'jinja2',
34
- 'boto3',
35
+ 'boto3==1.23.10',
35
36
  ]
36
37
 
37
38
  [project.urls]
@@ -0,0 +1,7 @@
1
+ requests
2
+ pyyaml
3
+ distro
4
+ jinja2
5
+ # https://github.com/boto/boto3/issues/4398
6
+ # This version is the last compatible with python 3.6.8
7
+ boto3==1.23.10; python_version >= '3.6'
@@ -19,7 +19,7 @@ install_requires = ['pyyaml', 'requests', 'distro', 'jinja2']
19
19
  # Old setuptools versions (which pip2 uses) don't support range comparisons
20
20
  # (like :python_version >= "3.6") in extras_require, so do this ourselves here.
21
21
  if sys.version_info >= (3, 6):
22
- install_requires.append('boto3')
22
+ install_requires.append('boto3==1.23.10')
23
23
 
24
24
  setup(
25
25
  name='alibuild',
@@ -8,6 +8,7 @@ from alibuild_helpers.args import doParseArgs, matchValidArch, finaliseArgs, DEF
8
8
  import sys
9
9
  import os
10
10
  import os.path
11
+ import re
11
12
 
12
13
  import unittest
13
14
  import shlex
@@ -16,18 +17,18 @@ BUILD_MISSING_PKG_ERROR = "the following arguments are required: PACKAGE"
16
17
  ANALYTICS_MISSING_STATE_ERROR = "the following arguments are required: state"
17
18
 
18
19
  # A few errors we should handle, together with the expected result
19
- ARCHITECTURE_ERROR = [call(u"Unknown / unsupported architecture: foo.\n\n{table}Alternatively, you can use the `--force-unknown-architecture' option.".format(table=ARCHITECTURE_TABLE))]
20
+ ARCHITECTURE_ERROR = u"Unknown / unsupported architecture: foo.\n\n.*"
20
21
  PARSER_ERRORS = {
21
- "build --force-unknown-architecture": [call(BUILD_MISSING_PKG_ERROR)],
22
- "build --force-unknown-architecture zlib --foo": [call('unrecognized arguments: --foo')],
23
- "init --docker-image": [call('unrecognized arguments: --docker-image')],
24
- "builda --force-unknown-architecture zlib" : [call("argument action: invalid choice: 'builda' (choose from 'analytics', 'architecture', 'build', 'clean', 'deps', 'doctor', 'init', 'version')")],
25
- "build --force-unknown-architecture zlib --no-system --always-prefer-system" : [call('argument --always-prefer-system: not allowed with argument --no-system')],
22
+ "build --force-unknown-architecture": BUILD_MISSING_PKG_ERROR,
23
+ "build --force-unknown-architecture zlib --foo": 'unrecognized arguments: --foo',
24
+ "init --docker-image": 'unrecognized arguments: --docker-image',
25
+ "builda --force-unknown-architecture zlib" : "argument action: invalid choice: 'builda'.*",
26
+ "build --force-unknown-architecture zlib --no-system --always-prefer-system" : 'argument --always-prefer-system: not allowed with argument --no-system',
26
27
  "build zlib --architecture foo": ARCHITECTURE_ERROR,
27
- "build --force-unknown-architecture zlib --remote-store rsync://test1.local/::rw --write-store rsync://test2.local/::rw ": [call('cannot specify ::rw and --write-store at the same time')],
28
- "build zlib -a osx_x86-64 --docker-image foo": [call('cannot use `-a osx_x86-64` and --docker')],
29
- "build zlib -a slc7_x86-64 --annotate foobar": [call("--annotate takes arguments of the form PACKAGE=COMMENT")],
30
- "analytics": [call(ANALYTICS_MISSING_STATE_ERROR)]
28
+ "build --force-unknown-architecture zlib --remote-store rsync://test1.local/::rw --write-store rsync://test2.local/::rw ": 'cannot specify ::rw and --write-store at the same time',
29
+ "build zlib -a osx_x86-64 --docker-image foo": 'cannot use `-a osx_x86-64` and --docker',
30
+ "build zlib -a slc7_x86-64 --annotate foobar": "--annotate takes arguments of the form PACKAGE=COMMENT",
31
+ "analytics": ANALYTICS_MISSING_STATE_ERROR
31
32
  }
32
33
 
33
34
  # A few valid archs
@@ -97,11 +98,17 @@ class ArgsTestCase(unittest.TestCase):
97
98
  @mock.patch('alibuild_helpers.args.argparse.ArgumentParser.error')
98
99
  def test_failingParsing(self, mock_print):
99
100
  mock_print.side_effect = FakeExit("raised")
100
- for (cmd, calls) in PARSER_ERRORS.items():
101
+ for (cmd, pattern) in PARSER_ERRORS.items():
101
102
  mock_print.mock_calls = []
102
103
  with patch.object(sys, "argv", ["alibuild"] + shlex.split(cmd)):
103
104
  self.assertRaises(FakeExit, doParseArgs)
104
- self.assertEqual(mock_print.mock_calls, calls)
105
+ for mock_call in mock_print.mock_calls:
106
+ args = mock_call[1]
107
+ print(args)
108
+ self.assertTrue(
109
+ re.match(pattern, args[0]),
110
+ f"Expected '{args[0]}' matching '{pattern}' but it's not the case."
111
+ )
105
112
 
106
113
  def test_validArchitectures(self):
107
114
  for arch in VALID_ARCHS:
@@ -25,7 +25,7 @@ TEST_DEFAULT_RELEASE_BUILD_HASH = "27ce49698e818e8efb56b6eff6dd785e503df341"
25
25
  TEST_ZLIB_RECIPE = """\
26
26
  package: zlib
27
27
  version: v1.2.3
28
- source: https://github.com/star-externals/zlib
28
+ source: https://github.com/madler/zlib
29
29
  tag: master
30
30
  ---
31
31
  ./configure
@@ -92,12 +92,12 @@ baad\trefs/tags/v3"""
92
92
  TEST_EXTRA_BUILD_HASH = ("5afae57bfc6a374e74c1c4427698ab5edebce0bc")
93
93
 
94
94
 
95
- GIT_CLONE_REF_ZLIB_ARGS = ("clone", "--bare", "https://github.com/star-externals/zlib",
95
+ GIT_CLONE_REF_ZLIB_ARGS = ("clone", "--bare", "https://github.com/madler/zlib",
96
96
  "/sw/MIRROR/zlib", "--filter=blob:none"), ".", False
97
- GIT_CLONE_SRC_ZLIB_ARGS = ("clone", "-n", "https://github.com/star-externals/zlib",
97
+ GIT_CLONE_SRC_ZLIB_ARGS = ("clone", "-n", "https://github.com/madler/zlib",
98
98
  "/sw/SOURCES/zlib/v1.2.3/8822efa61f",
99
99
  "--dissociate", "--reference", "/sw/MIRROR/zlib", "--filter=blob:none"), ".", False
100
- GIT_SET_URL_ZLIB_ARGS = ("remote", "set-url", "--push", "origin", "https://github.com/star-externals/zlib"), \
100
+ GIT_SET_URL_ZLIB_ARGS = ("remote", "set-url", "--push", "origin", "https://github.com/madler/zlib"), \
101
101
  "/sw/SOURCES/zlib/v1.2.3/8822efa61f", False
102
102
  GIT_CHECKOUT_ZLIB_ARGS = ("checkout", "-f", "master"), \
103
103
  "/sw/SOURCES/zlib/v1.2.3/8822efa61f", False
@@ -1,5 +1,6 @@
1
1
  from unittest.mock import patch, MagicMock
2
2
  from io import StringIO
3
+ import os.path
3
4
 
4
5
  from alibuild_helpers.deps import doDeps
5
6
  from argparse import Namespace
@@ -64,12 +65,14 @@ class DepsTestCase(unittest.TestCase):
64
65
  outgraph="/tmp/outgraph.pdf",
65
66
  package="AliRoot",
66
67
  defaults="release")
68
+ def fake_exists(n):
69
+ return {"/alidist/aliroot.sh": True}
70
+ with patch.object(os.path, "exists", fake_exists):
71
+ doDeps(args, MagicMock())
67
72
 
68
- doDeps(args, MagicMock())
69
-
70
- # Same check without explicit intermediate dotfile
71
- args.outdot = None
72
- doDeps(args, MagicMock())
73
+ # Same check without explicit intermediate dotfile
74
+ args.outdot = None
75
+ doDeps(args, MagicMock())
73
76
 
74
77
 
75
78
  if __name__ == '__main__':
@@ -1,6 +1,7 @@
1
1
  from __future__ import print_function
2
2
  from unittest.mock import patch, MagicMock
3
3
  from io import StringIO
4
+ import os.path
4
5
 
5
6
  from alibuild_helpers.doctor import doDoctor
6
7
  from argparse import Namespace
@@ -84,42 +85,45 @@ class DoctorTestCase(unittest.TestCase):
84
85
  disable=[],
85
86
  defaults="release")
86
87
 
87
- # What to call (longer names deprecated in Python 3.5+)
88
- if not hasattr(self, "assertRegex"):
89
- self.assertRegex = self.assertRegexpMatches
90
- self.assertNotRegex = self.assertNotRegexpMatches
91
-
92
- # Test: all should go OK (exit with 0)
93
- out = resetOut()
94
- with self.assertRaises(SystemExit) as cm:
95
- args.packages=["Package1"]
96
- doDoctor(args, MagicMock())
97
- self.assertEqual(cm.exception.code, 0)
98
-
99
- # Test: system dependency not found
100
- out = resetOut()
101
- with self.assertRaises(SystemExit) as cm:
102
- args.packages=["SysDep"]
103
- doDoctor(args, MagicMock())
104
- self.assertEqual(cm.exception.code, 1)
105
-
106
- # Test: invalid default
107
- out = resetOut()
108
- with self.assertRaises(SystemExit) as cm:
109
- args.packages=["BreakDefaults"]
110
- doDoctor(args, MagicMock())
111
- self.assertEqual(cm.exception.code, 2)
112
- self.assertRegex(out["error"].getvalue(), "- its_not_there")
113
-
114
- # Test: common defaults
115
- out = resetOut()
116
- with self.assertRaises(SystemExit) as cm:
117
- args.packages=["TestDef1"]
118
- doDoctor(args, MagicMock())
119
- self.assertEqual(cm.exception.code, 2)
120
- self.assertRegex(out["banner"].getvalue(), "- common_default")
121
- self.assertNotRegex(out["banner"].getvalue(), "- default1")
122
- self.assertNotRegex(out["banner"].getvalue(), "- default2")
88
+ def fake_exists(n):
89
+ return {"/alidist/aliroot.sh": True}
90
+ with patch.object(os.path, "exists", fake_exists):
91
+ # What to call (longer names deprecated in Python 3.5+)
92
+ if not hasattr(self, "assertRegex"):
93
+ self.assertRegex = self.assertRegexpMatches
94
+ self.assertNotRegex = self.assertNotRegexpMatches
95
+
96
+ # Test: all should go OK (exit with 0)
97
+ out = resetOut()
98
+ with self.assertRaises(SystemExit) as cm:
99
+ args.packages=["Package1"]
100
+ doDoctor(args, MagicMock())
101
+ self.assertEqual(cm.exception.code, 0)
102
+
103
+ # Test: system dependency not found
104
+ out = resetOut()
105
+ with self.assertRaises(SystemExit) as cm:
106
+ args.packages=["SysDep"]
107
+ doDoctor(args, MagicMock())
108
+ self.assertEqual(cm.exception.code, 1)
109
+
110
+ # Test: invalid default
111
+ out = resetOut()
112
+ with self.assertRaises(SystemExit) as cm:
113
+ args.packages=["BreakDefaults"]
114
+ doDoctor(args, MagicMock())
115
+ self.assertEqual(cm.exception.code, 2)
116
+ self.assertRegex(out["error"].getvalue(), "- its_not_there")
117
+
118
+ # Test: common defaults
119
+ out = resetOut()
120
+ with self.assertRaises(SystemExit) as cm:
121
+ args.packages=["TestDef1"]
122
+ doDoctor(args, MagicMock())
123
+ self.assertEqual(cm.exception.code, 2)
124
+ self.assertRegex(out["banner"].getvalue(), "- common_default")
125
+ self.assertNotRegex(out["banner"].getvalue(), "- default1")
126
+ self.assertNotRegex(out["banner"].getvalue(), "- default2")
123
127
 
124
128
  if __name__ == '__main__':
125
129
  unittest.main()
@@ -1,5 +1,6 @@
1
1
  from argparse import Namespace
2
2
  import os.path as path
3
+ import os.path
3
4
  import unittest
4
5
  from unittest.mock import call, patch # In Python 3, mock is built-in
5
6
  from io import StringIO
@@ -82,17 +83,20 @@ class InitTestCase(unittest.TestCase):
82
83
  fetchRepos = False,
83
84
  architecture = "slc7_x86-64"
84
85
  )
85
- doInit(args)
86
- self.assertEqual(mock_git.mock_calls, CLONE_EVERYTHING)
87
- mock_path.exists.assert_has_calls([call('.'), call('/sw/MIRROR'), call('/alidist'), call('./AliRoot')])
86
+ def fake_exists(n):
87
+ return {"/alidist/aliroot.sh": True}
88
+ with patch.object(os.path, "exists", fake_exists):
89
+ doInit(args)
90
+ self.assertEqual(mock_git.mock_calls, CLONE_EVERYTHING)
91
+ mock_path.exists.assert_has_calls([call('.'), call('/sw/MIRROR'), call('/alidist'), call('./AliRoot')])
88
92
 
89
- # Force fetch repos
90
- mock_git.reset_mock()
91
- mock_path.reset_mock()
92
- args.fetchRepos = True
93
- doInit(args)
94
- self.assertEqual(mock_git.mock_calls, CLONE_EVERYTHING)
95
- mock_path.exists.assert_has_calls([call('.'), call('/sw/MIRROR'), call('/alidist'), call('./AliRoot')])
93
+ # Force fetch repos
94
+ mock_git.reset_mock()
95
+ mock_path.reset_mock()
96
+ args.fetchRepos = True
97
+ doInit(args)
98
+ self.assertEqual(mock_git.mock_calls, CLONE_EVERYTHING)
99
+ mock_path.exists.assert_has_calls([call('.'), call('/sw/MIRROR'), call('/alidist'), call('./AliRoot')])
96
100
 
97
101
 
98
102
  if __name__ == '__main__':
@@ -2,6 +2,8 @@ from __future__ import print_function
2
2
  from textwrap import dedent
3
3
  import unittest
4
4
  from unittest import mock
5
+ from unittest.mock import patch
6
+ import os.path
5
7
 
6
8
  from alibuild_helpers.cmd import getstatusoutput
7
9
  from alibuild_helpers.utilities import getPackageList
@@ -71,7 +73,7 @@ RECIPES = {
71
73
 
72
74
 
73
75
  class MockReader:
74
- def __init__(self, url, dist=None):
76
+ def __init__(self, url: str, dist=None):
75
77
  self._contents = RECIPES[url]
76
78
  self.url = "mock://" + url
77
79
 
@@ -79,6 +81,7 @@ class MockReader:
79
81
  return self._contents
80
82
 
81
83
 
84
+
82
85
  def getPackageListWithDefaults(packages, force_rebuild=()):
83
86
  specs = {} # getPackageList will mutate this
84
87
  return_values = getPackageList(
@@ -115,11 +118,14 @@ class ReplacementTestCase(unittest.TestCase):
115
118
  This is was the only available behaviour in previous aliBuild versions
116
119
  and must be preserved for backward compatibility.
117
120
  """
118
- specs, systemPkgs, ownPkgs, failedReqs, validDefaults = \
119
- getPackageListWithDefaults(["disable"])
120
- self.assertIn("disable", systemPkgs)
121
- self.assertNotIn("disable", ownPkgs)
122
- self.assertNotIn("disable", specs)
121
+ def fake_exists(n):
122
+ return n in RECIPES.keys()
123
+ with patch.object(os.path, "exists", fake_exists):
124
+ specs, systemPkgs, ownPkgs, failedReqs, validDefaults = \
125
+ getPackageListWithDefaults(["disable"])
126
+ self.assertIn("disable", systemPkgs)
127
+ self.assertNotIn("disable", ownPkgs)
128
+ self.assertNotIn("disable", specs)
123
129
 
124
130
  def test_replacement_given(self):
125
131
  """Check that specifying a replacement spec means it is used.
@@ -127,16 +133,19 @@ class ReplacementTestCase(unittest.TestCase):
127
133
  This also checks that if no recipe is given, we report the package as
128
134
  a system package to the user.
129
135
  """
130
- specs, systemPkgs, ownPkgs, failedReqs, validDefaults = \
131
- getPackageListWithDefaults(["with-replacement"])
132
- self.assertIn("with-replacement", specs)
133
- self.assertEqual(specs["with-replacement"]["env"]["SENTINEL_VAR"], "magic")
134
- # Make sure nothing is run by default.
135
- self.assertEqual(specs["with-replacement"]["recipe"], "")
136
- # If the replacement spec has no recipe, report to the user that we're
137
- # taking the package from the system.
138
- self.assertIn("with-replacement", systemPkgs)
139
- self.assertNotIn("with-replacement", ownPkgs)
136
+ def fake_exists(n):
137
+ return n in RECIPES.keys()
138
+ with patch.object(os.path, "exists", fake_exists):
139
+ specs, systemPkgs, ownPkgs, failedReqs, validDefaults = \
140
+ getPackageListWithDefaults(["with-replacement"])
141
+ self.assertIn("with-replacement", specs)
142
+ self.assertEqual(specs["with-replacement"]["env"]["SENTINEL_VAR"], "magic")
143
+ # Make sure nothing is run by default.
144
+ self.assertEqual(specs["with-replacement"]["recipe"], "")
145
+ # If the replacement spec has no recipe, report to the user that we're
146
+ # taking the package from the system.
147
+ self.assertIn("with-replacement", systemPkgs)
148
+ self.assertNotIn("with-replacement", ownPkgs)
140
149
 
141
150
  def test_replacement_recipe_given(self):
142
151
  """Check that specifying a replacement recipe means it is used.
@@ -144,29 +153,35 @@ class ReplacementTestCase(unittest.TestCase):
144
153
  Also check that we report to the user that a package will be compiled
145
154
  when a replacement recipe is given.
146
155
  """
147
- specs, systemPkgs, ownPkgs, failedReqs, validDefaults = \
148
- getPackageListWithDefaults(["with-replacement-recipe"])
149
- self.assertIn("with-replacement-recipe", specs)
150
- self.assertIn("recipe", specs["with-replacement-recipe"])
151
- self.assertEqual("true", specs["with-replacement-recipe"]["recipe"])
152
- # If the replacement spec has a recipe, report to the user that we're
153
- # compiling the package.
154
- self.assertNotIn("with-replacement-recipe", systemPkgs)
155
- self.assertIn("with-replacement-recipe", ownPkgs)
156
+ def fake_exists(n):
157
+ return n in RECIPES.keys()
158
+ with patch.object(os.path, "exists", fake_exists):
159
+ specs, systemPkgs, ownPkgs, failedReqs, validDefaults = \
160
+ getPackageListWithDefaults(["with-replacement-recipe"])
161
+ self.assertIn("with-replacement-recipe", specs)
162
+ self.assertIn("recipe", specs["with-replacement-recipe"])
163
+ self.assertEqual("true", specs["with-replacement-recipe"]["recipe"])
164
+ # If the replacement spec has a recipe, report to the user that we're
165
+ # compiling the package.
166
+ self.assertNotIn("with-replacement-recipe", systemPkgs)
167
+ self.assertIn("with-replacement-recipe", ownPkgs)
156
168
 
157
169
  @mock.patch("alibuild_helpers.utilities.warning")
158
170
  def test_missing_replacement_spec(self, mock_warning):
159
171
  """Check a warning is displayed when the replacement spec is not found."""
160
172
  warning_msg = "falling back to building the package ourselves"
161
173
  warning_exists = False
162
- def side_effect(msg, *args, **kwargs):
163
- nonlocal warning_exists
164
- if warning_msg in str(msg):
165
- warning_exists = True
166
- mock_warning.side_effect = side_effect
167
- specs, systemPkgs, ownPkgs, failedReqs, validDefaults = \
168
- getPackageListWithDefaults(["missing-spec"])
169
- self.assertTrue(warning_exists)
174
+ def fake_exists(n):
175
+ return n in RECIPES.keys()
176
+ with patch.object(os.path, "exists", fake_exists):
177
+ def side_effect(msg, *args, **kwargs):
178
+ nonlocal warning_exists
179
+ if warning_msg in str(msg):
180
+ warning_exists = True
181
+ mock_warning.side_effect = side_effect
182
+ specs, systemPkgs, ownPkgs, failedReqs, validDefaults = \
183
+ getPackageListWithDefaults(["missing-spec"])
184
+ self.assertTrue(warning_exists)
170
185
 
171
186
 
172
187
 
@@ -176,17 +191,23 @@ class ForceRebuildTestCase(unittest.TestCase):
176
191
 
177
192
  def test_force_rebuild_recipe(self):
178
193
  """If the recipe specifies force_rebuild, it must be applied."""
179
- specs, _, _, _, _ = getPackageListWithDefaults(["force-rebuild"])
180
- self.assertTrue(specs["force-rebuild"]["force_rebuild"])
181
- self.assertFalse(specs["defaults-release"]["force_rebuild"])
194
+ def fake_exists(n):
195
+ return n in RECIPES.keys()
196
+ with patch.object(os.path, "exists", fake_exists):
197
+ specs, _, _, _, _ = getPackageListWithDefaults(["force-rebuild"])
198
+ self.assertTrue(specs["force-rebuild"]["force_rebuild"])
199
+ self.assertFalse(specs["defaults-release"]["force_rebuild"])
182
200
 
183
201
  def test_force_rebuild_command_line(self):
184
202
  """The --force-rebuild option must take precedence, if given."""
185
- specs, _, _, _, _ = getPackageListWithDefaults(
186
- ["force-rebuild"], force_rebuild=["defaults-release", "force-rebuild"],
187
- )
188
- self.assertTrue(specs["force-rebuild"]["force_rebuild"])
189
- self.assertTrue(specs["defaults-release"]["force_rebuild"])
203
+ def fake_exists(n):
204
+ return n in RECIPES.keys()
205
+ with patch.object(os.path, "exists", fake_exists):
206
+ specs, _, _, _, _ = getPackageListWithDefaults(
207
+ ["force-rebuild"], force_rebuild=["defaults-release", "force-rebuild"],
208
+ )
209
+ self.assertTrue(specs["force-rebuild"]["force_rebuild"])
210
+ self.assertTrue(specs["defaults-release"]["force_rebuild"])
190
211
 
191
212
 
192
213
  if __name__ == '__main__':
@@ -5,12 +5,13 @@ import unittest
5
5
  # Assuming you are using the mock library to ... mock things
6
6
  from unittest.mock import patch
7
7
 
8
- from alibuild_helpers.utilities import doDetectArch, filterByArchitecture
8
+ from alibuild_helpers.utilities import doDetectArch, filterByArchitectureDefaults, disabledByArchitectureDefaults, getPkgDirs
9
9
  from alibuild_helpers.utilities import Hasher
10
10
  from alibuild_helpers.utilities import asList
11
11
  from alibuild_helpers.utilities import prunePaths
12
12
  from alibuild_helpers.utilities import resolve_version
13
13
  from alibuild_helpers.utilities import topological_sort
14
+ from alibuild_helpers.utilities import resolveFilename, resolveDefaultsFilename
14
15
  import os
15
16
  import string
16
17
 
@@ -175,12 +176,24 @@ class TestUtilities(unittest.TestCase):
175
176
  self.assertEqual(asList(None), [None])
176
177
 
177
178
  def test_filterByArchitecture(self):
178
- self.assertEqual(["AliRoot"], list(filterByArchitecture("osx_x86-64", ["AliRoot"])))
179
- self.assertEqual([], list(filterByArchitecture("osx_x86-64", ["AliRoot:(?!osx)"])))
180
- self.assertEqual(["GCC"], list(filterByArchitecture("osx_x86-64", ["AliRoot:(?!osx)", "GCC"])))
181
- self.assertEqual(["AliRoot", "GCC"], list(filterByArchitecture("osx_x86-64", ["AliRoot:(?!slc6)", "GCC"])))
182
- self.assertEqual(["GCC"], list(filterByArchitecture("osx_x86-64", ["AliRoot:slc6", "GCC:osx"])))
183
- self.assertEqual([], list(filterByArchitecture("osx_x86-64", [])))
179
+ self.assertEqual(["AliRoot"], list(filterByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot"])))
180
+ self.assertEqual([], list(filterByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:(?!osx)"])))
181
+ self.assertEqual(["GCC"], list(filterByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:(?!osx)", "GCC"])))
182
+ self.assertEqual(["AliRoot", "GCC"], list(filterByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:(?!slc6)", "GCC"])))
183
+ self.assertEqual(["GCC"], list(filterByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:slc6", "GCC:osx"])))
184
+ self.assertEqual([], list(filterByArchitectureDefaults("osx_x86-64", "ali", [])))
185
+ self.assertEqual(["GCC"], list(filterByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:slc6", "GCC:defaults=ali"])))
186
+ self.assertEqual([], list(filterByArchitectureDefaults("osx_x86-64", "o2", ["AliRoot:slc6", "GCC:defaults=ali"])))
187
+
188
+ def test_disabledByArchitecture(self):
189
+ self.assertEqual([], list(disabledByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot"])))
190
+ self.assertEqual(["AliRoot"], list(disabledByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:(?!osx)"])))
191
+ self.assertEqual(["AliRoot"], list(disabledByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:(?!osx)", "GCC"])))
192
+ self.assertEqual([], list(disabledByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:(?!slc6)", "GCC"])))
193
+ self.assertEqual(["AliRoot"], list(disabledByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:slc6", "GCC:osx"])))
194
+ self.assertEqual([], list(disabledByArchitectureDefaults("osx_x86-64", "ali", [])))
195
+ self.assertEqual(["AliRoot"], list(disabledByArchitectureDefaults("osx_x86-64", "ali", ["AliRoot:slc6", "GCC:defaults=ali"])))
196
+ self.assertEqual(["AliRoot", "GCC"], list(disabledByArchitectureDefaults("osx_x86-64", "o2", ["AliRoot:slc6", "GCC:defaults=ali"])))
184
197
 
185
198
  def test_prunePaths(self):
186
199
  fake_env = {
@@ -227,6 +240,77 @@ class TestUtilities(unittest.TestCase):
227
240
  spec["version"] = "NO%(defaults_upper)s"
228
241
  self.assertTrue(resolve_version(spec, "release", "stream/v1", "v1"), "NO")
229
242
 
243
+ def test_get_pkg_dirs(self):
244
+ self.assertEqual(getPkgDirs("alidist"), ["alidist/"])
245
+ with patch.object(os, "environ", {"BITS_PATH": ""}):
246
+ self.assertEqual(getPkgDirs("alidist"), ["alidist/"])
247
+ with patch.object(os, "environ", {"BITS_PATH": "/foo/bar"}):
248
+ self.assertEqual(getPkgDirs("alidist"), ["/foo/bar", "alidist/"])
249
+ with patch.object(os, "environ", {"BITS_PATH": "/foo/bar:"}):
250
+ self.assertEqual(getPkgDirs("alidist"), ["/foo/bar", "alidist/"])
251
+ with patch.object(os, "environ", {"BITS_PATH": "foo/bar:"}):
252
+ self.assertEqual(getPkgDirs("alidist"), ["alidist/foo/bar", "alidist/"])
253
+ with patch.object(os, "environ", {"BITS_PATH": "foo/bar:/bar"}):
254
+ self.assertEqual(getPkgDirs("alidist"), ["alidist/foo/bar", "/bar", "alidist/"])
255
+
256
+ def test_resolveDefaults(self):
257
+ def fake_exists(n):
258
+ return {"alidist/defaults-release.sh": True,
259
+ "/foo/defaults-o2.sh": True,
260
+ "/bar/defaults-o2.sh": True,
261
+ "alidist/bar/defaults-o2.sh": True
262
+ }.get(n, False)
263
+
264
+ with patch.object(os.path, "exists", fake_exists):
265
+ self.assertEqual(resolveDefaultsFilename("release", "alidist"), "alidist/defaults-release.sh")
266
+ self.assertEqual(resolveDefaultsFilename("release", "alidost"), None)
267
+ self.assertEqual(resolveDefaultsFilename("o2", "alidist"), None)
268
+ with patch.object(os.path, "exists", fake_exists), \
269
+ patch.object(os, "environ", {"BITS_PATH": "/foo"}):
270
+ self.assertEqual(resolveDefaultsFilename("release", "alidist"), "alidist/defaults-release.sh")
271
+ self.assertEqual(resolveDefaultsFilename("release", "alidost"), None)
272
+ self.assertEqual(resolveDefaultsFilename("o2", "alidist"), "/foo/defaults-o2.sh")
273
+ with patch.object(os.path, "exists", fake_exists), \
274
+ patch.object(os, "environ", {"BITS_PATH": "/bar:/foo"}):
275
+ self.assertEqual(resolveDefaultsFilename("release", "alidist"), "alidist/defaults-release.sh")
276
+ self.assertEqual(resolveDefaultsFilename("release", "alidost"), None)
277
+ self.assertEqual(resolveDefaultsFilename("o2", "alidist"), "/bar/defaults-o2.sh")
278
+ with patch.object(os.path, "exists", fake_exists), \
279
+ patch.object(os, "environ", {"BITS_PATH": "bar:/foo"}):
280
+ self.assertEqual(resolveDefaultsFilename("release", "alidist"), "alidist/defaults-release.sh")
281
+ self.assertEqual(resolveDefaultsFilename("release", "alidost"), None)
282
+ self.assertEqual(resolveDefaultsFilename("o2", "alidist"), "alidist/bar/defaults-o2.sh")
283
+
284
+ def test_resolveFilename(self):
285
+ def fake_exists(n):
286
+ return {
287
+ "alidist/defaults-release.sh": True,
288
+ "alidist/zlib.sh": True,
289
+ "/foo/defaults-o2.sh": True,
290
+ "/bar/defaults-o2.sh": True,
291
+ "alidist/bar/defaults-o2.sh": True,
292
+ "/bar/python.sh": True
293
+ }.get(n, False)
294
+
295
+ def fake_abspath(n):
296
+ return os.path.join("/fake/", n)
297
+
298
+ with patch.object(os.path, "exists", fake_exists), \
299
+ patch.object(os.path, "abspath", fake_abspath):
300
+ self.assertEqual(resolveFilename({}, "zlib", "alidist"), ("alidist/zlib.sh", "/fake/alidist/"))
301
+
302
+ with patch.object(os.path, "exists", fake_exists), \
303
+ patch.object(os.path, "abspath", fake_abspath), \
304
+ patch.object(os, "environ", {"BITS_PATH": "/foo"}):
305
+ self.assertEqual(resolveFilename({}, "zlib", "alidist"), ("alidist/zlib.sh", "/fake/alidist/"))
306
+
307
+ with patch.object(os.path, "exists", fake_exists), \
308
+ patch.object(os.path, "abspath", fake_abspath), \
309
+ patch.object(os, "environ", {"BITS_PATH": "/bar:/foo"}):
310
+ self.assertEqual(resolveFilename({}, "zlib", "alidist"), ("alidist/zlib.sh", "/fake/alidist/"))
311
+ self.assertEqual(resolveFilename({}, "zlib", "alidost"), (None, None))
312
+ self.assertEqual(resolveFilename({}, "python", "alidist"), ("/bar/python.sh", "/bar"))
313
+
230
314
 
231
315
  class TestTopologicalSort(unittest.TestCase):
232
316
  """Check that various properties of topological sorting hold."""
@@ -260,6 +344,5 @@ class TestTopologicalSort(unittest.TestCase):
260
344
  self.assertEqual(frozenset(specs.keys()),
261
345
  frozenset(topological_sort(specs)))
262
346
 
263
-
264
347
  if __name__ == '__main__':
265
348
  unittest.main()
@@ -74,7 +74,7 @@ commands =
74
74
 
75
75
  coverage run --source={toxinidir} -a -m unittest discover {toxinidir}/tests
76
76
 
77
- git clone -b O2-v1.3.0 --depth 1 https://github.com/alisw/alidist
77
+ git clone -b alibuild_CI --depth 1 https://github.com/alisw/alidist
78
78
 
79
79
  coverage run --source={toxinidir} -a {toxinidir}/aliBuild -a {env:ARCHITECTURE} -z test-init init zlib
80
80
  # This command is expected to fail, but run it for the coverage anyway.
@@ -1,9 +0,0 @@
1
- requests
2
- pyyaml
3
- distro
4
- jinja2
5
- boto3; python_version >= '3.6'
6
- futures; python_version == '2.7'
7
- futures; python_version == '2.6'
8
- argparse; python_version == '2.6'
9
- ordereddict; python_version == '2.6'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes