Commit Graph

1716 Commits

Author SHA1 Message Date
James Antill 52c0d89a8c admin: Add ot_admin_checksum_version to get a dup of the version for a commit 2014-10-23 10:21:17 -04:00
Giuseppe Scrivano 49de180191 corrupt-repo-ref.js: more aggressive file corruption
changing only a byte may not generate a corrupted file, so play very
safe and change 10 bytes.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-22 20:02:06 +02:00
Giuseppe Scrivano 0785c398b0 fsck: report the correct error when a present file cannot be loaded
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-22 18:06:29 +02:00
Giuseppe Scrivano c4b7717076 tests: test-admin-deploy-switch doesn't use deprecated "current" symlink
commit dfeb27eca5 removed it, so change
the test to not use it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-21 16:18:30 -04:00
Giuseppe Scrivano 22a82341b1 tests: fix --help test
Check for "Usage" only in the root command, builtins may not output
it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-21 16:18:30 -04:00
Giuseppe Scrivano 26bdfae5bc make ostree_cmd__private__ ret value const 2014-10-21 16:18:30 -04:00
Colin Walters 5fb8bb955e repo: When writing to a non-root owned repo, chown() objects to match
Some package systems need to be run as root, so the process linking to
libostree may also be root.  However, it's reasonable to have the
target repository be owned by a uid other than root.

This patch makes it Just Work by chowning the file content to match.

Note this only operates on archive-z2 repositories, because you can't
usefully serve bare repositories via HTTP.

https://bugzilla.gnome.org/show_bug.cgi?id=738954
2014-10-21 15:43:43 -04:00
Matthew Barnes a4d904ee38 build: Include SELinux cflags with libostree build too
This is likely another issue with newer automake.

https://bugzilla.gnome.org/738875
2014-10-20 15:23:55 -04:00
Colin Walters cdfcf09316 Add "ostree remote delete" and corresponding API
For Anaconda, we have an ugly bootstrapping problem where we need to
add the remote to the repository's config, then do a pull+deploy, then
remove and re-add the config, because /etc/ostree/remotes.d doesn't
exist yet in the target system.

https://bugzilla.gnome.org/show_bug.cgi?id=738698
2014-10-17 19:09:42 -04:00
Colin Walters 49540f076f Release 2014.8 2014-10-16 16:54:55 -04:00
Colin Walters 884a9b27e9 repo: Disable uncompressed object cache on non-writable repos
While we did support disabling the uncompressed-objects-cache
per-repository:

1) We didn't actually respect that operation when doing
   CHECKOUT_MODE_USER on archive-z2 repositories
2) It'd be better to automatically detect we can't write to the
   repo and disable the uncompressed cache then.
2014-10-16 14:54:34 -04:00
Colin Walters d546abfa2a libostree: Add initial GRUB2 support
In this approach, we drop a /etc/grub.d/15_ostree file which is a
hybrid of shell/C that picks up bits from the GRUB2 library (e.g. the
block device script generation), and then calls into libostree's
GRUB2 code which knows about the BLS entries.

This is admittedly ugly.  There exists another approach for GRUB2 to
learn the BLS specification.  However, the spec has a few issues:

https://www.redhat.com/archives/anaconda-devel-list/2014-July/msg00002.html

This approach also gives a bit more control to the admin via the
naming of the 15_ostree symlink; they can easily disable it:

Or reorder the ostree entries ahead of 10_linux:

Also, this approach doesn't require patches for grub2, which is an
issue with the pressure to backport (rpm-)OSTree to EL7.
2014-10-16 14:15:00 -04:00
Giuseppe Scrivano 92c5a9f992 http: set the HTTP status on directory listing
Fix a HTTP response header like the following:

HTTP/1.1 0 (null)
Server: ostree-httpd libsoup/2.48.0
Date: Tue, 07 Oct 2014 11:19:22 GMT
Content-Type: text/html
Content-Length: 12533

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-07 13:19:36 +02:00
Giuseppe Scrivano 7b0e70b72f tests: do not leave running httpd after tests exit
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-07 12:05:59 +02:00
Colin Walters 5dba2442a1 trivial-httpd: Another followup fix - need to listen on all interfaces
This was the intended design, but it regressed when updating.
2014-10-06 17:43:02 -04:00
Giuseppe Scrivano 68b37dc001 libostree: fix a gobject-introspection warning
src/libostree/ostree-repo.c:1759: Warning: OSTree:
  ostree_repo_import_object_from: unknown parameter 'checksum' in
  documentation comment, should be 'sha256'

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-06 19:03:34 +02:00
Colin Walters 5451a4e309 Release 2014.7 2014-10-03 19:10:13 -04:00
Colin Walters 1dceb99056 Add missing file from previous commit 2014-10-03 14:38:30 -04:00
Colin Walters b3ad113f78 Add "unconfigured-state" concept to origin files
Some operating systems may come with external tools for subscription
management that drive access to the content.  In that case, the origin
file may not be useful (for example, it could refer to an installer
ISO).

This patch will allow OS installers to inject that state, with a
useful error message, directing the system administrator to an
external tool.

See: https://github.com/projectatomic/rpm-ostree/issues/31

https://bugzilla.gnome.org/show_bug.cgi?id=737686
2014-10-03 14:03:55 -04:00
Colin Walters 63abc1b513 pull: Support full recursive mirrors of repositories with summary file
Now that we have a summary file, we can use it to allow a simple:

ostree pull --mirror

To download the latest commit on every branch.  Also, for a case I'm
dealing with there's only one branch, but I don't want mirror users to
have to hardcode it.

https://bugzilla.gnome.org/show_bug.cgi?id=737807
2014-10-03 13:56:40 -04:00
Colin Walters 7ab1fb2369 Add API to directly link() objects between repositories
And use it in pull-local.  As one might expect, this is blazingly fast
if they're on the same filesystem.

I'll be using this to "promote" builds between different repositories.
2014-10-01 23:20:35 -04:00
Colin Walters 1b8759a67e upgrader: Hold a ref to the origin
We unref it in _finalize, so we need to hold a ref.  I *thought*
this was the source of
https://github.com/projectatomic/rpm-ostree/issues/30

But apparently not =/
2014-09-30 11:02:14 -04:00
Owen W. Taylor cc180f5d38 Test 'ostree admin --print-current-dir'
Add a test for the --print-current-dir option

https://bugzilla.gnome.org/show_bug.cgi?id=731051
2014-09-26 11:55:11 -04:00
Owen W. Taylor c3f8019c19 Add test case for 'admin instutil set-kargs'
Test out the newly added options to 'instutil set-kargs' along with
the existing functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=731051
2014-09-26 11:55:11 -04:00
Owen W. Taylor d64d003af0 ostree admin: Add a --print-current-dir option
Add an option --print-current-dir that prints the current deployment
directory to stdout and exits.

https://bugzilla.gnome.org/show_bug.cgi?id=731051
2014-09-26 10:40:38 -04:00
Owen W. Taylor 262cba09c0 ostree admin instutil set-kargs: make more flexible
Add command line arguments:
 --import-proc-cmdline: import values from /proc/cmdline
 --merge: import current values
 --replace=ARG=VALUE: replace value
 --append=ARG=VALUE: append a new argument

Extra command line arguments are treated like --append=, which
gives backwards compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=731051
2014-09-26 10:40:37 -04:00
Colin Walters edf9cf5a7f trivial-httpd: Further fixes for previous commit 2014-09-25 16:03:06 -04:00
Colin Walters 1b19a989fb Followup to SoupServer port deprecation
My patch didn't actually work with newer libsoup.
2014-09-25 15:57:58 -04:00
Owen W. Taylor 7fce7e0338 Add test for the behavior of --help
Recursive over ostree and all subcommands, and check that --help
is supported, properly outputs to standard out, and exits
with a 0 exit status. Check that for commands with subcommands,
they produce the help output to standard error when run with no arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=737194
2014-09-25 14:28:58 -04:00
Owen W. Taylor 3400f2d2ae --help should always go to stdout
The standard convention is that the  output of --help should go to standard
output (so that it can be piped to a pager and searched.) See, e.g., the
GNU coding standards.

https://bugzilla.gnome.org/show_bug.cgi?id=737194
2014-09-25 14:28:58 -04:00
Owen W. Taylor c9018c785c ostree admin instutil: make --help work for subcommands
Even though the subcommands don't take arguments, use a GOptionContext
so that --help works as expected.

https://bugzilla.gnome.org/show_bug.cgi?id=737194
2014-09-25 03:08:06 -04:00
Owen W. Taylor 9d72ff2d8e Fix help output for nested subcommands
Only 'ostree admin' was appearing in the help message for commands
nested within ostree admin.

https://bugzilla.gnome.org/show_bug.cgi?id=737194
2014-09-25 03:08:06 -04:00
Owen W. Taylor 1dca556691 Pass --help to the most nested subcommand
'ostree admin <x> --help' and 'ostree admin instutil <x> --help' should
give help on the deepest subcommand, not on 'ostree admin'.

https://bugzilla.gnome.org/show_bug.cgi?id=737194
2014-09-25 03:08:06 -04:00
Owen W. Taylor 40f490ed11 ostree admin: Fix return value from 'ostree admin [instutil]'
'ostree admin' and 'ostree admin instuil' with no arguments were meant to fail,
but the logic was wrong; add an assertion on the return value from all ostree
commands to catch similar problems in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=737194
2014-09-25 03:08:06 -04:00
Colin Walters 8f4ffa6950 deploy: Copy parent directories for modified config files
Previously, in the case where a parent directory of a modified config
file was removed, we would throw an exception.  This happens when
switching from a tree that has some software (e.g. firewalld), to one
that does not.

While it's nice to have this warning that your config file probably no
longer applies, there's no need to make it so...fatal.

It's particularly problematic that the only easy workaround is to
remove the config files from your current tree - which breaks
rollback.

The solution then is for for us to take ownership of the parent
directories too into the new /etc.  Admins can clean up these files
afterwards at any time.

https://bugzilla.gnome.org/show_bug.cgi?id=734293
2014-09-16 12:06:10 -04:00
Colin Walters b756a13a65 Extract opendirat() helper function into libotutil
We were duplicating the code to do an opendirat() in a few places.
2014-09-16 11:34:39 -04:00
Colin Walters dfeb27eca5 deploy: Remove legacy "current" symbolic links
Per comment, this was a temporary non-atomic hack, and it's time to
remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=731051
2014-09-13 10:44:29 -04:00
Colin Walters 12e3ed83d3 deploy: Clean up leftover state before creating new directories
This fixes a regression introduced with https://git.gnome.org/browse/ostree/commit/?id=7baa600e237b326899de2899a9bc54a6b863943c

The original code in "ostree admin upgrade" had a comment:

 /* Here we perform cleanup of any leftover data from previous
  * partial failures. This avoids having to call gs_shutil_rm_rf()
  * at random points throughout the process. */

But since I deleted that initial cleanup call, we *do* need to do the
cleanup during the process run.  It turns out there are only a few
places this is necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=733030
2014-09-13 10:43:14 -04:00
Colin Walters 7b01bd2e43 deploy: Consistently use fd-relative API
While looking to fix a different bug here, I found the current
state of things where we had a mix of fd-relative API versus not
frustrating.

Change the code around to consistently use *at, and also add some more
tests.
2014-09-13 10:41:59 -04:00
Colin Walters 34c336c1f3 Work around deprecation of SoupServer's port property
See https://bugzilla.gnome.org/show_bug.cgi?id=732184
2014-09-09 09:30:02 -04:00
Colin Walters b18e19f9e4 Release 2014.6 2014-09-08 13:43:12 -04:00
Colin Walters a593078722 pull: Squash some uninitialized variable warnings 2014-09-08 13:43:12 -04:00
Vincent Batts 8ed3883a21 build: We also work OK with LZMA 5.0
This is the version that's in Slackware at the moment at least.
2014-09-08 11:54:45 -04:00
Colin Walters 1242704d68 build: Unify CPPFLAGS settings
The libostree core uses SYSCONFDIR now, so we should ensure it's used
consistently.  Someone else was seeing SYSCONFDIR not being defined
while compiling with a newer automake version, which may process
CPPFLAGS more precisely.
2014-09-08 11:47:58 -04:00
Colin Walters afab8e2ad3 doc: Add a man page for summary command 2014-09-07 17:41:12 -04:00
Colin Walters b30f32e0da Drop g_type_init() call now that we depend on GLib 2.36 2014-09-07 12:58:10 -04:00
Colin Walters f8f5da219e Add repository "summary" file and metalink support
For Fedora and potentially other distributions which use globally
distributed mirrors, metalink is a popular solution to redirect
clients to a dynamic set of mirrors.

In order to make metalink work though, it needs *one* file which can
be checksummed.  (Well, potentially we could explode all refs into the
metalink.xml, but that would be a lot more invasive, and a bit weird
as we'd end up checksumming the checksum file).

This commit adds a new command:

$ ostree summary -u

To regenerate the summary file.  Can only be run by one process at a
time.

After that's done, the metalink can be generated based on it, and the
client fetch code will parse and load it.

https://bugzilla.gnome.org/show_bug.cgi?id=729585
2014-09-03 13:21:52 -04:00
Colin Walters 3571418557 Bump GIO dependency to 2.38 for GTask
I'd like to use GTask, so bump the dependency.

https://bugzilla.gnome.org/show_bug.cgi?id=729585
2014-08-27 17:39:15 -04:00
Colin Walters c08a4503ce fetcher: Close request body on error paths
Otherwise, we're potentially holding up subsequent requests.

I was hitting this when testing the metalink code, where we want to
continue doing more fetches after hitting a 404.

https://bugzilla.gnome.org/show_bug.cgi?id=729585
2014-08-27 14:00:31 -04:00
Anne LoVerso 6dfe99a283 pull: Fix use-after-free
The strchr() was pointing into a string we were freeing.
2014-08-21 13:57:31 -04:00