Commit Graph

2089 Commits

Author SHA1 Message Date
Matthew Barnes
e0f066e9c2 libglnx: Pick up bugfix and backports
Need more autocleanup backports for GIO types.
2015-05-06 10:28:31 -04:00
Colin Walters
5becd5ccad Teach fsck about partial commits
An OSTree user noticed that `ostree fsck` would produce `missing
object` errors in the case of interrupted pulls.

It's possible to do e.g. `ostree pull --subpath=/usr/share/rpm ...`,
which gets you just that portion of the commit.  The use case for this
was being able to see what changes would appear in an update before
actually downloading all of it.

(I think this would be better covered by static deltas, but those
 aren't final yet, and `--subpath` predates it)

Further, `.commitpartial` is used as a successor to the `transaction`
symlink for more precise knowledge in the case where a pull was
interrupted that we needed to resume scanning.

So it makes sense for `ostree fsck` to be aware of it.
2015-05-06 08:07:20 -04:00
Colin Walters
279308b5b9 core: Cleanup commitpartial file with fd-relative lookups
First, this is just a general continuation of the `GFile -> openat`
transition.

Second, it's preparatory work for fsck to gain awareness of partial
commits.
2015-05-06 08:07:20 -04:00
Giuseppe Scrivano
a68242c6c9 doc: remove unknown parameter from inline documentation
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-05 16:29:20 +02:00
Matthew Barnes
81138963c3 repo: Fix an obvious typo 2015-05-05 10:25:00 -04:00
Giuseppe Scrivano
9fa10e69f9 libglnx: fix reference to commit
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-05 16:23:51 +02:00
Colin Walters
9ef98fd05a sysroot: Add an API to lock
If a system administrator happens to type `ostree admin upgrade`
multiple times, currently that will lead to a potentially corrupted
system.

I originally attempted to do locking *internally* in `libostree`, but
that didn't work out because currently a number of the commands
perform multi-step operations that all need to be serialized.  All of
the current code in `ostree admin deploy` is an example.

Therefore, allow callers to perform locking, as most of the higher
level logic is presently implemented there.

At some point, we can revisit having internal locking, but it will be
difficult.  A more likely approach would be similar to Java's approach
with concurrency on iterators - a "fail fast" method.
2015-05-05 08:52:44 -04:00
Matthew Barnes
33b0667597 Fix build when using GLib < 2.44 2015-05-04 12:02:02 -04:00
Giuseppe Scrivano
857a852540 pull: the commit size in the summary is not for the detached metadata
Use the size specified in the summary file only for the not detached
metadata.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-03 21:44:09 +02:00
Matthew Barnes
f162c0b6d6 gpg: Fix _ostree_gpg_verifier_add_keyring()
The function never fails, but its API makes it look like it can.

Fortunately it's private, so just fix it.
2015-05-01 15:24:11 -04:00
Matthew Barnes
e7246e6d64 ostree: Split up "remote" subcommands
To make room for "remote gpg-import", which will be non-trivial.
ot-builtin-remote.c was already a little too crowded anyway.

Also while we're at it, port this bit of code away from libgsystem.
2015-05-01 14:38:17 -04:00
Matthew Barnes
ca63fab6b1 repo: Initialize GPGME in instance init()
Initially I had this in class_init() but there it would get invoked
during introspection scanning.
2015-05-01 14:38:17 -04:00
Matthew Barnes
97379ec38c libotutil: Add ot_gpgme_ctx_tmp_home_dir()
Currently used for signature verification, will also be used for
importing GPG keys.
2015-05-01 10:21:40 -04:00
Matthew Barnes
ceacc57206 libotutil: Establish a place for GPG utilities
Add ot-gpg-utils.[ch] and move _ostree_gpg_error_to_gio_error() here.
2015-05-01 10:20:34 -04:00
Giuseppe Scrivano
cd93780d97 show: add option --gpg-homedir
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-27 15:22:41 +02:00
Giuseppe Scrivano
f37cbe1fc9 gpg: do not use secring.gpg
It contains the secret keyring

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-27 15:22:41 +02:00
Giuseppe Scrivano
cf30f8717a g_output_stream_splice: check correctly the error code
While at it, change the style of other two occurrences.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-24 18:26:22 +02:00
Giuseppe Scrivano
8ab2e60edc test-auto-summary.sh properly quote arguments to assert_streq
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-24 15:46:28 +02:00
Matthew Barnes
9c449624f2 pull: Always request detached metadata for commits
Always request detached metadata for commit objects, even if we already
have the commit object.  This ensures we fetch any post facto detached
metadata updates such as new GPG signatures.

https://bugzilla.gnome.org/748220
2015-04-23 19:57:10 -04:00
Micah Abbott
d801d347f7 reset: update help output
The inline help for 'ostree reset' now correctly shows that it
requires a REF and a COMMIT as arguments.
2015-04-23 14:32:11 -04:00
Giuseppe Scrivano
42edb6f91b README.md: fix typo
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-21 23:05:23 +02:00
Colin Walters
e0b73d0742 deploy: Drop a fsync, use fd-relative APIs
Now that we can rely on `syncfs()`, drop another fsync in the deploy
path.  While we're here, convert it to fd-relative.
2015-04-20 21:03:23 -04:00
Colin Walters
45406bf815 deploy: Drop fsync of modified config files
These fsyncs were added for what turned out to be a fairly bogus
reason; I was hitting read errors from extlinux after upgrades and out
of conservatisim tried adding fsync calls, but the *actual* problem
was that extlinux didn't support 64 bit ext4.  Now that at least for
Project Atomic hosts we're just targeting grub2, we can drop these
fsync calls and rely on `syncfs()` being both faster and catching any
errors.
2015-04-20 21:03:23 -04:00
Colin Walters
c58a5c0cb3 deploy: Use syncfs() in addition to sync()
For some sort of crazy reason, the `sync()` system call doesn't
actually return an error code, even though from what I can tell in the
kernel it wouldn't be terribly hard to add.

Regardless though, it is better for userspace apps to use `syncfs()`
to avoid flushing filesystems unrelated to what they want to sync.  In
the case of OSTree, this does matter - for example you might have a
network mount point backing your database, and we don't want to block
upgrades on syncing it.

This change is safe because we're doing syncfs in *addition* to the
previous global `sync()` (a revision from an earlier patch).

Now because OSTree only touches the `/` mount point which covers the
repository, the deployment roots (including their copy of `/etc`), as
well as `/boot`, we should at some point later be able to drop the
`sync()` call.  Note that on initial system installs we do relabel
`/var` but that shouldn't happen at ostree time - any new directories
are taken care of via `systemd-tmpfiles` on boot.
2015-04-20 21:03:22 -04:00
Colin Walters
6d84321a16 status: Don't crash if we deployed a local refspec
In the case we built a local tree, we'd pass `NULL` as a remote down
to the GPG checking code.  Noticed this in the test suite.
2015-04-20 21:02:25 -04:00
Colin Walters
f08cb802ea sysroot: Close sysroot fd in finalize
Just noticed this while I was going to add another one there.
2015-04-20 16:51:05 -04:00
Colin Walters
02b3a81d11 libglnx: Update from master
No real changes, but I'd like to use some of the new APIs later.
2015-04-17 16:15:55 -04:00
Colin Walters
178d8ff194 Release 2015.6 2015-04-17 14:16:08 -04:00
Colin Walters
24087d477c sysroot: Add ostree_sysroot_get_fd()
This way external programs like rpm-ostree can do fd-relative
operations on the deployment directories, like inspecting the RPM
database.

Closes: https://github.com/GNOME/ostree/pull/91
2015-04-17 14:15:11 -04:00
Matthew Barnes
60ebec770e main: Tweak GPG output to match rpm-ostree 2015-04-17 12:43:46 -04:00
Matthew Barnes
a6bbcf2ba7 sysroot: Cache an OstreeRepo instance
Rather than returning a new OstreeRepo instance in each call to
ostree_sysroot_get_repo(), cache one internally so the same instance
is returned each time.
2015-04-17 11:19:08 -04:00
Matthew Barnes
6a7b9defb8 admin: Conditionally show GPG signatures in status command
Only if GPG verification is enabled for a deployment's origin.
2015-04-16 18:13:17 -04:00
Matthew Barnes
54bf665521 repo: Add ostree_repo_remote_get_gpg_verify()
Trivial function, but it does at least centralize the default value.
2015-04-16 18:13:13 -04:00
Matthew Barnes
d7a6f257a0 pull: Print GPG signature status as soon as its known 2015-04-16 18:13:08 -04:00
Matthew Barnes
20076ff201 repo: Add a "gpg-verify-result" signal
Emitted during a pull operation upon GPG verification (if enabled).
Applications can connect to this signal to output the verification
results if desired.
2015-04-16 18:13:04 -04:00
Matthew Barnes
d0770e9993 repo: Improve error handling in sign_data()
Use _ostree_gpg_error_to_gio_error() so the actual GPG error message is
included in the GError.  Then apply an "Unable to blah: " message prefix.
2015-04-16 18:12:58 -04:00
Colin Walters
ab15eafe56 reset: Don't enforce parent commits
First, git doesn't do this, and whatever Linus thinks is right or
something.

Second specifically to OSTree, it's quite common to not have
intermediate commits.  If one wants to reset a ref in order to prune
data after a deployment, the parentage check will fail.

Closes: https://github.com/GNOME/ostree/pull/87
2015-04-15 07:12:20 -04:00
Colin Walters
e5e0b95e27 libglnx: Update to latest
This pulls in more fixes for writes.
2015-04-14 15:53:51 -04:00
Giuseppe Scrivano
9e6ac6d822 config: add new parameter "commit-update-summary" to core section
When set to true, the summary file is automatically updated after
a commit.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-14 17:46:53 +02:00
Giuseppe Scrivano
362771aa98 summary: write the contents to a temporary file
do not write directly to the summary file but use a temporary file
first.  It avoids to create an empty file if "ot_util_variant_save"
fails.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-14 17:42:25 +02:00
Giuseppe Scrivano
69184e70e9 _ostree_repo_file_replace_contents: make buf const
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-14 17:42:24 +02:00
Matthew Barnes
a1352fec9d tests: Fix root uid check in test-commit-sign.sh 2015-04-14 08:53:48 -04:00
Matthew Barnes
79e28a13a3 libglnx: Pick up file permission regression fix
https://bugzilla.gnome.org/747813
2015-04-14 08:49:18 -04:00
Colin Walters
fff8ffdd2f repo: Add a private helper to replace a file, honoring fsync policy
Extracted from discussion in https://github.com/GNOME/ostree/pull/83
2015-04-13 13:28:02 -04:00
Colin Walters
1892a6fe13 refs: Use *at for writes, honor repo fsync flag
I was looking at https://bugzilla.gnome.org/show_bug.cgi?id=738954
which wants us to ensure we chown() the refs.  As part of that,
I did a generic conversion to use `*at()` (which naturally gives
us more low level control so we can call `fchown` etc.

This patch also sneaks in a change to respect the repo's
`disable_fsync` flag - if fsync is not set, then we never
`fdatasync()` (unlike the `g_file_replace_contents()` default.  Also
unlike it, if fsync is enabled, we *always* sync even if the file
didn't exist.
2015-04-13 08:47:05 -04:00
Giuseppe Scrivano
c648fada30 ostree_repo_checkout_tree_at: remove @subpath documentation
It is not an argument of the function.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-13 11:55:25 +02:00
Colin Walters
42744628b3 Add an API to set/unset a deployment tree's mutability
This will be used by rpm-ostree to unset the immutable bit temporarily
in order to do package layering.  We could add an API to deploy a tree
without the immutable bit, but this is simpler.
2015-04-10 17:54:08 -04:00
Colin Walters
54f848a78c pull-metalink: Don't print error output when we expect failure
I think I added `cat err.txt` to debug, but it's not necessary now.
2015-04-10 17:51:13 -04:00
Matthew Barnes
18fdc7cb97 admin: Show GPG signatures in status command 2015-04-08 10:18:53 -04:00
Matthew Barnes
7956b0a5c5 gpg: Add ostree_gpg_verify_result_describe()
Internalizes the signature output of "ostree show" so it can be reused
elsewhere.
2015-04-08 10:18:48 -04:00