2323 Commits

Author SHA1 Message Date
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 v2015.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
Colin Walters
bc5c9fca26 Release 2015.5 v2015.5 2015-04-07 16:18:45 -04:00
Colin Walters
c2aabcac3b ostree_repo_checkout_tree_at: New API for checkouts
rpm-ostree currently uses ostree_repo_checkout_tree(), which as a side
effect will use the uncompressed objects cache by default.  This is
rather annoying if you're using rpm-ostree on a server-side
repository, because if you then rsync the repo, you'll be syncing out
the uncompressed objects unless you exclude them.

We added the ability to disable the uncompressed cache in the
repository config to fix this, but it's better to allow application
control over this.  The uncompressed cache will in some future version
become opt in as well.

This new API further:
 - Drops the `GFile` usage in favor of `openat` APIs
 - Improves ergonomics by avoiding callers having to query the source
   `GFileInfo` (and carry around a copy of `OSTREE_GIO_FAST_QUERYINFO`)
 - Has a more extensible options structure

Per the comment, I rather crudely have the `ostree checkout` builtin
call both APIs to ensure some testing coverage.

However, I'd like to in the future have easier-to-set-up testing code
that calls `libtest.sh` to set up dummy data.
2015-04-07 15:12:16 -04:00
Colin Walters
115e05746b pull: Handle remote web server not honoring range requests
It's valid for the remote server to say 200 OK and give us the entire
file instead of a 206 Partial Content, and in that case we should blow
away the previous cached data, rather than blindly appending to it and
thus creating multiple copies of the data inside the file.

This problem primarily occurs when we do have the complete file, and
we're interrupted, then try again, where the new process didn't record
the download was already complete.  We do a range request for bytes
past the end, and some web servers (e.g. Akamai) will return 200 OK
with the whole content again, rather than a 416 Requested Range Not
Satisfiable.

Thus we could also fix this by saner caching strategy - since we know
the file is complete, rename it again to $checksum.done or something
before it's processed.  (Or really, rework how we do caching more
intelligently in general).

This fixes the issue that interrupted pulls failed with such
webservers, although repeated attempts would eventually succeed
because we'd unlink files that failed to pull.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1207292
2015-04-06 14:33:16 -04:00
Colin Walters
1e501422e2 tests: Verify that the pull error was from interruption
While working on https://github.com/GNOME/ostree/pull/84 I wanted to
verify that nothing else was going wrong.
2015-04-06 14:33:16 -04:00
Matthew Barnes
f2b2d7c3f2 core: Actually allow none in ostree_parse_refspec()
Both 'out_remote' and 'out_ref' parameters already have the (allow-none)
annotation but that wasn't actually true.
2015-04-06 12:08:27 -04:00
Daniel Svensson
f01fceb5d7 tests: Missing linker flags for test-rollsum
Reproducable on Debian; Fedora lets it slide.
2015-04-06 10:29:07 -04:00
Colin Walters
dcae7dee57 dist-packaging: Don't delete 91-ostree.preset, do clean old rpms/sources
We have to copy the sources to avoid rpmbuild deleting them.  But on
the other hand there's no reason for old sources to stick around.
2015-04-05 09:37:58 -04:00
Giuseppe Scrivano
d3545b0661 tests: skip test-commit-sign.sh when not root
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-03 09:57:20 +02:00
Giuseppe Scrivano
d0278b6407 build: exclude .sig files from syntax-check
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-03 09:57:20 +02:00
Giuseppe Scrivano
1de4035d49 src/ostree/ot-main.c: drop empty newline at end of file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-03 09:57:20 +02:00
Giuseppe Scrivano
12bc9a336a tests/basic-test.sh: enable repo-noperm test only for non-root user
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-03 09:57:20 +02:00
Giuseppe Scrivano
a1a4d15119 build: Drop libattr from the spec file
commit 534c4c20c3fa5ad9500ea96093a3ece7821a6056 already drops its
usage in the code.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-02 11:19:51 +02:00
Daniel Svensson
534c4c20c3 build: Use glibc's xattr support instead of requiring libattr
Fixes the build on Debian, and is one library less.

Closes: #78
2015-04-01 06:35:53 -04:00
Colin Walters
2a30af72db main: Only verify SUPERUSER flag if using default sysroot
The use case for non-default sysroots that I know of are:
 1) The current test suite
 2) Installers (Anaconda)
 3) Inspecting VM disks

For 2) and 3), it'll quickly be obvious if they're not running as
root, and these are more obscure cases.  We want to allow 1), and this
is a simple way to do it.

https://bugzilla.gnome.org/show_bug.cgi?id=747164
2015-04-01 06:21:34 -04:00
Matthew Barnes
e92fd9a83d Include ostree-gpg-verify-result.h in ostree.h 2015-03-31 19:48:55 -04:00
Sam Thursfield
d667ebe156 core: Fix possible crash in ostree_mutable_tree_walk()
If the starting index is beyond the end of the list, it's a programming
error. Previously, the code was trying to raise a runtime error, but
actually causing a segfault.

This was detected by test code in test-mutable-tree.c, which is removed
in this commit because it should now not be possible to crash here.

https://bugzilla.gnome.org/747032
2015-03-31 13:04:31 -04:00