Commit graph

45 commits

Author SHA1 Message Date
Christian Kellner
7171eb2bf3 osbuild: add custom selinux policy
A usual step in creating OS file system trees is to apply the
correct SELinux labels for all files and directories. This is
done by the org.osbuild.selinux stage, which internally uses the
setfiles command in order to do so. The SELiunx policy to be
used for this operation is the one of the newly created system,
not the host one. It therefore can contain labels that are not
known on the host. The kernel will prevent setting invalid,
i.e. unknown, labels unless the caller has the CAP_MAC_ADMIN
capability. By default, setfiles is executed in the setfiles_t
domain, where it lacks that capability. Therefore a custom
osbuild SELinux policy was created, with a special transition
rule that will execute setfiles in the setfiles_mac_t
domain. All stages, sources and assemblers as well as the main
binary are label with the new osbuild_exec_t label.

Additionally, allow a transition from osbuild_t to install_t by
using `anaconda_domtrans_install`, so that ostree and
rpm-ostree, which are labeled as install_exec_t, can transition
to the install_t domain when called form osbuild.  Update the
spec file to build the policy and include it in a new
osbuild-selinux sub-package.
2020-06-10 01:35:05 +02:00
Christian Kellner
162797f206 NEWS.md: update for osbuild version 16
Major changes are the support for ignition, that assembler results
wont be automatically committed anymore, a new org.osbuild.copy
stage, the removal of the `tree_id` & `output_id` as well as full
manifest validation due to the addition of source schema validation.
2020-06-04 16:22:59 +02:00
Christian Kellner
2fa594f334 15
This completes the development of osbuild version 15.
2020-05-20 21:44:58 +02:00
Christian Kellner
f2a3423caa 14
This completes the development of osbuild version 14.
2020-05-06 20:18:15 +02:00
Christian Kellner
4b7c68fcdf spec: simplify module inclusion code
Now that as a result of commit 4d2f15f all symlinks have been
dropped from the individual module paths, the search for module
contents can be simplified again.
2020-05-06 20:18:15 +02:00
Christian Kellner
a52c1dac45 spec: install schemata
Install the schema to %{_datadir}/osbuild/schema and provide a
link from %{pkgdir}/schema to that location so that the osbuild
library can easily access the schemata.
2020-05-06 15:42:23 +02:00
David Rheinsberg
4d2f15fb46 modules: drop osbuild symlink
Drop the `osbuild -> ../osbuild` symlink from all module directories.
We now properly initialize the PYTHONPATH to provide the imported
osbuild module from the host environment. Therefore, these links are no
longer needed.

The sources run from the host environment, so they should just pick them
up from the environment the same way osbuild itself does.
2020-05-04 12:32:25 +02:00
Christian Kellner
245809f40d 13
This completes the development of osbuild version 13.
2020-04-29 20:39:37 +02:00
David Rheinsberg
58d368df0d osbuild: unify libdir handling
We want to run stages and other scripts inside of the nspawn containers
we use to build pipelines. Since our pipelines are meant to be
self-contained, this should imply that the build-root must have osbuild
installed. However, this has not been the case so far for several
reasons including:

  1. OSBuild is not packaged for all the build-roots we want to support
     and thus we have the chicken-and-egg problem.

  2. During testing and development, we want to support using a local
     `libdir`.

  3. We already provide an API to the container. Importing scripts from
     the outside just makes this API bigger, but does not change the
     fact that build-roots are not self-contained. Same is true for the
     running kernel, and probably much more..

With all this in mind, our strategy probably still is to eventually
package osbuild for the build-root. This would significantly reduce our
API exposure, points-of-failure, and host-reliance. However, this switch
might still be some weeks out.

With this in mind, though, we can expect the ideal setup to have a full
osbuild available in the build-root. Hence, any script we import so far
should be able to access the entire `libdir`. This commit unifies the
libdir handling by installing the symlinks into `libdir` and providing
a single bind-mount of the module-path into `libdir`.

We can always decide to scratch that in the future when we scratch the
libdir-import from the host-root. Until then, I believe this commit
nicely unifies the way we import the module both in a local checkout as
well as in the container.
2020-04-21 13:44:43 +02:00
Christian Kellner
f036c10759 12
This completes the development of osbuild version 12.
2020-04-15 20:19:36 +02:00
Christian Kellner
22110ffb68 spec: ship ostree specific files in sub-package
Ship the stages, assembler and source that are necessary to build
images with OSTree support in the osbuild-ostree sub-package.
2020-04-15 19:37:20 +02:00
Christian Kellner
9a40cbc99a spec: require matching python3-osbuild version
The `osbuild` executable requires that the exact same version of the
corresponding python library is installed, but this was not enforced
in the RPM package. Thus a old version of osbuild could be installed
alongside an older version of python3-osbuild, which results in an
osbuild crash (see below).
Therefore, enforce that both installed packages have matching
versions by specifying the exact version for the `python3-osbuild`
dependency of the `osbuild` package.

Example osbuild crash if versions are not matching:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (osbuild 10 (/usr/lib/python3.8/site-packages), Requirement.parse('osbuild==11'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/osbuild", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3252, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3235, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'osbuild==11' distribution was not found and is required by the application
2020-04-07 10:55:16 +02:00
Christian Kellner
953cf7bff0 11
This completes osbuild version 11.
2020-04-01 19:03:41 +02:00
Ondřej Budai
b75c784b85 spec: do not generate deps from internal files
RPM is smart about dependencies - it goes over all shebangs of packaged files
and adds Requires to them. Prior this commit osbuild package depended on
python 3.6, because rhel runner has /usr/bin/python3.6 as shebang.

This commit fixes it by turning off dependency generators for our internal
stuff: assemblers, runners and stages. They run in a container, so I think
there's no reason to generate dependencies from them.
2020-03-26 21:16:21 +01:00
Christian Kellner
67dfe0965e spec: include NEWS.md in docs
We have some news for the world to read, therefore include the
recently added NEWS.md file in the rpm package.
2020-03-19 11:17:31 +01:00
Christian Kellner
61420d1496 10
This completes osbuild version 10.
2020-03-18 18:41:39 +01:00
David Rheinsberg
7271d0b8f7 spec: use make man and copy all man-pages
Use `make man` rather than hard-coding man-page creation in the
spec-file. Furthermore, install all man-pages, not just the base one.

The commands are adjusted to account for possibly more man-pages being
added. Tree-wide the only place to adjust for new man-pages being added
is the `%files` list in the spec-file.
2020-03-09 13:20:42 +01:00
David Rheinsberg
3e1aa25cf1 spec: make indentation consistent
We already indent the values in the spec-file to all start at the same
column. However, we use different indentation sizes for different
blocks of values. This makes it really confusing to read. Lets use a
consistent indentation and align everything with the main assignments in
the spec-file.
2020-03-09 13:20:42 +01:00
Christian Kellner
5c465220b4 spec: build and install man page
Build and install the osbuild(1) man page. Requires rst2man, which
is provided by the python3-docutils package.
2020-03-06 14:47:19 +01:00
Christian Kellner
6fdc52e2ec 9
Release osbuild version 9
2020-03-05 12:42:59 +01:00
David Rheinsberg
ccf050f6a7 build: avoid random tab in specfile
The specfile uses space-based alignment all over the place, except for
one line. Fix this up.
2020-03-03 10:53:30 +01:00
Lars Karlitski
a578a2b7e7 pipeline: detect host instead of using org.osbuild.host
Detect the host dynamically from os-release(5) instead of relying on the
`org.osbuild.host` symlink.

It is awkward to install a symlink that tells osbuild which distro is is
running on, when there is a standard way to detect this.

This makes it easier to run osbuild from sources and removes the need to
include every host in the spec file. The latter became hard to do,
because there's no obvious way to distinguish RHEL minor releases.
2020-02-28 16:06:30 +01:00
Major Hayden
7b8f70fc5b Allow osbuild to run on rawhide (f33)
Add an additional symlink and spec update for Fedora Rawhide,
which is currently set as release 33.

Signed-off-by: Major Hayden <major@redhat.com>
2020-02-26 15:25:47 +01:00
Tom Gundersen
e9cb75891e 8
Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-02-24 12:47:07 +01:00
Tom Gundersen
31f3533886 spec: use forgemeta
This changes the name of the source tarball, but apart from that has
no effect as-is.

However, if the `commit` global is set, then the source tarball is
expected to be the standard git-archive at that commit, and the
release field is set to contain the date and the git sha. This is
useful for when we want to build rpms between releases.

This works analogously to how osbulid-composer currently works.

See <https://fedoraproject.org/wiki/Forge-hosted_projects_packaging_automation>
for details.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-02-24 12:17:54 +01:00
Tom Gundersen
7817ae5e8b sources: add org.osbuild.files source
This source adds support for downloaded files. The files are
indexed by their content hash, and the only option is their URL.

The main usecase for this will be downloading rpms. Allowing depsolving
to be done outside of osbuild, network access to be restricted and
downloaded rpms to be reused between runs.

Each source is now passed two additional arguments, a cache directory
and an output directory. Both are in the source's namespace, and
the source is responsible for managing them. Each directory may
contain contents from previous runs, but neither is ever guaranteed
to do so.

Downloaded contents may be saved to the cache and resued between
runs, and the requested content should be written to the output dir.
If secrets are used, the source must only ever write contents to
the output that corresponds to the available secrets (rather than
contents from the cache from previous runs).

Each stage is passed an additional argument, a sources directory.
The directory is read-only, and contains a subdirectory named after
each used source, which will contain the requseted contents when
the `Get()` call returns (if the source uses this functionality).

Based on a patch by Lars Karlitski.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-02-06 19:01:12 +01:00
Christian Kellner
e7b989a08d osbuild.spec: actually install runners symlinks
The Fedora 31 and Fedora 32 runners are symlinks but the spec file
only looked for files and not symlinks. Fix that.

Follow up by 6a14ba40f7. Found by
Lars.
2020-01-23 00:47:57 +01:00
Martin Sehnoutka
6a14ba40f7 Create Fedora 31 and Fedora 32 runners 2020-01-10 18:27:55 +01:00
Lars Karlitski
ef7f17d95b osbuild.spec: install sources directory
Missed it in 510e2b1e94.
2020-01-09 23:55:20 +01:00
Lars Karlitski
5b77048e97 7 2019-12-16 01:17:25 +01:00
Lars Karlitski
f0a7b2261e pipeline: introduce host runner
osbuild currently throws an error when not passing a build environment
on the command line, because the runner is unset. This is annoying on
hosts which only need a runner set, but no build pipeline.

To simplify running osbuild in this common case, introduce
`org.osbuild.host`, which is a runner that is defined to work on the
host that osbuild is installed on. Use this runner by default and
include a symlink to the right runner in the Fedora and RHEL packages.

Also add `runners/org.osbuild.host` to `.gitignore`, so that developers
can set the symlink when running osbuild from the source directory.

Fixes #171
2019-12-02 13:45:48 +01:00
Lars Karlitski
d8bb359e81 6 2019-11-29 19:08:53 +01:00
Lars Karlitski
2c564afae8 osbuild.spec: make /usr/lib/osbuild/{stages,assemblers}/osbuild
osbuild bind-mounts its library to this location. The directory needs to
exist, because it is mounting `/usr` read-only.
2019-11-29 00:45:14 +01:00
Lars Karlitski
9f14aa79c4 osbuild.spec: replace tabs with spaces
To silence an rpmlint warning.
2019-11-29 00:45:14 +01:00
Lars Karlitski
64713449ce Introduce runners
We've been using a generic `osbuild-run`, which sets up the build
environment (and works around bugs) for all build roots. It is already
getting unwieldy, because it tries to detect the OS for some things it
configures. It's also about to cause problems for RHEL, which doesn't
currently support a python3 shebang without having /etc around.

This patch changes the `build` key in a pipeline to not be a pipeline
itself, but an object with `runner` and `pipeline` keys. `pipeline` is
the build pipeline, as before. `runner` is the name of the runner to
use. Runners are programs in the `runners` subdirectory.

Three runners are included in this patch. They're copies of osbuild-run
for now (except some additions for rhel82). The idea is that each of
them only contains the minimal setup code necessary for an OS, and that
we can review what's needed when updating a build root.

Also modify the `--build-pipeline` command line switch to accept such a
build object (instead of a pipeline) and rename it accordingly, to
`--build-env`.

Correspondingly, `OSBUILD_TEST_BUILD_PIPELINE` → `OSBUILD_TEST_BUILD_ENV`.
2019-11-25 13:05:22 +01:00
Lars Karlitski
1f526477d2 5 2019-10-30 18:49:56 +01:00
Lars Karlitski
434a01602b 3 2019-10-04 11:13:21 +02:00
Martin Sehnoutka
cd49e2407c replace _libdir with _prefix/lib
_libdir is platform dependant, but that is not what we want because we
would need additional runtime logic to handle platforms. this patch
overrides the defautl location
2019-10-03 15:35:50 +02:00
Martin Sehnoutka
fa8de2f6d8 move files from /usr/libexec to /usr/lib
There is no real difference in these two directories. Composer already
uses /usr/lib, so OSBuild should use the same as well.
2019-10-02 15:01:01 +02:00
Martin Sehnoutka
209d3fa437 release version 2 2019-09-18 00:05:43 +02:00
Martin Sehnoutka
448da5df8f [packit] sync from downstream branch 'master'
Downstream commit: 769e09f84422db3c56e7228a2c51a6076528616c

Signed-off-by: Martin Sehnoutka <msehnout@redhat.com>
2019-09-02 10:28:21 +02:00
Martin Sehnoutka
3bbe17073d download sources from github as <name>-<version>.tar.gz
packit produces tarballs with this name, so it is easier to download
them from github like this
2019-08-01 16:17:11 +02:00
Martin Sehnoutka
0812baa352 update url in the specfile 2019-07-29 09:41:28 +02:00
Lars Karlitski
265968f5c6 spec: only install regular files in stages/ and assemblers (#36)
The previous commit added a symlink to `../osbuild`, which is helpful
when developing, but shouldn't be included in the rpm.
2019-07-26 08:58:58 +02:00
Martin Sehnoutka
3c19420b3e introduce spec file and related build scripts
The repository now contains a Vagrantfile for running the testing script
against an RPM package created locally using `make rpm`. To run this
test use `make vagrant-test`. setup.py was also modified to adhere to
packaging guidelines and not to install system-level executables.
The lincense is now included in the Python package using the MANIFEST.in
file.
2019-07-23 15:22:40 +02:00