Commit Graph

2306 Commits

Author SHA1 Message Date
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 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 534c4c20c3 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
Giuseppe Scrivano 3ffc277bed bsdiff: change submodule location
The cleanup code was merged in the https://github.com/mendsley/bsdiff
repository, so just use it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-26 23:33:07 +01:00
Matthew Barnes aeab9df4fe Add OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER
Indicates the command requires superuser privilege.  Fails early with
a more helpful message than would otherwise be returned by libostree.

Currently all admin commands except 'status' require superuser.
2015-03-25 17:24:06 -04:00
Matthew Barnes e48ea0ba05 Add OstreeAdminBuiltinFlags for admin commands
Only OSTREE_ADMIN_BUILTIN_FLAG_NONE so far; does nothing.
2015-03-25 17:24:06 -04:00
Matthew Barnes 6b16aba5f9 tests: Add a test case for unwritable repos 2015-03-25 17:24:06 -04:00
Matthew Barnes 1d5e2682fd Check repo permission prior to attempting to modify it
Fail early with a helpful message if the user does not have sufficient
permission to modify an OSTree repository.
2015-03-25 17:24:05 -04:00
Matthew Barnes 7941189dfd Add ostree_ensure_repo_writable()
Commands that need to write files within the repo directory can call
this early to ensure the directory is writable for the current user.
If not, it fails with a helpful "You need to be root to perform this
command" message.
2015-03-25 17:24:05 -04:00
Matthew Barnes a25c7fab12 Add ostree_repo_is_writable() 2015-03-25 17:24:05 -04:00
Colin Walters f89032f581 Release 2015.4 2015-03-25 12:50:50 -04:00
Colin Walters 6c787093e8 gpg-sign: Add missing NULL terminator in options 2015-03-24 09:57:52 -04:00
Alexander Larsson 74f4fc2bc8 Fix build with !HAVE_LIBSOUP
Fix up ostree_repo_pull to match the new declaration
2015-03-23 14:26:01 +01:00
Matthew Barnes bf69c4b44a gpg-sign: Update man page for --delete option 2015-03-20 12:57:45 -04:00
Colin Walters b11d0e5f52 libglnx: Update to latest
Just on general principle.  Newer is better.
2015-03-20 10:56:45 -04:00
Colin Walters 64ff3444f8 build: ostree-gpg-verify-result.h is a public header, install it 2015-03-20 10:56:23 -04:00
Alexander Larsson d26359f823 Fix build failure on g_autoptr(gchar) with glib master
This was removed in favour of g_autofree
2015-03-20 15:36:56 +01:00
Matthew Barnes da918a74d5 gpg: Regenerate test data for test-gpg-verify-result
Turns out the expired signature case was failing because the signature
itself was corrupted.  Reconstructed the test data and updated the test
code.  Note, an expired signature is still counted as valid.

Also, handy debugging trick for setting a key or signature expiry: the
CLI makes it appear the shortest expiry is 1 day, but it also secretly
recognizes "seconds=N".
2015-03-19 12:43:04 -04:00
Matthew Barnes f9e95e2cd3 gpg: Link to GPGME bug about GPGME_SIGSUM_KEY_REVOKED 2015-03-19 10:21:08 -04:00
Matthew Barnes 9b8bad3c2e tests: Update test-gpg-signed-commit.sh
Utilize and test new CLI capabilities:

  - Signature count in 'ostree show' result
  - Duplicate signatures now rejected
  - Ability to delete signatures
2015-03-18 11:53:26 -04:00