Skip to content

Commit 82cdbd4

Browse files
committed
run.py: package the file so it can be installed using standard tooling
Adds instructions on the readme on how to do it. Adds a gitignore to ignore files produces by the packaging Signed-off-by: Pau Ruiz Safont <[email protected]>
1 parent 067c3f8 commit 82cdbd4

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Distribution / packaging
2+
build/
3+
*.egg-info/

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ If you have both installed, docker will be used by default. If you
2222
want to use a specific container runtime, set `XCPNG_OCI_RUNNER` to
2323
the docker-compatible command to use (typically `podman` or `docker`).
2424

25+
You'll need to install git-lfs to be able to download the source tarballs from
26+
git, otherwise when running run.py, it won't be able to extract the sources.
27+
2528
## Building the container image(s)
2629

2730
You need one container image per target version of XCP-ng.
@@ -37,6 +40,9 @@ Usage: ./build.sh {version_of_XCP_ng}
3740

3841
## Using the container
3942

43+
Install the `run.py` script with
44+
`uv tool install --from path/to/xcp-ng-build-env xcp-ng-build`.
45+
4046
Use the `run.py` script. It accepts a variety of parameters allowing for different uses:
4147
* rebuild an existing source RPM (with automated installation of the build dependencies)
4248
* 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.
@@ -103,7 +109,7 @@ optional arguments:
103109
104110
Rebuild an existing source RPM (with automated installation of the build dependencies)
105111
```sh
106-
./run.py -b 8.0 --rebuild-srpm /path/to/some-source-rpm.src.rpm --output-dir /path/to/output/directory --rm
112+
run.py -b 8.2 --rebuild-srpm /path/to/some-source-rpm.src.rpm --output-dir /path/to/output/directory --rm
107113
```
108114
109115
Build from git (and put the result into RPMS/ and SRPMS/ subdirectories)
@@ -116,7 +122,7 @@ git clone https://github.com/xcp-ng-rpms/xapi.git
116122
# ... Here add your patches ...
117123
118124
# Build.
119-
/path/to/run.py -b 8.0 --build-local xapi/ --rm
125+
run.py -b 8.2 --build-local xapi/ --rm
120126
```
121127
122128
**Important switches**
@@ -157,11 +163,11 @@ make
157163
158164
If you'd like to develop using the tools on your host and preserve the changes
159165
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
166+
can do using by mounting a volume in the container, using the `-v` option to mount
161167
a directory from your host to a suitable point inside the container. For
162168
example, if I clone some repos into a directory on my host, say `/work/code/`,
163169
then I can mount it inside the container as follows:
164170

165171
```sh
166-
./run.py -b 8.0 -v /work/code:/mnt/repos
172+
run.py -b 8.2 -v /work/code:/mnt/repos
167173
```

run.py renamed to cli.py

File renamed without changes.

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[project]
2+
name = "xcp-ng-build"
3+
description = "A tool to create XCP-ng-based build environments"
4+
readme = "README.md"
5+
requires-python = ">=3.9"
6+
license = "MIT"
7+
license-files = ["LICENSE"]
8+
dynamic = ["version"]
9+
10+
[project.scripts]
11+
"run.py" = "cli:main"
12+
13+
[project.urls]
14+
Homepage = "https://github.com/xcp-ng/xcp-ng-build-env/"
15+
16+
[build-system]
17+
requires = ["setuptools >= 77.0.3", "setuptools-scm>=8"]
18+
build-backend = "setuptools.build_meta"
19+
20+
[tools.setuptools_scm]

0 commit comments

Comments
 (0)