Commit Graph

1526 Commits

Author SHA1 Message Date
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
Colin Walters
51ae1e080e postprocess: Some porting to new style
Not all of it, but I did a few things since the GLnxTmpfile bit
let us port one of the functions.

Closes: #800
Approved by: jlebon
2017-05-29 14:24:43 +00:00
Colin Walters
0ea649d80b Bump libglnx, port to new tmpfile API
Update submodule: libglnx

Closes: #800
Approved by: jlebon
2017-05-29 14:24:43 +00:00
Colin Walters
fdaea2e8d6 Release 2017.6
Closes: #798
Approved by: jlebon
2017-05-26 19:47:16 +00:00
Colin Walters
7aba1b91dc Move rpm-md repo status display into core
Part of: https://github.com/projectatomic/rpm-ostree/issues/774

Basically, for `rpm-ostree status` to accurately help people
understand whether or not their system is up to date, we need
to be showing repository timestamps.

Ideally, we'd change the libdnf API to support what we're doing
here better.  But, this works for now.

Closes: #791
Approved by: jlebon
2017-05-26 19:11:17 +00:00
Colin Walters
2c509a768f core: Enable repo caching (one day)
This is prep for a rework of rpm-md downloads (visualizing state better + prep
for parallelization). libdnf defaults to a week which is just too long
(particularly for async security updates).

See also the linked https://github.com/rpm-software-management/libdnf/issues/291

Closes: #791
Approved by: jlebon
2017-05-26 19:11:17 +00:00
Colin Walters
ec5f95b0e3 lib/core: Define a helper to get enabled rpm-md repos
We do this in a few places. Prep for a future patch around metadata downloads.

Closes: #791
Approved by: jlebon
2017-05-26 19:11:17 +00:00
Colin Walters
15b8dd2b7c postprocess: A few more builtin /var suppressions
And tweak the comment; I'm not blindly adding everything from
e.g. a Fedora compose here, since while in practice we omit them,
the ugliness serves as a reminder to fix the packages.

(For example, pam should use tmpfiles.d snippets for `/var/log/tallylog`,
 or %ghost it)

Closes: #795
Approved by: jlebon
2017-05-26 14:26:25 +00:00
Jonathan Lebon
c0f39b8edd ci: append to CFLAGS, don't overwrite
I think this is why the -Wunused-variable wasn't actually taking effect.

Closes: #794
Approved by: jlebon
2017-05-25 20:53:08 +00:00
Colin Walters
9980448464 lib/util: Add a DECLARE_RPMSIGHANDLER_RESET to pacify clang
We need to add an `__attribute((used))` to the autocleanup variable in order to
pacify its set-but-unused, so make a macro to simplify callers. This is a bit
like systemd's `PRESERVE_ERRNO` cleanup.

Closes: #794
Approved by: jlebon
2017-05-25 20:53:08 +00:00
Colin Walters
a56a98152a core: Use a single tmpdir
This way we only have one directory to `rm_rf` at cleanup time.
A next steps might be teaching libdnf to use this.  Futher, we could
consider inheriting a tmpdir from the transaction.

Closes: #792
Approved by: jlebon
2017-05-25 19:18:38 +00:00
Colin Walters
6efa2de279 core: Pass self object instead of tmpdir dfd
In various places we thread down the tmpdir dfd. But since its lifecycle is
bound to the context, we might as well pass the context itself. This just ends
up being cleaner, and is also prep for changing how we do the tmpdir.

Closes: #792
Approved by: jlebon
2017-05-25 19:18:38 +00:00
Colin Walters
6d78f3504f core: Minor refactoring prep in local pkg install
Make a single place where we generate filenames, as prep for a future patch to
change it.

Closes: #792
Approved by: jlebon
2017-05-25 19:18:38 +00:00
Jonathan Lebon
8b8bdcc600 PAPR: migrate to the new name
The redhat-ci service has been renamed to PAPR. Previous values are
still supported though should be considered deprecated.

Closes: #790
Approved by: cgwalters
2017-05-25 16:27:10 +00:00
Colin Walters
53d259b3c3 lib: Define an autocleanup for RPM signal handling
Allows us to convert the metadata download func to new code style, and is
generally in line with our cleanup-focused philosophy on code, life,
and the meaning of the universe.

Closes: #789
Approved by: jlebon
2017-05-25 14:41:01 +00:00
Colin Walters
6210f34096 lib/core: Use autoptr to port tmprootfs_assemble() to new code style
I was going to make other changes here, and noticed the only
blocker was removed in https://github.com/projectatomic/rpm-ostree/pull/771

Closes: #787
Approved by: jlebon
2017-05-24 21:49:40 +00:00
Jonathan Lebon
86f82cf648 upgrader: switch to new code style
Splitting this out before I keep hacking on this file. Pretty
straightforward stuff. There is one legitimate use of the `goto out`
pattern left in which we clean up a tmpdir.

Closes: #788
Approved by: cgwalters
2017-05-24 21:19:49 +00:00
Colin Walters
f62c7665f7 livefs: Optimize etc merge by avoiding duplicate checkouts
This came up in review of https://github.com/projectatomic/rpm-ostree/pull/783

The implementation isn't the most beautiful thing in the world,
but we can revisit later.

Closes: #786
Approved by: jlebon
2017-05-24 18:49:29 +00:00
Colin Walters
d2bd8500da compose: Add tmp-is-dir option to make /tmp a directory
There are a few reasons to do this. First, systemd changed to refuse mounts on
symlinks, and hence if one *wants* "/tmp-on-tmpfs", one would need to write a
different `sysroot-tmp.mount` unit.

Second, the original rationale for having this symlink was that if you had
multiple ostree stateroots ("osnames"), it's nicer if they had the same `/tmp`
to avoid duplication. But in practice today that's already an issue due to
`/var/tmp`, and further the multiple-stateroot case is pretty unusual. And that
case is *further* broken by SELinux (if one wanted to have e.g. an Ubuntu and
Fedora) stateroots.  So let's fully decouple this and make `/tmp` a plain
old directory by default, so systemd's `tmp.mount` can become useful.

Now, things get interesting for the case where someone wants a physical `/tmp`
that *does* persist across reboots. Right now, if one just did a `systemctl mask
tmp.mount` as we do in Fedora Atomic Host's cloud images, you'd get a semantic
where `/tmp` stays per-deployment, which is weird.  Our recommendation for
that should likely be to set up a bind mount for `/tmp` → `/var/tmp`.

For now, this stays an option to ensure compatibility; if FAH Cloud images
want to stay with "physical /tmp", then we'd have to change the kickstart.

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

Closes: #778
Approved by: jlebon
2017-05-24 17:49:36 +00:00
Colin Walters
2adc1cf246 core: Ignore overrides for nonexistent %ghost files in /etc
As seen in e.g. `ipa-client-common`.  We expect ghosts 👻 to not
exist.

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

Closes: #785
Approved by: jlebon
2017-05-24 15:53:07 +00:00
Colin Walters
a18c2ecbf7 livefs: Fix etc merge with subdirectories
This was a kind of last-minute bug introduced when I tweaked the
checkout to use `.` to avoid a `mkdir()` for files.  But there were
multiple bugs with that; for files that are in subdirectories of `/etc`
we obviously need to get the right subdir and not use `/etc`.

Second, we need to handle the case where we're adding new subdirectories.

This change fixes `rpm-ostree install firewalld + rpm-ostree ex livefs`.

Closes: #783
Approved by: jlebon
2017-05-23 20:34:47 +00:00
Colin Walters
8ee6e86e38 tests: Use libtest-core.sh from ostree
Reduces drift.  In the future we may want to explicitly share
more test suite code too.

See https://github.com/ostreedev/ostree/pull/877

Closes: #782
Approved by: jlebon
2017-05-19 21:37:53 +00:00
Jonathan Lebon
174510fc5d core: allow no enabled repos for local pkgs
This is a valid case when layering local RPMs. Otherwise (e.g. if
specific non-local packages are requested), give the nicer error rather
than letting libdnf throw something less useful.

Closes: #780

Closes: #781
Approved by: cgwalters
2017-05-19 16:08:18 +00:00
Colin Walters
2ada15aff3 libtest: Fix bugs in assert_file_has_content()
First, we need to preserve whitespace in the regexps.  Second,
in the error path, all of our variables were wrong.

Commit 376a2cc3f5 is an excellent
poster child for how many bugs one can introduce in a single commit
for a ~5 line function.

Closes: #777
Approved by: jlebon
2017-05-18 13:43:15 +00:00
Colin Walters
69d8bfa042 compose-tests: Consolidate some misc options into test-misc-tweaks.sh
I was about to add another one of these but it feels like a bit
overkill to run through a recompose for trivial tweaks like turning off docs.

We can do a compose with multiple options at once and test the result as a unit,
at least for the smaller/less invasive options.

This change is prep for adding a switch to do `/tmp` as a regular dir.

Closes: #777
Approved by: jlebon
2017-05-18 13:43:15 +00:00
Colin Walters
82fbb5342f postprocess: Some porting to new code style
Prep for future work.  No surprises here.

Closes: #777
Approved by: jlebon
2017-05-18 13:43:15 +00:00
Jonathan Lebon
68c8d5e039 docs: update linked project names and minor tweaks
Just a few nits I noticed while preparing some slides.

Closes: #776
Approved by: cgwalters
2017-05-15 15:47:39 +00:00
Colin Walters
024f953124 core: Log to journal rpm-md repo timestamps
This is part of: https://github.com/projectatomic/rpm-ostree/issues/774

Basically, it's very useful for debugging since one could get an out-of-date
mirror or the like.

Down the line we may more formally store this data in a permanently-persistent
way, but this is a simple extension of the journaling we do now.

Closes: #775
Approved by: jlebon
2017-05-12 18:09:02 +00:00
Jonathan Lebon
63d648b9aa f25-build-check: install git early
Install `git` before `build-check.sh`, so that we can run the cheaper
`ci-commitmessage-submodules.sh` test first.

Closes: #773
Approved by: cgwalters
2017-05-12 16:32:49 +00:00
Jonathan Lebon
ab1176f682 transaction-types.c: convert to new style
Pretty straightforward stuff.

Closes: #773
Approved by: cgwalters
2017-05-12 16:32:49 +00:00
Jonathan Lebon
1105ef872d pkg-builtins: rename internal functions
The pkg-add/remove names are legacy now.

s/pkg_add/install/
s/pkg_remove/uninstall/

This is mostly for cosmetics.

Closes: #773
Approved by: cgwalters
2017-05-12 16:32:49 +00:00
Jonathan Lebon
da4c25fea1 libglnx: bump and use new helpers
Update submodule: libglnx

Closes: #773
Approved by: cgwalters
2017-05-12 16:32:49 +00:00
Jonathan Lebon
ba35102408 import ci/ci-commitmessage-submodules.sh from ostree
This would be useful here as well. Added small tweaks that I intend to
upstream (using realpath and --no-merges).

Closes: #773
Approved by: cgwalters
2017-05-12 16:32:49 +00:00
Colin Walters
95e9aa4284 Introduce ex livefs
There are a few different use cases here. First, for layering new packages,
there's no good reason for us to force a reboot. Second, we want some support
for cherry-picking security updates and allowing admins to restart services.  Finally,
at some point we should offer support for entirely replacing the running tree
if that's what the user wants.

Until now we've been very conservative, but there's a spectrum here. In
particular, this patch changes things so we push a rollback before we start
doing anything live. I think in practice, many use cases would be totally fine
with doing most changes live, and falling back to the rollback if something went
wrong.

This initial code drop *only* supports live layering of new packages.  However,
a lot of the base infrastructure is laid for future work.

For now, this will be classified as an experimental feature, hence `ex livefs`.

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

Closes: #652
Approved by: jlebon
2017-05-12 15:00:59 +00:00
Colin Walters
376a2cc3f5 libtest: Support matching multiple regexps in files
For a future patch.

Closes: #652
Approved by: jlebon
2017-05-12 15:00:59 +00:00
Colin Walters
3fae2eaf89 daemon/core: Fix leaks in metadata cleanup
I noticed I had `/tmp/rpmostree-metadata*` directories, and there
were two cases where we created those dirs.  Astonishingly,
*both* had bugs that prevented cleaning up.

Rename one of them so in the future it'll be clearer which is buggy (or both).

Closes: #772
Approved by: jlebon
2017-05-12 14:05:58 +00:00
Jonathan Lebon
96f75519f3 core: partial switch to new style
Switch a couple of core functions to the new style in preparation for
some other work there. This doesn't tackle the larger assemble()
function.

Another function which escaped for now is one that uses a tmpdir. Makes
me wonder if we should add a "GlnxTmpDir" type thing which simplifies
the mkdtempat/opendirat pattern and has a shutil_rmrf cleanup.

Closes: #771
Approved by: cgwalters
2017-05-10 20:46:43 +00:00
Jonathan Lebon
143b1a5bd5 rpm-util: use glib auto cleanups macros
Rather than defining our own cleanup functions. And it's easier on the
eyes!

Closes: #771
Approved by: cgwalters
2017-05-10 20:46:43 +00:00
Jonathan Lebon
27c525b706 vmcheck: stronger post-test cleanup
Now that rpm-ostree operations are cumulative, we need to make sure we
also clean up pending deployments. Also clean up the rollback for
consistency.

We also strengthen our ref handling. Always nuke the vmcheck ref (which
might not even exist anymore if a test rebased without --skip-purge) and
recreate it from the original ref.

Closes: #769
Approved by: cgwalters
2017-05-09 18:53:49 +00:00
Jonathan Lebon
caafaf6c1b vmcheck: add test for pkgcache chksum invalidation
Closes: #769
Approved by: cgwalters
2017-05-09 18:53:49 +00:00
Jonathan Lebon
8c3e8b24ad core: invalidate pkgcache based on RPM checksum
Now that the unpacker actually tracks what the RPM checksum was at
import time, we can make use of that to determine whether we should
download the newer RPM, even if it has the same NEVRA.

Closes: #769
Approved by: cgwalters
2017-05-09 18:53:49 +00:00
Jonathan Lebon
eff00053ef unpacker: embed RPM checksum in metadata
In addition to the header checksum, we also want a checksum of the RPM
file itself. This will allow us to know right away whether an RPM with
the same NEVRA in the repos is actually the same one we already
imported.

Closes: #769
Approved by: cgwalters
2017-05-09 18:53:49 +00:00
Jonathan Lebon
fa10f36fb6 core: write number of imported packages to journal
The actual number of imported packages is not printed right now on the
terminal. But it's useful information to have, so stick it in the
journal.

Also make both the ENABLED_REPOS and ENABLED_REPOS_SOLVABLES
comma-separated lists. This essentially makes them valid YAML/JSON,
which is a nice property to have for e.g. test/shell interactions.

Closes: #769
Approved by: cgwalters
2017-05-09 18:53:49 +00:00
Colin Walters
e66ea0865a libtest: Adapt xattr disabling for newer ostree
Matches the test changes in e8efd1c8dc

Closes: #770
Approved by: jlebon
2017-05-09 13:32:25 +00:00
Colin Walters
f81626d359 ci: Ensure fahc builds win over base
Right now due to rdgo using `git describe` we have `v2017.4.65`, which
is lower than `v2017.5`.

Closes: #770
Approved by: jlebon
2017-05-09 13:32:25 +00:00