Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,11 @@ git clone https://github.com/xcp-ng-rpms/xapi.git
# ... Here add your patches ...

# Build.
xcp-ng-dev container build -b 8.2 --rm xapi/
xcp-ng-dev container build --rm xapi/ 8.2
```

**Important switches**

* `-b` / `--branch` allows to select which version of XCP-ng to work on (defaults to the latest known version if not specified).
* `--no-exit` drops you to a shell after the build, instead of closing the container. Useful if the build fails and you need to debug.
* `--rm` destroys the container on exit. Helps preventing containers from using too much space on disk. You can still reclaim space afterwards by running `docker container prune` and `docker image prune`
* `-v` / `--volume` (see *Mounting repos from outside the container* below)
Expand All @@ -120,7 +119,7 @@ fully automated.
`%autopatch` in the `%prep` block; add `BuildRequires: quilt`
2. let quilt apply them in a 8.3 buildenv (`quilt` in 8.3 is only in EPEL) and get you a shell:
```sh
xcp-ng-dev container build --rm -b 8.3 --rpmbuild-stage=p -n --enablerepo=epel .
xcp-ng-dev container build --rm --rpmbuild-stage=p -n --enablerepo=epel 8.3
```
3. ask `quilt` to refresh all your patches (alternatively just the one you want)
```sh
Expand Down Expand Up @@ -170,5 +169,5 @@ example, if I clone some repos into a directory on my host, say `/work/code/`,
then I can mount it inside the container as follows:

```sh
xcp-ng-dev container shell -b 8.2 -v /work/code:/mnt/repos
xcp-ng-dev container shell -v /work/code:/mnt/repos 8.2
```
4 changes: 2 additions & 2 deletions src/xcp_ng_dev/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def buildparser():
"Built RPMs and SRPMs will be in RPMS/ and SRPMS/ subdirectories. "
"Any preexisting BUILD, BUILDROOT, RPMS or SRPMS directories will be removed first.")
parser_build.add_argument(
'build_local', nargs='?', default='.',
'source_dir', nargs='?', default='.',
help="Root path where SPECS/ and SOURCES are available. "
"The default is the working directory")
parser_build.add_argument(
Expand Down Expand Up @@ -160,7 +160,7 @@ def container(args):
if hasattr(args, 'command') and args.command != []:
docker_args += ["-e", "COMMAND=%s" % ' '.join(args.command)]
if build:
build_dir = os.path.abspath(args.build_local)
build_dir = os.path.abspath(args.source_dir)
docker_args += ["-v", f"{build_dir}:/home/builder/rpmbuild"]
docker_args += ["-e", "BUILD_LOCAL=1"]
print(f"Building directory {build_dir}")
Expand Down