Commit Graph

2306 Commits

Author SHA1 Message Date
Giuseppe Scrivano 0f8f668cd3 trivial-httpd: add option to specify the port
I use the trivial httpd server locally. Each time I restart the
server, I end up modifying manually the config file for other repos so
to point to the correct port. In this way I can just re-use the same
port.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 16:16:27 +02:00
Giuseppe Scrivano 26bb93ac24 trivial-httpd: fix indentation
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 16:16:23 +02:00
Matthew Barnes 4ef0280941 Remove unnecessary #include "libgsystem.h" 2015-05-06 22:07:11 -04:00
Matthew Barnes 302ac4dd89 Use g_auto(GStrv) instead of gs_strfreev 2015-05-06 22:07:11 -04:00
Matthew Barnes cca69b3f55 Use g_autoptr(GVariantBuilder) instead of gs_unref_variant_builder 2015-05-06 22:07:11 -04:00
Matthew Barnes c69347b622 Use g_autoptr(GKeyFile) instead of gs_unref_keyfile 2015-05-06 22:07:10 -04:00
Matthew Barnes c2c322efa9 Use g_autoptr(GVariant) instead of gs_unref_variant 2015-05-06 22:07:10 -04:00
Matthew Barnes bb231fdf74 Use g_autoptr(GPtrArray) instead of gs_unref_ptrarray 2015-05-06 22:07:10 -04:00
Matthew Barnes 196d983af9 Use g_autoptr(GHashTable) instead of gs_unref_hashtable 2015-05-06 22:07:10 -04:00
Matthew Barnes e6556dd223 Use g_autoptr(GBytes) instead of gs_unref_bytes 2015-05-06 22:07:10 -04:00
Matthew Barnes 3f044267b5 Use g_autoptr(GChecksum) instead of gs_free_checksum 2015-05-06 22:07:10 -04:00
Matthew Barnes 6a5f7b1288 Use glnx_unref_object instead of gs_unref_object
For non-GIO object types, at least until autocleanup support for GObject
based types becomes more widespread.
2015-05-06 22:07:04 -04:00
Matthew Barnes 4ee1acd981 Use g_autoptr() for GIO object types
GLib 2.44 supplies all the necessary autocleanup macros for GIO types,
and libglnx backports the relevant macros for ostree.
2015-05-06 21:51:19 -04:00
Matthew Barnes 7a62d64968 Use g_autofree instead of gs_free 2015-05-06 21:50:17 -04:00
Matthew Barnes 4f33515316 Juggling libglnx.h includes 2015-05-06 21:50:06 -04:00
Matthew Barnes 83aac088d1 gpg: Add ostree_gpg_verify_result_describe_variant()
Needed for printing signature details in places where
OstreeGpgVerifyResult cannot go.
2015-05-06 21:04:40 -04:00
Colin Walters 4a3c2a25b7 repo: Stop creating "transaction" symlink
This originally was a way that we detected the case where a pull was
interrupted.  Later, we added `.commitpartial` files which also cover
this case.

See also https://github.com/GNOME/ostree/pull/85

We still want to honor their existence (and unlink them) in case an
old version of ostree was in use, but I believe it's safe to stop
creating them now.

The only case where this would break is if you have a version of
ostree that predates commitpartial in your rollback history, but such
old versions are no longer in use by operating systems I support at
least.

Closes: https://github.com/GNOME/ostree/pull/100
2015-05-06 13:26:47 -04:00
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