Commit Graph

1670 Commits

Author SHA1 Message Date
Jonathan Lebon
a54efdff8a rpmostreed-utils.c: switch to new style
Since we're going to do some work there. Also fix not always translating
the error from ostree_parse_refspec.

Closes: #764
Approved by: cgwalters
2017-05-05 21:01:26 +00:00
Jonathan Lebon
3f5f749f82 libbuild.sh: pass arguments to make
Otherwise, e.g. `make check` && `make install` won't actually do
anything.

Closes: #765
Approved by: cgwalters
2017-05-05 20:23:22 +00:00
Colin Walters
a284b64479 ci: Use FAHC for build container
Conceptually: we're going to move rpm-ostree and ostree at the same
cadence most of the time; for both releases *and* for git master.
The problem so far has been the latter part.  Reusing FAHC
for the build gets us half of the problem.

The other trick I realized we can do - just pull ostree out from the build
container. This avoids fetching it from the internet, and makes my workflow for
hacking on both nicer - I just `sudo make install` in my build container for
ostree.

It's tempting to make the whole thing symmetric and require `sudo make install`
for rpm-ostree and not do the insttree thing but...perhaps after.

Closes: #758
Approved by: jlebon
2017-05-01 19:10:05 +00:00
Colin Walters
11309cab97 core: Ignore %pretrans
This was argued on list a while ago: http://lists.rpm.org/pipermail/rpm-ecosystem/2016-August/000391.html
Basically, every use of `%pretrans` is a workaround for some in-place
upgrade problem.  But we never do inplace updates, we always assemble
a new tree.  Hence, there is no point for us to ever execute these.

Let's stop erroring out on them. If there does turn out to be some problem with
a particular package (e.g. the `openjdk-copy-configs` or whatever), we would
likely end up needing to fix that package's `%post`, not start executing its
`%pretrans`.

Closes: #763
Approved by: jlebon
2017-05-01 18:07:06 +00:00
Colin Walters
081c9dc65b core: Journal selinux relabeling stats
An updated version of: https://github.com/projectatomic/rpm-ostree/pull/316
using the journal (and structured logging) instead.

I was just curious.  And yeah, in some quick testing via deploying an old
FAH `25.67`, there are zero relabels.

We should likely have a test that actually forces a relabel...would require
custom SELinux policy build?  Or hm, maybe we could override a file context.

Closes: #760
Approved by: jlebon
2017-04-28 21:42:39 +00:00
Colin Walters
4bbea19a31 ci: Delete dockerfile, move to common scripts, consolidate gcc/clang
The Dockerfile is problematic since we can't update it atomically. I also really
dislike reliance on the Hub. Further, I think rather than caching our build deps
as built containers, we should be caching RPMs in CI. And we should be using
rpm-ostree at some point to assemble filesystem trees faster.

Also, consolidate the clang to be serial with gcc, since while we lose a tiny
bit of parallelism, it's not really worth its own context right now.

Closes: #759
Approved by: jlebon
2017-04-28 21:17:18 +00:00
Colin Walters
23a9e7e1bc Release 2017.5
A very minor release, but better than backporting more patches. This rolls in
the `RegisterClient` fix as non-root, plus the arm32 crasher.

The syscore refactoring is the only risky part, but I'm pretty confident in it.

Closes: #757
Approved by: jlebon
2017-04-28 13:24:12 +00:00
Jonathan Lebon
f58600a348 util: fix potential overflow in var substitution
When appending the trailing bytes, we were passing (p - s), but p by
definition is always NULL at that point. Chaos ensues.

The really evil part about this is that the len is passed signed and
glib treats negative values to mean it should lookup the length itself,
so this worked *most of the time*. Though I'm guessing if the address at
s is large enough, (p - s) can wrap around and become positive again,
thus causing a massive allocation. Anyway, I didn't actually check this
(esp. since the report was for ARM), but the patch is clearly right.

I think this may be the cause for
https://bugzilla.redhat.com/show_bug.cgi?id=1381357.

Closes: #756
Approved by: cgwalters
2017-04-27 20:55:52 +00:00
Colin Walters
e4b5e77e64 tests: Add unit tests for varsubst
Trying to debug https://bugzilla.redhat.com/show_bug.cgi?id=1381357

I don't see the problem yet, but let's exercise the code a bit.

Closes: #755
Approved by: jlebon
2017-04-27 18:57:10 +00:00
Colin Walters
6f3f20a900 utils: Mostly convert to new code style
I was looking at the varsubst code, doing a style conversion first.

Closes: #755
Approved by: jlebon
2017-04-27 18:57:10 +00:00
Colin Walters
7d98e3efc8 libpriv: Add a helper function to print pkg diff
I want to use this in livefs, where I'll end up doing some diff
computations on the server and am currently rendering text there.

It might also be a step towards using this in `db diff`.

Closes: #709
Approved by: jlebon
2017-04-26 14:26:00 +00:00
Colin Walters
999e0034ef daemon/cleanup: Make use of new libostree API to fix TODO
We now avoid doing cleanup twice.

Closes: #709
Approved by: jlebon
2017-04-26 14:26:00 +00:00
Colin Walters
9260d828a8 daemon: Move deployment cleanup logic into core
While nothing else besides cleanup right now would call this directly, the code
should live close to the other very similar function:
`rpmostree_syscore_add_deployment()`.

Closes: #709
Approved by: jlebon
2017-04-26 14:25:59 +00:00
Colin Walters
386ac7537b daemon/core: Move some deployment logic here, also add bump_mtime()
This is prep for livefs.  We need to tweak the logic from what
core libostree has in `ostree_sysroot_simple_write_deployment()`,
and while we could land improved logic there, I think it makes
sense to carry this here until we're confident enough in the logic
to make it ABI.

This does depend on a [new libostree API](https://github.com/ostreedev/ostree/pull/745)
that allows writing deployments without doing cleanup.

The `bump_mtime()` bit is also prep for livefs, carrying in this patch to avoid
splitting things too much.

Closes: #709
Approved by: jlebon
2017-04-26 14:25:59 +00:00
Colin Walters
6485a8b306 core: Port a few functions to new style
I was looking at livefs executing scripts, realized I may need to
do some refactoring here, and decided to do some style updates.

Also, we make use of the `g_autoptr()` for ostree types in a few
places.

Closes: #752
Approved by: jlebon
2017-04-26 13:26:49 +00:00
Colin Walters
c8546b62a3 core: Fix error handling in hardlink changes for directory iteration
This function wasn't like the others.  If an error happened during
directory iteration, we'd still return TRUE, but with an error set.

Noticed while I was going to do some code style porting.

Closes: #752
Approved by: jlebon
2017-04-26 13:26:49 +00:00
Colin Walters
c87151b910 app: Prefix error when trying to connect to the bus
I typed `rpm-ostree status` in a container, and today we print:
`error: Could not connect: No such file or directory` which isn't
quite informative enough for me.

Closes: #751
Approved by: jlebon
2017-04-24 20:12:40 +00:00
Colin Walters
06e4ba2602 scripts: Ignore openjdk pretrans
I honestly didn't really dive into this, but it looks like
this is yet another "hack upgrades in the yum case", which we
should be able to ignore since we always do reassembly.

I at least tested `java -version` works with this.

This is a band-aid for the bigger issue of:
https://github.com/projectatomic/rpm-ostree/issues/749

(Doing this one since an AtomicWS user reported it)

Closes: #750
Approved by: jlebon
2017-04-24 14:38:33 +00:00
Colin Walters
65cfd22314 libpriv: Delete some dead code
I happened to notice these functions are unused. Purge them from existence.

Closes: #746
Approved by: jlebon
2017-04-21 13:54:05 +00:00
Colin Walters
a180a35a48 status: Do show Commit with --verbose, don't show StateRoot without it
`Commit` is useful in cases where one wants to e.g. run `rpm-ostree db diff`.
`StateRoot` however is going to be in the vast majority of cases identical
across deployments.

Closes: #743
Approved by: jlebon
2017-04-21 13:31:21 +00:00
Colin Walters
b2f9c5ed82 status: Rename OSName → StateRoot in the human-readable text
See: https://github.com/ostreedev/ostree/pull/794

I originally tried to do this ~a year ago in:
https://github.com/projectatomic/rpm-ostree/pull/295

But Micah pushed back at the time.  I'd still like to do this
though, since I personally find `OSName` *more* confusing
than `StateRoot`.

One specific rationale I have for making this change is that
I rebased a home server from CentOSAH to FAH - and I feel
it's just saner to see `StateRoot: centos-atomic-host` instead
of `OSName: centos-atomic-host` underneath the fedora refspec.

Closes: #743
Approved by: jlebon
2017-04-21 13:31:21 +00:00
Colin Walters
9ab46f5221 Require ostree 2017.5
This is preparatory for future changes which will make use the newer sysroot
writing API. But in this change, we can drop all of our version ifdef'd code.

Closes: #740
Approved by: jlebon
2017-04-20 20:58:51 +00:00
Colin Walters
b33d303a9d ci/container: Use updates-testing
This is another way to partially address
https://github.com/projectatomic/rpm-ostree/pull/740
We should also likely have a `fedora/25/atomic/testing` image.

Closes: #742
Approved by: jlebon
2017-04-19 13:22:19 +00:00
Colin Walters
b21b08c770 app: Only call RegisterClient() if we're root
Otherwise we can't do e.g. `rpm-ostree status`.

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

Closes: #739
Approved by: dustymabe
2017-04-14 02:30:19 +00:00
Colin Walters
67c9b3885b build: Always recurse build into libdnf/
This has bitten me many times already; switching libdnf submodule (or just
editing the code directly in the submodule dir to add debug prints) didn't
rebuild libdnf.

Recursing the build: cheap ¢.  Not spending a half hour figuring out
the code you're debugging isn't what you typed: priceless 💸.

Closes: #733
Approved by: jlebon
2017-04-13 16:10:14 +00:00
Colin Walters
d91e4942cb Release 2017.4
Closes: #734
Approved by: jlebon
2017-04-13 15:42:06 +00:00
Colin Walters
0c99106a99 Update libdnf submodule
To pull in the GPG https:// key fix.

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

Closes: #719
Approved by: jlebon
2017-04-13 15:15:03 +00:00
Jonathan Lebon
f13db897f6 core: handle enabled_metadata repos
In #728, we started querying enabled repos using get_n_solvables().
However, there are different kinds of enabled repos, and
`dnf_repo_get_enabled()` reflects that through the bitmask it returns:
  - DNF_REPO_ENABLED_NONE: repo disabled
  - DNF_REPO_ENABLED_PACKAGES: repo enabled for package installs
  - DNF_REPO_ENABLED_METADATA: repo enabled for metadata

We were treating it as a boolean, though really, we should only print
data about repos with ENABLED_PACKAGES on, which are the actual repos
libdnf can fetch packages from. Repos with only ENABLED_METADATA on are
not fetched by default, and thus will cause SIGSEGV when trying to
get_n_solvables().

I ran into this while trying to debug #720 on F25 AH, which has this
repo by default:

  [fedora-cisco-openh264]
  name=Fedora $releasever openh264 (From Cisco) - $basearch
  baseurl=https://codecs.fedoraproject.org/openh264/$releasever/$basearch/
  enabled=0
  enabled_metadata=1

Closes: #736
Approved by: cgwalters
2017-04-13 14:06:04 +00:00
Colin Walters
530ab23cb8 core: Add journal message for pkg state (repos, solvables)
I'm debugging a depsolve failure right now, and just like for
the treecompose case, it's useful to see the information about
enabled repositories.  (We should actually maintain this
better in the daemon, but this is a start)

Closes: #728
Approved by: jlebon
2017-04-11 19:24:33 +00:00
Colin Walters
fbdbddb3d4 vmcheck: Support a VMCHECK_DEBUG to not reset the system
I want to be able to debug a test by sshing in with the same setup;
right now the suite resets and reboots by default.

This also required fixing how we deal with `/etc/yum.repos.d`, since at the
start of the test it could be either pristine or not.

Closes: #578
Approved by: jlebon
2017-04-11 16:04:29 +00:00
Colin Walters
7819b85a7d treecompose: Prepare device API mounts
This gives scripts access to e.g. `/dev/urandom`.  Short term
hack until we implement https://github.com/projectatomic/rpm-ostree/issues/729

The reason we don't need to explicitly clean these up before committing is right
now for treecompose we only lift `/usr` from the RPM content, so we don't run
into ostree refusing to commit devices.

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

Closes: #730
Approved by: jlebon
2017-04-07 17:06:36 +00:00
Colin Walters
b060ecda21 unpacker: Also set flag to make failure to label fatal
There's no immediate need for this; was just a lead
I was chasing down while debugging
https://github.com/ostreedev/ostree/pull/775

Closes: #724
Approved by: jlebon
2017-04-05 13:19:39 +00:00
Jonathan Lebon
1c1dba8eee treefile.md: clarify boot_location documentation
The default is "both", not "legacy".

Closes: #722
Approved by: cgwalters
2017-04-04 18:47:31 +00:00
Jonathan Lebon
d5eeea646a rpmostree-kernel.c: always get kver from /lib/modules
The kver that rpmostree_find_kernel() returned would include the csum
that ostree tacks on. This would then cause dracut to fail to find the
modules for the given kver.

The issue is that rpmostree_find_kernel() can be called for both the
ostree checkout case (pkglayering) and the yumroot case (treecompose).
Rather than using a heuristic to determine whether there is a trailing
csum we should trim, we instead always fetch the kver from the dirname
in /usr/lib/modules, which will work in both cases and is stronger.

This also fixes a few cosmetic issues. Notably the final initramfs and
vmlinuz filenames in /usr/lib/ostree-boot would have *two* chekcsums
tacked on, rather than just one.

Closes: #722
Approved by: cgwalters
2017-04-04 18:47:31 +00:00
Jonathan Lebon
7b9f4870bd dracut: always specify kver
Otherwise dracut will just default to the running kernel, which will be
wrong if the pending deployment doesn't have the same kernel. Use --kver
rather than appending to be more explicit.

Closes: #722
Approved by: cgwalters
2017-04-04 18:47:31 +00:00
Colin Walters
378216b5a1 tests/ucontainer: Also disable xattrs here
This actually only worked before because of
https://github.com/ostreedev/ostree/pull/775

Closes: #723
Approved by: jlebon
2017-04-04 17:48:26 +00:00
Jonathan Lebon
b4fba5e7d2 initramfs: add --os switch
This is already standard in the other commands, and also comes in useful
in chroot situations like anaconda.

Closes: #717
Approved by: cgwalters
2017-04-04 15:52:12 +00:00
Jonathan Lebon
008b885026 start-daemon: add metavar for --dbus-peer option
Closes: #717
Approved by: cgwalters
2017-04-04 15:52:12 +00:00
Colin Walters
471f02b528 daemon: Fix systemctl reload rpm-ostreed
I think this was a conceptual merge conflict from
https://github.com/projectatomic/rpm-ostree/pull/292
and
https://github.com/projectatomic/rpm-ostree/pull/598

Also I noticed we weren't consistently using `@primaryname@`...
will fix that when we get back to the renaming PR.

Closes: #716
Approved by: jlebon
2017-04-04 15:28:17 +00:00
Jonathan Lebon
9c023429b6 vmcheck: add tests for unified txn support
Closes: #711
Approved by: cgwalters
2017-03-31 14:58:38 +00:00
Jonathan Lebon
c35622dada app: make use of new UpdateDeployment()
Add support for --install/--uninstall to upgrade/deploy/rebase by
calling out to UpdateDeployment(). Since it's not released yet, back out
the support for install-local-packages in the options variant for
PkgChange(), and make it instead use UpdateDeployment() as needed.

Closes: #711
Approved by: cgwalters
2017-03-31 14:58:38 +00:00
Jonathan Lebon
5e75dcf656 D-Bus: add new UpdateDeployment() method
The new UpdateDeployment() method wraps the full capability of the
deploy transaction handler. Modifiers indicate how one wants to change
the origin, and options indicate extra behaviours.

One interesting note here is that all the options "come together" for
the first time: some of them were user-specified options (reboot,
skip-purge, dry-run), some were internal only (no-pull-base), and some
were both (allow-downgrade).

This means we now have to handle interesting cases, e.g.:
  - We check for option conflicts between "no-pull-base" and
    "set-refspec"/"set-revision" (similarly for "skip-purge").
  - We enable "allow-downgrade" by default if the refspec or revision is
    changing.
  - Previously, "dry-run" could only be specified through PkgChange().
    Rather than making it only valid when pkgs are overlayed (which
    itself wasn't that meaningful since the introduction of dormant
    package requests), we generalize it so that "dry-run" just means:
    stop right before actually deploying the tree.

Closes: #711
Approved by: cgwalters
2017-03-31 14:58:38 +00:00
Colin Walters
c1872bc29e postprocess: Tell ostree to error out on missing labels
See https://github.com/ostreedev/ostree/pull/768 - basically
`/proc` is unlabeled, and this gets annoying for livefs work
since it shows up as a diff.

Plus at some point in the future `ostree fsck` might actually learn to verify
deployment directories.

Closes: #714
Approved by: jlebon
2017-03-31 14:30:03 +00:00
Colin Walters
f71e1b8b4d all: Conditionally use new ostree_sepolicy_new_at()
If available, using the also-new `OSTREE_CHECK_VERSION`. I dropped the `path`
argument from one of the internal APIs since it made the code simpler, and every
caller except one was passing `.`.

Closes: #712
Approved by: jlebon
2017-03-30 13:06:48 +00:00
Colin Walters
2abb3a547a util: Stub out OSTREE_CHECK_VERSION if we don't have it
Prep for using it in other places.

Closes: #712
Approved by: jlebon
2017-03-30 13:06:48 +00:00
Jonathan Lebon
d9c6733718 RpmostreedOS: share more between deployment handlers
All the handlers that eventually create a deploy transaction can share
much more code. This will make it easier to implement pkg
install/uninstall for all of them in one place.

Closes: #710
Approved by: cgwalters
2017-03-28 14:02:29 +00:00
Colin Walters
1b2a7cd90c daemon: Introduce a "sysroot core" file
Right now, the `rpm-ostree cleanup` logic calls into a "public static" method of
`RpmOstreeSysrootUpgrader`. That's because today, a lot of the high level "core
server side" logic lived in that class. However, it's only for upgrades (well,
really "generating pending deployments").

As I'm working on "livefs" which is really something different, I find it needs
to interact with some of `SysrootUpgrader`'s logic. Let's introduce a "sysroot
core" which is just a set of static functions taking an `OstreeSysroot*`, and
then all 3 of cleanup, (upgrade|deploy) and livefs can use these.

Closes: #708
Approved by: jlebon
2017-03-27 19:22:32 +00:00
Colin Walters
75d91a1757 daemon: Add a sysroot argument to state → GVariant functions
Prep for livefs; there we're storing live update state as xattrs on the
deployment root, and hence we need access to the sysroot to query it.

Closes: #706
Approved by: jlebon
2017-03-27 18:57:45 +00:00
Colin Walters
c1f15cd38b app: Add a helper to get a proxy for OSExperimental too
Prep work for livefs.  Also port the function to new style.

Closes: #706
Approved by: jlebon
2017-03-27 18:57:45 +00:00
Colin Walters
a127bbd7b2 build: Add OSExperimental to .gitignore
Tempting to have a check that `git status` is clean after a build in CI.

Closes: #705
Approved by: jlebon
2017-03-27 17:48:39 +00:00