alibuild 1.17.19__py3-none-any.whl

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 (74) hide show
  1. alibuild-1.17.19.data/scripts/aliBuild +137 -0
  2. alibuild-1.17.19.data/scripts/aliDeps +7 -0
  3. alibuild-1.17.19.data/scripts/aliDoctor +7 -0
  4. alibuild-1.17.19.data/scripts/alienv +344 -0
  5. alibuild-1.17.19.data/scripts/pb +7 -0
  6. alibuild-1.17.19.dist-info/METADATA +78 -0
  7. alibuild-1.17.19.dist-info/RECORD +74 -0
  8. alibuild-1.17.19.dist-info/WHEEL +5 -0
  9. alibuild-1.17.19.dist-info/licenses/LICENSE.md +674 -0
  10. alibuild-1.17.19.dist-info/top_level.txt +5 -0
  11. alibuild_helpers/__init__.py +21 -0
  12. alibuild_helpers/_version.py +21 -0
  13. alibuild_helpers/analytics.py +120 -0
  14. alibuild_helpers/args.py +493 -0
  15. alibuild_helpers/build.py +1209 -0
  16. alibuild_helpers/build_template.sh +314 -0
  17. alibuild_helpers/clean.py +83 -0
  18. alibuild_helpers/cmd.py +154 -0
  19. alibuild_helpers/deps.py +116 -0
  20. alibuild_helpers/doctor.py +195 -0
  21. alibuild_helpers/git.py +104 -0
  22. alibuild_helpers/init.py +103 -0
  23. alibuild_helpers/log.py +132 -0
  24. alibuild_helpers/scm.py +31 -0
  25. alibuild_helpers/sl.py +62 -0
  26. alibuild_helpers/sync.py +693 -0
  27. alibuild_helpers/templating_plugin.py +18 -0
  28. alibuild_helpers/utilities.py +662 -0
  29. alibuild_helpers/workarea.py +179 -0
  30. debian/changelog +11 -0
  31. debian/compat +1 -0
  32. debian/control +14 -0
  33. debian/copyright +10 -0
  34. debian/files +1 -0
  35. debian/rules +7 -0
  36. docs/README.md +1 -0
  37. docs/SUPPORT +3 -0
  38. docs/docs/alice_logo.png +0 -0
  39. docs/docs/deps.png +0 -0
  40. docs/docs/index.md +75 -0
  41. docs/docs/quick.md +89 -0
  42. docs/docs/reference.md +430 -0
  43. docs/docs/stylesheets/extra.css +9 -0
  44. docs/docs/troubleshooting.md +346 -0
  45. docs/docs/user.md +413 -0
  46. docs/mkdocs.yml +37 -0
  47. templates/alibuild_to_please.jnj +63 -0
  48. tests/test_analytics.py +42 -0
  49. tests/test_args.py +119 -0
  50. tests/test_build.py +426 -0
  51. tests/test_clean.py +154 -0
  52. tests/test_cmd.py +73 -0
  53. tests/test_deps.py +79 -0
  54. tests/test_doctor.py +128 -0
  55. tests/test_git.py +48 -0
  56. tests/test_hashing.py +67 -0
  57. tests/test_init.py +103 -0
  58. tests/test_log.py +50 -0
  59. tests/test_packagelist.py +235 -0
  60. tests/test_parseRecipe.py +132 -0
  61. tests/test_sync.py +332 -0
  62. tests/test_utilities.py +383 -0
  63. tests/test_workarea.py +101 -0
  64. tests/testdist/broken1.sh +1 -0
  65. tests/testdist/broken2.sh +1 -0
  66. tests/testdist/broken3.sh +3 -0
  67. tests/testdist/broken4.sh +2 -0
  68. tests/testdist/broken5.sh +2 -0
  69. tests/testdist/broken6.sh +2 -0
  70. tests/testdist/broken7.sh +5 -0
  71. tests/testdist/clobber-initdotsh.sh +4 -0
  72. tests/testdist/defaults-o2.sh +10 -0
  73. tests/testdist/delete-etc.sh +4 -0
  74. tests/testdist/tracking-env.sh +6 -0
@@ -0,0 +1,179 @@
1
+ import codecs
2
+ import errno
3
+ import os
4
+ import os.path
5
+ import shutil
6
+ import tempfile
7
+ from collections import OrderedDict
8
+
9
+ from alibuild_helpers.log import dieOnError, debug, error
10
+ from alibuild_helpers.utilities import call_ignoring_oserrors, symlink, short_commit_hash
11
+
12
+ FETCH_LOG_NAME = "fetch-log.txt"
13
+
14
+
15
+ def cleanup_git_log(referenceSources):
16
+ """Remove a stale fetch-log.txt.
17
+
18
+ You must call this function before running updateReferenceRepoSpec or
19
+ updateReferenceRepo any number of times. This is not done automatically, so
20
+ that running those functions in parallel works properly.
21
+ """
22
+ try:
23
+ os.unlink(os.path.join(referenceSources, FETCH_LOG_NAME))
24
+ except OSError as exc:
25
+ # Ignore errors when deleting a nonexistent file.
26
+ dieOnError(exc.errno != errno.ENOENT,
27
+ "Could not delete stale git log: %s" % exc)
28
+
29
+
30
+ def logged_scm(scm, package, referenceSources,
31
+ command, directory, prompt, logOutput=True):
32
+ """Run an SCM command, but produce an output file if it fails.
33
+
34
+ This is useful in CI, so that we can pick up SCM failures and show them in
35
+ the final produced log. For this reason, the file we write in this function
36
+ must not contain any secrets. We only output the SCM command we ran, its exit
37
+ code, and the package name, so this should be safe.
38
+ """
39
+ debug("%s %s for repository for %s...", scm.name, command[0], package)
40
+ err, output = scm.exec(command, directory=directory, check=False, prompt=prompt)
41
+ if logOutput:
42
+ debug(output)
43
+ if err:
44
+ try:
45
+ with codecs.open(os.path.join(referenceSources, FETCH_LOG_NAME),
46
+ "a", encoding="utf-8", errors="replace") as logf:
47
+ logf.write("%s command for package %r failed.\n"
48
+ "Command: %s %s\nIn directory: %s\nExit code: %d\n" %
49
+ (scm.name, package, scm.name.lower(), " ".join(command), directory, err))
50
+ except OSError as exc:
51
+ error("Could not write error log from SCM command:", exc_info=exc)
52
+ dieOnError(err, "Error during %s %s for reference repo for %s." %
53
+ (scm.name.lower(), command[0], package))
54
+ debug("Done %s %s for repository for %s", scm.name.lower(), command[0], package)
55
+ return output
56
+
57
+
58
+ def updateReferenceRepoSpec(referenceSources, p, spec,
59
+ fetch=True, usePartialClone=True, allowGitPrompt=True):
60
+ """
61
+ Update source reference area whenever possible, and set the spec's "reference"
62
+ if available for reading.
63
+
64
+ @referenceSources : a string containing the path to the sources to be updated
65
+ @p : the name of the package to be updated
66
+ @spec : the spec of the package to be updated (an OrderedDict)
67
+ @fetch : whether to fetch updates: if False, only clone if not found
68
+ """
69
+ spec["reference"] = updateReferenceRepo(referenceSources, p, spec, fetch,
70
+ usePartialClone, allowGitPrompt)
71
+ if not spec["reference"]:
72
+ del spec["reference"]
73
+
74
+
75
+ def updateReferenceRepo(referenceSources, p, spec,
76
+ fetch=True, usePartialClone=True, allowGitPrompt=True):
77
+ """
78
+ Update source reference area, if possible.
79
+ If the area is already there and cannot be written, assume it maintained
80
+ by someone else.
81
+
82
+ If the area can be created, clone a bare repository with the sources.
83
+
84
+ Returns the reference repository's local path if available, otherwise None.
85
+ Throws a fatal error in case repository cannot be updated even if it appears
86
+ to be writeable.
87
+
88
+ @referenceSources : a string containing the path to the sources to be updated
89
+ @p : the name of the package to be updated
90
+ @spec : the spec of the package to be updated (an OrderedDict)
91
+ @fetch : whether to fetch updates: if False, only clone if not found
92
+ """
93
+ assert isinstance(spec, OrderedDict)
94
+ if spec["is_devel_pkg"] or "source" not in spec:
95
+ return None
96
+
97
+ scm = spec["scm"]
98
+
99
+ debug("Updating references.")
100
+ referenceRepo = os.path.join(os.path.abspath(referenceSources), p.lower())
101
+
102
+ call_ignoring_oserrors(os.makedirs, os.path.abspath(referenceSources), exist_ok=True)
103
+
104
+ if not is_writeable(referenceSources):
105
+ if os.path.exists(referenceRepo):
106
+ debug("Using %s as reference for %s", referenceRepo, p)
107
+ return referenceRepo # reference is read-only
108
+ else:
109
+ debug("Cannot create reference for %s in %s", p, referenceSources)
110
+ return None # no reference can be found and created (not fatal)
111
+
112
+ if not os.path.exists(referenceRepo):
113
+ cmd = scm.cloneReferenceCmd(spec["source"], referenceRepo, usePartialClone)
114
+ logged_scm(scm, p, referenceSources, cmd, ".", allowGitPrompt)
115
+ elif fetch:
116
+ cmd = scm.fetchCmd(spec["source"], "+refs/tags/*:refs/tags/*", "+refs/heads/*:refs/heads/*")
117
+ logged_scm(scm, p, referenceSources, cmd, referenceRepo, allowGitPrompt)
118
+
119
+ return referenceRepo # reference is read-write
120
+
121
+
122
+ def is_writeable(dirpath):
123
+ try:
124
+ with tempfile.NamedTemporaryFile(dir=dirpath):
125
+ return True
126
+ except:
127
+ return False
128
+
129
+
130
+ def checkout_sources(spec, work_dir, reference_sources, containerised_build):
131
+ """Check out sources to be compiled, potentially from a given reference."""
132
+ scm = spec["scm"]
133
+
134
+ def scm_exec(command, directory=".", check=True):
135
+ """Run the given SCM command, simulating a shell exit code."""
136
+ try:
137
+ logged_scm(scm, spec["package"], reference_sources, command, directory, prompt=False)
138
+ except SystemExit as exc:
139
+ if check:
140
+ raise
141
+ return exc.code
142
+ return 0
143
+
144
+ source_parent_dir = os.path.join(work_dir, "SOURCES", spec["package"], spec["version"])
145
+ # The build script expects SOURCEDIR to be named after the shortened commit
146
+ # hash, not the full one.
147
+ source_dir = os.path.join(source_parent_dir, short_commit_hash(spec))
148
+ os.makedirs(source_parent_dir, exist_ok=True)
149
+
150
+ if spec["commit_hash"] != spec["tag"]:
151
+ symlink(spec["commit_hash"], os.path.join(source_parent_dir, spec["tag"].replace("/", "_")))
152
+
153
+ if "source" not in spec:
154
+ # There are no sources, so just create an empty SOURCEDIR.
155
+ os.makedirs(source_dir, exist_ok=True)
156
+ elif spec["is_devel_pkg"]:
157
+ shutil.rmtree(source_dir, ignore_errors=True)
158
+ # In a container, we mount development packages' source dirs in /.
159
+ # Outside a container, we have access to the source dir directly.
160
+ symlink("/" + os.path.basename(spec["source"])
161
+ if containerised_build else spec["source"],
162
+ source_dir)
163
+ elif os.path.isdir(source_dir):
164
+ # Sources are a relative path or URL and the local repo already exists, so
165
+ # checkout the right commit there.
166
+ err = scm_exec(scm.checkoutCmd(spec["tag"]), source_dir, check=False)
167
+ if err:
168
+ # If we can't find the tag, it might be new. Fetch tags and try again.
169
+ tag_ref = "refs/tags/{0}:refs/tags/{0}".format(spec["tag"])
170
+ scm_exec(scm.fetchCmd(spec["source"], tag_ref), source_dir)
171
+ scm_exec(scm.checkoutCmd(spec["tag"]), source_dir)
172
+ else:
173
+ # Sources are a relative path or URL and don't exist locally yet, so clone
174
+ # and checkout the git repo from there.
175
+ shutil.rmtree(source_dir, ignore_errors=True)
176
+ scm_exec(scm.cloneSourceCmd(spec["source"], source_dir, spec.get("reference"),
177
+ usePartialClone=True))
178
+ scm_exec(scm.setWriteUrlCmd(spec.get("write_repo", spec["source"])), source_dir)
179
+ scm_exec(scm.checkoutCmd(spec["tag"]), source_dir)
debian/changelog ADDED
@@ -0,0 +1,11 @@
1
+ python3-alibuild (1.8.4~focal) focal; urgency=medium
2
+
3
+ * Bump to v1.8.4
4
+
5
+ -- Giulio Eulisse <giulio.eulisse@cern.ch> Thu, 27 May 2021 19:18:00 +0200
6
+
7
+ python3-alibuild (1.8.2) bionic; urgency=medium
8
+
9
+ * Initial release.
10
+
11
+ -- Giulio Eulisse <giulio.eulisse@cern.ch> Tue, 04 May 2021 00:08:40 +0200
debian/compat ADDED
@@ -0,0 +1 @@
1
+ 10
debian/control ADDED
@@ -0,0 +1,14 @@
1
+ Source: python3-alibuild
2
+ Maintainer: Giulio Eulisse <giulio.eulisse@cern.ch>
3
+ Build-Depends: debhelper,dh-python,python3-all,python3-setuptools,python3-setuptools-scm
4
+ Section: devel
5
+ Priority: optional
6
+ Standards-Version: 3.9.6
7
+ X-Python3-Version: >= 3.6
8
+
9
+ Package: python3-alibuild
10
+ Architecture: all
11
+ Description: ALICE build tool.
12
+ Please refer to https://alisw.github.io/alibuild for full documentation.
13
+ Depends: ${python3:Depends},python3-requests,python3-yaml
14
+ Recommends: pigz
debian/copyright ADDED
@@ -0,0 +1,10 @@
1
+ Copyright CERN and copyright holders of ALICE O2. This software is
2
+ distributed under the terms of the GNU General Public License v3 (GPL
3
+ Version 3), copied verbatim in the file "/usr/share/common-licenses".
4
+
5
+ See http://alice-o2.web.cern.ch/license for full licensing information.
6
+
7
+ In applying this license CERN does not waive the privileges and immunities
8
+ granted to it by virtue of its status as an Intergovernmental Organization
9
+ or submit itself to any jurisdiction.
10
+
debian/files ADDED
@@ -0,0 +1 @@
1
+ python3-alibuild_1.8.2_source.buildinfo devel optional
debian/rules ADDED
@@ -0,0 +1,7 @@
1
+ #! /usr/bin/make -f
2
+
3
+ #export DH_VERBOSE = 1
4
+ export PYBUILD_NAME = python3-alibuild
5
+
6
+ %:
7
+ dh $@ --with python3 --buildsystem=pybuild
docs/README.md ADDED
@@ -0,0 +1 @@
1
+ Read the documentation here: <http://alisw.github.io/alibuild/>
docs/SUPPORT ADDED
@@ -0,0 +1,3 @@
1
+ Before submitting an issue, please refer to the [troubleshooting
2
+ section](http://alisw.github.io/alibuild/troubleshooting.html) of our
3
+ documentation.
Binary file
docs/docs/deps.png ADDED
Binary file
docs/docs/index.md ADDED
@@ -0,0 +1,75 @@
1
+ ---
2
+ subtile: About this tool
3
+ layout: main
4
+ ---
5
+
6
+ <div style="text-align:center;width:100%">
7
+ <a href="https://badge.fury.io/py/alibuild"><img src="https://badge.fury.io/py/alibuild.svg" alt="PyPI version" height="22"></a>
8
+ <a href="https://github.com/alisw/alibuild/actions/workflows/pr-check.yml"><img src="https://github.com/alisw/alibuild/actions/workflows/pr-check.yml/badge.svg?branch=master&event=push" alt="Build status" height="22"></a>
9
+ </div>
10
+
11
+ A simple build tool for ALICE experiment software and its externals. Recipes
12
+ for the externals and ALICE software are stored in
13
+ [alidist](https://github.com/alisw/alidist).
14
+
15
+ You can install aliBuild on [Ubuntu][ubuntu], [MacOS][mac], [CentOS 7][centos7], [Alma 8][alma8], [Alma 9][alma9] and [Fedora][fedora].
16
+
17
+ [centos7]: https://alice-doc.github.io/alice-analysis-tutorial/building/prereq-centos7.html
18
+ [alma8]: https://alice-doc.github.io/alice-analysis-tutorial/building/prereq-centos8.html
19
+ [alma9]: https://alice-doc.github.io/alice-analysis-tutorial/building/prereq-alma9.html
20
+ [ubuntu]: https://alice-doc.github.io/alice-analysis-tutorial/building/prereq-ubuntu.html
21
+ [mac]: https://alice-doc.github.io/alice-analysis-tutorial/building/prereq-macos.html
22
+ [fedora]: https://alice-doc.github.io/alice-analysis-tutorial/building/prereq-fedora.html
23
+
24
+ Then, build ALICE's software with:
25
+
26
+ git clone https://github.com/alisw/alidist.git
27
+ aliBuild build O2Physics
28
+
29
+ For a more verbose documentation of what is happening have a look at
30
+ the [quickstart guide](quick.md). See the [user guide](user.md)
31
+ for more command line options or have a look at the [troubleshooting
32
+ pages](troubleshooting.md) for hints on how to debug build errors.
33
+ Have a look at the [reference guide](reference.md) if you want to
34
+ package your own software.
35
+
36
+ <div style="display:grid;
37
+ grid-template-columns: repeat(3,1fr); /* 3 columns */
38
+ grid-template-rows: repeat(2,1fr); /* 2 rows */
39
+ grid-gap:50px 30px;
40
+
41
+ ">
42
+ <div><h2>Simple build recipes</h2>
43
+ Build recipes are simple bash scripts with a YAML header. Whenever
44
+ a dependency or a package changes only what is affected by the
45
+ change is rebuilt.
46
+ <br/><a href="reference.html">Read more</a>
47
+ </div>
48
+ <div><h2>Reuses system tools</h2>
49
+ If desired, aliBuild will do its best to reuse what is available
50
+ on the system, if compatible to what is found in the recipe.
51
+ <br/><a href="user.html#controlling-which-system-packages-are-picked-up">Read more</a>
52
+ </div>
53
+ <div><h2>Docker support</h2>
54
+ aliBuild allows builds to happen inside a docker container, so
55
+ that you can develop on Mac and build on your production Linux
56
+ platform.
57
+ <br/><a href="user.html#running-in-docker">Read more</a>
58
+ </div>
59
+ <div><h2>Binary packages</h2>
60
+ aliBuild provides the ability to reuse binary packages which were
61
+ previously centrally built, when they match the one that would be
62
+ built locally.
63
+ <br/><a href="user.html#using-precompiled-packages">Read more</a>
64
+ </div>
65
+ <div><h2>Developer mode</h2>
66
+ Besides building and packaging your dependencies, aliBuild
67
+ provides you the ability to develop those via a simple git clone.
68
+ <br/><a href="user.html#developing-packages-locally">Read more</a>
69
+ </div>
70
+ <div><h2>Integrates with modules</h2>
71
+ Easily setup your work environment using `alienv`, which is based on
72
+ standard <a href="http://modules.sourceforge.net">modulefiles</a>.
73
+ <br/><a href="quick.html#loading-the-package-environment">Read more</a>
74
+ </div>
75
+ </div>
docs/docs/quick.md ADDED
@@ -0,0 +1,89 @@
1
+ ---
2
+ subtitle: Quick Start
3
+ layout: main
4
+ ---
5
+
6
+ aliBuild is a tool to simplify building and installing ALICE / ALFA
7
+ software. This is a quickstart Guide which will show you how to build
8
+ and use a package, for extended documentation please have a look at the
9
+ [user guide](user.md).
10
+
11
+ ## Setting up
12
+
13
+ The tool itself is available as a standard PyPi package. You
14
+ can install it via:
15
+
16
+ pip install alibuild
17
+
18
+ Alternatively, if you cannot use pip, you can checkout the Github repository and
19
+ use it from there:
20
+
21
+ git clone https://github.com/alisw/alibuild.git
22
+
23
+ This will provide you the tool itself.
24
+
25
+ In order to work you will need a set of recipes from a repository called
26
+ [alidist](https://github.com/alisw/alidist.git). On the first invocation of
27
+ `alibuild` the recipes will be downloaded and put in a `alidist` folder.
28
+ In case you need to use a special branch / repository you can always `git clone`
29
+ the repository yourself. By default alibuild will pickup the recipes found
30
+ in `$PWD/alidist`.
31
+
32
+ ## Building a package
33
+
34
+ Once you have obtained both repository, you can trigger a build via:
35
+
36
+ aliBuild [-d] -j <jobs> build <package>
37
+
38
+ (or alibuild/aliBuild if you are working from sources) where:
39
+
40
+ - `<package>`: is the name of the package you want to build, e.g.:
41
+ - `AliRoot`
42
+ - `AliPhysics`
43
+ - `O2`
44
+ - `ROOT`
45
+ - `-d` can be used to have verbose debug output.
46
+ - `<jobs>` is the maximum number of parallel processes to be used for
47
+ building where possible (defaults to the number of CPUs available if
48
+ omitted).
49
+
50
+ If you need to modify the compile options, you can do so by looking at the
51
+ recipes in your local `alidist` folder and amend them.
52
+
53
+ ## Results of a build
54
+
55
+ By default (can be changed using the `-c` option) the installation of your builds
56
+ can be found in:
57
+
58
+ sw/<architecture>/<package-name>/<package-version>-<revision>/
59
+
60
+ where:
61
+
62
+ - `<architecture>` is the same as the one passed via the `-a` option.
63
+ - `<package-name>`: is the same as the one passed as an argument.
64
+ - `<package-version>`: is the same as the one found in the related recipe in alidist.
65
+ - `<package-revision>`: is the number of times you rebuilt the same version of
66
+ a package, using a different recipe. In general this will be 1.
67
+
68
+ For example, on Centos7:
69
+
70
+ sw/slc7_x86-64/AliRoot/v6-16-01-1
71
+
72
+ ## Using the built package
73
+
74
+ Environment for packages built using aliBuild is managed by [Environment
75
+ Modules](http://modules.sourceforge.net) and a wrapper script called alienv.
76
+ Notice you will need the package `environment-modules` on Linux or `modules` on
77
+ macOS for the following to work.
78
+
79
+ Assuming you are in the toplevel directory containing `alibuild`, `alidist` and
80
+ `sw` you can do:
81
+
82
+ alienv q
83
+
84
+ to list the available packages, and:
85
+
86
+ alienv enter VO_ALICE@PackageA::VersionA[,VO_ALICE@PackageB::VersionB...]
87
+
88
+ to enter a shell with the appropriate environment set. To learn more about alienv you
89
+ can also look at the [user guide](user.md#using-the-packages-you-have-built).