Commit graph

1484 commits

Author SHA1 Message Date
Christian Kellner
2b4e913e1e objectstore: only bind-mount /usr for host trees
The only thing we should ever need from the host is `/usr`. Therefore
instead of bind-mounting the entirety that is `/`, just bind-mount
`/usr`.
2021-07-09 18:09:37 +01:00
Christian Kellner
d2c4888843 test/data: use mpp-define-image in ostree-image
Use the new partiton layout support in MPP. NB: start data as
well as the size of the last partition have been omitted now,
since `sfdisk` will figure those out for us.
2021-07-08 22:47:45 +02:00
Christian Kellner
d39e3a239e tools/mpp: support for defining partitions
It is now possible to define a partition layout via `mpp-define-image`.
The defined layout is actually written to a temporary sparse file and
read back via `sfdisk`, so that all partition data like `size` and
`start` include actual padding and such. The `image` variable will be
defined with `size` and `layout` keys, the latter containing the
partition layout data. It can be accessed via the "String expansion"
mechanism.
2021-07-08 22:47:45 +02:00
Christian Kellner
4456e1f276 stages: add org.osbuild.mkdir
Can create one or more directories, optionally also their parents.
Add some basic tests as well.
2021-07-08 21:14:21 +01:00
Christian Kellner
3a69bf39b7 host: catch BrokenPipeError while sending replies
Catch the BrokenPipeError exception when sending a reply. This will
happen when the other side closes their side of the connection/pipe
so in that case we just break out of the serve loop.
2021-07-08 15:01:33 +01:00
Christian Kellner
254c1cd9fb api: remove host side arguments facility
Now that arguments are transmitted via a mapped, i.e. bind-mounted,
file instead of using the jsoncomm RPC mechanism, all the methods
related to the latter can be removed from API.
2021-07-08 15:01:33 +01:00
Christian Kellner
affd384669 pipeline: deliver stage arguments via a file
Instead of using the jsoncomm API to transmit stagge arguments,
write them out to a file that is then mapped into the container.
The `api.arguments` function is re-written just read that file
from within the container.
2021-07-08 15:01:33 +01:00
Christian Kellner
82d33a35ae api: remove unused 'monitor' parameter
The monitor parameter, which previously was used for stream logs
to via the output handling of API, is now no longer needed. Thus,
it can be removed.
2021-07-08 15:01:33 +01:00
Christian Kellner
2643a85758 pipeline: use single tempdir for inputs, mounts
Instead of creating two separate temporary directores, use one and
create sub-directories for inputs and mounts in it.
2021-07-08 15:01:33 +01:00
Christian Kellner
a449bf0c42 pipeline: small whitespace change
No need to spread the BuildRoot instantiation over two lines.
2021-07-08 15:01:33 +01:00
Christian Kellner
46d675b102 api: remove unused methods
Remove the functions `_prepare_output` and `_output_ready`, which
both were used when stdout for the stages was handled by the api.
2021-07-08 15:01:33 +01:00
Christian Kellner
83fc64c565 devices/loopback: since file on close
On rare occasions, when trying to mount a file system via the
loopback device that was created in the stage before the mount
fails with `wrong fs type, bad option, bad superblock on ...`.
It is not yet fully clear why this appears since in theory the
kernel should handle the sequence of operations we do, but it
might be down to the caching or bugs in the underlying file-
system.
To mitigate with potential caching issue we therefore now sync
the file that is backing the loopback device after the device
has been closed. In order to not have to re-open the file we
keep the file descriptor around as long as the loopback device
is open.
2021-07-07 17:24:58 +01:00
Christian Kellner
23628b3f62 objectstore: sync before unmounting
This should, in theory, not be necessary because the bubblewrap
process and its children should be stopped already and umount
should just block until it is finished. But, if the store is on
a filesystem, like the one used by docker machine, unmounting
frequently produces errors like:
  `umount: .../tmp9nlyzwdu-writer: target is busy.`
Syncing the filesystem before that seems to help in some cases
and it surely does not hurt.
2021-07-07 17:24:58 +01:00
Christian Kellner
1dc845f331 tools/mpp: properly support substitutions
Previous versions of mpp would already set the arch and basearch
substitution, which would work for dep-solving itself, but not
properly re-write the resulting URLs which means that the manifest
was broken. Fix this by properly replacing the substitutions in
the URL. Also support official 'releasever' substitution.
2021-07-07 15:10:00 +02:00
Christian Kellner
7c9035e48a tools/mpp: set module_platform_id again
This, together with the "ignore-weak-deps" option got lost in the
refactoring. Add it back.
2021-07-07 15:10:00 +02:00
Alexander Todorov
6f86cf455f ci: Start building on 8.5 aarch64
we need the RPM before we can even start testing osbuild-composer on
aarch64.
2021-07-05 16:43:35 +02:00
Paul Wayper
6ee1bb93dd Reformat other subprocess.run commands to highlight command
Signed-off-by: Paul Wayper <paulway@redhat.com>
2021-07-02 11:38:02 +01:00
Paul Wayper
6d0054826b Trivial formatting change to test public contribution system
Signed-off-by: Paul Wayper <paulway@redhat.com>
2021-07-02 11:38:02 +01:00
Christian Kellner
d47f735112 tools/mpp: create PkgInfo class for package info
Instead of passing dictionaries around that are inconvenient to
use in code and even more in the `mpp-format-*` directives, use
a simple class to represent package information. Use that in
the `pkginfo` dict that can be accessed via `mpp-format-*`. Use
the `evra` property instead of string manipulation in the
`fedora-boot.mpp.json` and `-ostree-bootiso.mpp.json` manifest.
2021-07-02 11:28:43 +02:00
Christian Kellner
d5c5947271 test/data: generate the fff... uuid
Instead of writing 32 `f` chars, we can now generate it. The
future is here.
2021-07-02 11:28:43 +02:00
Christian Kellner
8a27de0d10 tools/osbuild-mpp: include nevra in package list
Include the nevra in the list of dep-solved packages. Use that for the
package info. Adapt the boot manifest accordingly.
2021-07-02 11:28:43 +02:00
Christian Kellner
ff76b6fade tools/osbuild-mpp: small whitespace fixes
Since David is on leave, I have to do them. Also Move the pylint
comment above the line, not next to it.
2021-07-02 11:28:43 +02:00
Christian Kellner
5ac1e004a6 spec: ship osbuild-mpp in new -tools
Include the `osbuild-mpp` tool, that is now installed via `setup.py`
in a new `osbuild-tools` package.
2021-07-02 11:28:43 +02:00
Christian Kellner
a247b8cc1e setup: install osbuild-mpp
Install the Manifest Pre-Processor tool.
2021-07-02 11:28:43 +02:00
Christian Kellner
44fec6cd91 tools/mpp: rename mpp.py to osbuild-mpp
Prepare the optional installation of the script via a more unique
and langauge independent name.
2021-07-02 11:28:43 +02:00
Christian Kellner
e4f39c5e03 devcontainer: add pyyaml dependency
This is needed for the pylint to work correctly with the new
cloud-init stage.
While there, add some more utilities useful for debugging. Also
add glibc-langpack-en needed for `en_GB`.
2021-07-01 23:29:03 +02:00
Alexander Larsson
53af328b7c mpp: Use the right format for the file secrets
I was getting:

.sources.org.osbuild.curl.items.sha256:02c8f76fd8b13972c541e4fa3bd2101681b7d4baa1320e3101bc4167b5531685:
  {'url': 'https://cdn.redhat.com/content/dist/rhel8/8/aarch64/baseos/os/Packages/e/elfutils-libelf-0.182-3.el8.aarch64.rpm', 'secrets': 'org.osbuild.rhsm'} is not valid under any of the given schemas

Because the secrets key should have an object, not a string value.
2021-07-01 18:15:00 +02:00
Alexander Larsson
e4eb3e0fd0 Use the new formating features to simplify the test manifests
This uses size computations to simplify the partition size/offsets
and the depsolv results to get the kernel version.

This makes no changes to the resulting json files.
2021-07-01 15:06:57 +02:00
Alexander Larsson
bdfef651eb mpp: Set a variable to the set of depsolved rpms
This allows you to format strings based on what will get installed.
A common example here is extracting the kernel version for the
dracut stage.
2021-07-01 15:06:57 +02:00
Alexander Larsson
e541c1c196 mpp: Add support for formating strings
This lets a mpp manifest define some variables and then use
these variables inside python f-strings to expand things in a
flexible way. This allows a single value such as `rootfs_size` to
be expanded in various places, including using computations to
e.g. define the partition offsets/sizes.
2021-07-01 15:06:57 +02:00
Achilleas Koutsou
ba3467d747 test/data: update nginx.conf manifests
- Update to v2 manifest
- Add build stage
2021-07-01 10:49:38 +02:00
Achilleas Koutsou
7e1f2fa9b9 test/data: update chmod manifests
- Update to v2 manifest
- Add build stage
- Create file from inline data and use it for testing chmod
2021-07-01 10:49:38 +02:00
Achilleas Koutsou
6636d390d6 stages/nginx.conf: SCHEMA_2 2021-07-01 10:49:38 +02:00
Achilleas Koutsou
c77767c788 stages/chmod: SCHEMA_2 2021-07-01 10:49:38 +02:00
Christian Kellner
fbbefa0f48 tools/mpp: remove separate mpp tools
Those got unified in tools/mpp.py, which should be used now instead.
2021-06-30 20:26:07 +01:00
Christian Kellner
68bd2c5339 Makefile: use new mpp tool
Use the new unified mpp tool instead of the two separate tools.
2021-06-30 20:26:07 +01:00
Christian Kellner
3b7320d114 tools/mpp: remove elif after return
Pylint will complain otherwise.
2021-06-30 20:26:07 +01:00
Christian Kellner
1202085883 tools/mpp: move main code into main function
Move all the global code into a `main` function and call that. This
fixes a lot of pylint warnings where variable names were re-used
from the main, and thus global, context.
2021-06-30 20:26:07 +01:00
Christian Kellner
802f401069 tools/mpp: refactor dep-solving
Create a DepSolver class that carries the global state such as dirs
and subscription information, as well as local state, like the 
repositories and basedir. The latter can be reset so the class can
easily be re-used for all dep-solve sections.
This avoids having any global state.
2021-06-30 20:26:07 +01:00
Christian Kellner
77c5c8e8a6 tools/mpp: silence bare-except warning
In that case we don't care what exactly went wrong.
2021-06-30 20:26:07 +01:00
Christian Kellner
f37c83ec25 tools/mpp: raise exception from None
Raise the `ValueError` that is thrown when we are unable to get
the secrets from `None`.
2021-06-30 20:26:07 +01:00
Christian Kellner
c600ea60a4 tools/mpp: don't compare None with ==
Either use `is` or the truth-y-ness directly.
2021-06-30 20:26:07 +01:00
Christian Kellner
bb620d727d tools/mpp: use python3 style super invocation
In Python3 there is no need for arguments in the `super` invocation
itself.
2021-06-30 20:26:07 +01:00
Christian Kellner
fdd757dd28 tools/mpp: sort the source urls
Sort the checksum: urls dictionary via the url, so that no matter
where the urls came from (import or any dep-solve section), the
checksum: url dict is the same for the same set of urls.
2021-06-30 20:26:07 +01:00
Christian Kellner
ec68369daf tools/mpp: support search dirs for manifests
Add support for additional paths that are searched when trying to
load a manifest. Currently only the path of the manifest that has
the include is searched. With this changed additional directories
will be included after that, in the order they were given ton the
command line.
2021-06-30 20:26:07 +01:00
Christian Kellner
2230dfe566 mpp: use simple urls if possible
If no `secrets` is required to download a package we can use the
simple checksum: url mapping, instead of the checksum: {url: }
one.
2021-06-30 20:26:07 +01:00
Christian Kellner
1b4f96c4e7 mpp: unify add package code path
Both v1 and v2 code paths used the same logic to add the resolved
dependencies to the `source_urls` dict, which is already stored
in the base class. Move the logic into the base class too.
2021-06-30 20:26:07 +01:00
Christian Kellner
4add7c69ff mpp: turn comment into doc string 2021-06-30 20:26:07 +01:00
Christian Kellner
3298a6461e mpp: small whitespace fixes
Be PEP-8 complaint.
2021-06-30 20:26:07 +01:00
Alexander Larsson
ab453bf81a mpp: combine depsolve and import into mpp.py
Rewrite image pre-processor to single tool so that it is easier to use.
Now also supports `ignore-weak-deps` when dep-solving and supports
relative paths for local files.
Also create a symlink to the osbuild package, so that the tools can be
run from the source checkout and have access to the osbuild package.
2021-06-30 20:26:07 +01:00