Commit Graph

2019 Commits

Author SHA1 Message Date
Jonathan Lebon
05e09cd72c auto-updates: Cache cached-update GVariant to disk
Rather than recalculating `cached-update` as part of transaction
cleanups and RpmostreedOS internal reloads, write it directly to a file
from `deploy_transaction_execute`. This gives two major benefits:

1. Auto-updates now has virtually zero impact to daemon startup time.
2. We get to directly use the `DnfSack` created during metadata refresh
   rather than reconstructing it later on. This greatly simplifies code.

This makes use of new APIs in libdnf to skip filelists and load
updateinfo metadata right from the start.

Closes: #1268
Approved by: cgwalters
2018-03-05 22:42:26 +00:00
Jonathan Lebon
1b580ce201 libpriv/core: Use new download_metadata libdnf API
Allow callers to pass flags directly to libdnf depending on their needs.
Make use of this in `refresh-md` at least so that we don't even bother
loading the rpmdb since we're just interested in downloading fresh bits.

Closes: #1268
Approved by: cgwalters
2018-03-05 22:42:26 +00:00
Colin Walters
bc01208d13 core: Use libdnf API to disable filelists in "pure rojig" mode
All depsolving etc. was done on the server side; we just need the
`primary.xml` in order to enumerate available rojigRPMs.

Update submodule: libdnf

Requires: https://github.com/rpm-software-management/libdnf/pull/416

Closes: #1268
Approved by: cgwalters
2018-03-05 22:42:26 +00:00
Jonathan Lebon
03874ba49a core: Print rpmmd to journal in prepare()
The "Preparing pkg txn" message is a bit misleading when all we're doing
is e.g. `refresh-md` or check-mode auto-updates trigger. Move that
message to `prepare()` instead.

We already do print to the journal the repos that are enabled before we
try to update them. That seems like good enough information for the
cases mentioned above.

Closes: #1289
Approved by: cgwalters
2018-03-05 20:06:19 +00:00
Jonathan Lebon
747e52cbc9 app/status: Display StateRoot if multiple OSes
Auto-detect if there are multiple OSes deployed and display the
StateRoot by default if so.

Closes: #1289
Approved by: cgwalters
2018-03-05 20:06:19 +00:00
Jonathan Lebon
b54b8744b9 tests/libvm: Handle transient service already existing
We would error out when trying to start the transient httpd service if
it already exists, e.g. from a previous test.

Depending on how we exit, the `vm_stop_httpd` trap for the previous test
might not have been able to kick in. I think this happens when we exit
using `fatal`, which just does an `exit 1`. It's not strictly an error,
so doesn't trip the `ERR` handler.

Let's just go the extra mile and explicitly delete transient services if
they already exist.

Closes: #1284
Approved by: cgwalters
2018-03-01 23:29:17 +00:00
Jonathan Lebon
a05a21edd3 daemon/refresh-md: Describe transaction as "refresh-md"
Not sure what I was thinking using "makecache" as the human-friendly
title for this transaction, when the well-known name is "refresh-md".
Let's just make these match.

Closes: #1284
Approved by: cgwalters
2018-03-01 23:29:17 +00:00
Jonathan Lebon
3496947f8d configure.ac: Also build in debug mode for -Og
I prefer to use `-Og` rather than `-O0` in debug mode. Notably, it shuts
up `_FORTIFY_SOURCE` warnings which require *some* optimizations turned
on.

Closes: #1284
Approved by: cgwalters
2018-03-01 23:29:17 +00:00
Jonathan Lebon
d85a1fba0a libpriv/util: Factor out size limit checking
This will be used in the upcoming patch.

Closes: #1284
Approved by: cgwalters
2018-03-01 23:29:17 +00:00
Jonathan Lebon
f6fb505cac daemon: Complete output-to-self rename
To reduce confusion in future versions of myself and other readers,
complete the suggested rename from "redirect-output" to "output-to-self"
to internal variable names as well.

Closes: #1283
Approved by: cgwalters
2018-03-01 23:04:11 +00:00
Colin Walters
36071d3c69 rojig-rename: (almost) Everything else
This renames the remaining C files, tests, etc.  There are only
a few hits for `jigdo` left; changing them would be a format break,
so let's wait to do that until we need to.

Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Colin Walters
ec5b560979 rojig-rename: Client side files
Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Colin Walters
df86d81ad7 rojig-rename: Rename the "build" side files
Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Colin Walters
6dcc8376a1 rojig-rename: Core defines
Rename the `core.h` file and the `#define` set.

Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Colin Walters
76919a0c4b rojig-rename: API functions in core/origin, pruning refspec
This renames the API functions in the core and origin, and also fixes up the
fact that we were still looking for `jigdo/` refs in the pruning code.

Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Jonathan Lebon
bb4033f3e8 app/usroverlay: Do a root check and fix typo
Let's give a nicer error than 'Permission denied' if users try to run
this as non-root. Kinda overkill to set up polkit auth for this command.
Feels like something only uid 0 should be able to do anyway.

Also fix `/usr` typo.

Closes: #1286
Approved by: cgwalters
2018-03-01 21:30:54 +00:00
Colin Walters
50b1f9b63f compose: Also treat FUSE as a netfs
Fedora is apparently currently using sshfs because S390 is in a different
location than the main servers.

Since it seems nontrivial to detect just sshfs, and FUSE is problematic in
general, let's just do the the not-horrific-on-netfs path for all FUSE mounts.

Closes: #1285
Approved by: jlebon
2018-03-01 18:51:42 +00:00
Jonathan Lebon
83a94ffe95 daemon/os: Check deployment before using it
If one isn't actually booted in a deployment, we'd get `NULL` from
libostree. Check for it before trying to use it. Something something
Rust.

This will all go away soon with #1268, though this quick fix should
allow anyone hitting this to use FAHC RPMs to move forward.

Closes: #1282
Approved by: cgwalters
2018-02-28 17:52:42 +00:00
Colin Walters
07d5cb5914 scripts: Disable rofiles-fuse for glibc locales
OK so I give up on this glibc locales issue; see
https://github.com/ostreedev/ostree/pull/1470

Based on what I've been reading it looks like newer FUSE may
help, but we can't rely on that.

We should also rewrite the upstream glibc code to be less pathological; it'd
make sense to use `O_TMPFILE` for example, and keep track of how many bytes we
wrote rather than calling `fstat()`, and rather than `truncate()` on the tmpl
file at the end, do a create-empty-file-then-`rename()`. But for now let's go
with this so we get the pretty `●` back in rojig mode!

Closes: #1280
Approved by: jlebon
2018-02-28 16:33:20 +00:00
Jonathan Lebon
ccae8ca977 auto-updates: Redirect output to self if timer
As mentioned during code review, it feels odd to have our automatic
service collect output under its name rather than the main daemon. It
shouldn't be thought of as a daemon with its own logs, it's really just
a trigger.

We change this here so that for automatic updates, output is redirected
to the daemon stdout, which of course goes to the journal. This should
make logs in case of errors more discoverable as well since
`rpm-ostreed` is the well-known name.

I drilled down the notion directly into `RpmostreedTransaction` since I
think it's a useful property that might be handy at a more general
level.

Closes: #1278
Approved by: cgwalters
2018-02-28 14:13:47 +00:00
Jonathan Lebon
f0910c2b5c libpriv/output: Also quiet down progress if not tty
Teach the RpmOstreeOutput default handler to be nice to non-TTYs as
well, just like we did in #1225. We should look at somehow unifying this
with the code in `rpmostree-dbus-helpers.c`.

Closes: #1278
Approved by: cgwalters
2018-02-28 14:13:47 +00:00
Jonathan Lebon
80bd997212 daemon/os: Check transaction before connecting signal
Didn't hit this, but clearly we should check if there's even a
transaction to listen to before trying to connect a signal.

Closes: #1278
Approved by: cgwalters
2018-02-28 14:13:47 +00:00
Jonathan Lebon
26f3784972 daemon/transaction: drop emit_message_printf() helper
This was superseded by `rpmostree_output_message`. This is prep for
being able to "silence" transactions and instead have all the output go
to the daemon.

Closes: #1277
Approved by: cgwalters
2018-02-27 21:14:55 +00:00
Colin Walters
aba3f444d6 scripts: Support RPMOSTREE_SCRIPT_DEBUG
This makes it easy to get an interactive shell instead of executing a specific
script. I used this while debugging `build-locale-archive`. This is better than
`bwrap-script-shell.sh` as we'll get the real rofiles-fuse etc., and
additionally have the root filesystem at the exact same point.

Closes: #1275
Approved by: jlebon
2018-02-27 19:16:18 +00:00
Colin Walters
b304a433a0 Second renaming pass for "rojig"
We're continuing an incremental renaming process; previously we changed
the most user-visible strings.  Now we're doing some internal variables,
and notably the cached refs and the origin files - the latter set is
things that end up on disk.

This leaves the biggest items; renaming APIs, files, and tests.

Closes: #1276
Approved by: jlebon
2018-02-27 18:45:10 +00:00
Jonathan Lebon
829a746821 lib/package: Handle arch pkg transitions
Let's try to match expectations a bit from the dnf/yum world and
describe e.g. a `noarch` package become archful as an upgrade rather
than a removal and an addition. This was originally implicitly supported
(before PR #1230) by the fact that we didn't compare arches at all (and
in fact, arches don't even show up in a `db diff` output for modified
packages).

We bring this back here, but only in the simple case that it's a single
package. We still don't try to do any fancy handling for packages of the
same name.

Closes: #1272

Closes: #1274
Approved by: cgwalters
2018-02-27 15:44:11 +00:00
Jonathan Lebon
64968436e6 lib/package: Re-order arch comparison branches
Making this a separate commit to increase the odds we get this right.
Prep for next commit.

Closes: #1274
Approved by: cgwalters
2018-02-27 15:44:11 +00:00
Jonathan Lebon
56c192f5cc lib/package: Fix logic error in diff algorithm
Classic indentation/bracing error causing logic error. This made us skip
over some packages which then showed up wrongly as removed. This will be
implicitly tested in a new test case added in a following commit.

Closes: #1274
Approved by: cgwalters
2018-02-27 15:44:11 +00:00
Jonathan Lebon
0874152ba6 vmcheck: Drop selinux-policy hack
This shouldn't be necessary anymore.

Closes: #1274
Approved by: cgwalters
2018-02-27 15:44:11 +00:00
Micah Abbott
ad8e9b6de8 man: add example usage for automatic update policy
The man page was a little weak on how to configure and enable the
automatic update policy of `rpm-ostreed`.  I've added an `EXAMPLE`
section that shows the necessary steps to get this working.

Closes: #1273
Approved by: jlebon
2018-02-26 20:21:43 +00:00
Colin Walters
3dd132285a Initial renaming pass of "jigdo" to "rojig"
I noticed that Ubuntu also uses the original "jigdo", so let's start
pulling off the band-aid here and do a mass rename.

For this first pass I'm focusing on CLI entrypoints and docs, as that's what
people are going to see; renaming all of the internal C functions, structure
variables etc. can come later.

Closes: #1269
Approved by: jlebon
2018-02-26 15:32:50 +00:00
Colin Walters
4af55efffd main: Fix wording of ex command description
Previous wording was awkward; noticed this in a CI error.

Closes: #1271
Approved by: jlebon
2018-02-23 18:21:17 +00:00
pcahyna
1ea5426751 fix "make tags"
src/libpriv/rpmostree-cleanup.h was removed in commit f14d1a3536 and its presence in Makefile causes "make tags" to fail.
Closes: #1270
Approved by: jlebon
2018-02-23 16:35:48 +00:00
Colin Walters
88324984ab README.md: Update "projects using rpm-ostree" section
Mention Kube over Docker, and also drop the "immutable" bit as I think it's a
misleading term.

Closes: #1264
Approved by: jlebon
2018-02-20 15:42:35 +00:00
Colin Walters
d03cd8a7b7 tests/jigdo-client: Re-enable
FAHC is rebuilt now with v5.

Closes: #1263
Approved by: jlebon
2018-02-20 14:27:54 +00:00
Jonathan Lebon
cf6f704ee4 Release 2018.3
Bugfix release to fix minor performance regression from auto-updates
work. Plus a low-risk enhancement to `status` to print only the booted
deployment with `--booted`.

Also minor refresh of release workflow documentation.

Closes: #1262
Approved by: cgwalters
2018-02-18 18:20:34 +00:00
Jonathan Lebon
55040a56ad daemon/sysroot: Emit UPDATED signal for configs
Let's also make sure we refresh `RPMOSTreeOS` objects when configs
changed. Specifically, what they export to their D-Bus interfaces may be
dependent on daemon settings, as is the case with auto-updates.

We might want to decouple this into two separate signals in the future
(one for sysroot changes, and one for config changes), though given that
only `RPMOSTreeOS` listens for `UPDATED` right now, we can just get away
with a single one for the time being.

Closes: #1261
Approved by: cgwalters
2018-02-17 21:15:30 +00:00
Jonathan Lebon
df80e15002 auto-updates: Use service type simple
I initially used `oneshot` for this since it felt like a better fit for
non-daemon services. But the only practical difference between the two
is that systemd will wait until we exit before running dependent
follow-up units.

I'd like to change this to `simple` because we can expect users to force
a trigger run using `systemctl start rpm-ostree-automatic`, which will
hang until completion in `oneshot` mode. And given that we're not part
of the boot process and no other unit depends on us, the distinction
makes no semantic difference to us.

Closes: #1261
Approved by: cgwalters
2018-02-17 21:15:30 +00:00
Jonathan Lebon
5d1c043058 daemon/os: Do less work on startup if auto-updates off
While playing with the freshly built v2018.2 Fedora packages on my
Atomic Workstation, I realized that we paid the auto-updates startup
cost even when it was disabled. I've had auto-updates on for so long, I
hadn't seen this pass by me. 🙈

The long-term fix here is caching the update to disk rather than
recalculating it on startup everytime (as suggested during review). Will
work on this as follow-up. Though for now, I'd like to get this smaller
patch in and backported to Fedora so only folks opting in to try it out
experience the >1s startup delay.

Closes: #1261
Approved by: cgwalters
2018-02-17 21:15:30 +00:00
Colin Walters
2e25732ba1 status: Add -b/--booted to only print that deployment
It's usually what I want to paste into bug reports for example; I rarely want to
show the pending state or rollback.

Closes: #1260
Approved by: jlebon
2018-02-17 19:00:24 +00:00
Jonathan Lebon
f54779df20 configure.ac: Bump ostree build dep to v2018.2
We make use of the new `OstreeRepoCheckoutFilterResult` type.

Closes: #1259
Approved by: cgwalters
2018-02-16 22:07:10 +00:00
Jonathan Lebon
b65f696b0b Release 2018.2
We have lots of goodies in the bag worthy of a release. More rojig
improvements, initial auto-updates support, and many fixes.

Closes: #1258
Approved by: cgwalters
2018-02-16 20:28:53 +00:00
Jonathan Lebon
ff9c19acd3 app/override: allow removing and replacing atomically
This is an essential functionality rather than a nicety. Some
replacements can *only* be done without conflicts if we can remove
packages at the same time.

I do like that this has to be done explicitly, though OTOH, I can
definitely see folks wanting an `--allow-removals` type of switch in the
future.

Closes: #1255

Closes: #1257
Approved by: cgwalters
2018-02-16 19:15:18 +00:00
Colin Walters
5879b96a64 jigdo V5: Use number of objects as cache invalidation trigger
Changes in a server-side tree can cause the need for clients to import different
objects from packages. For example, turning on documentation. Another more
subtle case is where an object might "move" from package A to B by being deleted
from A - then the jigdo build process will pick the B version.

We need a "cache validation key"; a way for the server to tell the client that
the objects it should import from the package have changed. Initially I was
thinking of using the libostree "content hash" but that would be awkward as we'd
have to do an import on the server side too.

After more consideration I realized a simple *count* of the number of objects
actually works, because (as I note in a comment) changing a file in the tree
will result in it ending up in the jigdoRPM (and count as a deletion).  And
obviously adding or removing objects changes the count too.

In fact we could have done this *without* breaking the format by just having the
client start recording the number of xattr entries, but this adds greater
flexibility down the line since we can in theory change how we do cache
invalidation if we *really* need to (but at the cost of triggering clients to
redownload packages).

Note the client logic got moved around as now we need to parse all the xattrs
before we decide what packages to download.

My test case here is turning on docs - I noticed this actually affects *every*
package which was surprising to me; I expected at least some packages wouldn't
have docs. I'll double check this.

It'd be good to have a "moving object" case too which I may look at.

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

Closes: #1256
Approved by: jlebon
2018-02-16 18:45:51 +00:00
Colin Walters
a4d8980d59 tests/jigdo-e2e: Strictly require npkgs to import
Since we changed things to have `jigdoSet = pkgSet`, we can just require exactly
`${npkgs}` here on import, which is what we found from `db list`.

Closes: #1256
Approved by: jlebon
2018-02-16 18:45:51 +00:00
Colin Walters
64c4fe8559 origin: Rename jigdo-version key to jigdo-override-version
Suggested in PR review, it matches the current `override-version`
key better.

Closes: #1240
Approved by: jlebon
2018-02-16 17:02:47 +00:00
Colin Walters
a0b6d241d2 status: Render jigdo mode using package NEVRA
What's happened up till now is supporting `rojig://` in the same way as
`ostree://`.  However, part of the high level goal here is to reduce
the need for system administrators to understand ostree.

This patch set starts to introduce some of the ideas for client-side
changes as part of jigdo ♲📦:
https://github.com/projectatomic/rpm-ostree/issues/1081#issuecomment-348540604

Concretely, we start using `${repo}:${nevra}` instead of `rojig://`.

(v2): Keep `Version` (plus timestamp) as a split out field for maximum visual aid.

Also, let's be opinionated here and entirely drop the `Commit` checksum by
default. I believe the Cockpit guys were right here - versions are for humans.
The fact that we have a checksum is powerful; and we still show it with `status
-v`. The way I think of it is: the checksum shows we're really an image system.
But we don't need to show it by default.

Closes: #1240
Approved by: jlebon
2018-02-16 17:02:47 +00:00
Jonathan Lebon
0729487ae5 Check and display pending security advisories
Pick up security advisories when checking for pending updates and
include them in the `cached-update` property. On the client-side,
display them in the output of `status`.

This was part of the original vision for how useful a smart `check` mode
could be. It directly impacts how one manages their individual system
(e.g. when to reboot), and paves the way for integration into
higher-level apps that act at the cluster level.

Closes: #1249
Approved by: cgwalters
2018-02-15 15:30:26 +00:00
Jonathan Lebon
45a3b53558 daemon/api: fix legacy D-Bus API and add coverage
Fix logic to make sure we check if the refspec is of type `ostree://`
even when it's explicitly specified. Also fix `Deploy` in the case where
we didn't just `Download` the RPM diff by adding a new @checksum
parameter to the higher-level API.

Finally, add a basic test for the `GetCached*RpmDiff` APIs so we have at
least *some* coverage. This is also good prep for making sure we don't
break anything when we convert those APIs to use the more efficient
pkglist metadata. The tests completely ignore the `DownloadRpmDiff`
paths for now though.

Closes: #1250

Closes: #1253
Approved by: cgwalters
2018-02-15 15:03:05 +00:00
Colin Walters
528456a59f daemon: Add an origin_is_rojig() helper
Suggested in another PR review, it makes the code nicer.

Closes: #1252
Approved by: jlebon
2018-02-14 21:54:35 +00:00