Commit Graph

800 Commits

Author SHA1 Message Date
Colin Walters c9f56564a3 switchroot: Use MS_MOVE to / rather than chroot
This fixes a number of bugs; the two biggest are:

1) On shutdown systemd can correctly umount /
2) We can use linux-user-chroot inside the system, as is
   necessary to do upgrades

See http://lists.freedesktop.org/archives/systemd-devel/2012-September/006703.html
2013-02-11 20:46:53 -05:00
Colin Walters 1d98f8865c pull-deploy: Allow switching trees too
$ ostree admin pull-deploy gnome-ostree trees/gnomeos-3.8-x86_64-devel

Now works to switch your current tree to -devel from the current
runtime.
2013-02-01 10:56:06 -05:00
Colin Walters 42e3f1f4ab pull-local: Fix crasher in previous commit when not connected to tty 2013-01-28 15:44:13 -05:00
Colin Walters aa5e11af12 pull-local: Port to GSConsole 2013-01-28 15:35:47 -05:00
Colin Walters 13f36aa224 pull-local: Support pulling checksums too
This matches what pull allows.
2013-01-28 15:32:06 -05:00
Colin Walters 5424652a7e libgsystem: Update to the latest 2013-01-25 15:19:34 -05:00
Colin Walters 64934202e4 admin: Don't overwrite previous ref unless it's different
We shouldn't overwrite deploy/<osname>/previous unless we actually
have something new.

This fixes the bug where two consecutive:

$ ostree admin upgrade foo
$ ostree admin upgrade foo

would end up pruning the data for foo/previous from the repo.
2013-01-24 17:32:59 -05:00
Colin Walters 59c98d0a04 pull: Drop dead code to pad output strings too
This is in GSConsole now.
2013-01-24 15:38:06 -05:00
Colin Walters 6fde0b61a8 Port ostree-pull to GSConsole
As part of this, we need to ensure our streams are inherited across
the chain of child processes.
2013-01-24 15:22:16 -05:00
Colin Walters fafb256f57 Update to the latest libgsystem 2013-01-23 15:20:19 -05:00
Colin Walters 13aefbc096 admin install: Ensure /ostree is initialized first
https://bugzilla.gnome.org/show_bug.cgi?id=692008
2013-01-18 08:38:09 -05:00
Colin Walters 341923b928 admin: Ensure /var/log/journal exists
This is admittedly a hack, since the story is that services should be
handling /var on their own.  But on the other hand the current systemd
story is that admins should create it to enable it.  Possibly a better
fix is --enable-journal-always or something for systemd.
2013-01-17 22:08:21 -05:00
Colin Walters 50ca6b672b update-kernel: Change dracut to use tmpdir on host, fix deploy path lookup
We had a bit of legacy code that looked for "current" if the deploy
path was unspecified; this needs to be deploy/OSNAME/current.

Secondly, we need to point dracut at a tmpdir outside of the root when
doing FUSE, because directories with mode 0700 and owned by root:root
aren't writable.

Also update libgsystem to the latest.
2013-01-09 04:32:51 -05:00
Colin Walters 77fa143bf3 admin: Add --no-bootloader option to update-kernel
Will be used by the QA scripts, since we need to inspect the kernel
configuration and generate a correct grub conf from that, rather than
trying to have update-bootloader reuse an existing config, since there
won't be one initially.
2013-01-08 13:57:24 -05:00
Colin Walters ecc0d1e07f Update to the latest libgsystem 2013-01-08 07:04:29 -05:00
Colin Walters 1dcf796868 admin update-kernel: Drop support for booting from host kernel
Now that gnome-ostree has a kernel, this functionality is no longer
necessary.  It was always a hack.
2013-01-06 12:37:45 -05:00
Colin Walters 6b868d84d8 admin update-kernel: Ensure initramfs has correct owner/mode
It was 0600, and owned by the creating process (in the fuse case,
non-root!).  We want it 0644/root/root.
2013-01-06 06:43:49 -05:00
Colin Walters 9795f4a67e admin: Propagate --boot-dir to subcommands
Really, I should be using internal functions here...
2013-01-06 06:12:42 -05:00
Colin Walters ccfdf22bb8 core: Drop dead prototypes from header
Followup to previous commit.
2013-01-04 19:47:56 -05:00
Colin Walters cd5fce713c core: Reuse more libgsystem API in utils
More code drain to libgsystem.
2013-01-04 19:46:02 -05:00
Colin Walters c9a840c659 core: Ensure kernel and initramfs are put into place with fdatasync()
Via a new libgsystem API.
2013-01-04 19:32:26 -05:00
Colin Walters 47bd290065 core: Drain fdatasync() API into libgsystem
Just code cleanup.
2013-01-04 17:25:32 -05:00
Colin Walters 2db497fd3f admin: Allow specifying --boot-dir
This is intended for use by QA tools that want to manipulate a
loopback-mounted disk image or the like.
2013-01-02 22:44:06 -05:00
Giovanni Campagna 6c9c7b0173 admin: restore current-etc symlink
It is useful now like it was before, and it is used by the grub
update script.

https://bugzilla.gnome.org/show_bug.cgi?id=690743
2012-12-26 19:42:46 +01:00
Colin Walters 9bd4d35c2b pull: Fix a race condition causing an early exit
This is a little less magical than what we had before.
2012-12-23 17:22:08 -05:00
Colin Walters 3c67c209db pull: Use a basic exponential moving average for bytes/sec
Still should look what other downloading programs do, but this
is better then what we had before.
2012-12-23 14:29:15 -05:00
Colin Walters 0ab1f78ec8 admin: Add new run-triggers command
In some cases we want the ability to run triggers independently of
checking out a tree.  For example, due to kernel limitations which
impact the gnome-ostree build system, we may need to run triggers on
first boot via systemd.

Secondarily, if the user installs a system extension which adds a new
shared library to /usr/lib for example, the system will need to run
the triggers again.

Also, I think I want to take triggers out of the core and put them in
ostree admin anyways.
2012-12-22 14:52:33 -05:00
Colin Walters 3832544ac4 admin: Rework /ostree/deploy to support multiple independent operating systems
The real vision of OSTree is to "multiple versions of multiple
operating systems".  Up until now, it's worked to install gnome-ostree
inside a host distribution, but several things don't work quite right
if you try to do completely different systems.

In the new model, there's the concept of an "osname" which encompasses
a few properties:

1) Its own /var
2) A set of trees deployed in /ostree/deploy/OSNAME/
3) Its own "current" and "previous" links.

Now it no longer really makes sense to boot with "ostree=current".
Instead, you specify e.g. "ostree=gnome/current".

This is an incompatible change to the deployment code - you will need
to run init-os gnome and redeploy.

All "ostree admin" subcommands now take an OSNAME argument.
2012-12-21 13:47:15 -05:00
Colin Walters 16d312e82f admin: Support installing a kernel from the tree, default to it
The "protocol" here is rather lame; we just look for
/boot/vmlinuz-RELEASE and /lib/modules/RELEASE.  But good enough for
now.
2012-12-21 12:20:55 -05:00
Colin Walters 19df2d372d core: Use new libgsystem GSSubprocess API
It's less screwing around with GPtrArray in most cases.
2012-12-21 11:52:28 -05:00
Colin Walters 90ccc7b2d2 core: Pick better names for tmpfiles if no prefix given
Just makes it easier to track down where files came from.
2012-12-21 11:30:58 -05:00
Colin Walters 3d41d1d2db OtWorkerQueue: Don't exit until we've fulfilled initial requests
This counts as an implicit "hold" on the first items, which we must
complete.  Otherwise there are race conditions where the queue may
signal idle when in fact the main process is still working.
2012-12-21 09:36:38 -05:00
Colin Walters fddc11ca74 Update to latest libgsystem
Has a bugfix change to gs_subprocess_new().
2012-12-20 21:14:31 -05:00
Colin Walters ad956ff9e2 core: Allow creating tempfile without associated output stream
Just slightly more efficient, and we'll use this for spawning curl to
a tempfile.
2012-12-20 21:14:27 -05:00
Colin Walters a97211e3d0 core: Clean up tmpfile creation code
I have been seeing random failures here...not entirely sure why yet,
but this code is cleaner.
2012-12-13 15:12:51 -05:00
Colin Walters 380b54d689 Update libgsystem
Just keeping up.
2012-12-13 15:12:33 -05:00
Colin Walters b637ea7674 admin init-fs: New builtin
Should be used when initializing a new root filesystem for a "pure
OSTree" system; for example, what "ostbuild privhelper-deploy-qemu"
does when creating a filesystem image loopback.
2012-12-09 17:01:51 -05:00
Colin Walters a2acaedfdc admin: Process newly added config files recursively
Previously we just failed out if there was a new directory in /etc
added by the user (or the system).
2012-12-07 18:29:03 -05:00
Colin Walters 227d22adca Update to the latest libgsystem 2012-12-03 12:05:41 -05:00
Colin Walters a9a9baeb2a Update to latest libgsystem
Has a rather important bugfix.
2012-12-02 23:02:39 -05:00
Colin Walters fc7f05940c core: Use mmap() with O_NOATIME if merely reading archive-z2 entries
Previously we'd open(path, O_NOATIME) and do a series of small read()
calls to just parse the header.  I think this will trigger kernel readahead
into the compressed portion, but we don't care about that.

This should be more efficient.
2012-12-02 15:20:17 -05:00
Colin Walters 7fcebed4e8 cleanup: Rebase spawn API on top of libgsystem GSSubprocess
We didn't need most the parameters anyways, so this is fewer lines of
code.  It also helps me test GSubprocess.
2012-12-01 16:53:06 -05:00
Colin Walters b423ea2041 Update to the latest libgsystem 2012-11-29 18:16:45 -05:00
Colin Walters 6dda8da6c5 Switch to using libgsystem shutil
More code moved into libgsystem.
2012-11-29 17:11:24 -05:00
Colin Walters 1ac307e6b8 Switch to libgsystem file reading API
More draining common utilities into libgsystem.
2012-11-29 16:58:39 -05:00
Colin Walters f3d765c903 Switch to libgsystem directory creation API
More code being dropped into a common place.
2012-11-29 16:40:17 -05:00
Colin Walters 6d81120455 otutil: Move checksum related bits into checksum-utils.[ch]
This paves the way for slimming ot-gio-utils.[ch] into libgsystem.
2012-11-29 16:28:24 -05:00
Colin Walters 5761733218 Drop some bits from libotutil that are now merged in libgsystem 2012-11-29 16:24:49 -05:00
Colin Walters d1ddfc973c libotutil: Drop dead prototype
Was never implemented.
2012-11-29 15:56:17 -05:00
Colin Walters f2b1be6a1e deploy: With --no-kernel, do copy host kernel modules
This is used by the qemu scripts, and there we *do* need the kernel
modules inside the target system.
2012-11-21 12:38:29 -05:00
Colin Walters 05e7b6d596 pull-local: Make multithreaded
We were blocking for easily 1/10 or 1/5 of a second in fdatasync(),
which drastically slows down the whole process.

This threading isn't quite as good as the ostree-pull command, but it
lets us avoid the dependency on libsoup everywhere, and it's simpler.
2012-11-19 12:08:41 -05:00
Colin Walters de1ce843f1 core: Drop old GLIB_CHECK_VERSION(2.32) bits
We hard require 2.34 now; if it doesn't exist on the system, that's
what embedded dependencies are for.
2012-11-18 15:44:21 -05:00
Colin Walters 3f4d223361 admin prune: New builtin for cleaning up deployments and repo
After a while of pull-deploy cycles, you start to accumulate a lot of
them.  While the deployment read-only part is hardlinked, the -etc
space adds up.

Additionally, the repository itself just gets large.

The new command "ostree admin prune" deletes everything except the
"current" and "previous" deployments.
2012-11-16 17:41:46 -05:00
Colin Walters 05895780a3 deploy: Write refs into repo for current/previous deployments
We don't want this data to be gc'd by default by a prune.
2012-11-16 17:14:23 -05:00
Colin Walters ffd774e2e6 prune: Report how much disk space we freed
Just nicer to see...
2012-11-16 15:45:05 -05:00
Colin Walters 7861b98673 prune: Add option to traverse refs only
The previous code (unintentionally) only traversed from refs; so data
only reachable from previous commits would be deleted.  That shouldn't
be the default, but we do want to offer it as an option.

So add a --refs-only option.
2012-11-16 12:50:13 -05:00
Colin Walters 51b1dd7cbd traverse: Skip already traversed commits
This is just more efficient, since e.g. "ostree prune" may invoke
ostree_traverse_commit() multiple times for the same commit.
2012-11-16 12:35:52 -05:00
Colin Walters 4169d628c5 prune: Default to deleting loose objects, code cleanup
We're getting closer to matching 'git gc'.
2012-11-16 10:58:35 -05:00
Colin Walters ee533d6ab9 admin: code cleanup
Refactor internal functions so they can be used by a later patch.
2012-11-16 10:40:49 -05:00
Jasper St. Pierre cda5b28bab ot-main: Ignore lt- prefixes in binary names
libtool is the best

https://bugzilla.gnome.org/show_bug.cgi?id=682438
2012-10-24 12:20:15 -04:00
Colin Walters cc4df4f3c2 admin: Add new pull-deploy command
Fetch the latest for the current tree, and deploy it in one go.
2012-10-22 20:41:49 -04:00
Colin Walters f405737164 libgsystem: Update 2012-10-22 18:24:31 -04:00
Matthias Clasen a0449ed246 Make ostree admin --help output more useful
At a minimum, it should list the available subcommands. This is
still not perfect, since there is no way to get at the help output
of the subcommands - getting that right needs more refactoring.

Signed-off-by: Colin Walters <walters@verbum.org>
2012-10-22 18:10:56 -04:00
Colin Walters 5a51bee024 core: quiet a compiler warning 2012-10-17 20:54:52 -04:00
Colin Walters 0c3e901dae core: Check out files before directories
Otherwise we pretty easily hit maximum FD limits =(
2012-10-15 20:03:13 -04:00
Colin Walters bdbf76b6eb core: Ensure correct file data is synced in non-overwrite case 2012-10-15 18:44:55 -04:00
Colin Walters 1642310486 core: Use linkat() rather than link() in threaded checkouts
This seems to work around a likely Linux kernel VFS bug, where I
randomly see ENOENT on link() when we *definitely* called mkdir() at
an earlier point in time.
2012-10-15 10:49:48 -04:00
Colin Walters d6956bfc19 core: And one more race in multithreaded mkdir -p
Sigh =(
2012-10-15 10:49:48 -04:00
Colin Walters c0a6b5da71 core: Fix devino speedup for archive-z 2012-10-14 17:19:30 -04:00
Colin Walters 0d04738801 core: Rework archive-z mode to have header be uncompressed
This is an incompatible change to archive-z, thus it is now renamed to
archive-z2 and ostree will no longer parse archive-z.

I noticed in perf that we were spending some time zlib-decompressing
file headers, which is just inefficient.  Rather than do this, keep
the headers uncompressed, and just zlib-compress content.
2012-10-14 17:10:57 -04:00
Colin Walters 2b90e987bf core: Call fdatasync() before we rename()
Just noticed this from strace, doesn't really matter, but looks nicer.
2012-10-14 15:34:33 -04:00
Colin Walters b0b409f82e checkout: Drop uncompressed object GC for now
It's racy when multiple processes are involved, and needs a bit more
thought.
2012-10-13 19:22:29 -04:00
Colin Walters 5b512d4c78 core: Fix case where we hardlinked successfully but thought we didn't
We need to return hardlink_supported even if we had to do an unlink
first.
2012-10-13 18:41:47 -04:00
Colin Walters ad26c7a80b core: A few more error-prefixings 2012-10-13 18:02:39 -04:00
Colin Walters c159188b81 core: One more minor tweak to recursive directory creation
We would fail in the case where we were trying to create a
subdirectory of /; this didn't actually happen, just noticed
via code inspection.
2012-10-13 17:54:19 -04:00
Colin Walters a284075731 core: Prefix some error messages
To help debug why I still have this race condition...
2012-10-13 17:46:24 -04:00
Colin Walters 6b09f90122 core: Threadsafe recursive direction creation is harder than it appears 2012-10-13 10:47:03 -04:00
Colin Walters b4d408f483 core: Fix regression in previous commit 2012-10-12 15:25:25 -04:00
Colin Walters 4436ed34d8 core: Make mkdir -p function safer
Recursing here is just a more obvious way to do it, rather than
relying on the semantics of g_file_make_directory_with_parents().
2012-10-12 15:10:39 -04:00
Colin Walters 238da603b8 core: Ensure file data is synced to disk when checking out via non-hardlinks
Otherwise we aren't crash-safe.
2012-10-12 13:09:10 -04:00
Colin Walters e9dd22dc86 repo: Avoid race condition in threaded checkout with symbolic links
We were inconsistently putting symbolic links into the uncompressed
object cache, which could cause the threaded checkout to get confused.
2012-10-12 11:24:06 -04:00
Colin Walters ee73c0fa34 core: Add dynamic uncompressed object cache for archive-z
This gives us something closer to the advantages of archive and
archive-z when using the latter.  Concretely we get deduplication
among multiple checkouts, along with the "devino" hash table trick
during commits to avoid checksumming content again.

This is enabled by default.
2012-10-11 18:33:03 -04:00
Colin Walters 3c0fe01152 pull: Print elapsed time 2012-10-05 17:20:40 -04:00
Colin Walters 52a0b7bdb1 core: Only do devino scan on commit (speeds up pull)
When fetching data remotely, there's no point to the devino scan
because we're not going to be committing local files.

Only do it for "commit".
2012-10-05 17:12:39 -04:00
Colin Walters efe27f1b05 pull: Ensure worker queue finishes if we unhold an empty queue too 2012-10-04 20:32:14 -04:00
Colin Walters 9618232f4d pull: Stage content asynchronously
For similar reasons as metadata, this avoids having the main thread
blocked in fdatasync(), and even better - we can achieve much higher
parallelism if we have multiple threads blocked on fdatasync().
2012-10-04 20:00:00 -04:00
Colin Walters 5b8e833351 pull: Stage metadata objects asynchronously
This avoids the main thread being blocked on fdatasync(); also as a
bonus we checksum metadata in a separate thread too.
2012-10-04 18:24:37 -04:00
Colin Walters f1b4db15a2 pull: Ensure queued filemeta requests don't starve everything else
We need this hack for "archive mode" repositories; otherwise,
what ends up happening is that we get 10000+ requests pending
for .filemeta files, which we can't process until we also get
the .filecontent.

Note this hack is unneccessary when fetching from archive-z
repositories.
2012-10-04 18:23:18 -04:00
Colin Walters 4e51701bea pull: Merge metadata and content fetch phases
This is a notable speedup when the metadata scanner is working, and we
don't have a lot of traffic; we can pull down data at the same time.
2012-10-04 15:37:23 -04:00
Colin Walters 5c1dc390ae pull: Asynchronous metadata fetch
Create a worker thread for processing metadata, reserving the main
thread for HTTP requests.

This can create a very significant efficiency win for large pull
requests since we are much more likely to keep a full pipeline open.

The status display is also nicer now.
2012-10-03 22:35:33 -04:00
Colin Walters 8153799121 admin: Prepare /var/log/dracut.log when creating initramfs
Otherwise dracut complains.
2012-10-01 10:25:36 -04:00
Colin Walters 3e9c358628 Update libgsystem
This ensures we're disting the README, which makes the autogen.sh do
the right thing.
2012-09-25 22:25:06 -04:00
Colin Walters 26e487bacf core: use open(..., O_NOATIME) for reading loose objects
More efficient, and atime shouldn't matter for these.
2012-09-24 07:36:42 -04:00
Colin Walters 40ce43036f Add an archive-z repository mode
This is where loose content objects are stored as one compressed file,
instead of the two separate ones for regular archive mode.  This mode
would be suitable for HTTP servers, beause only one HTTP request is
necessary, and the result would be compressed.
2012-09-23 19:23:45 -04:00
Colin Walters 35a1ff51d0 pull: Fix two minor memory leaks 2012-09-23 17:32:11 -04:00
Colin Walters 34c49f0411 core: Clean up staging API and internals
Cleanly separate metadata/content APIs, rather than defaulting to
raw streams.  This helps most use cases.

Also, drop support for staging content without knowing the total
length.  This complicated the code, and for things like streaming
HTTP, we should be able to figure this out from Content-Length.
2012-09-23 16:44:12 -04:00
Colin Walters 2a0601efc7 core: Drop packfiles as they are now
They're not a large efficiency win at the moment, because we don't
do any delta compression.

At the moment, they simply served to compress data, but we will change
the archive mode to do that by default.
2012-09-23 16:02:03 -04:00
Colin Walters a8764bf996 diff: Fix case when used on native files 2012-09-23 15:55:02 -04:00
Colin Walters a6e9e54891 admin: Initialize /var more fully
This helps out gnome-ostree, because gdm needs /var/lib for example.
2012-09-18 08:58:07 -04:00
Giovanni Campagna 2881194186 Grub2: use /etc/system-release now that we have one
This matches the upstream code more, and avoids the GNOME OS trademark
in ostree, which is otherwise platform agnostic.

https://bugzilla.gnome.org/show_bug.cgi?id=684049
2012-09-17 00:25:30 +02:00
Giovanni Campagna 8c9406637c Add /ostree/current-etc symlink to current configuration
Configuration associated with a specific revision is stored in a folder
named <revision>-etc. In a similar spirit, add /ostree/current-etc, pointing
to the -etc folder for the revision named by current. This allows
easy editing of configuration from the host distribution, and allows
diffing current/etc and current-etc for configuration changes.

https://bugzilla.gnome.org/show_bug.cgi?id=684049
2012-09-17 00:25:29 +02:00
Giovanni Campagna 8a98e8d964 Update kernel files for command naming changes
ostadmin is now ostree admin.

https://bugzilla.gnome.org/show_bug.cgi?id=684049
2012-09-17 00:00:33 +02:00
Colin Walters 59ddbcc500 pull: Check the remote repo type
We can only pull from archive repositories right now.  This will also
be useful for adding compressed archives later.
2012-09-15 12:41:25 -04:00
Colin Walters 31153913ff Extract keyfile helpers into libotutil
Will be used by ostree-pull too soon.
2012-09-15 11:20:56 -04:00
Colin Walters 117b9c109e ostadmin: Fix up deploy config logic again
Clearly we need tests here...
2012-09-09 11:42:17 -04:00
Colin Walters 2f8b3517f4 admin: Ensure we pass options to subcommands
Otherwise ostree admin --ostree-dir=/foo deploy --no-kernel bar
doesn't work.
2012-09-09 11:31:22 -04:00
Colin Walters 7831ae81c2 update-kernel: Fix free -> g_object_unref 2012-09-09 10:42:13 -04:00
Colin Walters fa5485c6c4 Move "ostadmin" => "ostree admin"
This helps us avoid polluting the global binary namespace.
2012-09-08 19:34:10 -04:00
Colin Walters 2ddbeb1f71 Make /etc a writable mount
First, move deployments to /ostree/deploy.  Having them in the
toplevel clutters the filesystem layout too much.

When we deploy a tree like /ostree/deploy/NAME, there is now also a
writable directory /ostree/deploy/NAME-etc.  This is mounted as
read-write inside the system.

On an initial install, that directory is copied from
/ostree/deploy/NAME/etc.  On subsequent deployments, we find any
changes made in the current deployment's /etc, and apply that set of
changes to the new deployment's /etc.

See https://live.gnome.org/OSTree/EverythingInEtcIsABug
2012-09-06 08:17:23 -04:00
Colin Walters 9ba968a5f4 otutil: Add a few more helper functions
To be used by wip/etc-writable branch.
2012-09-03 10:43:42 -07:00
Colin Walters cf31942a69 core: Refactor diff to be an internal API
For future use by other code.
2012-08-31 17:39:04 -07:00
Colin Walters 38d62d79a2 ostadmin: Also ensure /ostree/modules exists
We depend on host kernel for now.
2012-08-30 17:42:36 -07:00
Colin Walters 60368fae76 Use correct libgsystem
Accidentally pushed a local patch.
2012-08-28 09:58:07 -04:00
Colin Walters a17a8e1f4e Update libgsystem 2012-08-27 18:48:14 -04:00
Colin Walters 4d2f770748 core: Use O_NOATIME to open metadata
We really don't need atime for metadata, it's just a speed hit.
2012-08-27 16:07:39 -04:00
Colin Walters 2396608754 repo: Call fdatasync() before adding objects to the repo
I run builds on my laptop, but it also crashes about 1/4 of the time
while suspending.  It's definitely undesrirable to get e.g. empty
.dirtree objects because they corrupt builds.  Concretely, I was
getting empty contents committed for xorg-util-macros.

Now, we used to write out temporary files using g_file_replace() which
does a fsync() during close, but then switched to a more "manual"
g_file_append_to().

We could switch back to g_file_replace(), but the problem is, we don't
want to call fsync() on temporary files in the case where we already
have the object.  Attempting to add an object we already have is a
*very* common case.

This is both the old and new code sequence for the case where an
object is already stored:

open(temp, O_WRONLY)
write() write() write()
close()
lstat(objects/3a/9fe332...) = 0
unlink(temp)

In the *new* code, here's the case where an object *isn't* stored:

open(temp, O_WRONLY)
write() write() write()
close()
lstat(objects/3a/9fe332...) = -1
open(temp, O_RDONLY)
fdatasync()
close()
rename(temp, objects/3a/9fe332)

Compare with the *old* code path for when an object isn't stored:

open(temp, O_WRONLY)
write() write() write()
close()
lstat(objects/3a/9fe332...) = -1
link(temp, objects/3a/9fe332)
unlink(temp)

The problem with this is we really need to fdatasync().  Also doing
just rename() instead of the weird link()/unlink() helps us express to
the filesystem that we want atomic semantics.  For example, BTRFS has
special handling for rename().
2012-08-27 15:35:40 -04:00
Colin Walters 5038a1930f traverse: Set an explicit error when loading a corrupted commit
I had a empty files for a .commit and .dirmeta, and previously we were
segfaulting.
2012-08-27 11:39:44 -04:00
Colin Walters 7b977beec8 ostadmin: Cosmetic change for option defaults 2012-08-26 17:34:32 -04:00
Colin Walters e9d23befd0 ostadmin: Add --ostree-dir option to init
Matches the option for deploy.
2012-08-26 17:34:25 -04:00
Colin Walters 8f6f3623c3 repo: Ensure all stored files are readable
We really don't have a sane story for private files.  This is a
defensive step ensuring that with old versions of gnome-ostree,
components that mistakenly have un-world-readable files don't break
pulls.
2012-08-26 16:35:44 -04:00
Colin Walters e2aabce708 prune: Don't fail if an object isn't found
We expect most people to have partial repositories.
2012-08-25 16:02:38 -04:00
Colin Walters 9d58bad7ca repo: Also traverse remote refs when enumerating objects
Otherwise ostree --repo=repo prune will delete everything =/
2012-08-25 16:02:38 -04:00
Matthias Clasen 4b0bbb94a0 Improve the pango trigger
Use the new update-cache mode of pango-querymodules, which
automatically finds the correct cache file location.

Updated to look in both places by Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=682411
2012-08-25 14:59:17 -04:00
Colin Walters 7087d28ec3 libostree: Quiet compiler warning with --disable-libarchive
This function is only used if compiling with it.
2012-08-24 16:47:31 -04:00
Matthias Clasen f5113085e1 ostree: Remove duplicate command in help output
The 'remote' command was listed twice. Also, the list
was almost-but-not-quite alphabetically sorted. Fix
that too.
2012-08-23 20:03:40 -04:00
Colin Walters 79f993beb4 pull: Only fetch pack files if we want more than 66% of their objects
This avoids some pathologically bad cases where we would fetch a 25MiB
pack file only to extract one 5KiB object from it.
2012-08-22 19:45:01 -04:00
Colin Walters b36b19eaf8 pull: Exit mainloop immediately if we encounter an error
Otherwise we'll just hang.
2012-08-22 19:45:00 -04:00
Colin Walters f115a8943a pack: Support --content-only
This should be useful for implementing more sophisticated packing
strategies.

Also clean up the pack size default handling.
2012-08-22 19:45:00 -04:00
Colin Walters ece71b22c5 pull: Set an error when we get an unsuccessful HTTP response
Otherwise we'll e.g. try to parse 404 HTML as an object which will
fail.
2012-08-22 19:45:00 -04:00
Giovanni Campagna a97bcc68d7 Add infrastructure for automatic kernel updates
If the distribution supports running arbitrary scripts at kernel
updates, we can hook into it and update the ostree side of things
automatically.
2012-08-20 23:01:58 +02:00
Giovanni Campagna affa5755a6 ostadmin: add update-kernel command to regenerate initramfs and boot config
This command regenerates kernel-dependent files. It is meant to
be run after kernel upgrades in the host distribution, to keep
the ostree installation running, and attempts to figure out the
right version automatically (and without changing the ostree checkout)
2012-08-20 23:01:57 +02:00
Giovanni Campagna 1057f8289c Don't fail for EPERM when hardlinking
As the manual page doesn't say, but the in-code kernel documentation
shows, hardlinking for normal users can fail for a variety of
reasons (including very common situations such as non regular file
or non writable file), if the owner of the file does not match
the user linking (e.g. when checking out a shadow repo with a root-
owned master).
If that happens, fail back silently to copying instead of aborting
the whole operation.

https://bugzilla.gnome.org/show_bug.cgi?id=682298
2012-08-20 23:01:57 +02:00
Giovanni Campagna 1d93a743dc ostree-run-triggers: fix typo in filename comparison function
The comparison function was comparing the first file to itself,
and this resulted in triggers being run in random order.

https://bugzilla.gnome.org/show_bug.cgi?id=682297
2012-08-20 23:01:57 +02:00
Stef Walter f5cf21e471 Include pull and other external commands in usage output 2012-08-19 15:05:01 -04:00
Giovanni Campagna edf69d6283 ostadmin: fix command line handling in the builtins
Common code was duplicating the command name and not shifting
arguments properly, which thus required the builtins to be aware
of it, instead of being treated like subcommands.
2012-08-18 19:21:22 +02:00
Stef Walter 66c8a1d3f6 Support non-builtin commands
* Support executing commands in the path
 * This makes 'ostree-pull' work as 'ostree pull'
2012-08-10 15:55:26 +02:00
Colin Walters 179fc65947 triggers: Print execution time for each trigger 2012-08-05 16:39:57 -04:00
Colin Walters 36b6ad41cb ostadmin: Use g_spawn_check_exit_status()
Just code cleanup.
2012-08-05 16:39:57 -04:00
Colin Walters a6c19aa00c ostadmin: Change command line for qemu deploy helper
The qemu helper really wants to copy kernel modules, but not
update the system bootloader.  Allow it to reuse ostadmin for
this.

Note that our previous path of shelling out to "cp -al" broke because
it refused to make cross-device links.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   src/libotutil/ot-gio-utils.c
#	modified:   src/libotutil/ot-gio-utils.h
#	modified:   src/ostadmin/ot-admin-builtin-deploy.c
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	embedded-dependencies/glib/
#	embedded-dependencies/libsoup/
2012-08-05 16:39:57 -04:00
Colin Walters 09707780b9 ostadmin: Add --ostree-dir directory
This will be used by the qemu deployment script.
2012-08-05 16:39:57 -04:00
Colin Walters 5284d21f8d ostadmin: Print an error message if run as non-root
See https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-07-30 10:29:45 -04:00
Colin Walters a179138a23 ostadmin: [incompat syntax change] Allow deploying any revision
The old command line syntax assumed you wanted the latest from
a given revision, but to bisect, you really want the ability
to deploy any given one.

Old:
$ ostadmin deploy gnomeos-3.6-i686-{runtime,devel}

New:

$ ostadmin deploy trees/gnomeos-3.6-i686-runtime
$ ostadmin deploy trees/gnomeos-3.6-i686-devel

And note that the deploy directory now changes to:
/ostree/trees/gnomeos-3.6-i686-devel

And now it's possible to:

$ ostadmin deploy trees/gnomeos-3.6-i686-devel trees/gnomeos-3.6-i686-devel^^^
2012-07-26 10:56:32 -04:00
Colin Walters 5bbdce2c06 pull: When --depth is specified, ensure we have all requested objects
We were previously optimizing by skipping object traversal if the refs
were unchanged, but if the user specifies a deeper depth than they did
before.
2012-07-26 10:17:41 -04:00
Colin Walters a310eb861b core: Add context when we fail to chmod()/chown()
This helps make things less confusing when we try to create a file not
owned by our uid, such as running ostree-pull as non-root on a
repository owned by root.
2012-07-19 11:01:39 -04:00
Colin Walters 0d86702115 core: Drop ot_clear_hashtable for g_clear_pointer() 2012-07-17 08:18:43 -04:00
Colin Walters 43a2fec6a8 core: Drop ot_clear_ptrarray in favor of g_clear_pointer 2012-07-17 08:16:54 -04:00
Colin Walters 2ced4abf11 core: Drop ot_clear_gvariant() in favor of g_clear_pointer 2012-07-17 08:14:33 -04:00
Colin Walters 57fcafd1ab core: Remove ot_clear_checksum() in favor of g_clear_pointer() 2012-07-17 08:08:57 -04:00
Colin Walters c8d7fc216d core: Use g_spawn_check_exit_status() 2012-07-17 08:06:20 -04:00
Colin Walters 6b31c580ca pull: Only take up one terminal line for status output
And print total bytes transferred at the end.
2012-07-16 22:35:18 -04:00
Colin Walters b2c2bf7e04 Fix libgsystem submodule 2012-07-15 18:29:15 -04:00
Colin Walters da43fb6db5 Hard require GLib 2.34
Anyone wanting to build against an earlier version can use the
embedded-dependencies system.
2012-07-15 18:22:41 -04:00
Colin Walters 464f4a81c9 Add libgsystem as git external
Don't replace ot_lfree and stuff yet though...to much code churn.
2012-07-15 11:59:05 -04:00
Colin Walters 95921bcbf0 pull: Correctly display concurrent libsoup requests
The "status text" code was assuming that libsoup was only doing one
thing at a time, but that's never been the case.  Change the code to
display the status of all active requests.
2012-07-12 11:19:15 -04:00
Colin Walters 664e9b404d core: drop dead/unused code
The daemon is a nice idea but needs a lot more thought.  Let's just
delete the unused code for now and come back to it later.
2012-06-30 13:49:25 -04:00
Colin Walters 311493338e core: Drop ot_gfile_new_for_path
Not necessary anymore since we switched to GIO_USE_VFS=local in the
binaries.
2012-06-30 13:42:24 -04:00
Colin Walters d5a1f1deda pull: Fix a memory leak 2012-06-28 15:18:10 -04:00
Colin Walters a98ca05676 pull: Fix use-after-free in async fetcher
Refcount the pending data structure.
2012-06-28 15:06:18 -04:00
Colin Walters d596615bab main: Fix a format string error 2012-06-27 22:26:16 -04:00
Colin Walters a7b917c856 core: Check out asynchronously
This can be a large performance win in certain circumstances:

 * Cold buffer cache (we don't block the whole process)
 * Requiring a copy instead of hardlink
2012-06-21 18:05:13 -04:00
Colin Walters 7cce6e5ba1 pull: Properly propagate errors 2012-06-20 15:42:41 -04:00
Colin Walters ee98a0b4f7 core: Don't silence output of ostree-run-triggers
We want to see which triggers are being run by default.
2012-06-19 16:14:31 -04:00
Colin Walters 4d59080f46 triggers: Quiet GConf trigger
The default is just way, way too verbose.
2012-06-19 15:03:16 -04:00
Adrian Perez bdc57338c1 Add fontconfig trigger
This wil regenerate the fontconfig caches, accounting for modifications in
the system font directories.
2012-06-13 17:58:53 +03:00
Colin Walters 35a80c8e39 core: Fall back to copying checkouts on EMLINK/EXDEV
The previous fix to just ignore symbolic links for hard linking isn't
really good enough, since it can happen for empty files too.

Since this is an optimization, when we get EMLINK, let's instead just
fall back to copying.  This also applies to EXDEV.
2012-06-12 14:50:41 -04:00
Colin Walters 270dc05176 ostbuild: Move to gnome-ostree module
Since we want to keep "ostree" buildsystem-independent, let's move
ostbuild out into the gnome-ostree module.

http://git.gnome.org/browse/gnome-ostree/commit/?id=04ba1926e33b442af1e357460e4415d4c0311e87
2012-06-08 19:01:25 -04:00
Colin Walters 6aaa2089f0 ostbuild: Fix previous commit (this should have been amended) 2012-06-08 16:51:51 -04:00
Colin Walters f4b6d88254 ostbuild: Fix -k option to git-mirror 2012-06-08 16:47:23 -04:00
Colin Walters 13b37ddaa2 ostbuild: Allow specifying components to git fetch 2012-06-07 10:19:28 -04:00
Colin Walters 210fbc3daf ostbuild: Add rootdir argument to deploy-qemu 2012-06-06 15:43:42 -04:00
Colin Walters 2c385c0078 ostbuild: Fix circular dependency between resolve and git-mirror
git-mirror was looking for the latest snapshot, which we don't
have until we resolve.

This leads to some code duplication.
2012-06-06 12:56:48 -04:00
Colin Walters a14ff0aeab core: Fix mkdtemp invocation 2012-06-06 10:03:15 -04:00
Colin Walters c436f8ac61 ostbuild: Add -k option to git-mirror
libwacom's sourceforge git server was down...
2012-06-05 22:55:53 -04:00
Colin Walters e485bace01 pull: Download and checksum asynchronously
This is quite a noticeable speedup when downloading loose objects.
2012-06-05 22:38:17 -04:00
Colin Walters df54408e5d core: Fix memory leak 2012-06-05 22:32:03 -04:00
Colin Walters 8f2dda3e25 core: Just require libsoup, not libsoup-gnome 2012-05-31 10:25:41 -04:00
Colin Walters cbd4ade053 core: Switch to using mkdtemp() so we only depend on GLib 2.28
We claim to build against 2.28, let's actually make it work.
2012-05-29 22:34:11 -04:00
Colin Walters f438d9aaa6 core: Drop some dead temporary file code 2012-05-29 22:09:31 -04:00
Matthias Clasen 90aff4f2f6 Trivial: fix a typo 2012-05-26 18:48:06 -04:00
Colin Walters d3b063cec0 ostbuild: Have resolve use git-mirror rather than duplicating code
This also brings us back to a sensible world of:

ostbuild resolve --fetch

Doing both fetch *and* writing out the updated revisions.
2012-05-26 12:10:51 -04:00
Colin Walters 9582effb8d core: Don't checkout symbolic links via hardlink
Doing so can easily get us up to the maximum ext4 hardlink count.
2012-05-26 11:55:12 -04:00
Colin Walters 1ef6bb0ef6 ostbuild: add --diffstat option for source-diff 2012-05-25 15:01:41 -04:00
Colin Walters 9c27f1de99 core: Remove leftover debug print 2012-05-25 09:55:10 -04:00
Colin Walters 88b3440eef core: ostree-pull: Add --depth option
This is useful for getting say the last 10 builds.
2012-05-24 20:58:20 -04:00
Colin Walters fb71519cd6 core: Attempt direct link() and fallback on EEXIST
Rather than always doing:

1) make temporary link
2) unlink() target
3) rename()

Just try making the link, and only do the second two if the file
already exists.  This reduces system call traffic a lot.
2012-05-24 20:14:51 -04:00
Colin Walters f7bbf41132 ostbuild: Add 'tag' concept to manifest, improve git mirroring
We should explicitly distinguish between the case where we have a git
branch we're following, versus an immutable tag.  In the latter case,
we can entirely avoid running 'git fetch' for it once we have it.
This is a noticeable speedup in our current scenario of pinning WebKit
to a tag.

The git mirroring code now has a --fetch-skip-secs=X option which
allows us to basically run it in a loop, without hitting remote git
repositories too often.
2012-05-24 19:54:36 -04:00
Colin Walters 0d1ba45c73 ostbuild: git-mirror: Also fetch patches git 2012-05-24 18:11:06 -04:00
Colin Walters 1a5ea54aff core: Make OstreeRepo struct private 2012-05-23 18:08:52 -04:00
Colin Walters 6c006815ce ostbuild: Fix --debug-shell option 2012-05-23 18:02:08 -04:00
Colin Walters 893774aab5 core: Make device/inode loose object cache work for parent repos too
Otherwise ostbuild suddenly becomes significantly slower when using a
shadow repo.
2012-05-23 07:48:16 -04:00
Colin Walters b45a0803fe ostbuild: Few more misc fixes 2012-05-22 08:26:17 -04:00
Colin Walters 95f66e1157 ostbuild: Fix typos in component lookup path 2012-05-21 18:41:59 -04:00
Colin Walters 9bd36f9bff ostbuild: Enhance source-diff with --log and --logp options 2012-05-18 20:25:02 -04:00
Colin Walters 6d59b4077c ostbuild: Add source-diff builtin
OMG OMG OMG
2012-05-18 20:12:35 -04:00
Colin Walters 58d28ad5a6 core: Rearrange code for clarity (doesn't actually fix leaks) 2012-05-18 20:12:17 -04:00
Colin Walters 790d2757f6 ostbuild: Drop dead branch-prefix and pull-components
And other various tweaks.
2012-05-18 16:30:45 -04:00
Colin Walters 32020e55c8 ostbuild: Various fixes, removal of dead code 2012-05-18 16:30:45 -04:00
Colin Walters ecfd9b2cf3 ostbuild: Remove /var from components
We expect them to create on demand.
2012-05-18 16:30:45 -04:00
Colin Walters a3246d590e ostbuild: Fix git-mirror 2012-05-18 16:30:45 -04:00
Colin Walters bcab6748a5 ostbuild: Some work on qemu deployment 2012-05-18 16:30:45 -04:00