Commit Graph

932 Commits

Author SHA1 Message Date
Jonathan Lebon
5479ed5240 tests: refactor rpm building and add package foo
We're going to be create many different packages in the future. Let's
refactor and generalize the targets so that they can build anything.

We also add a package foo, which will be used soon for a basic test of
package layering.

Closes: #344
Approved by: cgwalters
2016-06-23 00:05:09 +00:00
Jonathan Lebon
c0924b8997 vmcheck: add a basic test harness
This is a very simple test harness inspired by the atomic one. It's a
simple bash script that sets up a permanent ssh connection to the host
and runs the test scripts. Also add a "demo" test-basic.sh test to make
sure that it works.

Closes: #344
Approved by: cgwalters
2016-06-23 00:05:09 +00:00
Jonathan Lebon
fdbe28b964 docs: fix README.md and add HACKING.md
Add a HACKING.md document detailing how to get started and test
rpm-ostree using the vagrant box.

Fix the CONTRIBUTING.md link and add a link to HACKING.md in README.md.

Closes: #344
Approved by: cgwalters
2016-06-23 00:05:09 +00:00
Jonathan Lebon
9587ab6597 vagrant: move helper files to vagrant/
These files are not only for vmcheck, but may be used as well for
setting up for development.

Closes: #344
Approved by: cgwalters
2016-06-23 00:05:09 +00:00
Jonathan Lebon
38c8040879 vmcheck: clean before building and adapt to new json
If the dir that was rsync'ed already contains build artifacts, we don't
want those contaminating our build process.

Closes: #336
Approved by: cgwalters
2016-06-20 19:57:37 +00:00
Jonathan Lebon
2c7013e86f rpmostree-core.c: squash -Wunused-function
Closes: #336
Approved by: cgwalters
2016-06-20 19:57:37 +00:00
Colin Walters
6efc0453c9 unpacker: Clean up directory perms override
Link to the Fedora bug that introduced this, and also change things so
it's also used for the "compose" case because:

 - Again it doesn't add security
 - Tools that operate on "compose" repos have to work around this
   when doing checkouts, see e.g. https://lists.freedesktop.org/archives/xdg-app/2016-June/000241.html

Closes: #335
Approved by: jlebon
2016-06-20 19:13:34 +00:00
Colin Walters
3c77c36999 core: Make unprivileged case ignore ownership, add "_compose" context
I was in the process of trying to support `%post` scripts, and I
wanted to use `rpm-ostree container` for convenient and safe testing.
However the recent package layering changes broke it to error out
on perms like `filesystem`'s `root:mail` on `/var/mail`.

I decided to introduce a new `rpmostree_context_new_compose` which had
the current behavior, switch `compose tree` to use it, and then change
`_new_unprivileged` to *really* be unprivileged.  Specifically we
ignore file ownership (and fix dir owners) because we assume we'll be
operating with `bare-user` repos.

Closes: #327
Approved by: jlebon
2016-06-20 15:10:44 +00:00
Colin Walters
5936b53812 daemon: Unify PkgAdd/PkgDelete into PkgChange
We need the ability to both add and remove packages as one
transaction in the general case (`Conflicts:`), plus it'd
be quite nice to allow users to do multiple package things
before rebooting.

And finally, this deletes a lot of duplicate code.

Where I'm really thinking this should go is we only have one
transaction type internally for at least upgrade/pkg as a group.

Closes: #326
Approved by: jlebon
2016-06-20 14:45:49 +00:00
Colin Walters
90cae512a8 status: Print active transaction
I really want a command to cancel the running transaction, but as a
preparatory step, let's display what's going on in `status`.

The text output here is really a demonstration - I'll improve it but I
want to rework the internals first.

Closes: #320
Approved by: jlebon
2016-06-20 14:38:33 +00:00
Colin Walters
63ee7d0a9a status: Make JSON an object with "deployments" subkey
In the future I want to add more content in the status such
as active operations, so let's make the "deployments" just
one entry in an object.

Closes: #320
Approved by: jlebon
2016-06-20 14:38:33 +00:00
Colin Walters
b948ca1421 compose: With --cachedir, retain packages too
Really...we should have done this since day zero.  Given that the
final integration of package layering/compose/rpm caching is finally
over the horizion but not yet here, let's still do this now.

I plan to backport this patch to the 2016.3-fixes branch.

Closes: #332
Approved by: jlebon
2016-06-20 13:36:38 +00:00
Colin Walters
8066844de0 compose: Support RPMOSTREE_RPM_VERBOSITY
In the future we'll be taking over pretty much all RPM functionality
(unpack/scripts) and will be able to provide a lot more useful
information more directly under our control.

But in the meantime:

 - Set the default to "info" which is apparently where things like
   corrupted packages will show up.  It's just info you know?
 - Allow callers to override this via environment variable, specifially
   one can use "debug" for lots of info.

Closes: #331
Approved by: jlebon
2016-06-20 13:32:34 +00:00
Colin Walters
e53ccda425 core: Go back to not verifying %post
Otherwise `nxs upgrade` fails.  We'll do this better later; allow
people to use the current state.

Closes: #330
Approved by: jlebon
2016-06-17 20:21:56 +00:00
Jonathan Lebon
3073a42868 tmpfiles.d: rename and re-order
According to tmpfiles.d(5), files should follow the convention
<package>.conf or <package>-<part>.conf. So we rename
tmpfiles-ostree-integration.conf to rpm-ostree-0-integration.conf.

The 0 index is so that the autovar conf created by postprocess is
sourced *after* this one, so that `integration.conf` has higher
precedence if there are duplicate entries.

Closes: #325
Approved by: cgwalters
2016-06-15 20:41:45 +00:00
Jonathan Lebon
ea83aced3a test-ucontainer.sh: simplify
Seems silly to make a new var for it now that we're only using the
variable once.

Closes: #325
Approved by: cgwalters
2016-06-15 20:41:45 +00:00
Jonathan Lebon
f411c0babb testenv: include same vars as real test environment
Closes: #325
Approved by: cgwalters
2016-06-15 20:41:45 +00:00
Colin Walters
f83909a02d daemon/upgrader: Remove hotfix from origin on upgrades
We made this same change in ostree, but all consumers need to be
aware of it.

Fixes: https://github.com/ostreedev/ostree/issues/339

Closes: #322
Approved by: jlebon
2016-06-15 19:11:10 +00:00
Jonathan Lebon
816194cd58 Makefile-tests: add toplevel vm* targets
The `make vmshell` target makes it even easier to immediately try out
your changes in a live running Atomic Host. It will automatically
provision the VM, sync your latest changes, build, install in a new
deployment onto which the VM is rebooted, and drop you in the shell.

Closes: #321
Approved by: cgwalters
2016-06-15 13:38:34 +00:00
Jonathan Lebon
be3a677125 vmcheck: create a new deployment instead
In order for vmcheck to be useful for testing, we need the machine to be
in a "clean" state. That is, sitting on a commit, ready for being
manipulated.

This is a small step towards this goal. Instead of overwriting the
files, we use rofiles-fuse to safely install and create a new
deployment.

Closes: #321
Approved by: cgwalters
2016-06-15 13:38:34 +00:00
Colin Walters
a86826eff4 Add --noscripts concept for pkg-add/delete
Right now, while one can `pkg-add strace`, there are a lot of
packages with `%post`.  Since some current developers want
to use package layering as it is today, let's add the concept.

Even after we have a whitelist of scripts and have cleaned up Fedora
to use them, we'll still have potential issues with 3rd party RPMs
etc. for a long time, so allow people this out to stumble forward for
those and potentially run them by hand if necessary.

Closes: #311
Approved by: jlebon
2016-06-15 01:11:01 +00:00
Colin Walters
ad51527292 daemon: Convert internal pkg ops booleans into flags
A friend once convinced me that having two boolean arguments to a
function was bad, three or more really should be converted into flags
to avoid confusion.

I plan to add another.

Closes: #311
Approved by: jlebon
2016-06-15 01:11:01 +00:00
Colin Walters
1a1e08fbf7 core: Verify no %posts for imported packages
This is bringing forward an old PR for libhif:
https://github.com/rpm-software-management/libhif/pull/39

Right now, we aren't running `%post` or any of the other variants.  A
lot of packages will work if we just ignore `%post`, others won't.
Let's be conservative until we start running them, and don't imply we
support things we don't yet.

Closes: #311
Approved by: jlebon
2016-06-15 01:11:01 +00:00
Colin Walters
84c691af8a compose: Explicitly clear out context object before removing rootfs
This squashes an ugly `/var/tmp/rootfs.XXXX/usr/share/rpm: ENOENT`
warning that occurs because we were nuking the temporary rootfs
before cleaning up the context object, which was indirectly
holding references to it.

Closes: #319
Approved by: jlebon
2016-06-13 20:39:18 +00:00
Colin Walters
b7d1b827b7 status: Support --json option
It's really simple to reflect the DBus API into JSON, which tools like
Ansible or `jq` from the command line or whatever can parse to find
interesting things like the current version.

Closes: #301

Closes: #315
Approved by: jlebon
2016-06-13 14:54:25 +00:00
Colin Walters
0578e13de8 core: Set a useragent
See https://github.com/rpm-software-management/libhif/pull/140

I just noticed this while debugging HTTP requests.

Closes: #318
Approved by: giuseppe
2016-06-12 16:20:33 +00:00
Colin Walters
81cc46d2e8 daemon: Use memory GSettings backend explicitly
See: https://bugzilla.gnome.org/show_bug.cgi?id=767183

This suppresses a warning when a HTTP proxy is enabled.

Closes: #312
Approved by: jlebon
2016-06-09 20:59:36 +00:00
Jonathan Lebon
b243ac1b70 status: print version string in bold
I think 99% of the time, that's the only thing users are interested in.
Make it bold to make it easier to see.

Closes: #314
Approved by: miabbott
2016-06-09 20:34:11 +00:00
Colin Walters
46e93e5d77 Vagrantfile: Bump RAM to 2048, update comment
I was running out of RAM doing builds in the VM with just 512MB.
I think for single host machines, we can assume a lot of RAM.
If one is doing multi-node Vagrant that's a different thing.

Also update the comment at the top.

Closes: #313
Approved by: jlebon
2016-06-09 19:53:56 +00:00
Colin Walters
d587051d0f daemon: Add base-commit to deployment metadata
I think most users are really going to be interested in the base/origin
commit, and not whatever the stuff they made locally happened to hash
to.

Closes: #295
Approved by: jlebon
2016-06-09 19:33:19 +00:00
Colin Walters
879ecbe6f1 daemon: More error handling cleanup for loading deployment metadata
I really don't like doing a `g_warning()` in the middle of a call
stack and stumbling onwards.  If we fail to load a commit, we should
pass the error back up to toplevel boundary - normally a DBus method
invocation.  As opposed to giving partial or incorrect data.

This is a preparatory (git) commit for adding more data from the
(ostree) commit to the deployment variant.

Closes: #295
Approved by: jlebon
2016-06-09 19:33:19 +00:00
Colin Walters
0b3dfefff6 daemon: Cleanup error handling in rpmostreed_os_load_internals()
- `ostree_sysroot_get_deployments()` cannot fail (only assert)
 - Relying on setting a GError to detect the rollback only to
   clear it was a bit weird; instead just pass `NULL` there.

Closes: #295
Approved by: jlebon
2016-06-09 19:33:19 +00:00
Colin Walters
c756d55127 status: Print unlocked state
For obvious reasons it's data we'd like to show.

Closes: #295
Approved by: jlebon
2016-06-09 19:33:19 +00:00
Colin Walters
ea4fdf1692 daemon: Insert unlocked state into deployment dict
So we can consume it via `rpm-ostree status` etc.

Closes: #295
Approved by: jlebon
2016-06-09 19:33:19 +00:00
Colin Walters
0724240092 status: Replace status with key-value output
With the end goal in mind that I want to optimize for the case
of 1-2 deployments, it's actually a lot simpler to just
nuke the whole current column base.

It just really doesn't make sense with layered packages, and even
before then, I usually found the timestamp and osname columns
redundant.

Closes: #295
Approved by: jlebon
2016-06-09 19:33:19 +00:00
Colin Walters
b82405d17b status: Move current status display into function
Pure code motion, no real functional changes.  Preparation for having
multiple statuses.

Closes: #295
Approved by: jlebon
2016-06-09 19:33:19 +00:00
Colin Walters
20e69a9692 status: Import systemd bits to use UTF-8 circle
It's slightly prettier, but this is just laying some
groundwork/precedent for importing more systemd code and using it for
our formatting.

Closes: #295
Approved by: jlebon
2016-06-09 19:33:19 +00:00
Jonathan Lebon
d99df468c7 libhif: always prefix include directives
This is in response to:
https://github.com/rpm-software-management/libhif/pull/138

Closes: #310
Approved by: cgwalters
2016-06-09 12:27:53 +00:00
Colin Walters
a3769a7219 vmcheck: Experiment with the name nxs
I find myself not liking the name rpm-ostree anymore; it's
descriptive, but unfortunately we compete with other projects with
easier and sexier names.

Also, people continually find the ostree and rpm-ostree layering
unclear.  It's *much* easier to say "nxs depends on ostree", even
though textually it's obvious "rpm-ostree depends on ostree".

Anyways, just an experiment for now.

Closes: #307
Approved by: giuseppe
2016-06-08 14:26:08 +00:00
Jonathan Lebon
c1de9f5c46 RpmOstreeSysrootUpgrader: update self on override
When a user called `set_origin_override()`, we were updating the origin,
but not our current state.

Resolves: #306

Closes: #309
Approved by: cgwalters
2016-06-08 13:26:54 +00:00
Jonathan Lebon
66daf13d68 rpm-ostree-1.pc.in: fix cflags
Closes: #308
Approved by: cgwalters
2016-06-08 13:19:45 +00:00
Colin Walters
77eb3e2b5b tests: Introduce "vmcheck"
This is infrastructure that's oriented around Vagrant, we do builds
inside the target VM (actually inside a Docker container), but then
directly `make install DESTDIR=/host/`.

The goal here is to have a convenient workflow for:

  - dev -> hand testing
  - dev -> run destructive tests

Closes: #303
Approved by: jlebon
2016-06-07 18:39:46 +00:00
Jonathan Lebon
6b07755d68 add RPMOSTREE_UNINSTALLED_PKGLIBDIR
Since we now run everything uninstalled, we can't expect the tmpfiles
conf file to be installed. We add an env var that will allow us to tell
rpm-ostree to look elsewhere. This is then used in test-compose.sh.

Closes: #304
Approved by: cgwalters
2016-06-06 21:14:07 +00:00
Jonathan Lebon
acd3c8ff41 tests: restructure dirs
- Move all the uninstalled, non-destructive tests to check/
- Add a README
- Move utilities to utils/
- Move common files to common/

Closes: #304
Approved by: cgwalters
2016-06-06 21:14:07 +00:00
Jonathan Lebon
9eefc59220 tests: no longer use installed tests
For now, we don't remove the ability to install tests (e.g. the
necessary blurbs in glib-tap.mk are still there), but we take out all
our previously installed tests from the list.

All the previously installed tests are then converted to work
uninstalled. This also allows us to do some simplifications in the test
cases.

Also do some cleanups in the Makefile to improve legibility.

Closes: #304
Approved by: cgwalters
2016-06-06 21:14:07 +00:00
Jonathan Lebon
7f3c5288d4 man page: add pkg-add and pkg-delete
Closes: #302
Approved by: cgwalters
2016-06-03 19:13:13 +00:00
Jonathan Lebon
dc8e94d7e6 man page: reorder, reflow, refresh
No text changes actually made here (except for very small space fixes
and such)

- Fix synopsis
- Abide by 72 max line
- Reflow all the tags to get the right indentation (and in the process
  replace all errant tabs with spaces).
- Re-order the commands in the same order they appear in `rpm-ostree
  --help`.
- Get rid of duplicate `deploy` section.
- Rename 'rpm' command to 'db' (which is what was done in the code).

Closes: #302
Approved by: cgwalters
2016-06-03 19:13:13 +00:00
Colin Walters
3a93fc162f core: Checksum package checksums, not just NEVRA for change detection
GPG signing an RPM doesn't change its NEVRA, and we need to support
detecting the case when RPMs change from unsigned to signed (or vice
versa).

It's also quite common for local developers to rev RPMs without
bumping the release or whatever, so this will fix that too.

Closes: #291

Closes: #296
Approved by: jlebon
2016-06-02 18:40:32 +00:00
Colin Walters
6472b75a69 daemon: Fix regression in --preview/--check
Some code changes in the package layering broke this to always
error out with `refs are equal`.

Reading the code I was confused for a bit until it dawned on
me that `self->refspec` was the input, and we extracted the current
one in a different way.  I ended up modeling it back on the last
working commit I saw (`9eabc1ba`).

That said the logic here could be cleaned up more...it feels like we
should just have a "dry run" flag for the rebase transaction core or
something.  Anyways, going for a surgical fix now.

Closes: #299
Approved by: jlebon
2016-06-02 15:02:06 +00:00
Colin Walters
93e4039f60 core: Dedup hardlink/tempfile code
I wanted to avoid yet another copy of the "generate tempfile name"
code, so moved it to libglnx:

  https://github.com/GNOME/libglnx/pull/14

This also closes the TODO about deduping the "break one hardlink" code
with the "break all links in one dir" code.  The core observation here
is that it's simpler to copy to a tempfile and rename over the
existing, rather than rename, create, unlink.

Closes: #293
Approved by: jlebon
2016-06-01 15:15:11 +00:00