Skip to content

Commit b40c199

Browse files
committed
Move build.sh to the new python package as xcp-ng-dev-build
This needed a small bit of python glue code Signed-off-by: Pau Ruiz Safont <[email protected]>
1 parent 66528b3 commit b40c199

File tree

12 files changed

+26
-9
lines changed

12 files changed

+26
-9
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ the docker-compatible command to use (typically `podman` or `docker`).
2525
You'll need to install git-lfs to be able to download the source tarballs from
2626
git, otherwise when running xcp-ng-dev, it won't be able to extract the sources.
2727

28+
## Installation
29+
30+
Clone this repository and install the `xcp-ng-dev` package:
31+
32+
```bash
33+
git clone xcp-ng/xcp-ng-dev-build-env
34+
cd xcp-ng-dev-build-env
35+
uv tool install --from . xcp-ng-dev
36+
```
37+
38+
If `uv` is not available you can use other tools to install python packages,
39+
like `pipx install .`
40+
41+
After this, two new commands will be available: `xcp-ng-dev-build` and
42+
`xcp-ng-dev`,
43+
2844
## Building the container image(s)
2945

3046
You need one container image per target version of XCP-ng.
@@ -40,12 +56,6 @@ Usage: ./build.sh {version_of_XCP_ng}
4056

4157
## Using the container
4258

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-dev`
47-
`pipx install path/to/xcpng-build-env`
48-
4959
Use `xcp-ng-dev`. It accepts a variety of parameters allowing for different uses:
5060
* rebuild an existing source RPM (with automated installation of the build dependencies)
5161
* 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.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dynamic = ["version"]
99

1010
[project.scripts]
1111
xcp-ng-dev = "xcp_ng_dev.cli:main"
12+
xcp-ng-dev-build = "xcp_ng_dev.cli:build"
1213

1314
[project.urls]
1415
Homepage = "https://github.com/xcp-ng/xcp-ng-build-env/"

build.sh renamed to src/xcp_ng_dev/build.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
set -e
44

5+
SELF_NAME="xcp-ng-dev-build"
6+
57
if [ -z "$1" ]; then
6-
echo "Usage: $0 {version}"
8+
echo "Usage: $SELF_NAME {version}"
79
echo "... where {version} is a 'x.y' version such as 8.0."
810
exit
911
fi
@@ -32,12 +34,12 @@ CUSTOM_ARGS=()
3234
case "$1" in
3335
7.*)
3436
REPO_FILE=files/xcp-ng.repo.7.x.in
35-
DOCKERFILE=Dockerfile-7.x
37+
DOCKERFILE=files/Dockerfile-7.x
3638
CENTOS_VERSION=7.2.1511
3739
;;
3840
8.*)
3941
REPO_FILE=files/xcp-ng.repo.8.x.in
40-
DOCKERFILE=Dockerfile-8.x
42+
DOCKERFILE=files/Dockerfile-8.x
4143
CENTOS_VERSION=7.5.1804
4244
;;
4345
*)

src/xcp_ng_dev/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ def main():
204204

205205
sys.exit(return_code)
206206

207+
def build():
208+
bargs = [os.path.join(os.path.dirname(__file__ ), 'build.sh')] + sys.argv[1:]
209+
return_code = subprocess.call(bargs)
210+
sys.exit(return_code)
207211

208212
if __name__ == "__main__":
209213
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)