summaryrefslogtreecommitdiff
path: root/src/ostree
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Run clang-formatColin Walters2023-05-0275-2986/+2757
| | | | | This is a one-time tree wide reformatting to ensure consistency going forward.
* tree-wide: Fix various include ordering issuesColin Walters2023-05-015-4/+4
| | | | This fixes the build with `clang-format`.
* fetcher: add libsoup3 backendDaniel Kolesa2023-04-122-62/+168
| | | | | The default is still soup2, you can use --with-soup3 to enable the soup3 backend instead.
* Merge pull request #1946 from dbnicholson/ostree-metadata-apiColin Walters2023-02-0919-183/+71
|\ | | | | ostree-metadata commit API
| * repo: Create metadata commit in ostree_repo_regenerate_metadataDan Nicholson2023-02-071-101/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Rather than creating the `ostree-metadata` commit in the summary builtin, do it in the new `ostree_repo_regenerate_metadata` API. The commit contents are unchanged and the commit is generated before the summary as before. To keep from triggering an extra summary update, automatic summary updating is disabled in the transaction. Since the summary builtin was already using the new API, it will continue to generate the `ostree-metadata` commit when the repo has a collection ID. However, the `ostree_repo_regenerate_summary` API will still only generate the summary file as before.
| * bin/summary: Use ostree_repo_regenerate_metadataDan Nicholson2023-02-071-38/+27
| | | | | | | | | | | | | | | | | | Call `ostree_repo_regenerate_metadata` with the provided GPG and sign keys to generate and sign the summary in one call. This changes the handling when GPGME support is disabled but GPG keys are supplied. Instead of silently ignoring the option, it will now error. IMO that's better as callers would otherwise not know that the summary is not GPG signed.
| * Strip trailing whitespace on all C filesDan Nicholson2023-02-0718-46/+46
| | | | | | | | | | | | | | | | My editor started following the configuration in .editorconfig and is applying this rule to many files I'm editing. Let's just get this over with and strip everything. This was done like so: git ls-files | grep '\.[ch]$' | xargs sed -ri 's/\s+$//'
* | Merge pull request #2811 from dbnicholson/cli-polishColin Walters2023-02-097-50/+286
|\ \ | | | | | | Various CLI improvements
| * | bin/remote-summary: Add options to show metadataDan Nicholson2023-02-071-31/+47
| | |
| * | bin/summary: Add options to show metadataDan Nicholson2023-02-071-5/+44
| | |
| * | ostree/dump: Add support for summary metadata keysDan Nicholson2023-02-072-0/+66
| | | | | | | | | | | | | | | Like with commit metadata, it's useful to list and print metadata keys are in a summary file. This adds helpers to do that.
| * | bin/show: Add options to list metadata keysDan Nicholson2023-02-071-6/+71
| | | | | | | | | | | | | | | While `--print-metadata-key` is very useful, it's not that helpful if you don't know what the keys are.
| * | bin/remote-refs: Add option to print revisionsDan Nicholson2023-02-071-1/+13
| | | | | | | | | | | | | | | | | | | | | The only other way to get the remote ref revision from the CLI is to scrape the output of `ostree remote summary` or pull the commit. The revision is already there in the summary's ref map, so might as well add an option to show it.
| * | bin/refs: Add option to print revisionsDan Nicholson2023-02-071-1/+17
| | | | | | | | | | | | | | | | | | Allow printing the revision along with the ref. This is very convenient for looping over the refs in a shell as well as for quickly seeing which refs are pointed to the same commit.
| * | bin/refs: Sort listingDan Nicholson2023-02-071-6/+28
| |/ | | | | | | | | The output is much more readable sorted. I can't think of any reason you'd want it unsorted (which is essentially dentry order).
* | ostree/prune: Calculate reachability under exclusive lockJonathan Lebon2023-01-301-0/+9
|/ | | | | | | | | | | | | | | | | | | When we calculate the reachability set in `ostree prune`, we do this without any locking. This means that between the time we build the set and when we call `ostree_repo_prune_from_reachable`, new content might've been added. This then causes us to immediately prune that content since it's not in the now outdated set. Fix this by calculating the set under an exclusive lock. I think this is what happened in https://github.com/fedora-silverblue/issue-tracker/issues/405. While the pruner was running, the `new-updates-sync` script[1] was importing content into the repo. The newly imported commits were immediately deleted by the many `ostree prune --commit-only` calls the pruner does, breaking the refs. [1] https://pagure.io/fedora-infra/ansible/blob/35b35127e444/f/roles/bodhi2/backend/files/new-updates-sync#_18
* sysroot: Add an API to initialize with mountnsColin Walters2022-11-221-17/+3
| | | | | | | | | | | | | This lowers down into the C library some logic we have in the binary/app logic, in prep for having more Rust-native CLI code in https://github.com/ostreedev/ostree-rs-ext/pull/412 Basically we want to *ensure* a mount namespace by invoking `unshare()` if necessary, instead of requiring our callers to do this dance. This also helps fix e.g. Closes: https://github.com/ostreedev/ostree/issues/2769
* ot-builtin-pull: Fix a minor leak with progress reportingPhilip Withnall2022-11-212-2/+2
| | | | | | `ostree_async_progress_get_status()` returns an allocated string. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* ot-builtin-commit: Don’t mention a C function name in a help stringPhilip Withnall2022-11-181-1/+1
| | | | | | | Instead mention the formal name of the format accepted by `g_variant_parse()`. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* ot-builtin-commit: Fix a typo in a command line help stringPhilip Withnall2022-11-181-1/+1
| | | | Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* Support overlayfs whiteouts on checkoutMiguel Angel Ajo2022-09-281-1/+6
| | | | | | | | | | | | Introduces an intermediate format for overlayfs storage, where .wh-ostree. prefixed files will be converted into char 0:0 whiteout devices used by overlayfs to mark deletions across layers. The CI scripts now uses a volume for the scratch directories previously in /var/tmp otherwise we cannot create whiteout devices into an overlayfs mounted filesystem. Related-Issue: #2712
* finalize-staged: Don't listen to `SIGTERM`, just let kernel exit usColin Walters2022-08-301-17/+3
| | | | | | | | | Followup from discussion in https://github.com/ostreedev/ostree/pull/2544#discussion_r958840936 This is more efficient; no need to have the kernel context switch us in at shutdown time just so we can turn around and call `exit()`.
* finalize-staged: Ensure /boot automount doesn't expireDan Nicholson2022-08-301-5/+63
| | | | | | | | | | | | | | | | | | | If `/boot` is an automount, then the unit will be stopped as soon as the automount expires. That's would defeat the purpose of using systemd to delay finalizing the deployment until shutdown. This is not uncommon as `systemd-gpt-auto-generator` will create an automount unit for `/boot` when it's the EFI System Partition and there's no fstab entry. To ensure that systemd doesn't stop the service early when the `/boot` automount expires, introduce a new unit that holds `/boot` open until it's sent `SIGTERM`. This uses a new `--hold` option for `finalize-staged` that loads but doesn't lock the sysroot. A separate unit is used since we want the process to remain active throughout the finalization run in `ExecStop`. That wouldn't work if it was specified in `ExecStart` in the same unit since it would be killed before the `ExecStop` action was run. Fixes: #2543
* main: Factor out sysroot loadingDan Nicholson2022-08-302-34/+55
| | | | | | | It can be useful to parse the options and initialize the sysroot without actually loading it until later. Factor out the sysroot loading to a new `ostree_admin_sysroot_load` and add a new `OSTREE_ADMIN_BUILTIN_FLAG_NO_LOAD` flag to accommodate this.
* cli/rev-parse: Add `--single` optionColin Walters2022-08-181-0/+36
| | | | | | | | | | | | In the current "ostree native container" flow, we're inserting a commit object into the repo but with no refs. We have hacks in a few places to find the commit digest via e.g. `find repo/objects -name *.commit` but that's a horrible hack. Add `ostree rev-parse --single` which will print the single commit, and error out if there is not exactly one commit. Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
* cli/rev-parse: Port to new code styleColin Walters2022-08-161-18/+8
| | | | Prep for future changes.
* Remove unused `linux/fs.h` includesColin Walters2022-08-031-1/+0
| | | | | Prep for fixing conflicts introduced by newer glibc. cc https://github.com/ostreedev/ostree/issues/2685
* Fix `ostree admin kargs edit-in-place` fails issueHuijing Hei2022-07-121-4/+3
| | | | | | Add func to set kernel arguments in place, instead of create new deployment Fix https://github.com/ostreedev/ostree/issues/2664
* RFE: Add a hidden option to `ostree admin kargs edit-in-place` toHuijing Hei2022-06-235-0/+253
| | | | | | | | | | | update all existing deployments in place Example: $ sudo ostree admin kargs edit-in-place --append-if-missing=rw See https://github.com/ostreedev/ostree/issues/2617 This will not add duplicate key, if there is `TESTARG=VAL1` in the kernel arguments, `--append-if-missing=TESTARG=VAL2` will be ignored.
* cli/refs: Port to C99 styleColin Walters2022-06-151-15/+9
| | | | General background cleanup.
* cli/remote-list: Port to C99 styleColin Walters2022-06-151-17/+10
| | | | General background cleanup.
* cli/gpg-sign: Port to C99 styleColin Walters2022-06-151-29/+19
| | | | General background cleanup.
* Merge pull request #2650 from cgwalters/misc-declare-and-initialize-1Jonathan Lebon2022-06-142-49/+35
|\
| * cli/diff: Port to C99 styleColin Walters2022-06-141-36/+26
| | | | | | | | General background cleanup.
| * cli/config: Port to C99 styleColin Walters2022-06-141-13/+9
| | | | | | | | General background cleanup.
* | cli/unlock: Port to C99 styleColin Walters2022-06-141-18/+11
| | | | | | | | General background cleanup.
* | cli/undeploy: Port to C99 styleColin Walters2022-06-141-12/+7
| | | | | | | | General background cleanup.
* | cli/os-init: Port to C99 styleColin Walters2022-06-141-14/+8
|/ | | | | General background cleanup; motivated by a recent PR which was using pre-C99 code as a base.
* fsck: Use `load_variant_if_exists`Colin Walters2022-06-121-15/+5
| | | | This cleans up error handling here.
* fsck: Move most commit processing into helper functionColin Walters2022-06-121-85/+98
| | | | | The inner loop was way too long; split out most of the heavy lifting around backrefs and tombstones into a helper function.
* fsck: De-indent loopColin Walters2022-06-121-90/+80
| | | | | Could have done this in the previous change, but wanted to avoid excessive diff noise.
* fsck: Don't load all object names into memoryColin Walters2022-06-091-10/+11
| | | | | | | We recently discovered `list_objects()` is inefficient with memory. The more efficient `list_objects_set()` API isn't yet public, but this fsck code actually just skips over non-commit objects, and we already have an API to list just those.
* Rename ostree-cmdprivate to drop out of introspectionColin Walters2022-06-025-5/+5
| | | | | | I was looking at our `.gir` and noticed we had the cmdprivate bits because the pattern for excluding headers is `-private.h`, which didn't match `cmdprivate.h`.
* Remove dup "--os=OSNAME" line in output of "ostree admin config-diff --help"Huijing Hei2022-05-251-1/+0
| | | | Small fix for https://github.com/ostreedev/ostree/issues/2594
* Fix GNU style of two spaces for indent in ↵Huijing Hei2022-05-251-12/+12
| | | | https://github.com/ostreedev/ostree/pull/2612
* Teach --karg-delete option to ostree admin deployHuijing Hei2022-05-191-1/+21
| | | | See https://github.com/ostreedev/ostree/issues/2586
* Add an `ostree-boot-complete.service` to propagate staging failuresColin Walters2022-04-263-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quite a while ago we added staged deployments, which solved a bunch of issues around the `/etc` merge. However...a persistent problem since then is that any failures in that process that happened in the *previous* boot are not very visible. We ship custom code in `rpm-ostree status` to query the previous journal. But that has a few problems - one is that on systems that have been up a while, that failure message may even get rotated out. And second, some systems may not even have a persistent journal at all. A general thing we do in e.g. Fedora CoreOS testing is to check for systemd unit failures. We do that both in our automated tests, and we even ship code that displays them on ssh logins. And beyond that obviously a lot of other projects do the same; it's easy via `systemctl --failed`. So to make failures more visible, change our `ostree-finalize-staged.service` to have an internal wrapper around the process that "catches" any errors, and copies the error message into a file in `/boot/ostree`. Then, a new `ostree-boot-complete.service` looks for this file on startup and re-emits the error message, and fails. It also deletes the file. The rationale is to avoid *continually* warning. For example we need to handle the case when an upgrade process creates a new staged deployment. Now, we could change the ostree core code to delete the warning file when that happens instead, but this is trying to be a conservative change. This should make failures here much more visible as is.
* glib: bump glib requirement to 2.66 and port to GUriDaniel Kolesa2022-03-122-2/+4
| | | | | This removes the old SoupURI copypasta from previous generation of libsoup and opens up a path for a simple libsoup3 port.
* src/ostree: Add --commit-only option to ostree pruneSaqib Ali2022-02-251-7/+21
| | | | | | | | | | | | Recently we have noticed exceedingly long execution times for multiple invocations of ostree prune. This is a result of calculating full reachability on each invocation. The --commit-only flag provides an alternative strategy. It will only traverse and delete commit objects to avoid the more expensive reachability calculations. This allows us to chain multiple --commit-only commands cheaply, and then follow with a more expensive ostree prune invocation at the end to clean up orphaned meta and content objects.
* lib/repo: Add commit version metadata to summary metadataDan Nicholson2022-02-041-0/+5
| | | | | | | | The commit metadata `version` key is well established but getting it for a remote commit is cumbersome since the commit object needs to be fetched and loaded. Including it in the summary additional metadata allows a much more convenient view of what each of the remote refs represents.