Commit Graph

951 Commits

Author SHA1 Message Date
Jonathan Lebon
55e1cfeb99 buildimg: add new prereqs
Closes: #360
Approved by: cgwalters
2016-06-29 19:17:38 +00:00
Colin Walters
9d473df11e build: Remove --enable-usrbin-atomic
We haven't used this in a long time now that the atomic command
exists.

Closes: #361
Approved by: jlebon
2016-06-29 16:44:08 +00:00
Colin Walters
462645e71c core: Fix up more nevra leaks
Really do need to make it `const` but let's do that separately.

Closes: #359
Approved by: jlebon
2016-06-29 15:17:18 +00:00
Colin Walters
974d725f30 core: Store pkg directly rather than leaking nevras
I noticed that actually `hif_package_get_nevra()` mallocs, but a bunch
of this core code seems to assume it's const.

Actually, I suspect there's no good reason for it to strdup, so I'll
fix that too.

But in the meantime, we actually don't need to indirect through the
nevra, we can just store the `HifPackage` that we wanted anyways as
the key.

Now, the *real* reason I wrote this is right now rpm-ostreed is
segfaulting due to failing to look up the key, and I can't figure
out why...this doesn't fix it, but it makes the code better.

Closes: #359
Approved by: jlebon
2016-06-29 15:17:18 +00:00
Colin Walters
5ff77217f3 scripts: Ignore glibc-headers.prein and vagrant*.prein
The first is pure legacy, the second is an adduser that we should
eventually handle, but not critical right now.

Closes: #358
Approved by: jlebon
2016-06-29 13:53:42 +00:00
Colin Walters
5b6bf4576f main: Distinguish "preview" and "experimental" commands
Let's say package layering is "preview" - we show it in help, but
marked `(preview)`.

Whereas the `container` and `internals` builtins this patch calls
"experimental" - we don't show them in help even.

Both get a warning message when executed.

Closes: #354
Approved by: jlebon
2016-06-28 14:56:14 +00:00
Colin Walters
000b0675bd core: Always refresh cache, rather than never
I was trying to upgrade my desktop today and hit errors due
the fact I was apparently only upgrading the base, and not
layered packages.  (Due to a newer shared library in the base
needing to be version locked with a layered package).

It turns out we were keeping the cache forever, which is really quite
the opposite of what we want here.

I haven't looked if librepo is doing If-Modified-Since etc. updates or
not, but if it isn't we need to fix that.

Closes: #355
Approved by: jlebon
2016-06-28 14:38:57 +00:00
Jonathan Lebon
8be7d4968a daemon: don't try to resolve rev
During the initialization of the daemon, it would try to load the
deployments and cache a few things. One of these steps wanted to look up
the rev of the deployment. However, if the rev no longer exists (e.g. we
just did a rebase, purged the ref, and rebooted), this would error out.

Replace the lookup by simply directly using the csum from the
deployment.

Closes: #353
Approved by: cgwalters
2016-06-27 17:29:26 +00:00
Jonathan Lebon
b41e39045b sysroot-upgrader: remove csum override on rebase
Rebasing on a new branch should not in any way care about which commit
we're currently overridden on.

Also fix a typo which would cause override-commit keys to not be
deleted from the origin.

Closes: #353
Approved by: cgwalters
2016-06-27 17:29:26 +00:00
Gerard Braad
34c504055b Links for more information
Closes: #351
Approved by: cgwalters
2016-06-26 21:18:58 +00:00
Gerard Braad
350718ffd5 Correct location of document link
Closes: #352
Approved by: giuseppe
2016-06-26 12:07:47 +00:00
Jonathan Lebon
225be81c40 RPMOSTreeSysroot: add "booted" entry to deployment variant
Now that the `status` command learned a `--json` option, we can pretty
much avoid parsing human-readable output. The only piece of information
that is missing from the JSON output compared to the output for humans
is *which* deployment we're currently booted in.

This patch fixes that shortcoming by adding a "booted" boolean variant
to the deployment variant.

Closes: #350
Approved by: cgwalters
2016-06-25 12:23:04 +00:00
Colin Walters
f35f5cf468 core: Initial implementation of %posttrans using bwrap+rofiles-fuse
In order to make many things work, we need to run scripts.  Short version:
For now, we:

 - Run `%posttrans`
 - Treat most `%post` as the same as `%posttrans`
 - Ignore `%preun` and such since we never uninstall

Most importantly though, we start to build up an "override" list
for script handling.  Currently it's just a blacklist of scripts
we don't need.

Significant work here would be needed to run Lua scripts, so far I've
been able to just skip them.

Closes: #338
Approved by: jlebon
2016-06-24 16:08:08 +00:00
Colin Walters
4738c6eb60 core: Remove a stray _percent_progress_end()
See https://github.com/projectatomic/rpm-ostree/pull/338

Closes: #348
Approved by: jlebon
2016-06-23 19:53:13 +00:00
Colin Walters
6130032e80 daemon: Check for GPG signature on base commit, not layered
We don't currently expect people to sign commits locally.

However, long term, I would like to support a verified boot model
where we still support layered packages.  A system administrator could
log in and perform changes, and possibly use a remote hardware token
to sign the commit.  Anyways that's for the future.

Closes: #346
Approved by: jlebon
2016-06-23 18:03:07 +00:00
Colin Walters
1616ca5f07 app: Rename pkg-delete -> pkg-remove and unify codebase
I've found it's a lot less code to have multiple builtins share live
in the same `.c` file where they can share things like options.

Also, rename `pkg-delete` -> `pkg-remove` since the canonical antonym
of `add` is `remove`.

Closes: #345
Approved by: jlebon
2016-06-23 13:37:07 +00:00
Jonathan Lebon
c53d8fa9cb setup.yml: cache buildimg container
By far the longest step in provisioning a new VM is the building of the
container. This helps alleviate things a little by caching it on the
host. It's not a complete solution however. We also need to make it easy
to update an existing container.

Closes: #344
Approved by: cgwalters
2016-06-23 00:05:09 +00:00
Jonathan Lebon
4ce0a06ed5 vagrant: set up ssh for root user
From Vagrantfile:

It's just easier to have ssh set up as root from the start so that tests
don't need to sudo, which can sometimes cause issues. If we need to test
any unprivileged things, we can still just sudo back into the vagrant
user.

Closes: #344
Approved by: cgwalters
2016-06-23 00:05:09 +00:00
Jonathan Lebon
812c431856 test-layering.sh: basic package layering test
This is a preliminary package layering test which simply installs the
foo package and verifies that it functions properly. A bunch of
primitives are added to libvm.sh to facilitate this and future tests.

Closes: #344
Approved by: cgwalters
2016-06-23 00:05:09 +00:00
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