Commit Graph

4188 Commits

Author SHA1 Message Date
Jeremy Bicha
1ec4945c2d tests: Update for glib 2.59.2
glib 2.59.2 uses a non-breaking space instead of a space to
separate the quantity and unit in g_format_size() so update
our test to handle both a plain space and a non-breaking space.

See https://gitlab.gnome.org/GNOME/glib/issues/1625

Closes: #1818
Approved by: cgwalters
2019-02-11 13:26:32 +00:00
Matthew Leeds
f7a0ec9bf7 tests: Don't skip collection-based summary test
OSTree's P2P support used to be a compile time option but is now always
enabled. One of the tests was still checking for the old feature flag,
"experimental", which has been renamed to "p2p" and skipping for that
reason. Delete the check so the test always runs.

Closes: #1804
Approved by: pwithnall
2019-02-11 00:14:45 +00:00
Matthew Leeds
27d354da86 lib/repo: Fix Since: annotation for REMOTE_CHANGE_REPLACE
Closes: #1813
Approved by: jlebon
2019-02-08 21:57:13 +00:00
Dan Nicholson
b33a4e9b1e remote-add: Add --force option to add or replace remote
This uses the OSTREE_REPO_REMOTE_CHANGE_REPLACE operation to add a
remote or replace an existing one. This is roughly the opposite of
--if-not-exists and will raise an error if both options are passed.

Closes: #1166
Approved by: cgwalters
2019-02-08 14:36:41 +00:00
Dan Nicholson
8431bb5406 man: Document remote add --if-not-exists option
Closes: #1166
Approved by: cgwalters
2019-02-08 14:36:41 +00:00
Dan Nicholson
15ba2007a1 repo: Add OstreeRepoRemoteChange replace operation
Add the OSTREE_REPO_REMOTE_CHANGE_REPLACE operation to the
OstreeRepoRemoteChange enum. This operation will add a remote or replace
an existing one. It respects the location of the remote configuration
file when replacing and the remotes config dir settings when adding a
new remote.

Closes: #1166
Approved by: cgwalters
2019-02-08 14:36:41 +00:00
Matthew Leeds
6e935ee26f lib/repo-pull: Fix docs for n-network-retries option
Add "Since: 2018.6" and copy the docs to
ostree_repo_pull_from_remotes_async() which also supports it.

Closes: #1812
Approved by: jlebon
2019-02-07 14:36:08 +00:00
Colin Walters
6649032a37 lib/commit: Don't set user.ostreemeta for bare → bare-user-only imports
The point of `bare-user-only` is it doesn't have xattrs; it's a
special case in import handling.

Closes: #1803
Approved by: jlebon
2019-01-16 14:37:15 +00:00
Colin Walters
c63ee3cef4 lib/commit: Set xattr on correct fd for bare-user → bare-user imports
Another fix to https://github.com/ostreedev/ostree/pull/1771

Closes: #1803
Approved by: jlebon
2019-01-16 14:37:15 +00:00
Colin Walters
c79d792fd5 lib/commit: Fix bare → bare imports
Regression from https://github.com/ostreedev/ostree/pull/1771

This broke rpmostreepayload in Anaconda where we import a bare repo:
https://openqa.fedoraproject.org/tests/345339#step/_do_install_and_reboot/4

Reported-by: Adam Williamson <adamwill@fedoraproject.org>

Closes: #1803
Approved by: jlebon
2019-01-16 14:37:15 +00:00
Micah Abbott
620a3138ae README: add note about Liri OS
Closes: #1802
Approved by: rfairley
2019-01-15 17:41:34 +00:00
Colin Walters
40a54e3d27 Post-release bump
Closes: #1800
Approved by: jlebon
2019-01-11 15:49:45 +00:00
Colin Walters
13bcc49603 Release 2019.1
Closes: #1800
Approved by: jlebon
2019-01-11 15:49:45 +00:00
Colin Walters
308d30d080 pull: If built with --disable-http2, allow enabling via http2=1
We have a `http2=[0|1]` remote config option; let's have the
`--disable-http2` build option define the default for that.  This way
it's easy to still enable http2 for testing even if
we have it disabled by default.

Closes: #1798
Approved by: jlebon
2019-01-09 15:04:27 +00:00
Colin Walters
fa35ec38b7 fixup! admin/status: test GPG signature check 2019-01-08 15:24:10 +00:00
Rafael Fonseca
6e8377cbd1 admin/status: test GPG signature check
Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>

Closes: #1797
Approved by: cgwalters
2019-01-08 14:47:08 +00:00
Sinny Kumari
cd9138d9a0 atomic-upgrades doc: fix example url to fetch a ref checksum
Signed-off-by: Sinny Kumari <sinny@redhat.com>

Closes: #1795
Approved by: cgwalters
2019-01-02 14:26:03 +00:00
Ricardo Salveti
b6795c93ea grub2: add support for devicetree
Similar as available for u-boot (ce2995e1dc)
and syslinux (c5112c25e4), enable parsing
and writing devicetree filename into grub.cfg.

This is required by arm64-based devices running edk2 instead of u-boot
as the main bootloader (e.g. 96boards HiKey and HiKey960).

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>

Closes: #1790
Approved by: cgwalters
2018-12-21 14:00:42 +00:00
Matthias Clasen
ee988f69aa Fix a small leak in ostree_repo_remote_list_collection_refs
g_variant_iter_loop would free the value for us,
but not if we're returning from the middle of the
loop body.

Closes: #1788
Approved by: cgwalters
2018-12-20 18:10:16 +00:00
Matthias Clasen
f0719681f9 Fix a small leak in ostree_repo_pull_with_options
Spotted in a flatpak valgrind log.

Closes: #1788
Approved by: cgwalters
2018-12-20 18:10:16 +00:00
Jonathan Lebon
c62232c09d boot/grub2: Add some more explanation in ostree-grub-generator
Even with the previous docstring, I didn't understand at first the
relationship between the `ostree-grub-generator` script and
`ostree-bootloader-grub2.c`. Throw some more docs to clarify things a
bit.

Closes: #1791
Approved by: cgwalters
2018-12-20 18:09:36 +00:00
Rafael Fonseca
f2d4537ffb admin/status: Correctly check GPG signature
Closes: #1770

Closes: #1787
Approved by: jlebon
2018-12-14 15:23:53 +00:00
Umang Jain
c25b1c7063 man/ostree.repo-config: Update min-free-space-* docs
Docs should reflect the changes done in PR:
https://github.com/ostreedev/ostree/pull/1779

Closes: #1786
Approved by: jlebon
2018-12-12 14:25:16 +00:00
Umang Jain
963395217a lib/repo-commit: Relax min-free-space check in prepare_transaction()
We want a case where we can disable the min-free-space check. Initially,
it felt like to add a OSTREE_REPO_PULL_FLAGS_DISABLE_FREE_SPACE_CHECK but
the problem is prepare_transaction() does not have a OstreeRepoPullFlags
parameter which we can parse right here. On top of it, prepare_transaction()
enforces min-free-space check and won't let the transaction proceed if
the check failed.

This is pretty bad in conjunction with "inherit-transaction" as what
Flatpak uses. There is no way to disable this check unless we remove
it altogether from prepare_transaction.

This issue came out to light when flatpak wasn't able to write metadata
after fetching from remote:

[uajain@localhost ~]$ flatpak remote-info flathub org.kde.Platform//5.9
error: min-free-space-size 500MB would be exceeded

Metadata objects helps in housekeeping and restricting them means
restricting crucial UX (like search, new updates) functionalities
in clients like gnome-software. The error banners originated from
these issues are also abrupt and not much helpful to the user. This
is the specific instance of the issue this patches tries to address.

See https://github.com/flatpak/flatpak/issues/2139 for discussion.

Closes: #1779
Approved by: mwleeds
2018-12-10 20:04:17 +00:00
Luca Bruno
3ecbdd8197 lib/kargs: allow empty-list arguments
This adds support for empty-list arguments (e.g. `acpi_osi=`), which
are semantically different from simple-keyword arguments.

Ref: https://github.com/projectatomic/rpm-ostree/issues/1706

Closes: #1785
Approved by: cgwalters
2018-12-10 19:39:23 +00:00
Alexander Larsson
d044bfeb30 Fix leak in ostree_content_stream_parse()
We need to ref_sink new GVariants for autoptr to work

Closes: #1784
Approved by: cgwalters
2018-12-10 14:12:24 +00:00
Colin Walters
416007e766 ci/papr: Drop insttests
This didn't quite work out, and is now always failing because Ansible
changed.

For now we have some OK coverage via the rpm-ostree suite, let's just
drop this and revisit later.

Closes: #1783
Approved by: jlebon
2018-12-10 14:01:47 +00:00
Jonathan Lebon
30d79517ae bin/pull: Add URL metavar for --url switch
Otherwise it's not obvious that it takes an argument.

Closes: #1782
Approved by: cgwalters
2018-12-07 21:48:10 +00:00
Colin Walters
cc2659e957 Update libglnx
To pick up https://gitlab.gnome.org/GNOME/libglnx/merge_requests/4

Update submodule: libglnx

Closes: #1781
Approved by: jlebon
2018-12-07 15:13:31 +00:00
Colin Walters
dc2a7de217 lib/commit: Try checksum+hardlink for untrusted local same-uid repos
This mainly helps flatpak for enabling a hardlink-able local pull
during deploy in the --system case.  We assume the files are immutable
when owned by the same uid.

See https://github.com/ostreedev/ostree/issues/1723
and https://github.com/flatpak/flatpak/pull/2342

Closes: #1776
Approved by: uajain
2018-12-04 20:38:41 +00:00
Matthew Leeds
c515c69d48 lib/repo: Clarify docs for importing w/ trust
The way _ostree_repo_import_object() is written, a hardlink copy is only
attempted if the source repo is trusted, so update the docs for
ostree_repo_import_object_from_with_trust() to reflect that.

Closes: #1777
Approved by: cgwalters
2018-12-04 01:01:08 +00:00
rfairley
05e8c7ef6a lib/repo: Search a list of paths in gpgkeypath for gpg keys
This allows specifying gpgpath as list of
paths that can point to a file or a directory. If a directory path
is given, paths to all regular files in the directory are added
to the remote as gpg ascii keys. If the path is not a directory,
the file is directly added (whether regular file, empty - errors
will be reported later when verifying gpg keys e.g. when pulling).

Adding the gpgkeypath property looks like:

ostree --repo=repo remote add --set=gpgpath="/path/key1.asc,/path/keys.d" R1 https://example.com/some/remote/ostree/repo

Closes #773

Closes: #1773
Approved by: cgwalters
2018-11-21 17:03:10 +00:00
Jonathan Lebon
244d9a7ec1 lib/commit: Copy user.ostreemeta only for bare-user
When falling back to copying objects when importing them into a
bare-user repo, we only actually need to transfer over the
`user.ostreemeta` xattr.

This allows the destination repo to be on a separate filesystem that
might not even support `security.selinux`. (I hit this while importing
over virtio-9p).

Closes: #1771
Approved by: cgwalters
2018-11-13 15:15:13 +00:00
Jonathan Lebon
8eac5be030 lib/commit: Add devino_cache_hits to txn stats
I found this useful while hacking on rpm-ostree but I think it might be
useful enough to upstream. This stat is really helpful for validating
that a pipeline is hitting the devino cache sweet spot.

Closes: #1772
Approved by: cgwalters
2018-11-05 14:08:54 +00:00
Jonathan Lebon
1dcebe8846 bin/pull-local: Add --commit-metadata-only
It might be "local", but e.g. we may be crossing filesystems. So there
are valid use cases for only wanting to pull the commit metadata with
`pull-local`.

Closes: #1769
Approved by: cgwalters
2018-11-01 14:51:09 +00:00
Jonathan Lebon
34a8867749 bin/refs: Disallow creating broken aliases
This is the alias version of #1749. I.e. we want to make sure that one
can't even create an alias which would end up dangling.

See also: https://pagure.io/releng/issue/7891

Closes: #1768
Approved by: sinnykumari
2018-10-31 12:32:30 +00:00
Giuseppe Scrivano
51752baf0e checkout: honor opaque checkouts
if a file ".wh..wh..opq" is present in a directory, delete anything
from lower layers that is already in that directory.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1486
Approved by: cgwalters
2018-10-26 18:26:51 +00:00
Colin Walters
04da47a5fb ci: Add dist-then-build target to catch missing EXTRA_DIST
I personally am very opposed to the entire idea of `make distcheck`;
I think source code should canonically be *git* and not tarballs.
See e.g. https://github.com/cgwalters/git-evtag for some
rationale.

But anyways we are uploading classic tarballs since today that
what Debian/Fedora/etc consume sadly, so we need to test it.

We explicitly skip `make distcheck` since we don't want to rerun
the test suite.

Closes: #1766
Approved by: jlebon
2018-10-25 16:24:10 +00:00
Colin Walters
62594765b2 build-sys: Dist ostree-finalize-staged.path
Otherwise the tarball doesn't work.

Closes: #1766
Approved by: jlebon
2018-10-25 16:24:10 +00:00
Jonathan Lebon
759b099861 ostree/main: Wrap Version in --version in quotes
Wrap the `Version` key in the YAML-compatible output of
`ostree --version` with quotes so that it's parsed as a string. The
issues with the previous approach in a nutshell:

```
In [5]: yaml.load("asdf: 2018.10")
Out[5]: {'asdf': 2018.1}
```

It's treating the version number as a floating-point. Now, this is
technically a backwards incompatible change, but given that the previous
approach is inherently broken for our needs, I don't see a way around
breaking it now.

Closes: #1761
Approved by: cgwalters
2018-10-24 18:46:39 +00:00
Umang Jain
e4e3e087ee Post-release version bump
Closes: #1761
Approved by: cgwalters
2018-10-24 18:46:39 +00:00
Umang Jain
f3eba6bcec Release 2018.9
Closes: #1761
Approved by: cgwalters
2018-10-24 18:46:39 +00:00
Matthew Leeds
ed41822b45 Rename core.repo-finders to core.default-repo-finders
This renames a config key to make its semantics more obvious. Despite
what the commit message says, it only applies when a set of repo finders
is not specified (either on the command line or in a library API call).
This also renames the corresponding ostree_repo_get function. We can do
this since it hasn't been released yet.

Closes: #1763
Approved by: pwithnall
2018-10-23 14:26:50 +00:00
Matthew Leeds
3fc46f37f7 lib/repo-pull: Add an explanatory comment
Closes: #1763
Approved by: pwithnall
2018-10-23 14:26:50 +00:00
Colin Walters
c9a9e6c381 README: Add bindings section
Since rust-libostree now exists too, let's make sure people
know about it.

Closes: #1762
Approved by: jlebon
2018-10-23 13:29:27 +00:00
Jonathan Lebon
ac1a919ffd boot: Add ostree-finalize-staged.path
Rather than manually starting the `ostree-finalize-staged.service` unit,
we can leverage systemd's path units for this. It fits quite nicely too,
given that we already have a path we drop iif we have a staged
deployment.

To give some time for the preset to make it to systems, we don't yet
drop the explicit call to `systemctl start`. Though we do make it
conditional based on a DEBUG env var so that we can actually test it in
CI for now. Once we're sure this has propagated, we can drop the
`systemctl start` path and the env var together.

Closes: #1740
Approved by: cgwalters
2018-10-23 13:10:49 +00:00
Colin Walters
1e16aec357 remount: Refactor to helper function instead of loop
Prep for further work.  It was silly to use a loop on
a static array of two elements.

Closes: #1760
Approved by: jlebon
2018-10-22 18:53:27 +00:00
Matthew Leeds
1d6347fe97 lib/repo-pull: Disable LAN updates by default
This commit disables searching on the local network for refs, unless
explicitly requested by the user either by changing the value of the
"core.repo-finders" config option, or by passing an OstreeRepoFinderAvahi to
ostree_repo_find_remotes_async() / ostree_repo_finder_resolve_async(),
or by specifying "lan" in the --finders option of the find-remotes
command.

The primary reason for this is that ostree_repo_find_remotes_async()
takes about 40% longer to complete with the LAN finder enabled, and that
API is used widely (e.g. in every flatpak operation). It's also probable
that some users don't want ostree doing potentially unexpected traffic
on the local network, even though everything pulled from a peer is GPG
verified.

Flathub will soon deploy collection IDs to everyone[1] so these code
paths will soon see a lot more use and that's why this change is being
made now.

Endless is the only potential user of the LAN updates feature, and we
can revert this patch on our fork of ostree. For it to be used outside
Endless OS we will need to upstream eos-updater-avahi and
eos-update-server into ostree.

[1] https://github.com/flathub/flathub/issues/676

Closes: #1758
Approved by: cgwalters
2018-10-21 19:11:43 +00:00
Matthew Leeds
3956fc885b Allow disabling pulling from LAN/USB/Internet
Currently libostree essentially has two modes when it's pulling refs:
the "legacy" code paths pull only from the Internet, and the code paths
that are aware of collection IDs try to pull from the Internet, the
local network, and mounted filesystems (such as USB drives). The problem
is that while we eventually want to migrate everyone to using collection
IDs, we don't want to force checking LAN and USB sources if the user
just wants to pull from the Internet, since the LAN/USB code paths can
have privacy[1], security[2], and performance[3] implications.

So this commit implements a new repo config option called "repo-finders"
which can be configured to, for example, "config;lan;mount;" to check
all three sources or "config;mount;" to disable searching the LAN. The
set of values mirror those used for the --finders option of the
find-remotes command. This configuration affects pulls in three places:
1. the ostree_repo_find_remotes_async() API, regardless of whether or
not the user of the API provided a list of OstreeRepoFinders
2. the ostree_repo_finder_resolve_async() /
ostree_repo_finder_resolve_all_async() API
3. the find-remotes command

This feature is especially important right now since we soon want to
have Flathub publish a metadata key which will have Flatpak clients
update the remote config to add a collection ID.[4]

This effectively fixes https://github.com/flatpak/flatpak/issues/1863
but I'll patch Flatpak too, so it doesn't pass finders to libostree only
to then have them be removed.

[1] https://github.com/flatpak/flatpak/issues/1863#issuecomment-404128824
[2] https://github.com/ostreedev/ostree/issues/1527
[3] Based on how long the "ostree find-remotes" command takes to
  complete, having the LAN finder enabled slows down that step of the
  pull process by about 40%. See also
  https://github.com/flatpak/flatpak/issues/1862
[4] https://github.com/flathub/flathub/issues/676

Closes: #1758
Approved by: cgwalters
2018-10-21 19:11:43 +00:00
Jonathan Lebon
a4a49724d6 ostree-prepare-root.service: Run earlier in initrd
Previously, we were preparing the root very late in the boot process;
right before we switch root. The issue with that is that most services
in the initrd that run `After=initrd-root-fs.target` expect that
`/sysroot` already points to the rootfs we'll be pivoting to. Running
this late violates that assumption.

This patch fixes this by making `ostree-prepare-root.service` instead
run right after `sysroot.mount` (the physical sysroot mounted by
systemd) but still before `initrd-root-fs.target` (which is the target
signalling that `/sysroot` is now valid and ready).

This should make it easier to integrate OSTree with other initrd
services such as Ignition.

Related: https://github.com/dustymabe/ignition-dracut/issues/20

Closes: #1759
Approved by: cgwalters
2018-10-19 15:41:10 +00:00