Commit Graph

1670 Commits

Author SHA1 Message Date
Jonathan Lebon
4ffe12a6af libglnx: bump for GLNX_HASH_TABLE_FOREACH macros
Example of what the new macros look like when applied on a whole
codebase. It definitely feels much nicer to work with!

Update submodule: libglnx

Requires: https://github.com/GNOME/libglnx/pull/55

Closes: #834
Approved by: cgwalters
2017-06-20 14:09:24 +00:00
Kalev Lember
368b1c36f6 Don't use polkit when running on the session bus
This is the case when we're running self tests.

Closes: #825
Approved by: cgwalters
2017-06-19 21:19:42 +00:00
Kalev Lember
184c017b36 libbuild.sh: Install polkit-devel
We need this until the updated package with the polkit support added
makes it into a repo.

Closes: #825
Approved by: cgwalters
2017-06-19 21:19:42 +00:00
Kalev Lember
41a8c7a02e ci: Install polkit-devel for c7-build
We need this until the updated package with the polkit support added
makes it into a repo and yum-builddep picks up the new dep.

Closes: #825
Approved by: cgwalters
2017-06-19 21:19:42 +00:00
Kalev Lember
84f6bcb4f0 Add polkit support
This allows non-root users access to the rpm-ostree daemon, which is
a pre-requirement for gnome-software rpm-ostree support.

Closes: #745

Closes: #825
Approved by: cgwalters
2017-06-19 21:19:42 +00:00
Jonathan Lebon
5803fbc807 vmcheck: also clear repo metadata between tests
Closes: #833
Approved by: cgwalters
2017-06-19 15:19:59 +00:00
Jonathan Lebon
c1e6685767 upgrader: fix missing goto out
Closes: #833
Approved by: cgwalters
2017-06-19 15:19:59 +00:00
Jonathan Lebon
782edff91a deploy transaction: factor out local RPM importing
This will be useful in the future for local replacement overrides.

Closes: #833
Approved by: cgwalters
2017-06-19 15:19:59 +00:00
Jonathan Lebon
f0ed8cdb88 rpm-utils: fix pkglist printout
Noticed this while doing composes recently.

Closes: #833
Approved by: cgwalters
2017-06-19 15:19:59 +00:00
Jonathan Lebon
6b8f0f6b23 core: fix error message construction
In the error path when trying to remove a base package, we would try to
print a DnfPackage as char*, which of course didn't result in any
coherent output.

Closes: #833
Approved by: cgwalters
2017-06-19 15:19:59 +00:00
Jonathan Lebon
f5227c8d51 postprocess: add explanatory comment re. /var/run
Include the findings from
https://github.com/projectatomic/rpm-ostree/pull/831 as a comment for
future investigations.

Closes: #832
Approved by: cgwalters
2017-06-16 13:33:49 +00:00
Jonathan Lebon
57cf8d9bc0 postprocess: always nuke /var/run
If `/var/run` exists, it will be a dir, so we'll fail the `unlinkat`
with `EISDIR`. Let's just explicitly nuke it.

Closes: #831
Approved by: cgwalters
2017-06-15 19:27:14 +00:00
Jonathan Lebon
943138b132 postprocess: stronger handling for sepolicy in /var
We shouldn't just check that the "targeted" dir exists, but rather that
the actual directory where the modules are stored exists. This fixes a
regression on RHEL in which the new selinux-policy-targeted lists some
%ghost files under /var/lib/selinux and as a result think that the
policy is in /var.

Closes: #831
Approved by: cgwalters
2017-06-15 19:27:14 +00:00
Jonathan Lebon
4a5e9c3086 postprocess: use glnx_throw helpers to add details
Closes: #831
Approved by: cgwalters
2017-06-15 19:27:14 +00:00
Colin Walters
9f671efc60 treecompose: Add various g_prefix_error()
To help debug a problem which turned out to be in SELinux postprocessing for
RHELAH.

Closes: #830
Approved by: jlebon
2017-06-15 17:40:33 +00:00
Jonathan Lebon
4a61e55663 deploy: use consistent argument names
This is just a cosmetic patch that ensures we use the same names for the
same things everywhere to make it easier to follow along.

Closes: #829
Approved by: cgwalters
2017-06-13 13:25:24 +00:00
Jonathan Lebon
9907f9b283 vmoverlay: overlay on default checksum, not booted
This allows us to save one reboot if we want the overlay to happen on
the pending base checksum.

Closes: #829
Approved by: cgwalters
2017-06-13 13:25:24 +00:00
Jonathan Lebon
4ee57a6dbd rpmostree-dbus-helpers: generalize pkg sorting
Minor prep for replace overrides.

Let rpmostree_sort_pkgs_strv work on an existing fd list rather than
creating its own, since it may be called multiple times on different
pkgs arrays.

Factor out the logic that calls to sort and inserts the values in the
final modifiers variant dict to prepare for being able to do this
operation multiple times.

Closes: #829
Approved by: cgwalters
2017-06-13 13:25:24 +00:00
Colin Walters
6b74f440dc tests: Use G_DEBUG=fatal-warnings for daemon
To catch things like https://github.com/projectatomic/rpm-ostree/issues/826
during testing.

(Really IMO this should be the system-wide default except GNOME and
 lots of apps would start dumping core all over the place... 😢)

Closes: #828
Approved by: jlebon
2017-06-09 20:42:44 +00:00
Jonathan Lebon
1331ac837d deploy transaction: append to txn title in piecemeal
Only add information to it re. installing/uninstall/local installs after
we check that the corresponding arrays are not `NULL`.

Closes: #826

Closes: #827
Approved by: cgwalters
2017-06-09 20:12:36 +00:00
Jonathan Lebon
afcd99c1bf status: don't use autoptr() on generated objects
This would make a hard dependency on glib > 2.50, which we're not ready
for yet.

Closes: #824
Approved by: cgwalters
2017-06-08 21:14:58 +00:00
Jonathan Lebon
5d8783b62d ci: add centos build checker
We should make sure that we can build on CentOS 7, so that we don't
inadvertently break the rdgo c7 stream. This will be enforced even more
explicitly when we were integrate RPM building in PAPR.

Closes: #824
Approved by: cgwalters
2017-06-08 21:14:58 +00:00
Jonathan Lebon
e6a86c1c8e util.h: add helper macro for proper English pluralization
This is to assuage my pet peeve of bad grammar output. It's of course
English-centric, and would require some tweaking if/when we support
internalionalization systems like gettext. Though I don't think it
makes it more difficult to do so in the future.

Closes: #824
Approved by: cgwalters
2017-06-08 21:14:58 +00:00
Jonathan Lebon
cba24435b0 core: don't use rpmfiles if missing
Starting from v4.12, rpmteFI has been deprecated in favour of
rpmteFiles. Make use of it if we can, otherwise fall back to the older
API.

Closes: #824
Approved by: cgwalters
2017-06-08 21:14:58 +00:00
Colin Walters
1977e3cfba scripts: Unlink our temporary post scripts
I just happened to do an `ls /usr` on my workstation. Sigh 😣

Closes: #822
Approved by: jlebon
2017-06-08 15:55:57 +00:00
Colin Walters
5da409fcad upgrader: Add user-inaccessible private dir for rootfs checkouts
This is part of the saga of permissions and checkouts that
came about thinking about flatpak, but suid and world-writable dirs
are also an issue for us.

There's no reason to make suid binaries accessible temporarily
to users while we're computing a new root.  Similarly, we don't
want anyone to actually *write* to our temporary `/tmp`.  The
simple fix is to make an intermediate dir that's `0700`.

See: https://github.com/ostreedev/ostree/pull/909
See: https://github.com/flatpak/flatpak/pull/843

Closes: #821
Approved by: jlebon
2017-06-08 15:24:02 +00:00
Colin Walters
69cc3a13a2 upgrader: Remove duplicate #defines
These were moved to `sysroot-core.h`, but the originals weren't
deleted.  Do so now.  Prep for more work here.

Closes: #821
Approved by: jlebon
2017-06-08 15:24:02 +00:00
Jonathan Lebon
4e2936f085 origin: avoid double lookup on hash table removals
More efficient *and* prettier! So much win!

Closes: #797
Approved by: cgwalters
2017-06-05 20:48:50 +00:00
Jonathan Lebon
b9f6d09f91 vmcheck: add new test for override remove
Closes: #797
Approved by: cgwalters
2017-06-05 20:48:50 +00:00
Jonathan Lebon
ec34eec6db vmcheck: create new test-basic.sh test
And move tests from test-layering-basic.sh that aren't related to
pkglayering there.

Closes: #797
Approved by: cgwalters
2017-06-05 20:48:50 +00:00
Jonathan Lebon
cde3295e26 app: add experimental support for pkg removals
This is one more step towards making rpm-ostree more powerful in its
quest to be the ultimate *hybrid* image/package system. Package layering
allows us to add packages on top of the base package set received from
the content provider. However, we're not able to remove or replace
packages in the base set itself.

This patch introduces a new `override` command, which is for now nested
under the experimental `ex` command. The `override` command will allow
users to modify the base package set itself. The first implemented
subcommands are `remove` and `reset`.

A stub has been provided for the more useful `replace` subcommand,
though much of the needed logic for that operation are implemented in
this patch as part of the `remove` subcommand.

Part of: https://github.com/projectatomic/rpm-ostree/issues/485

Closes: #797
Approved by: cgwalters
2017-06-05 20:48:50 +00:00
Colin Walters
7d1424e0c7 compose: Error out early if treecompose-post isn't executable
Closes: https://github.com/projectatomic/rpm-ostree/issues/817

Closes: #818
Approved by: jlebon
2017-06-05 19:18:20 +00:00
Jonathan Lebon
a6c9b6213c origin: drop GCancellable arg and rename function
1. There's no point in passing a GCancellable in those cases. All the
   manipulations should be short-lived.
2. Rename delete_packages to remove_packages, since "remove" is the
   proper antonym of "add".

Closes: #819
Approved by: cgwalters
2017-06-05 18:47:14 +00:00
Colin Walters
02f1fa678e daemon: Plug leak of AddMatch rules for RegisterClient
I noticed this when I set up a `while true; do rpm-ostree status; done` loop
to test: https://github.com/projectatomic/rpm-ostree/pull/814
This is a local, authenticated DoS of sorts, but there are honestly a lot of
those, IMO not worth a CVE.

Closes: https://github.com/projectatomic/rpm-ostree/issues/815

Closes: #816
Approved by: jlebon
2017-06-02 17:57:14 +00:00
Colin Walters
e5294829b8 Add human-readable Title to transaction, render in status
There's a lot that could be done to improve this; we're not setting a title for
`rollback` etc. But I think in practice right now the "deploy" path (which
includes upgrade/install) etc. is most important.

Re-synthesizing a human readable string here is definitely a bit fragile and
going to be a maintenance pain. One thing I debated is having the client send
its commandline as a string. But that would only work for `/usr/bin/rpm-ostree`,
not e.g. Cockpit.

Anyways for now, this is useful and we can always improve it later.

Closes: https://github.com/projectatomic/rpm-ostree/issues/454

Closes: #814
Approved by: jlebon
2017-06-02 17:27:10 +00:00
Colin Walters
d5a493f8b1 Update libglnx
This adapts us to the new dfd API.

Update submodule: libglnx

Closes: #813
Approved by: jlebon
2017-05-31 20:56:27 +00:00
Jonathan Lebon
cdd4b4148a core: drop unused argument to assemble_tmprootfs
Closes: #808
Approved by: cgwalters
2017-05-31 15:19:09 +00:00
Jonathan Lebon
af982ff156 livefs: fix nested continue bug in optimization
There's a subtle but classic issue in this code: calling `continue`
really just continued the inner loop, whereas we meant continuing the
outer loop.

Fix this by making the prefix lookup check a proper predicate function.
Place that function somewhere public, because we'll make use of it in
base overrides as well.

Closes: #807
Approved by: cgwalters
2017-05-31 14:47:54 +00:00
Jonathan Lebon
b800fae0cc upgrader: refactor to improve legibility
At this point, there are many helper functions that really should just
be made upgrader-aware to make it easier to follow. For example, now
both find_missing_pkgs_in_rpmdb() and generate_treespec() are passed the
Upgrader object directly, allowing us to avoid having to thread through
multiple arguments everywhere. Another example is that the Upgrader now
carries the list of final packages that need to be overlaid rather than
passing it around.

We also rename the functions to better reflect what they actually do.

Closes: #804
Approved by: cgwalters
2017-05-30 16:42:59 +00:00
Jonathan Lebon
33935173fa upgrader: drop unnecessary malloc for tmprootfs
Since we now use a predictable directory for the rootfs checkout and
assembly operation, there's no need for a tmprootfs variable anymore.

Closes: #804
Approved by: cgwalters
2017-05-30 16:42:59 +00:00
Jonathan Lebon
5735447f2a origin: add helper to check if local assembly needed
It's less cumbersome to check for this in the origin. Factor it out
there so that it's easier to modify it in the future.

Closes: #804
Approved by: cgwalters
2017-05-30 16:42:59 +00:00
Jonathan Lebon
3fea05d35f upgrader: factor out sack_has_subject
In preparation for using it outside the upgrader.

Closes: #804
Approved by: cgwalters
2017-05-30 16:42:59 +00:00
Jonathan Lebon
c491114720 core: auto-call download_metadata()
In all cases, we always do download_metadata() followed by prepare().
Let's just make life easier for callers by inlining this in prepare(),
much like what libdnf does. The function is still public in case some
use case calls for making them separate.

Closes: #805
Approved by: cgwalters
2017-05-30 15:17:07 +00:00
Jonathan Lebon
b804ae8ae3 core: absorb RpmOstreeInstall into RpmOstreeContext
There's not much use in having RpmOstreeInstall be separate now that
it's completely private. Let's just make it part of the main context
object rather than making callers allocate space for it and pass it to
the various context methods.

We also rename `prepare_install` to `prepare` since it will (soon) do
more than just installs (and sometimes only pure uninstalls).

Closes: #805
Approved by: cgwalters
2017-05-30 15:17:07 +00:00
Jonathan Lebon
d1608ba066 app: more conversion to new style
No big surprises there. A few goto cleanups remain in rpm-util.c
functions which use tmpdirs.

Closes: #803
Approved by: cgwalters
2017-05-30 14:47:31 +00:00
Jonathan Lebon
83aeb018c1 main: deduplicate subcommand handling
We had a lot of duplicate code that handled subcommand handling. Though
now that we have proper structs to represent commands and command
invocations, we can easily unify these.

Closes: #803
Approved by: cgwalters
2017-05-30 14:47:31 +00:00
Jonathan Lebon
fa62981693 main: delete duplicate GPG sig printing function
We already have a `rpmostree_print_signatures` function that the
`status` command uses to print GPG signatures.

Closes: #803
Approved by: cgwalters
2017-05-30 14:47:31 +00:00
Jonathan Lebon
e852bf33d6 main: make rpm subcommand a proper alias
We were manually aliasing `rpm` to `db`, but we now have a nicer way to
define legacy aliases. Use it.

Closes: #803
Approved by: cgwalters
2017-05-30 14:47:31 +00:00
Jonathan Lebon
4297bdf263 vmsync: also pull ostree from build container
Copy the bits from `overlay.sh` that takes the ostree files from the
build container so that we also get updated ostree bits when we
`vmsync`.

Also make sure to `daemon-reload` before restarting the daemon.

Closes: #803
Approved by: cgwalters
2017-05-30 14:47:31 +00:00
Jonathan Lebon
ac9c3c1635 compose: use test env fedora.repo file instead
During provisioning, PAPR injects a fedora.repo pointing at a much
better & faster mirror than dl.fp.o. Let's use that to make the compose
test less flaky. Hoping to make these sorts of optimizations more
discoverable in upstream PAPR.

Closes: #799
Approved by: cgwalters
2017-05-30 14:17:38 +00:00