Commit Graph

2123 Commits

Author SHA1 Message Date
Matthew Barnes
e592faec43 repo: Add _ostree_repo_get_remote_option_inherit()
Split out from ostree-repo-pull.c.  Still private but more reusable now.
2015-06-26 11:02:24 +02:00
Matthew Barnes
b02777accd repo: Add _ostree_repo_remote_new_fetcher()
Creates and configures an OstreeFetcher instance for a given remote.

Split out from ostree_repo_pull_with_options().
2015-06-26 11:02:24 +02:00
Matthew Barnes
6e3cb828b6 diff: Fix adding CLI options twice 2015-06-18 17:58:13 -04:00
Colin Walters
43cbe8c1b1 tests/metalink: Add a case with nested unknown elements 2015-06-15 21:20:52 -04:00
Matthew Barnes
b6722f9d80 metalink: Fix behavior when requested file is not found
The state machine's "passthrough_previous" field never got set, so the
machine gets put back into the wrong state after a passthrough phase.
Couple other minor issues around error handling.
2015-06-15 21:20:52 -04:00
Dan Nicholson
5af7e8e8c2 pull-local: Support --depth option
Like pull, allow pull-local to mirror another another repository by
specifying how many parents to traverse.

https://bugzilla.gnome.org/show_bug.cgi?id=750581
2015-06-14 08:49:35 -04:00
Giuseppe Scrivano
91d7f3fa0d tests/test-pull-mirror-summary.sh: remove empty newline
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-06-12 13:10:02 +02:00
Giuseppe Scrivano
a0520a51d2 autogen.sh: fix typo
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-06-12 09:44:12 +02:00
Matthew Barnes
9f1b50d41c repo: Change GPG verification policy
The global keyring directory (trusted.gpg.d) is deprecated.  Only use it
when a specified remote does NOT have its own keyring, or when verifying
local repository objects.

Note, because mixing in the global keyring directory is now an explicit
choice, OstreeGpgVerifier no longer needs to implement GInitableIface.
2015-06-10 12:28:57 -04:00
John Hiesey
4f6f97caf0 Fix double free in ostree_repo_pull_with_options
Duplicate the commit checksum for expected_commit_sizes since it's also
used as a value in requested_refs_to_fetch.

https://bugzilla.gnome.org/show_bug.cgi?id=750366
2015-06-05 17:27:38 -04:00
Dan Nicholson
acf228e3c8 Revert "tests: skip test-commit-sign.sh when not root"
This reverts commit d3545b0661. Since the
test is now using the temporary copy of the gpg homedir, it is no longer
owned by root.
2015-06-04 20:58:26 -04:00
Dan Nicholson
e228e0f142 tests: Use temporary gpg homedir
libtest always makes a copy of the gpghome directory to the test
directory, so there's no need to operate on the installed copy. This
allows test-remote-gpg-import to pass as an unprivileged user since it
otherwise couldn't create the temp files gpgme creates.
2015-06-04 20:58:14 -04:00
Dan Nicholson
2e0521804d tests: Use readdir64 when _FILE_OFFSET_BITS set
On 32 bit systems, _FILE_OFFSET_BITS will be set to 64 by
AC_SYS_LARGEFILE. This causes the glibc headers to use readdir64 rather
than readdir. Emulate that behavior in the preloader or the tests will
all fail with "No such file or directory".
2015-06-04 18:56:31 -04:00
Dan Nicholson
7aa23d53cd tests: Link test-gpg-verify-result with gpgme
This test uses gpgme directly to verify the signatures, so it needs to
find the gpgme headers and link with gpgme to ensure the linker can
resolve the symbols.
2015-06-04 18:16:00 -04:00
John Hiesey
06fc597762 Fix tests on 32 bit systems
Use guint64 when the 't' format is used for GVariant
2015-06-04 17:58:12 -04:00
Matthew Barnes
94ef7669d7 gpg: Gracefully handle no trusted.gpg.d directory
This is a deprecated fallback method anyway.  We prefer
remote-specific keyrings now.

https://bugzilla.gnome.org/750049
2015-06-04 17:54:42 -04:00
Colin Walters
44e7e59d27 Release 2015.7 2015-06-02 12:59:48 -04:00
Colin Walters
4f785d4f86 tests/remote-gpg-import: Only commit workdir
Just noticed this while debugging something else.  We don't want to
commit the whole test dir, just the workdir.

Trying to commit the repo itself is potentially subject to race
conditions at least.
2015-06-02 12:39:23 -04:00
Colin Walters
92deafec46 tests: Run all tests through a randomized readdir()
Having undefined (but in practice rarely changing) ordering for
`readdir()` ended up screwing us over for bootloader config
generation; see https://bugzilla.redhat.com/show_bug.cgi?id=1226520

Let's make things significantly more likely to fail more quickly in
the future if similar bugs are introduced.  We accomplish this by
introducing a little `LD_PRELOAD` library that randomizes the results
of `readdir()`.
2015-06-02 12:02:59 -04:00
Colin Walters
5ec148ec4d Revert "tests: Run all tests through a randomized readdir()"
Unintentionally pushed.

This reverts commit ce49264157.
2015-06-02 12:02:28 -04:00
Colin Walters
ee9b98e9d7 tests: Add a test-pull-summary-sigs
This is intended to cover non-mirroring usage of GPG + summary +
deltas.
2015-06-02 09:07:28 -04:00
Colin Walters
acf1caa12f repo: Don't crash when creating a summary if we have --empty deltas 2015-06-02 09:07:28 -04:00
Colin Walters
9acb6283d1 tests: Add a commented out test for mirroring with deltas 2015-06-02 09:07:28 -04:00
Colin Walters
9161e35d20 pull: Validate delta checksums more strongly
We need to check that it's 'ay'.  Also reuse the existing validation
function to check it's 32 bytes rather than potentially crashing with
assertion.

Just noticed this during a code review.
2015-06-02 09:07:28 -04:00
Colin Walters
0bd1ff3939 pull: Ensure console state for multiple GPG verification messages
If there are multiple signatures to verify, we would attempt to
display them multiple times, but we can only call
`gs_console_end_status_line()` if the console has been enabled.

Ensure we turn back on the console after printing our status.  This
will result in extra newlines, but fixing that cleanly would require a
saner GSConsole API.
2015-06-02 09:07:28 -04:00
Colin Walters
ce49264157 tests: Run all tests through a randomized readdir()
Having undefined ordering (but in practice rarely changing)
ordering for `readdir()` ended up screwing us over with respect
to bootloader config file read ordering.

Let's make things significantly more likely to fail more quickly in
the future if similar bugs are introduced.  We accomplish this by
introducing a little `LD_PRELOAD` library that randomizes the results
of `readdir()`.
2015-06-01 22:34:14 -04:00
Colin Walters
20bf7692a9 tests: Add a crosscheck for syslinux bootloader config generation
And actually wire this one up in admin-test.sh.
2015-05-28 14:21:30 -04:00
Colin Walters
0f31c4c4b2 tests: Add a test script to cross-check loader config vs GRUB2
One can run this on a machine to validate things.  I'd like to
get this plugged into the actual OSTree tests as soon as we can
figure out how to sanely run grub2-generate as non-root in
our test suite.

Alternatively, this script can easily be run on a real install.
2015-05-28 14:21:30 -04:00
Colin Walters
3300ee6259 sysroot: Sort returned boot loader configs
I haven't done a full dig through the history, but it seems quite
possible right now we've been relying on inode enumeration
order for generating bootloader configuration.

Most of the time, newer inodes (i.e. later written files) will win.
But that's obviously not reliable.

Fix this by sorting the returned configuration internally.
2015-05-28 14:21:30 -04:00
Jeff Ortel
ca0f02a54b Fix annotations on ostree_repo_remote_gpg_import(). 2015-05-27 15:03:25 -04:00
Giuseppe Scrivano
96baf34edf ostree-repo: document OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-19 11:13:34 +02:00
Colin Walters
bf59d0c6f5 admin: Ensure instutil commands and usage help don't grab lock
When I was introducing the `_UNLOCKED` flag, I only audited
subcommands of `ostree admin`, but I missed that `ostree admin
instutil` also used the option parsing.  Those are only used by
Anaconda today so we can ignore them for locking purposes.

Also, the usage help generation was grabbing the lock unnecessarily.
2015-05-15 09:13:50 -04:00
Matthew Barnes
6a6479c355 repo: Prevent GPG keys from being imported to keybox format
If a remote keyring does not already exist, create an empty pubring.gpg
file in the temporary directory prior to importing keys.  This prevents
gpg2 from creating a pubring.kbx file in the new keybox format [1].  We
want to stay with the older keyring format since its performances issues
are not relevant here.

[1] https://gnupg.org/faq/whats-new-in-2.1.html#keybox
2015-05-14 17:02:39 -04:00
Colin Walters
efcdf4c3f8 repo: Bump mtime any time we write a ref
External daemons like rpm-ostree want push notification any time a
change is made by an external entity.  inotify provides notification,
but a problem is there's no easy way to monitor all of the refs.

In the past, there has been discussion of opt-in recursive timestamps:
https://lkml.org/lkml/2013/4/5/307

But in today's world, let's just bump the mtime on the repo itself, as
a central inotify point.

Closes: https://github.com/GNOME/ostree/pull/111
2015-05-14 06:33:31 -04:00
Giuseppe Scrivano
7224450591 ostree-repo: replace more gs_unref_(variant|bytes) with g_autoptr
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-14 10:04:16 +02:00
Colin Walters
2c526046d8 test-basic: Always chown back before doing assertion
Sometimes I rerun the tests for debugging in the same directory, and
having it be not writable breaks `rm * -rf`.
2015-05-13 22:18:36 -04:00
Colin Walters
3f9fa58213 tests: Fix writable repo test
When I removed the `transaction` symlink, that made this test start
failing.  Fix it by doing `chmod` on `repo/objects`, which is what the
core `ostree_repo_is_writable()` looks at.
2015-05-13 22:11:39 -04:00
Colin Walters
c10bc00249 admin: Use locking for most sysroot commands
The previous commit introduced locking for `ostree admin deploy`, but
we do expect people to possibly accidentally do e.g.
`ostree admin upgrade` concurrently.

Using consistent locking in the admin commands will help rpm-ostree.

Closes: https://github.com/GNOME/ostree/pull/110
2015-05-13 17:23:07 -04:00
Matthew Barnes
06818ceddc tests: Add test-remote-gpg-import.sh 2015-05-13 13:08:49 -04:00
Matthew Barnes
64252a4a39 ostree: Add --gpg-import to the "remote add" command
Convenience option imports GPG keys for a newly-created remote.
2015-05-13 13:08:49 -04:00
Matthew Barnes
c287a7419c ostree: Add a "remote gpg-import" command
Imports GPG keys into a remote-specific keyring.
2015-05-13 13:08:49 -04:00
Matthew Barnes
a9b87ebc18 repo: Add remote's keyring during GPG verification
This is pretty fugly but it at least avoids new public API.
2015-05-13 13:08:49 -04:00
Matthew Barnes
4d7e73ede1 repo: Add ostree_repo_remote_gpg_import()
Imports one or more GPG keys from a source stream or from the user's
personal keyring into a remote-specific keyring.  The keys to import
can optionally be restricted by a list of key IDs.

The imported keys are used to conduct GPG verification when pulling
from the given remote.
2015-05-13 13:08:49 -04:00
Matthew Barnes
0c92d7a8d0 repo: Delete a remote's keyring when deleting a remote 2015-05-13 13:08:48 -04:00
Matthew Barnes
56d684173d repo: Stash keyring name in OstreeRemote 2015-05-13 12:25:58 -04:00
Giuseppe Scrivano
59937d101c maint.mk: Remove GNU releases specific bits
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-13 10:02:47 +02:00
Giuseppe Scrivano
e3a3e2b618 syntax-check: add syntactic rule to prohibit gs_strfreev
and fix an instance.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-13 10:02:47 +02:00
Giuseppe Scrivano
f38ec6dfdf syntax-check: add syntactic rule to prohibit gs_unref_*
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-13 10:02:47 +02:00
Giuseppe Scrivano
4282ef65bf tests: add new test for pull --disable-static-deltas
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-13 09:38:04 +02:00
Giuseppe Scrivano
12f911826a doc: add missing options block for pull
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-13 09:38:04 +02:00