Commit Graph

4269 Commits

Author SHA1 Message Date
Dan Nicholson
d2a9c8604e tests/gpg: Skip tests when subkeys can't be expired
The ability to expire subkeys using gpg's --quick-set-expire is only
available on gnupg 2.1.22. If expiring a subkey fails, assume this is
why and skip the tests that require it but run the actions that the
subsequent tests depend on. This was failing on the Debian Stretch CI
tests since stretch has gnupg 2.1.18.

Closes: #1892
Approved by: jlebon
2019-07-27 03:20:21 +00:00
Dan Nicholson
8ac348d19a tests/gpg: Use exit hook to kill agent in temporary GPG homedir
This wasn't available when I originally wrote this, but it ensures that
the running gpg-agent in tmpgpghome is killed in case the tests exit
early.

Closes: #1892
Approved by: jlebon
2019-07-27 03:20:21 +00:00
Dan Nicholson
615861443b tests/sizes.js: Fix byte array unpacking
Recent GJS changed how byte arrays are unpacked with some assumptions
that they are likely strings. Manually use get_child_value() and
get_byte() to ensure the correct value is parsed when checking the
`ostree.sizes` metadata.

The upstream test is currently passing fine with GJS 1.56.2, but at
Endless we (unfortunately) have a downstream change that adds the object
type as an additional byte in the array. This is parsed incorrectly by
`deep_unpack()`. We can carry this patch downstream, but this change
makes the test more robust regardless.

Closes: #1884
Approved by: cgwalters
2019-07-23 12:49:26 +00:00
Dan Nicholson
2312caad76 tests/sizes: Fix call to commit_transaction()
The GIR for commit_transaction() only has a single argument for the
GCancellable. Calling it with 2 arguments prints a GJS warning:

Gjs-Message: 15:37:40.287: JS WARNING: [/home/dan/src/ostree/tests/test-sizes.js 56]: Too many arguments to method OSTree.Repo.commit_transaction: expected 1, got 2

Currently this is harmless, but it could become a hard error in GJS at
some point.

Closes: #1884
Approved by: cgwalters
2019-07-23 12:49:26 +00:00
Rafael Fonseca
a904f434cd lib/kargs: add missing function to symbol-versioning table
Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>

Closes: #1883
Approved by: jlebon
2019-07-02 13:58:26 +00:00
Matthew Leeds
48624c99ad lib/repo: Improve docs for get_min_free_space_bytes()
Closes: #1879
Approved by: jlebon
2019-06-26 14:14:08 +00:00
Robert Fairley
322e8697e9 lib/util: Drop unneeded ot-tool-util.h includes
With `ot-tool-util.h` made visible in `otutil.h` (in
be2572bf68), drop previous includes
of `ot-tool-util.h` elsewhere.

Closes: #1876
Approved by: zonggen
2019-06-21 14:52:11 +00:00
Robert Fairley
86cf6ba5c5 ci/flatpak: Bump FLATPAK_TAG to 1.4.1
Bump the flatpak version used in CI to avoid a repeated definition of
`renameat2()` in libglnx and glibc.

See: https://github.com/ostreedev/ostree/pull/1871#issuecomment-503768062

Closes: #1871
Approved by: jlebon
2019-06-21 13:17:10 +00:00
Robert Fairley
fd8795f387 Makefile-libostree.am: Work around clang issues with g-ir-scanner
Work around an issue with clang-7 in Fedora 29 where the
`-fstack-clash-protection` flag is not recognized. Force
the compiler used by `g-ir-scanner` to `gcc`, so that the flag
is recognized.

Related: https://github.com/projectatomic/rpm-ostree/pull/1787#issuecomment-473971585

Closes: #1871
Approved by: jlebon
2019-06-21 13:17:10 +00:00
Robert Fairley
35cce4972e ci/build-check: Remove unused-command-line-argument diagnostic
Since `clang-4.0` is no longer being used, it should be safe to remove
use of this diagnostic for clang. This enables using `gcc` as a workaround
for `g-ir-scanner`, as `unused-command-line-argument` is not recognized by
`gcc`.

See: https://github.com/ostreedev/ostree/pull/1871#issuecomment-503765624

Closes: #1871
Approved by: jlebon
2019-06-21 13:17:10 +00:00
Robert Fairley
46da9356a7 ci: Use Fedora 29 artifacts
Use Fedora 29 artifacts instead of Fedora 28, since 28 is now
end-of-life.

Also rename `ci/fah28-insttests.sh` -> `ci/fah29-insttests.sh`
and use the https://getfedora.org/atomic_qcow2_latest redirect
URL for the latest Fedora Atomic Host 29 image.

Closes: #1871
Approved by: jlebon
2019-06-21 13:17:10 +00:00
Dan Nicholson
abb173352d tests: Always cleanup gpg-agent when exiting
Add `libtest_cleanup_gpg()` to the array of commands to run when
exiting. This provides 2 improvements:

1. You don't need to worry about whether the test will spawn a gpg-agent
   and therefore require adding a call to `libtest_cleanup_gpg()`.

2. All the existing users were calling `libtest_cleanup_gpg()` at the
   end of the script. If there was a failure and the script exited
   early, then it wouldn't cleanup and there may be a stray gpg-agent
   hanging around.

Closes: #1799
Approved by: cgwalters
2019-06-19 17:30:24 +00:00
Dan Nicholson
0dd27bbf4b tests/libtest: Allow appending actions to be run on EXIT
Currently if a test script adds a trap on `EXIT` to run some cleanup, it
will stomp on the existing trap to run `save_core()`. Allow for scripts
to append actions that will run on exit by introducing an array that
will be iterated over by a single exit runner.

Closes: #1799
Approved by: cgwalters
2019-06-19 17:30:24 +00:00
Dan Nicholson
b6979e7572 lib: Kill GPG agent when cleaning up tmp homedirs
When a temporary directory is used for GPG operations, it's pretty clear
that the running agent will be useless after the directory is deleted.
Call the new `ot_gpgme_kill_agent ()` helper to kill gpg-agent rather
than leaving them it hanging around forever.

As it turns out, gnupg does have code to make gpg-agent automatically
exit when the homedir is removed (https://dev.gnupg.org/T2756), but
that's only available on gnupg 2.2 or newer. Possibly this code can be
dropped later when that's more widely deployed or users/distros have
been advised to backport the necessary changes.

Closes: #1799
Approved by: cgwalters
2019-06-19 17:30:24 +00:00
Dan Nicholson
4670837f7c lib/gpg: Add helper to kill GPG agent
With GnuPG 2, any time you do basically any operation, a gpg-agent will
be spawned for the GPG home directory in use. The classic way to kill a
gpg-agent is to use `gpg-connect-agent` and send the `killagent` command
as is done in libtest.sh.

Closes: #1799
Approved by: cgwalters
2019-06-19 17:30:24 +00:00
Dan Nicholson
0c63f30783 tests/test-gpg-signed-commit: Test more key states
Extend test-gpg-signed-commit.sh to test various key states. If gpg is
found that supports the required options, keys will be generated on the
fly and changed in various ways to exercise the output from
`ostree_gpg_verify_result_describe_variant` used in `ostree show`.

I tested this using gnupg 2.2.12, so I hope it works well enough on
various gpgs found in the wild.

Closes: #1872
Approved by: cgwalters
2019-06-19 17:17:11 +00:00
Dan Nicholson
d8649f4d56 tests/libtest: Allow specifying GPG homedir to cleanup
In case the tests want to use a custom GPG homedir, allow passing in the
homedir to use when cleaning up a running gpg-agent.

Closes: #1872
Approved by: cgwalters
2019-06-19 17:17:11 +00:00
Dan Nicholson
d0ec319b6b lib/gpg: Show if GPG key has been revoked
Rather then showing the incorrect `BAD signature`.

Closes: #1872
Approved by: cgwalters
2019-06-19 17:17:11 +00:00
Dan Nicholson
d714e622b8 lib/gpg: Show information for expired keys
Introduce a new signature attribute for the key expiration timestamp and
display it when the key has a non-zero expiration time. Without this,
the error shown is `BAD signature`, which isn't correct.

Closes: #1872
Approved by: cgwalters
2019-06-19 17:17:11 +00:00
Dan Nicholson
901c2f5e5f lib/gpg: Factor out expiration timestamp formatting
This will be reused to format a key expiration message.

Closes: #1872
Approved by: cgwalters
2019-06-19 17:17:11 +00:00
Allen Bai
be2572bf68 lib/kargs: Make API public and upstream new rpm-ostree APIs
This change makes public the current kargs API in src/libostree/ostree-kernel-args.c
and adds documentations.

Upstreams the new kargs API from rpm-ostree/src/libpriv/rpmostree-kargs-process.c

Merges libostree_kernel_args_la_SOURCES to libostree_1_la_SOURCES in Makefile-libostree.am

Upstreams tests/check/test-kargs.c from rpm-ostree.

Closes: #1833

Closes: #1869
Approved by: jlebon
2019-06-18 14:29:14 +00:00
Rafael Fonseca
2db79fb398 admin: allow multiple args for pin subcommand
Fixes #1816

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>

Closes: #1874
Approved by: rfairley
2019-06-17 15:06:09 +00:00
Dan Nicholson
d916383953 bin/refs: Allow overwriting existing ref
Currently if you want to update a non-alias ref, you need to first check
if it exists and use either `ostree refs --create` or `ostree reset` as
appropriate. That's unnecessarily complicated and is much less
convenient than the old `write-refs` builtin that simply called
`ostree_repo_set_ref_immediate()` without any checks.

Add a `--force` option to be used with `--create` that does not raise an
error when the destination ref already exists.

Closes: #1870
Approved by: jlebon
2019-06-12 15:00:19 +00:00
Allen Bai
6733843f87 lib/util: Fix segfault when validating filename
This change fixes the segfault issue when calling ostree_repo_checkout_tree with
empty GFileInfo. A simple condition check for NULL value is added at
src/libotutil/ot-unix-utils.c:46. Closes: ostreedev#1864.

Closes: #1868
Approved by: jlebon
2019-06-06 16:05:19 +00:00
Philip Withnall
e0ddaa811b ostree-repo-finder: Clarify immutability after construction
I think this was the intention, but I forgot to document it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1863
Approved by: mwleeds
2019-05-29 03:36:06 +00:00
Tristan Van Berkom
b847cc37bb tests: Test committing archives from stdin
This updates test-libarchive.sh to test committing archives from
stdin and verifying their content is correct.

Closes: #1862
Approved by: jlebon
2019-05-28 17:03:22 +00:00
Tristan Van Berkom
1c7bddd57a man: Document ability to commit archives from stdin
Closes: #1862
Approved by: jlebon
2019-05-28 17:03:22 +00:00
Tristan Van Berkom
bebd8d6980 bin/commit: Support committing archives from stdin
This commit interprets archive filenames specified as '-' to
indicate that the input should be read from stdin.

Closes: #1862
Approved by: jlebon
2019-05-28 17:03:22 +00:00
Tristan Van Berkom
da4d0245af lib/commit: Added new ostree_repo_write_archive_to_mtree_from_fd()
Similar to ostree_repo_write_archive_to_mtree(), but takes
a file descriptor to read the archive from instead of mandating
a file path.

Usefull for importing archives into an OSTree repo over a socket
or from standard input in command line tools.

Closes: #1862
Approved by: jlebon
2019-05-28 17:03:22 +00:00
Robert Fairley
1c0933b40c ci: Split out installdeps.sh from build.sh
This script is useful to run individually when setting up a
development environment for OSTree.

Closes: #1865
Approved by: jlebon
2019-05-27 16:07:07 +00:00
Robert Fairley
4929fc38e9 lib/fetcher-util: Use GIOErrorEnum instead of GIOError
Use GIOErrorEnum as the return value for
_ostree_fetcher_http_status_code_to_io_error(), to avoid an
implicit cast from GIOError.

Closes: #1857
Approved by: cgwalters
2019-05-20 13:09:28 +00:00
Robert Fairley
e493505ade tests: Drop unused variable
Closes: #1857
Approved by: cgwalters
2019-05-20 13:09:28 +00:00
Felix Krull
2c1658538f lib: add parameter annotations for sysroot_load_if_changed
Closes: #1861
Approved by: cgwalters
2019-05-19 14:50:08 +00:00
Felix Krull
aa5df8995e lib: add some missing (out) annotations
Closes: #1861
Approved by: cgwalters
2019-05-19 14:50:08 +00:00
Felix Krull
0872708ea1 lib: fix up some nullability annotations
Closes: #1861
Approved by: cgwalters
2019-05-19 14:50:08 +00:00
Felix Krull
e607e79f4e lib: add minimum version to various symbols based on libostree-released.sym
Closes: #1861
Approved by: cgwalters
2019-05-19 14:50:08 +00:00
Felix Krull
4aeba118b0 lib: fix doc comment for ostree_repo_get_min_free_space_bytes
Closes: #1861
Approved by: cgwalters
2019-05-19 14:50:08 +00:00
Felix Krull
01c471a6f3 README: update link to ostree-rs
Closes: #1860
Approved by: jlebon
2019-05-17 16:27:16 +00:00
Richard Hughes
f31d779690 lib: mmap the summary to reduce RSS in clients
Closes: #1855

Closes: #1856
Approved by: cgwalters
2019-05-08 19:36:24 +00:00
Tristan Cacqueray
82eccad945 docs: fix missing as typo
This change fixes a typo in the adapting-existing doc.

Closes: #1850
Approved by: cgwalters
2019-05-06 13:29:48 +00:00
Tristan Cacqueray
27b7d468e6 prepare-root: remove ignored MS_MGC_VAL flag
Since Linux 2.4 this is no longer required and the flag is ignored.

Closes: #1851
Approved by: cgwalters
2019-05-05 20:53:17 +00:00
Tristan Cacqueray
b35f337dc7 docs: fix switchroot source link
This change updates the switchroot source relative url to an absolute url so
that it works from the readthedocs service. This change also removes
redundant switchroot.sh reference.

Closes: #1849
Approved by: cgwalters
2019-05-05 20:38:58 +00:00
Jonathan Lebon
3ca1035e98 Post-release version bump
Closes: #1844
Approved by: rfairley
2019-04-25 16:47:40 +00:00
Jonathan Lebon
80435e12a7 Release 2019.2
Also add `ostree_repo_get_bootloader` to the public API, which was
missed when it was initially merged.

Closes: #1844
Approved by: rfairley
2019-04-25 16:47:40 +00:00
Colin Walters
304abee9eb prepare-root: Fix compilation with --with-static-compiler
Closes: https://github.com/ostreedev/ostree/issues/1845

Closes: #1846
Approved by: akiernan
2019-04-25 13:00:40 +00:00
Jonathan Lebon
586cc2deee lib/deploy: Support locking deployment finalization
Teach `ostree-finalize-staged.service` to check for a file in `/run` to
determine if it should do the finalization. This will be used in
RPM-OSTree, where we want to be able to separate out "preparing updates"
from "making update the default" for more fine-grained control. See:
https://github.com/projectatomic/rpm-ostree/issues/1748

Closes: #1841
Approved by: cgwalters
2019-04-24 21:38:24 +00:00
Jonathan Lebon
405d9ef9e0 lib/deploy: Write to journal if nothing to finalize
This can happen if a deployment was staged and later cleaned up. Though
just as a helper when debugging issues, let's explicitly mention that
case.

Closes: #1841
Approved by: cgwalters
2019-04-24 21:38:24 +00:00
Jonathan Lebon
5464535205 lib: Add ot_journal_* helper macros
Rather than wrapping each instance of `sd_journal_*` with
`HAVE_SYSTEMD`, let's just add some convenience macros that are just
no-op if we're not compiling with systemd.

Closes: #1841
Approved by: cgwalters
2019-04-24 21:38:24 +00:00
Robert Fairley
d69214ade3 grub2: Generate config from pending deployment
Generate a grub2 config using the pending deployment, if a grub2
bootloader is detected in the sysroot. Allows grub2-mkconfig
to run if there are no previous deployments.

Fixes: #1774

Closes: #1831
Approved by: jlebon
2019-04-24 21:29:39 +00:00
Robert Fairley
42573eae59 tests/test-admin-deploy-none: Split grub.cfg directory and file creation
Split the creation of the directory containing grub.cfg, and the creation
of the file, so that a failure in the mkdir command will fail the test
and not attempt the touch command.

Closes: #1831
Approved by: jlebon
2019-04-24 21:29:39 +00:00