Commit Graph

2148 Commits

Author SHA1 Message Date
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
Giuseppe Scrivano
45cb5b5f42 pull: add new switch option --disable-static-deltas
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-13 09:38:04 +02:00
Giuseppe Scrivano
f6d16a6d95 ostree-repo-pull: add option to disable static-deltas
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-12 10:06:56 +02:00
Colin Walters
2dfe24632a sysroot: Add a try_lock() API
The blocking locking API wasn't sufficient for use in the rpm-ostree
daemon; it really wants to know if the lock is held, then continue to
do other things (like service DBus requests), and get notification
when the lock is available.

We also add an async variant that can be called if the lock is not
available.

Implement a higher level "loop until lock is available" method in the
`ostree admin` commandline.
2015-05-10 16:20:53 -04:00
Matthew Barnes
d0edf63346 repo: Simplify sign_data() a little
Use ot_gpgme_data_output() to wrapper a GOutputStream.
2015-05-07 17:50:22 -04:00
Matthew Barnes
239f05ecdd gpg: Add custom data buffers to wrapper GIO streams
ot_gpgme_data_input() and ot_gpgme_data_output(), shamelessly ripped
off from seahorse_gpgme_data_input() and seahorse_gpgme_data_output().
2015-05-07 17:07:36 -04:00
Matthew Barnes
cd1551b1ee gpg: Fix ot_gpgme_error_to_gio_error()
Need to extract the error code from a gpgme_error_t, can't just compare
it directly.
2015-05-07 16:02:39 -04:00
Giuseppe Scrivano
223a9eaaa5 ot-fs-utils: remove empty line at EOF
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:59:30 +02:00
Giuseppe Scrivano
70d9599246 summary: delete summary.sig on an update
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Giuseppe Scrivano
6aeeba4280 tests: add a test for signed summary file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Giuseppe Scrivano
ef7a4dee10 pull: verify signature for the summary file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Giuseppe Scrivano
5f33133054 summary: add new command line arguments to sign the summary file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Giuseppe Scrivano
fee785a72e ostree-repo: add new API to sign the summary file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Giuseppe Scrivano
94360d3d1c pull: get rid of detached metadata for deltas
Once the summary file will be signed, we can validate the superblock
from there.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Giuseppe Scrivano
8c3d4eb7b2 pull: check that the superblock checksum is the same as in the summary
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Giuseppe Scrivano
222696996f core: store information about delta files checksums
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Giuseppe Scrivano
ae672c3c9f core: new function _ostree_parse_delta_name
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Giuseppe Scrivano
e0da4db77c summary: list the available static deltas
Write the information in the additional_metadata element for backward
compatibility.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
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