@@ -22,6 +22,9 @@ If you have both installed, docker will be used by default. If you
22
22
want to use a specific container runtime, set ` XCPNG_OCI_RUNNER ` to
23
23
the docker-compatible command to use (typically ` podman ` or ` docker ` ).
24
24
25
+ You'll need to install git-lfs to be able to download the source tarballs from
26
+ git, otherwise when running xcp-ng-dev, it won't be able to extract the sources.
27
+
25
28
## Building the container image(s)
26
29
27
30
You need one container image per target version of XCP-ng.
@@ -37,27 +40,33 @@ Usage: ./build.sh {version_of_XCP_ng}
37
40
38
41
## Using the container
39
42
40
- Use the ` run.py ` script. It accepts a variety of parameters allowing for different uses:
43
+ Install the ` xcp-ng-dev ` script with however you usually install python
44
+ binaries. For example:
45
+
46
+ ` uv tool install --from path/to/xcp-ng-build-env xcp-ng-build `
47
+ ` pipx install path/to/xcpng-build-env `
48
+
49
+ Use ` xcp-ng-dev ` . It accepts a variety of parameters allowing for different uses:
41
50
* rebuild an existing source RPM (with automated installation of the build dependencies)
42
51
* build a package from an already extracted source RPM (sources and spec file), or from a directory that follows the rpmbuild convention (a ` SOURCES/ ` directory and a ` SPECS/ ` directory). Most useful for building packages from XCP-ng's git repositories of RPM sources: https://github.com/xcp-ng-rpms .
43
52
* or simply start a shell in the build environment, with the appropriate CentOS, EPEL and XCP-ng yum repositories enabled.
44
53
45
54
``` sh
46
- usage: run.py [-h] [-b BRANCH] [-l BUILD_LOCAL] [--define DEFINE]
47
- [-r REBUILD_SRPM] [-o OUTPUT_DIR] [-n] [-p PACKAGE] [-s SRPM]
48
- [-d DIR] [-e ENV] [-v VOLUME] [--rm] [--syslog] [--name NAME]
49
- [-a ENABLEREPO] [--fail-on-error]
50
- ...
55
+ usage: xcp-ng-dev [-h] [-b BRANCH] [-l BUILD_LOCAL] [--define DEFINE]
56
+ [-r REBUILD_SRPM] [-o OUTPUT_DIR] [-n] [-p PACKAGE]
57
+ [-s SRPM] [-d DIR] [-e ENV] [-v VOLUME] [--rm] [--syslog]
58
+ [--name NAME] [--ulimit ULIMIT] [-a ENABLEREPO]
59
+ [--disablerepo DISABLEREPO] [--fail-on-error]
60
+ ...
51
61
52
62
positional arguments:
53
63
command Command to run inside the prepared container
54
64
55
- optional arguments :
65
+ options :
56
66
-h, --help show this help message and exit
57
- -b BRANCH, --branch BRANCH
58
- XCP-ng version: 7.6, 8.0, etc. If not set, will
59
- default to 8.0.
60
- -l BUILD_LOCAL, --build-local BUILD_LOCAL
67
+ -b, --branch BRANCH XCP-ng version: 7.6, 8.3, etc. If not set, will
68
+ default to 8.3.
69
+ -l, --build-local BUILD_LOCAL
61
70
Install dependencies for the spec file(s) found in the
62
71
SPECS/ subdirectory of the directory passed as
63
72
parameter, then build the RPM(s). Built RPMs and SRPMs
@@ -71,30 +80,35 @@ optional arguments:
71
80
' xcp_ng_section extras' , for building the ' extras'
72
81
version of a package which exists in both ' base' and
73
82
' extras' versions.
74
- -r REBUILD_SRPM , --rebuild-srpm REBUILD_SRPM
83
+ -r, --rebuild-srpm REBUILD_SRPM
75
84
Install dependencies for the SRPM passed as parameter,
76
85
then build it. Requires the --output-dir parameter to
77
86
be set.
78
- -o OUTPUT_DIR , --output-dir OUTPUT_DIR
87
+ -o, --output-dir OUTPUT_DIR
79
88
Output directory for --rebuild-srpm and --build-local.
80
89
-n, --no-exit After executing either an automated build or a custom
81
90
command passed as parameter, drop user into a shell
82
- -p PACKAGE , --package PACKAGE
91
+ -p, --package PACKAGE
83
92
Packages for which dependencies will be installed
84
- -s SRPM , --srpm SRPM SRPMs for which dependencies will be installed
85
- -d DIR , --dir DIR Local dir to mount in the image. Will be mounted at
93
+ -s, --srpm SRPM SRPMs for which dependencies will be installed
94
+ -d, --dir DIR Local dir to mount in the image. Will be mounted at
86
95
/external/< dirname>
87
- -e ENV, --env ENV Environment variables passed directly to docker -e
88
- -v VOLUME, --volume VOLUME
89
- Volume mounts passed directly to docker -v
96
+ -e, --env ENV Environment variables passed directly to docker -e
97
+ -v, --volume VOLUME Volume mounts passed directly to docker -v
90
98
--rm Destroy the container on exit
91
99
--syslog Enable syslog to host by mounting in /dev/log
92
100
--name NAME Assign a name to the container
93
- -a ENABLEREPO, --enablerepo ENABLEREPO
101
+ --ulimit ULIMIT Ulimit options passed directly to docker run
102
+ -a, --enablerepo ENABLEREPO
94
103
additional repositories to enable before installing
95
104
build dependencies. Same syntax as yum' s --enablerepo
96
- parameter. Available additional repositories: xcp-ng-
97
- updates_testing, xcp-ng-extras, xcp-ng-extras_testing.
105
+ parameter. Available additional repositories: check
106
+ files/xcp-ng.repo.*.x.in.
107
+ --disablerepo DISABLEREPO
108
+ disable repositories. Same syntax as yum' s
109
+ --disablerepo parameter. If both --enablerepo and
110
+ --disablerepo are set, --disablerepo will be applied
111
+ first
98
112
--fail-on-error If container initialisation fails, exit rather than
99
113
dropping the user into a command shell
100
114
` ` `
@@ -103,7 +117,7 @@ optional arguments:
103
117
104
118
Rebuild an existing source RPM (with automated installation of the build dependencies)
105
119
` ` ` sh
106
- ./run.py -b 8.0 --rebuild-srpm /path/to/some-source-rpm.src.rpm --output-dir /path/to/output/directory --rm
120
+ xcp-ng-dev -b 8.2 --rebuild-srpm /path/to/some-source-rpm.src.rpm --output-dir /path/to/output/directory --rm
107
121
` ` `
108
122
109
123
Build from git (and put the result into RPMS/ and SRPMS/ subdirectories)
@@ -116,7 +130,7 @@ git clone https://github.com/xcp-ng-rpms/xapi.git
116
130
# ... Here add your patches ...
117
131
118
132
# Build.
119
- /path/to/run.py -b 8.0 --build-local xapi/ --rm
133
+ xcp-ng-dev -b 8.2 --build-local xapi/ --rm
120
134
` ` `
121
135
122
136
** Important switches**
@@ -157,11 +171,11 @@ make
157
171
158
172
If you' d like to develop using the tools on your host and preserve the changes
159
173
to source and revision control but still use the container for building, you
160
- can do using by mouning a volume in the container, using the ` -v` option to mount
174
+ can do using by mounting a volume in the container, using the `-v` option to mount
161
175
a directory from your host to a suitable point inside the container. For
162
176
example, if I clone some repos into a directory on my host, say `/work/code/`,
163
177
then I can mount it inside the container as follows:
164
178
165
179
```sh
166
- ./run.py -b 8.0 -v /work/code:/mnt/repos
180
+ xcp-ng-dev -b 8.2 -v /work/code:/mnt/repos
167
181
```
0 commit comments