Commit Graph

546 Commits

Author SHA1 Message Date
Matthew Barnes
4a2733f9e7 gpg: Add OstreeGpgVerifyResult
Wrappers a referenced gpgme_verify_result_t so detailed verify results
can be examined independently of executing a verify operation.

_ostree_gpg_verifier_check_signature() now returns this object instead
of a single valid/invalid boolean, but the idea is for OstreeRepo to also
return this object for commit signature verification so it can be utilized
at the CLI layer (and possibly by other programs).
2015-03-18 11:52:22 -04:00
Giuseppe Scrivano
3f3096a65c tests: Add tests for test-ot-tool-util
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:38 +01:00
Giuseppe Scrivano
c1c34c601a tests: add test for test-ot-opt-utils.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:38 +01:00
Giuseppe Scrivano
50c69c3392 keyfile-utils: add tests
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:37 +01:00
Giuseppe Scrivano
d414ee5852 tests: add tests for mutable tree.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-04 17:52:17 -05:00
Giuseppe Scrivano
aea173b3f8 tests: enforce ${CMD_PREFIX} on all ostree processes
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-03 18:32:24 -05:00
Giuseppe Scrivano
6029f4d820 tests: add test for bsdiff
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-03 12:16:17 -05:00
Matthew Barnes
a5b002dae6 ostree: Add gpg-sign command
Signs a commit with one or more GPG keys.
2015-02-26 12:53:01 -05:00
Colin Walters
2f205331f4 tests: Move test gpg keyring into writable tmpdir
At least the version of gpgme in RHEL7 wants to create a lock file,
work around this by copying it into the writable test temporary
directory.
2015-02-23 15:21:23 -05:00
Daniel Drake
7c267d6089 libostree: set directory mtimes to 0 on checkout
We already set all file mtimes to 0 so that they are constant
over all checkouts, and can be made constant with a known value from
the system where the ostree was created.

However, this was not happening for directories. Zero their mtimes too.

This is important for shipping a fontconfig cache in the ostree;
the fontconfig cache files embed a directory mtime.
2015-02-18 18:27:18 -05:00
Colin Walters
08476ce254 deltas: Prune deltas when the corresponding "to" commit vanishes
We want prune to actually give you back disk space when using deltas.
2015-02-16 10:10:35 -05:00
Colin Walters
dbad2f6e19 deltas: Make syntax-check happy 2015-02-16 10:10:35 -05:00
Colin Walters
9aa7e30b38 deltas: Implement rollsums
This does an rsync-style prepared delta basically.  On my test data,
it shaves ~6MB of uncompressed data.  Not a huge amount, but I expect
this to be more useful for things like binaries which embed data, etc.
2015-02-16 10:10:35 -05:00
Colin Walters
92cc3b5968 deltas: Use base64 for csums, add version to parts 2015-02-16 10:10:35 -05:00
Colin Walters
ab3bf493dd pull: Optimize file:/// URIs to skip libsoup and hardlink if possible
It's always been suboptimal to have both pull and pull-local; as we go
beyond the raw object data into things like deltas and summary files,
the logic to perform e.g. mirroring should only be in one place.

This will be used by Pulp's OSTree content plugin at least to perform
promotions.
2015-02-06 10:02:57 -05:00
Colin Walters
1fdecbd263 pull: Copy the upstream summary file when doing a pull --mirror
While it could be regenerated downstream, there might be other
metadata upstream, and the goal here is a mirror.

https://bugzilla.gnome.org/show_bug.cgi?id=739377
2015-02-05 21:24:21 -05:00
Colin Walters
fab1e113db When mirroring, write content directly, do not verify
When doing a pull --mirror from an archive-z2 repository into another
archive-z2 repository, currently we gunzip/checksum/gzip each content
object.  The re-gzip process in particular is fairly expensive.

This does assume that the upstream content is trusted and correct.
It'd be nice in the future to do at least a CRC check, if not the full
checksum.  (Could we append CRC data to the end of filez objects?)

We could also choose to only do this optimization if fetching over
TLS.

before: 1626 metadata, 20320 content objects fetched; 299634 KiB transferred in 62 seconds
after : 1626 metadata, 20320 content objects fetched; 299634 KiB transferred in 11 seconds
2015-02-05 21:24:21 -05:00
Giuseppe Scrivano
cfc344fbb0 tests: Add tests for ot-unix-utils
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-02-02 17:42:41 +01:00
Giuseppe Scrivano
6a3959c895 syntax-check: Remove empty lines at the end of file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-02-02 15:07:56 +01:00
Giuseppe Scrivano
10642cd732 Replace "==" with "=" in shell script test
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Colin Walters
6bbfa5f85a admin: Add set-origin command
See projectatomic/rpm-ostree#42 for rationale. There are two high
level use cases:

 - If the OS comes unconfigured, this is a way to point it at a repo of your choice.
 - To switch between repositories while keeping the same branch easily.
2015-01-19 13:55:20 -05:00
Giuseppe Scrivano
f2ae405f9f static-delta: do not accept both --from=REV and --empty for generate
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-15 22:54:56 -05:00
Alexander Larsson
5b721a5b08 Allow creating and pulling static deltas starting from "empty"
You create these with something like:
  ostree static-delta generate --empty --to=master

These will be automatically used during pull if no previous revision
exists in the target repo.

These work very much like the normal static deltas except they
are named just by the "to" revision. I.e:

deltas/94/f7d2dc23759dd21f9bd01e6705a8fdf98f90cad3e0109ba3f6c091c1a3774d

for a from-scratch to 94f7d2dc23759dd21f9bd01e6705a8fdf98f90cad3e0109ba3f6c091c1a3774d delta.

https://bugzilla.gnome.org/show_bug.cgi?id=721799
2015-01-14 14:43:32 +01:00
Matthew Barnes
7727fe84d9 Require a PREFIX when deleting refs
Also fix the "ostree refs" help output to not give the impression that
the --delete option takes its own PREFIX argument.

https://bugzilla.gnome.org/show_bug.cgi?id=742454
2015-01-06 10:33:12 -05:00
Giuseppe Scrivano
ed2b56a430 fix --help for static-delta
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-12-18 12:48:47 +01:00
Colin Walters
5c47389243 test-rollsum: Process all input, print more statistics
Copying the bup code, we need to loop over all chunks even after
hitting the rollsum returning 0.

Also print more statistics.
2014-12-18 12:48:47 +01:00
Colin Walters
ca678224be Static deltas support
https://bugzilla.gnome.org/show_bug.cgi?id=721799
2014-12-18 12:48:47 +01:00
Matthew Barnes
e54d48be39 Add "ostree remote list" command
Lists available remote names.
2014-12-17 16:05:53 -05:00
Colin Walters
d3edda5edc basic-test: Fixup mtime check for bare-user
https://bugzilla.gnome.org/show_bug.cgi?id=741662
2014-12-17 11:34:10 -05:00
Colin Walters
9dadebb501 tests: Fix two bugs in tests revealed by new remote changes 2014-12-17 10:43:01 -05:00
Colin Walters
f6a6e68412 Add more flexible _remote_change() API , expose via 'ostree remote'
For Anaconda, I needed OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
with the GFile *sysroot argument to avoid ugly hacks.  We want to
write the content provided via "ostreesetup" as a remote to the target
chroot only in the case where it isn't provided as part of the tree
content itself.

This is also potentially useful in idempotent systems management tools
like Ansible.

https://bugzilla.gnome.org/show_bug.cgi?id=741577
2014-12-15 21:28:09 -05:00
Alexander Larsson
e908ebd9b3 test-local-pull: Sort find output to make test robust
There is no guarantee that find will produce output in the same
order, so we need to sort the output to ensure we always
get the same output.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 20:28:09 +01:00
Alexander Larsson
dbf717ac4b Add local-pull archive-z2 <=> bare-user roundtrip test
This creates a archive-z2 repo, pull-locals it to bare-user and then
again back to archive-z2 making sure things fsck along the way.
Then it checks out all repos and makes sure each one reproduces
the same result.

Unfortunately we can't install this as a real test because
it doesn't work in the test-runner because tmpfs doesn't support
user xattrs.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 12:03:27 +01:00
Alexander Larsson
fcd3caf6dd Add test-basic-user.sh testing for bare-user repos
This just does whatever test-basic.sh does, but on a bare-user
repo.

This works standalone, but unfortunately it breaks in
gnome-desktop-testing-runner as /tmp doesn't support
xattrs, so it is not installed atm.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 10:39:44 +01:00
Alexander Larsson
a3422791d4 Split out basic tests from test-basic.sh
This will let us reuse them with other repo types

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 10:39:44 +01:00
Colin Walters
038ba3dade tests: Fix u-boot test failure
This bit needs to be specific to syslinux.
2014-11-25 15:21:12 -05:00
Giuseppe Scrivano
bbd3fd7a22 tests: fix intermittent failure for test-sysroot
libtestExec doesn't run twice the same process now.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-11-10 19:48:45 +01:00
Colin Walters
97519b6c22 admin-test: Fix two typos in bootloader UI change
Based on a patch from Giuseppe Scrivano <gscrivan@redhat.com>
2014-11-06 18:22:20 -05:00
Matthew Barnes
e5b147c643 libostree: Reformat bootloader titles
Use the pattern:

  $PRETTY_NAME [$COMMIT_VERSION] (ostree[:$OSNAME][:$DEPLOYMENT_INDEX])

$OSNAME is only shown if there are multiple values.

$COMMIT_VERSION refers to the version tag in the commit's metadata.

$DEPLOYMENT_INDEX is only shown if no $COMMIT_VERSION is available.

https://bugzilla.gnome.org/show_bug.cgi?id=739416
2014-11-03 20:43:36 -05:00
Colin Walters
bcf40b4902 pull: Add depth support
For mirroring in particular, we really want to be able to traverse
all history.

$ ostree --repo=repo pull --mirror --depth=-1

https://bugzilla.gnome.org/show_bug.cgi?id=739240
2014-10-28 11:16:55 -04:00
Giuseppe Scrivano
7973a58607 checkout: permit checkout of a single file
fixes a coredump when using a command like:

$ ostree --repo=repo checkout -U --subpath=/usr/lib/passwd \
  fedora-atomic/rawhide/x86_64/docker-host usrlib-new

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-24 11:18:45 -04:00
Colin Walters
b43ce2329e tests: Add some versioning metadata and test it appears in status output
Followup to previous commits.
2014-10-23 11:24:44 -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
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
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
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
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
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
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
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
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
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
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
Anne LoVerso
3742c32945 repo-pull: Allow pulling only one directory
Changes the pull API to allow pulling only a single directory instead
of the whole deployment.  This option is utilized by the check-diff
option in rpm-ostree.

Add a new state directory to hold <checksum>.commitpartial files, so
we know that we've only downloaded partial state.
2014-08-20 15:09:32 -04:00
Colin Walters
82fb07e4ae deploy: Also honor multiply-specified kernel args with existing config
If we deployed a new tree inside an existing OS, inheriting kernel
args, we need to use append() instead of replace() to avoid collapsing
multiply specified kernel arguments like console=/dev/foo
console=/dev/bar.

Reported-by: Dusty Mabe <dusty@dustymabe.com>
2014-08-03 14:34:28 -04:00
Colin Walters
9bd229dff5 pull-local: Write detached metadata into the correct repository
We want to write to the dest repo, not src.

Noticed while reviewing this code for some other bug.

https://bugzilla.gnome.org/show_bug.cgi?id=733579
2014-07-22 15:43:33 -04:00
Colin Walters
cdaa9517af repofile: Avoid segfault if querying child in non-directory
The user might "ostree ls /usr/bin/bash/blah", which previously would
segfault.

A somewhat related future enhancement here would be for "ostree ls" to
follow symbolic links.

Reported-by: Dusty Mabe <dustymabe@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=733476
2014-07-21 07:58:07 -04:00
Colin Walters
e392820541 core: Do enumerate ff/ objects as well
An embarassing off-by-one here.  I noticed we weren't pruning them.

https://bugzilla.gnome.org/show_bug.cgi?id=733458
2014-07-21 07:25:51 -04:00
Anne LoVerso
fd56952d6b ostree-repo-resolve-rev: Add function to accept a partial checksum
This patch adds a function that will parse a partial checksum when
resolving a refspec.  If the inputted refspec matches a truncated
existing checksum, it will return that checksum to be parsed.  If
multiple truncated checksums match the partial refspec, it is not
unique and will return false.  This addition is inspired by the same
functionality in Docker, which allows a user to reference a specific
commit without typing the entire checksum.

partial checksums: Add function to abstract comparison

This modifies the list_objects and list_objects_at functions
to take an additional argument for the string that a commit starts
with.  If this string arg is not null, it will only list commit
objects beginning with that string.  This allows for a new function
ostree_repo_list_commit_objects_starting_with to pass a partial string
and return a list of all matching commits.  This improves on the
previous strategy of listing refs because it will list all commit objects,
even ones in past history.  This update also includes bugfixes on
error handling and string comparison, and changes the output structure
of resolve_partial_checksum. The new strcuture will no longer return FALSE
without error.  Also, the hashtable foreach now uses iter.  Also
includes modified test file
2014-07-18 15:15:44 -04:00
Colin Walters
b2329cf875 tests: Add a test for an empty /etc directory gaining content
https://bugzilla.gnome.org/show_bug.cgi?id=731924
2014-06-20 13:43:12 -04:00
Colin Walters
3d5ff5b542 tests: Add a test which exercises --fsync=false 2014-06-18 18:24:41 -04:00
Colin Walters
6a5e66b152 pull: Support --mirror option
There's several use cases for calling into ostree itself to do
mirroring, instead of using bare rsync.  For example, it's a bit more
efficient as it doesn't require syncing the objects/ directory.

https://bugzilla.gnome.org/show_bug.cgi?id=728351
2014-06-16 17:14:13 -04:00
Colin Walters
47610b45c2 Limit metadata to 10 MiB
If fetching GPG-signed commits over plain HTTP, a MitM attacker can
fill up the drive of targets by simply returning an enormous stream
for the commit object.

Related to this, an attacker can also cause OSTree to perform large
memory allocations by returning enormous GVariants in the metadata.

This helps close that attack by limiting all metadata objects to 10
MiB, so the initial fetch will be truncated.

But now the attack is only slightly more difficult as the attacker
will have to return a correctly formed commit object, then return a
large stream of < 10 MiB dirmeta/dirtree objects.

https://bugzilla.gnome.org/show_bug.cgi?id=725921
2014-05-27 14:15:27 -04:00
Colin Walters
a864190a04 admin switch: Allow switching just remote names
This is a followup to the previous commit; for the installation media
case we want to keep the current origin ref, and only switch remotes.
2014-05-15 08:58:44 -04:00
Colin Walters
24e1bf2552 admin switch: Support switching remotes as well
Say I have an installation from CDROM; the remote name may be
"installmedia" or something like that.  We want to allow also
switching remotes.
2014-05-12 17:31:34 -04:00
Colin Walters
a10ddca1da test-sysroot: Use GSystem to spawn subprocess
I was getting a weird hang in the installed tests with the shell as a
zombie process, not reaped by the parent, which was just stuck in
select() on the output pipes.  The thing is we don't actually want to
capture stdout/stderr, we just want to inherit.

GSystem.Subprocess makes that possible, so let's just use it now that
it's a proper installed library.
2014-03-19 09:15:38 -04:00
Colin Walters
f2e0162846 upgrade: Refuse chronologically older commits unless --allow-downgrade
We don't want to allow MITM attackers to intercept upgrade requests
and provide clients with older OS versions vulnerable to security
flaws.

Only "ostree admin upgrade" gets this behavior for now - whether we
want to do it for "ostree admin switch" is another question.
2014-02-20 18:25:56 -05:00
Colin Walters
26d5db696b tests: Fix up GPG tests for more strict EL7 GPG
These GPG tests were failing for me on EL7 - it appears to be because
we had only one directory for both private and public keys, and we
were giving that to ostree for verification, which passed them onto
gpgv.

In EL7 beta at least, gpgv now barfs if it finds a private key where
it is just expecting to find public keys.

Fix this by splitting out the public trusted directory from the
private key directory.  Except now for signing, we still need the
public key there, so symlink it.  Whee!
2014-02-10 09:40:35 -05:00
Colin Walters
2d6374822b Initial basic static delta code drop
This has a very basic level of functionality (deltas can be generated,
and applied offline).  There is only some stubbed out pull code to
fetch them via HTTP.

But, better to commit this now and improve it from a known starting
point, rather than have it languish in a branch.
2014-02-04 10:31:44 -05:00
Colin Walters
844c5ea652 core: Import bup's "rollsum" code, add a test case
For static deltas, one strategy that will be employed is to split each
object into chunks, and only include changed chunks in the deltas.
2014-02-04 10:12:56 -05:00
Colin Walters
390b781d3a pull: Add remotename:ref syntax
This is really the common case.
2014-01-21 08:57:34 +00:00
Colin Walters
3802a0679b tests/pull-corruption: Ensure we corrupt an object to be pulled
This test had some nondeterminism because we chose a random
object to corrupt, but because there were multiple commits, it
was possible that we chose an object that was not being pulled.

Fix this by writing some custom GJS code to find an explicitly random
object that exists in a given ref, an change a random byte offset.
This adds a lot more randomness to the testing too.
2014-01-19 13:19:10 -05:00
Colin Walters
0a9f246016 tests: Small tweaks to pull corruption test
This one is failing here, I suspect it's the generic pull race
condition, but these fixes should make it slightly more reliable.
2014-01-19 11:48:27 -05:00
Colin Walters
1a20ab4420 test-sysroot: Update for API change 2014-01-18 17:50:22 -05:00
Colin Walters
878a43411e admin/switch: New builtin to switch between trees
This is something I want to make easier, as it better showcases the
flexibility of OSTree.
2014-01-18 17:47:16 -05:00
Colin Walters
5034bf3a9d commit: Reject non-regular/non-symlinks earlier with better error message
Also avoid _NOT_SUPPORTED as that triggers the --help behavior from
the commandline; just use _FAILED.

https://bugzilla.gnome.org/show_bug.cgi?id=722410
2014-01-17 10:39:36 -05:00
Colin Walters
b2d0ba7ac1 deploy: Rework kernel arguments, add --karg-append to "admin deploy"
The "ordered hash" code was really just for kernel arguments.  And it
turns out it needs to be a multihash (for e.g. multiple console=
arguments).

So turn the OstreeOrderedHash into OstreeKernelArgs, and move the bits
to split key=value and such into there.

Now we're not making this public API yet - the public OstreeSysroot
just takes char **kargs.  To facilitate code reuse between ostree/ and
libostree/, make it a noinst libtool library.  It'll be duplicated in
the binary and library, but that's OK for now.  We can investigate
making OstreeKernelArgs public later.

https://bugzilla.gnome.org/show_bug.cgi?id=721136
2014-01-16 15:07:55 -05:00
Colin Walters
5bf6099a8b Unify uboot and syslinux test cases
The test-admin-deploy-1 was copied into -uboot at some point.  But
really they should be testing exactly the same thing, except for
the bootloader backend.

Unify these tests by extracting a common test core.
2014-01-15 09:48:04 -05:00
Colin Walters
108546c08c admin: Add --karg-proc-cmdline argument
When installing a new tree inside an existing OS, this is a convenient
way to include the command line arguments one needs (such as root=).
2014-01-15 09:19:32 -05:00
Colin Walters
54e58a51ca deploy: Write bootloader config even if just kernel arguments changed
The official way to add bootloader arguments to the current deployment
is to redeploy with --karg.  However, doing so tripped up an
optimization made inside the deployment code to just swap the
bootlinks if we're keeping the same "bootcsum".

Change this optimization to look at the pair of (bootcsum, options).
2014-01-15 09:19:32 -05:00
Colin Walters
091523a3bd sysroot: Error out on deploy --os=<unknown> which has not been initialized
We should hard require "ostree admin os-init foo" before letting
deployments go there; it's too easy to typo the argument.
2014-01-08 18:30:38 -05:00
Colin Walters
39e3c1bb8a ostree/remote-add: Add --no-gpg-verify option
To more conveniently disable GPG verification.
2013-12-25 14:17:36 -05:00
Roddy Shuler
fe5ed36461 core: Set mtime of content objects to 0
This is necessary to satisfy tools such as guile and python, which
compare mtimes to determine whether or not source files need to be
compiled.

https://bugzilla.gnome.org/show_bug.cgi?id=720363
2013-12-15 11:32:34 -05:00
Colin Walters
a24afd68f0 Move xattr handling into libgsystem, fix sysroot to handle directory ownership/perms
This large patch moves the core xattr logic down into libgsystem,
which allows the gs_shutil_cp_a() API to copy them.  In turn, this
allows us to just use that API instead of rolling our own recursive
copy here.

As noted in the new comment though, one case that we are explicitly
regressing is where the new /etc removes a parent directory that's
needed by a modified file.  This seems unlikely for most vendors now,
but let's do that as a separate bug.

https://bugzilla.gnome.org/show_bug.cgi?id=711058
2013-11-28 23:28:13 -05:00
Daniel Narvaez
03aa10f17d main/remote: Add a show-url operation to the remote command
Useful to get the remote url in scripts.

https://bugzilla.gnome.org/show_bug.cgi?id=710967
2013-10-28 09:14:23 -04:00
Colin Walters
c65923e642 Add OstreeAsyncProgress, use it for ostree_repo_pull
Several APIs in libostree were moved there from the commandline code,
and have hardcoded g_print() for progress and notifications.  This
isn't useful for people who want to write PackageKit backends, custom
GUIs and the like.

From what I can tell, there isn't really a winning precedent in GLib
for progress notifications.

PackageKit has the model where the source has GObject properties that
change as async ops execute, which isn't bad...but I'd like something
a bit more general where say you can have multiple outstanding async
ops and sensibly track their state.

So, OstreeAsyncProgress is basically a threadsafe property bag with a
change notification signal.

Use this new API to move the GSConsole usage (i.e. g_print()) out from
libostree/ and into ostree/.
2013-10-24 14:27:13 -04:00
Jeremy Whiting
f583c4ab0b core: Add size information to commit metadata
Add a --generate-sizes option to commit to add size information to the
commit metadata.  This will be used by higher level code which wants
to determine the total size necessary for downloading.
2013-10-19 11:56:51 -04:00
Colin Walters
b2a98f4ca3 sysroot: Handle deleting directories in /etc
We need to use the full shutil_rm_rf() in order to actually delete
complete directories.

Test suite code based on a patch from Sjoerd Simons <sjored@luon.net>

https://bugzilla.gnome.org/show_bug.cgi?id=710097
2013-10-15 14:56:43 -04:00
Colin Walters
3b700ccb50 core: Add code to read/write "varints"
Adapted from Google protobufs.  For several cases, we want to support
e.g. file sizes up to guint64, but paying the cost of 8 bytes for each
number is too high.

This will be used for static deltas and sizes metadata.
2013-10-11 12:21:37 -04:00
Colin Walters
af1c9b8721 tests: Extend test-sysroot.js further
Now covers a lot more of the API.
2013-10-04 10:52:05 -04:00
Colin Walters
07904c2457 sysroot: Support more arbitrary deployment changes
This commit changes the sysroot API so that one can create arbitrary
new deployment checkouts, then commit them as one step.  This is to
enable things like an automatic bisection tool which say create 50
deployments at once, then when done clean them up.

This also moves some printfs from the library into src/ostree.
2013-10-02 20:18:06 -04:00
Colin Walters
650aab7628 tests: Add a simple test-sysroot.js that covers OSTree.Sysroot
This will be more interesting as a test case user of the API.
2013-10-02 20:18:06 -04:00
Jeremy Whiting
7f9eefb62d pull: Verify commits with gpg signatures from detached metadata
This uses gpgv for verification against DATADIR/ostree/pubring.gpg by
default.  The keyring can be overridden by specifying OSTREE_GPG_HOME.

Add a unit test for commit signing with gpg key and verifying on pull;
to implement this we ship a test GPG key generated with no password
for Ostree Tester <test@test.com>.

Change all of the existing tests to disable GPG verification.
2013-09-29 14:49:47 -04:00
Jeremy Whiting
7d5aa74dae core: Use libgpgme to add GPG signatures to detached metadata for commit object
Add an optional dependency on gpgme to add GPG signatures into the
detached metadata, with the key "ostree.gpgsigs", as an "aay", an
array of signatures (treated as binary data).

The commit command gains a --gpg-sign=<key-id> argument.  Also add an
argument --gpg-homedir to set the GPG homedir where we look for
keyrings.
2013-09-28 16:12:35 -04:00
Colin Walters
0f486105db remote-add: Add --set=KEY=VALUE option
This can be used to add a remote and set e.g. tls-permissive=true, or
gpgverify=false.
2013-09-28 12:00:16 -04:00
Colin Walters
7d72a4b941 pull: Also fetch detached commitmeta files
These will contain GPG signatures and the like in the future, so we
should fetch them now.
2013-09-26 14:36:06 -04:00
Javier Martinez Canillas
4df1d0644f tests: Fix U-Boot test case
commit 08b873457 ("deploy: Remove checksum from generated loader entries")
changed the generated loader entries file names thus making the U-Boot test
case to fail since this test parsed those files.

Fix test-admin-deploy-uboot.sh by looking to the updated files names.

https://bugzilla.gnome.org/show_bug.cgi?id=708511

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
2013-09-21 11:05:01 -04:00
Colin Walters
298625d7f8 deploy: Correctly swap bootloader version with new boot checksums
If we had two deployments with different boot checksums, and were
trying to remove the one that was the same and add a new one (the
normal case), we'd end up assuming due to comparison with 0 that
we only needed to do the fast subbootversion swap.

Fix this by actually putting 1 where we really mean 1.

And update the tests to verify the fix; I have double-verified by
undoing the fix, and noting that the test fails.

https://bugzilla.gnome.org/show_bug.cgi?id=708351
2013-09-20 11:21:08 -04:00
Colin Walters
08b8734576 deploy: Remove checksum from generated loader entries
The actual deployment checksum shouldn't be in there, because we may
just swap bootlinks, rendering the name of the old bootloader entry
file invalid.  Thankfully nothing actually parsed the names of these
files, so let's just use the index.
2013-09-19 22:41:33 -04:00
Colin Walters
d1bc9e2acf deploy: Some minor assertion and error message improvements
To help debug https://bugzilla.gnome.org/show_bug.cgi?id=708351

Plus run a status consistently in the tests.
2013-09-19 22:23:19 -04:00
Colin Walters
b4082d5642 test-core.js: Add standard copyright header
Like everything else.
2013-09-18 16:34:57 -04:00
Colin Walters
58a8d6d6ef tests: Add a gjs-based test
This covers introspection, and in general is a much better way to get
API coverage tests.
2013-09-18 12:02:12 -04:00
Javier Martinez Canillas
3715b0cc82 admin: add U-Boot backend test case
OSTree now supports a backend for the U-Boot bootloader,
add a test case for this.

https://bugzilla.gnome.org/show_bug.cgi?id=708069

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
2013-09-15 12:46:39 -04:00
Javier Martinez Canillas
ae61abb029 tests: allow setup_os_repository to create U-Boot stub config
Currently OSTree supports two bootloader backends: syslinux
and U-Boot; allow to create a stub configuration for both.

https://bugzilla.gnome.org/show_bug.cgi?id=708069

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
2013-09-15 12:46:39 -04:00
Javier Martinez Canillas
f19ba12360 tests: don't create a syslinux stub unconditionally in libtest
libtest.sh has an setup_os_repository() helper function tha is
used by many tests to setup an OSTree initial repository.

This function creates an syslinux configuration unconditionally
but OSTree supports other bootloader backends besides syslinux.

So, is better to conditionally create a syslinux configuration
only when it is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=708069

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
2013-09-15 12:46:39 -04:00
Colin Walters
ac2d61dd51 core: Add detached metadata, readd metadata to commits
Previously I thought we'd have to ditch the current commit
format to avoid a{sv} due to

See https://bugzilla.gnome.org/show_bug.cgi?id=673012

But I realized that we don't really have to care about
unpacking/repacking commit objects, so let's just re-expose the
existing metadata a{sv} in commits in the API.

Also, add support for "detached" metadata that can be updated at any
time post-commit.  This is specifically designed for GPG signatures.

https://bugzilla.gnome.org/show_bug.cgi?id=707379
2013-09-09 17:01:32 -04:00
Colin Walters
b2625268aa tests: Drop kernel modules from checksums
We can actually share these across different kernels.  Thanks to
Tobias Hunger <tobias.hunger@gmail.com> for pointing this out.
2013-08-30 18:12:31 -04:00
Colin Walters
c9d7050d3d main: Support passing bare directory names to commit
It segfaulted before if you passed non-options, and a single directory
name is probably what people want.
2013-08-28 17:32:21 -04:00
Jeremy Whiting
499df2a90b pull: Add support for resuming downloads via range requests
Use a consistent temporary filename to download uri's.
Check for downloaded files before fetching from uri.
Download to hash.part file, then copy/move to hash.done when complete.
Add argument support to setup_fake_remote_repo1 function.
Add test for pull resume.
To implement this, pass --force-range-requests into the trivial-httpd,
which will only serve half of the objects to clients at a time.

https://bugzilla.gnome.org/show_bug.cgi?id=706344
2013-08-28 14:35:54 -04:00
Jeremy Whiting
902848cd71 test: Improve pull corruption test
To verify pull with a second repo works.
2013-08-27 20:35:45 -04:00
Colin Walters
8abad0b452 admin: Write out correct version fields in boot/loader/entries files
Before, we were writing the "bootversion", which is either 0 or 1, for
all entries.  This is completely wrong; the idea of the "version"
field is to compare between entries.

Fix this by writing out the inverted index - internally, index 0 is
the *first* boot entry, so we give it the highest version number, and
index N is the last, so give it version 0.

Then fix the deployment sorting code to correctly reverse the version
number comparison, so we read back the right order.

In practice before this bug didn't matter because "normally" you only
have at most two deployments.

https://bugzilla.gnome.org/show_bug.cgi?id=706546
2013-08-22 05:46:11 -04:00
Javier Martinez Canillas
2033edc658 test: fix a trivial typo in libtests.sh
When running the test-admin-deploy-1.sh unit test,
cat shows the following error:

cat: boot/vmlinuz-3-6.0: No such file or directory

due a trivial typo in the kernel image file name.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=706371
2013-08-20 06:46:52 -04:00
Colin Walters
1ec7c30408 core: Remove old "archive" mode
We'll always have "bare" mode for keeping files-as-hardlinks as root.
But "archive" was my second attempt at a format for non-root file
storage, used by the gnome-ostree buildsystem which runs as non-root.

It was really handy to have a "tar" like mode where I can create
tarballs as a user, that contain files owned by root for example.

The "archive" mode stored content files as two pieces in the
filesystem; ".file" contained metadata, and ".filecontent" was the
actual content, uncompressed.  The nice thing about this was that to
check out a tree as non-root, you could just hardlink into the repo.

However, archive was fairly bad for serving via HTTP; it required
*two* HTTP requests per content object, greatly magnifing the already
inefficient fetch process.  So "archive-z2" was introduced.

To allow gnome-ostree to still check out trees as a user, the
"uncompressed-object-cache" was introduced, and that's how things have
been working for a while.

So we should just be able to kill this code.  Specifically note just
how much better the stage_object() function became.

https://bugzilla.gnome.org/show_bug.cgi?id=706057
2013-08-16 22:56:42 -04:00
Stef Walter
f9b2c45fc0 Add 'ostree reset' command to undo a bad commit
Accepts the following arguments: ref checksum

Checks that the checksum is a parent of the ref before rewriting
the ref.

https://bugzilla.gnome.org/show_bug.cgi?id=705979
2013-08-16 17:28:43 +02:00
Stef Walter
3989e0d397 Add 'ostree log' command
Follows the parent of commits showing each in turn until it reaches
the top of the commit tree.

https://bugzilla.gnome.org/show_bug.cgi?id=705973
2013-08-15 07:01:30 +02:00
Stef Walter
790132a81a Intelligible display for 'ostree show'
Show something similar to git metadata display. Show raw variant
data when --raw is specified

https://bugzilla.gnome.org/show_bug.cgi?id=705973
2013-08-15 06:48:25 +02:00
Colin Walters
f68ac018c2 test-xattrs: Skip if current FS doesn't support user_xattr
tmpfs doesn't =(
2013-08-14 20:46:46 +02:00
Stef Walter
1904e3e0f4 Don't pass non-checksums to ostree_repo_has_object()
The 'ostree show' command passed non-checksum arguments
to the ostree_repo_has_object() function which led to
an assertion.

https://bugzilla.gnome.org/show_bug.cgi?id=705967
2013-08-14 16:08:18 +02:00
Colin Walters
8c31e6fda7 tests: Add xattr test case
Since it was broken up until now for multiple attributes =(
2013-08-14 15:07:14 +02:00
Colin Walters
760b866104 main: Assume / for ls if no path given
Since it just is kind of a sane default.
2013-07-27 20:12:07 -04:00
Colin Walters
187c75eae5 main: Support using repo from current directory
$ cd repo
$ ostree ls foo /
...

Can be a lot more convenient than typing --repo=repo a lot.
2013-07-24 14:05:12 -04:00
Colin Walters
c9b61cbfee Drop support for related objects and metadata in commit objects
While the actual commit object format is presently the same, for a
number of reasons we'd like to change it fairly radically.  Among
other things, we need to drop our a{sv} types in objects, to protect
against GVariant changing format.

Since now gnome-ostree now longer uses related objects, and nothing
ever used metadata, just drop them both.
2013-07-24 12:59:27 -04:00
Colin Walters
3b9da094d8 main: Drop log builtin
We may revive this later, but commits in their current form aren't
very useful for humans to read, so it doesn't make sense to have a
tool to show a history of useless stuff.

More interesting things are diffs between commits, object statistics,
etc.
2013-07-23 18:19:14 -04:00
Colin Walters
3d7bff2d41 admin: Add an "undeploy" command
Otherwise it's really easy to keep accumulating deployments.  Also, we
may want to run this after rebooting, so we're back down to one
operating system.
2013-07-23 09:19:24 -04:00
Colin Walters
67823beb1f core: Don't strip setuid bits when creating files
This ugly regression occurred because I overlooked the fact that our
chown() invocation would strip off setuid.
2013-07-18 14:23:55 -04:00
Colin Walters
f0c5a5f334 main: Add --delete option to fsck
This is useful for clearing out all corrupted objects locally.
2013-07-18 12:09:44 -04:00
Colin Walters
a40b09310c tests: Add a test for link checkout speedup 2013-07-17 19:47:40 -04:00
Colin Walters
62a896350b Drop support for fifos and devices
While the first was useful way back in the day when we were importing
Debian bits and /sbin/init was expecting to find /dev/.initctl as a
named pipe, that's no longer an issue with systemd since it uses
dynamic Unix sockets.

Likewise, character and block devices in /dev are now dynamically
created by the devtmpfs from the kernel.

Less complexity and code here if we just support directories, regular
files, and symbolic links.
2013-07-16 09:35:44 -04:00
Colin Walters
fb93b95807 admin: Rename prune -> cleanup, avoid doing repo prune twice
Calling it "cleanup" is better since it does more than repo pruning.

We were also doing a prune twice; ot_admin_cleanup() already does one,
so drop the bits to do it in cleanup.c.
2013-07-15 16:13:12 -04:00
Colin Walters
420763e90d tests: Add a test of corruption during a pull process
These corruption tests could be a lot better...like randomly try
single bit flips, range flips.  Better, content-aware fuzzing.  But
this is useful for now.
2013-07-09 11:28:49 -04:00
Colin Walters
43d69ac8a3 tests: Drop numeric prefix
Theoretically it's useful to have layers of tests, but in practice
it's just annoying to assign numbers.
2013-07-09 10:41:07 -04:00
Colin Walters
bea4a7538f Fix test reference to obsolete ostree-pull
It was leftover in my buildroot =/
2013-07-09 09:28:02 -04:00
Colin Walters
c66148160c admin: Also delete unsed boot directories
My VM filled up /boot.  Oops.
2013-07-07 13:45:18 -04:00
Colin Walters
bb6eedfb25 [INCOMPATIBLE CHANGE] Implement new deployment model
See https://wiki.gnome.org/OSTree/DeploymentModel2

This is a major rework of the on-disk filesystem layout, and the boot
process.  OSTree now explicitly supports upgrading kernels, and these
upgrades are also atomic.

The core concept of the new model is the "deployment list", which is
an ordered list of bootable operating system trees.  The deployment
list is reflected in the bootloader configuration; which has a kernel
argument that tells the initramfs (dracut) which operating system root
to use.

Invidiual notable changes that come along with this:

1) Operating systems should now come with their etc in usr/etc; OSTree
   will perform a 3-way merge at deployment time, and place etc in
   the actual root.  This avoids the need for a bind mount, and is
   just a lot cleaner.
2) OSTree no longer bind mounts /root, /home, and /tmp.  It is expected
   that the the OS/ has these as symbolic links into /var.

At the moment, OSTree only supports managing syslinux; other
bootloader backends will follow.
2013-07-07 11:31:26 -04:00
Colin Walters
ec21dc4242 Add "trivial-httpd" builtin, use it in tests
A simple HTTP server implementation is so few lines of code when one
is linking to libsoup anyways, so let's just have one here in ostree
that will be used for the test suite.

This allows us to run the archive tests that previously required
apache even in gnome-ostree.
2013-07-05 16:28:40 -04:00
Colin Walters
2ed49a3749 tests: Pull from file:/// only works with archive-z right now 2013-07-02 11:24:07 -04:00
Colin Walters
a93f2b8d16 pull: Make fetcher work for file:/// URIs too
Even if very suboptimally, for now; we copy the files, then copy them
again.

The obvious long term plan is to merge pull-local and pull together,
but truly optimizing that requires the pull code to know how to use
the OstreeRepo APIs when operating on local repositories (as
pull-local does), rather than assuming the remote is an archive-z
fetched over HTTP.
2013-07-01 22:43:17 -04:00
Colin Walters
dc0f3c3dcb Add support for deleting refs
The internal API will be used by admin, and "ostree refs --delete"
is handy for interactive management.
2013-07-01 15:41:27 -04:00
Colin Walters
5b3fca8426 Add "refs" builtin
This is just useful to look at before pruning, etc.
2013-06-29 14:51:08 -04:00
Colin Walters
aa1eb19eea Add a bit more testing for prune 2013-06-29 14:02:17 -04:00
Colin Walters
a167bb7342 pull-local: Support --remote argument
For offline upgrades, pull-local can now write the refs into a
specific remote, rather than using the local heads.
2013-06-29 13:00:42 -04:00
Colin Walters
82f444020e Add a --version argument that also outputs features
And use it in the tests to skip libarchive tests when the build
doesn't support it.
2013-05-01 19:15:06 -04:00
Colin Walters
b1ace57ef8 archive-test: Handle umask of 022 or 002
Red Hat appears to default to 002, whereas Debian systems default
to 022.  Fun.
2013-05-01 18:43:01 -04:00
Colin Walters
e9a181c67d Install tests
Matching https://live.gnome.org/GnomeGoals/InstalledTests
2013-05-01 15:26:21 -04:00
Colin Walters
c60c70e9a9 checkout: Add --allow-noent option
This is useful for the gnome-ostree build system where each build is
one commit, but it's split up into /runtime /devel /debug etc. trees.
Ideally we wouldn't have a /debug subdirectory for "noarch"
components for example.

So add an option to not error out if the given path doesn't exist in
the commit.
2013-05-01 12:15:02 -04:00
Colin Walters
a268b53dc9 run-apache: Use -DFOREGROUND, not -X
-X implies debug mode which limits the workers to 1, which totally
kills parallelism.
2013-04-01 18:55:35 -04:00
Colin Walters
bde7e5c719 pull: Drop support for original archive repositories
For future refactoring here, it's just too complex to maintain support
for both of them, and the advantages of archive-z2 outweigh archive
too much.
2013-03-29 17:22:56 -04:00
Colin Walters
8a2628fc2c tests: Update expected diff output
For previous diff commit.
2013-03-26 08:29: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
7aa620109e Add tests missing from previous commit 2012-09-23 19:25:09 -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
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
aa9aaa9a62 tests: Drop tests of removed --atomic-retarget option 2012-09-23 15:56:28 -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
eba0ff75cc tests: Just use OT_TESTS_DEBUG to say "save test data" 2012-06-21 11:42:45 -04:00
Colin Walters
c18817eca1 tests: Tweak valgrind suppression 2012-05-18 16:30:44 -04:00
Colin Walters
0fc291b954 core: Drop --link-cache option, we do it by default now for archives 2012-05-04 16:10:30 -04:00
Colin Walters
8d926c3e36 core: Add valgrind framework, plug various memory leaks 2012-05-04 10:04:32 -04:00
Colin Walters
d4321629f4 core: Rename local-clone to pull-local
Also change it to copy selective refs, rather than enumerating
all objects.
2012-05-01 17:44:29 -04:00
Colin Walters
9cb87ffc07 core: pack: Add --metadata-only argument
Useful for bare repositories.
2012-04-29 12:15:12 -04:00
Colin Walters
5947b5b145 core: Add ability for repositories to have a "parent"
This will be useful for ostbuild; a user can create their own archive
mode repository which transparently inherits objects from the
root-owned one in /ostree.
2012-04-18 23:12:34 -04:00
Colin Walters
262f426997 core: Add --link-cache option to checkout
This is a convenient way to have a lookaside directory of hard links,
which can greatly speed up checkouts.  In the future we probably want
to push this down into the repository.
2012-04-13 14:33:38 -04:00
Colin Walters
38ef75e6e0 core: Re-unify on one OSTREE_OBJECT_TYPE_FILE
Having the archived vs not distinction in the object system wasn't
useful in light of pack files.  In fact, we should probably move
towards generating a pack file per commit by default.
2012-04-11 22:27:59 -04:00
Colin Walters
188621f0b2 core: Drop 'compose' builtin
We'll just add this functionality to commit.
2012-04-11 19:54:55 -04:00
Colin Walters
3a847a571b tests: Actually test pack functionality
With --keep-loose we were just using the loose objects.
2012-04-11 19:54:28 -04:00
Colin Walters
bae584c64a core: Associate branches with remotes, move trigger runs into checkout
Also add --atomic-retarget option to checkout. This does the magical
symlink dance to do atomic swaps between trees.
2012-04-03 23:46:34 -04:00
Colin Walters
80bdfd7f42 core: Add pack files
This concept is also directly inspired by git.  At present, our
implementation is quite similar, except we don't have delta
compression.
2012-03-31 11:51:47 -04:00
Colin Walters
76bc35186e core: Add --union mode to checkout
This is another step towards ostbuild using this instead of the
"compose" builtin.
2012-03-06 11:59:06 -05:00
Colin Walters
4db485dd5f core: Add "subpath" option to checkout
Will be used by ostbuild to extract e.g. /runtime or /devel from
artifacts.
2012-03-06 11:59:06 -05:00
Colin Walters
eb7c3d01a3 core: Add 'cat' builtin 2012-03-06 11:59:06 -05:00
Colin Walters
d3a73225b0 core: Add API to enumerate all refs 2012-02-27 05:58:42 -05:00
Colin Walters
e8dbaa3c07 core: Add generic "commit filter" API, use it to implement statoverride
The builder wants the ability to mark a given file as e.g. setuid.  To
implement this, the repo now has a callback-based API when importing a
directory to modify or remove items.

The commit tool accepts a "statoverride" file as input which looks like:

+mode /path/to/file
2012-01-22 13:27:38 -05:00
Colin Walters
a322ecacba core: Fix test now that ls prints actual size 2012-01-22 13:10:01 -05:00
Colin Walters
e36c48f923 core: Fix compose tests 2012-01-11 14:33:13 -05:00
Colin Walters
0044ff133a core: Add from-file argument to compose
We don't want to have to pass a million arguments.
2012-01-10 18:55:00 -05:00
Colin Walters
95d0e94370 core: Make --recompose skip passed arguments if they were already composed
This allows us to do "--recompose -b foo bar baz" and add bar and baz
iff they weren't already there.
2012-01-06 14:04:39 -05:00
Colin Walters
5119cbdb7c core: Add --no-xattrs option for commit
Will be used by ostbuild.
2012-01-05 19:10:26 -05:00
Colin Walters
af62271eed tests: Fix metadata test, we removed the spurious = 2011-12-27 10:31:23 -05:00
Colin Walters
1687f3efa8 core: Add --add-metadata-string option for commit
A convenience function for the common case of slapping a string into
the metadata.
2011-12-23 07:17:46 -05:00
Colin Walters
2e48474263 core: Fix libarchive test count 2011-12-23 07:12:03 -05:00
Colin Walters
3e59cc1305 core: Add --tar-autocreate-parents option for commit
The tar files we're making of artifacts don't include parent
directories.  Now we could change the builder to make them, but we can
also just autocreate them on import.  Mode 0755 with no xattrs seems
OK here.
2011-12-23 06:49:04 -05:00
Colin Walters
dab4611263 core: Add --skip-if-unchanged option for commit
There's not much point for OS builds to have "empty" commits.
2011-12-22 18:47:30 -05:00
Colin Walters
3292dcb6d6 core: Allow / in ref names like git does
Using / is nice basically.
2011-12-22 15:59:47 -05:00
Colin Walters
8a499c4a2a core: Add --recompose option for compose
This will allow us to easily regenerate a compose without passing the
full list of components each time.
2011-12-22 10:29:16 -05:00
Colin Walters
e9fd921afe core: Change compose to operate purely in-memory
This is *significantly* faster than checking out each branch into the
real filesystem, then importing it again.
2011-12-21 21:42:13 -05:00
Colin Walters
add55849ab core: Allow specifying a previous commit tree as a basis for a new commit
It's pretty trivial to map a previously existing commit tree into a
mutable tree too.  While we're here change the command line arguments
for commit so that we can now properly overlay any combination of
directory, commit, or tarfile.
2011-12-21 20:10:10 -05:00
Colin Walters
bdfde03b61 core: Support committing multiple tarballs in the same transaction
ostbuild will generate two artifacts: foo-runtime.tar.gz and
foo-devel.tar.gz in the general case.  When committing to the devel
tree, it'd be lame (i.e. slower and not atomic) to have to commit
twice.
2011-12-20 17:21:15 -05:00
Colin Walters
11d57d63e3 core: Support --owner-uid and --owner-gid options for commit
This allows us to more easily import user-built tarballs into
a root-owned OSTree repo.
2011-12-18 17:36:46 -05:00
Colin Walters
a287274935 tests: Ensure we quote grep pattern
Otherwise we fail if the pattern starts with -
2011-12-18 17:35:30 -05:00
Colin Walters
134283afbf core: In user mode checkouts of archives, use hard links
Now that we've done all the gyrations to separate content from
metadata in archives, we can just hard link when doing user checkouts.
2011-12-15 16:12:31 -05:00
Colin Walters
78f435d245 core: Fix handling of hardlinks for tar commits
We were creating files with the wrong name.  Add a test.
2011-12-04 14:38:30 -05:00
Colin Walters
17cc772cf3 core: Support for committing from any libarchive-supported format
We really want the ability to take a .tar.gz and directly import
it into a repository, without creating a temporary filesystem tree.

First, doing it this way is significantly faster.  Also, this allows
us to handle importing tar files with e.g. uid 0 files into packed
repositories as non-root, which is very useful for tests and builds.
2011-12-04 14:08:55 -05:00
Colin Walters
e8865af09e core: Split pull functionality into separate ostree-pull binary
This is to avoid everything depending on libsoup.
2011-11-30 09:21:14 -05:00
Colin Walters
7e32bc6cd7 core: Make commit always operate on directory contents, not file list
This simplifies things significantly, at some cost in flexibility.
We'll later add the ability to e.g. filter out files by regular
expression.
2011-11-28 12:57:25 -05:00
Colin Walters
a042731673 core: Add local-clone builtin
This is useful for converting between e.g. archive and non-archive
repositories.
2011-11-18 18:50:53 -05:00
Colin Walters
12f2d89174 core: Add checksum builtin
This necessitated reworking things so that builtins can specify no
--repo is required.
2011-11-18 07:29:13 -05:00
Colin Walters
b8cef545d1 core: CHANGE CHECKSUM ALGORITHM, port checksum API to GFile
This commit originally was to port ostree_stat_and_checksum_file() to
GFile*, but I noticed that the checksum code was reading data in host
endianness.  Fix that while we're here.

This invalidates all existing repositories.
2011-11-17 19:32:01 -05:00
Colin Walters
8e9b9c59d6 core: Fix pull to actually download files too 2011-11-17 10:40:55 -05:00
Colin Walters
4a26be1bef core: diff: Correctly handle files changing type 2011-11-16 23:09:32 -05:00
Colin Walters
e759c1cce5 tests: Fix number of tests 2011-11-16 22:51:56 -05:00
Colin Walters
9fb390664a core: Implement diff command 2011-11-16 18:16:41 -05:00
Colin Walters
659c99417c Switch to LGPLv2+ for most code
Since we're making a shared library, it should be usable by non-GPL
apps.

To allow more code sharing between the core and the tests, move them
to the LGPLv2+ too.

A few bits of test and other code are still GPL.  See the new COPYING
file for more information.
2011-11-10 13:17:04 -05:00
Colin Walters
a103218fd1 core: Support named pipes
This is mainly useful for sysvinit's "/dev/initctl".
2011-11-09 09:08:58 -05:00
Colin Walters
1d23e4b8e8 core: Actually return an error from fsck
And add some tests that fsck reports an error.
2011-11-09 08:27:47 -05:00
Colin Walters
8bda1c6a84 tests: Add OT_TEST_DEBUG environment variable 2011-11-09 05:29:53 -05:00
Colin Walters
2be1407622 commit: Drop the ability to --add --remove
This forces us to have two code paths for doing a commit; let's just
drop this ability for now since it's not very useful.
2011-11-08 18:58:01 -05:00
Colin Walters
ea6a761265 Reorder compose and pull tests 2011-11-04 16:14:12 -04:00
Colin Walters
9877f7eea3 tests: A few more compose tests 2011-11-04 16:13:21 -04:00
Colin Walters
ed90bf77cc core: Make compose commits contain metadata about their composition
This allows tracking of their history better.
2011-11-04 15:59:08 -04:00
Colin Walters
d2cb5fb49a core: Support actually adding metadata to commits 2011-11-04 15:59:08 -04:00
Colin Walters
889f454cb1 tests: Make GLib warnings fatal 2011-11-04 15:59:08 -04:00
Colin Walters
dd37e46172 tests: Output errors to stderr, so they show up under "prove" 2011-11-04 12:31:40 -04:00
Colin Walters
b15eee447a commit: Support reading current directory rather than requiring 'find'
Implement 'find' internally.
2011-11-04 10:53:47 -04:00
Colin Walters
d6b3fb5118 core: Take --repo as the first argument
I kept doing this over and over...it feels more natural.  The "prefix"
thing was (almost) unused anyways, and it was easy enough to replace.
2011-11-03 23:08:28 -04:00
Colin Walters
3b61a21c0f tests: Add some more tests of compose content 2011-11-03 22:35:42 -04:00
Colin Walters
69f104c558 core: Make compose its own builtin
This will allow more flexibility down the line.
2011-11-03 22:32:06 -04:00
Colin Walters
d23f203108 core: Add ostree checkout --compose
This allows merging e.g. multiple artifact trees into one big tree.
2011-11-03 21:50:00 -04:00
Colin Walters
2b00cf3810 core: add ^ for rev-parse 2011-11-02 13:22:13 -04:00
Colin Walters
796dc7fc57 core: remove stub http backend for now
The plain http pull is probably good enough.
2011-11-02 12:43:25 -04:00
Colin Walters
3ceec68a54 pull: Properly clean up after test 2011-11-01 12:35:50 -04:00
Colin Walters
e125dffbfd misc test fixes 2011-11-01 08:49:01 -04:00
Colin Walters
c910f29c00 Consolidate tests
Rather than having a ton of separate tests, be like git and have
a "basic" test that does a lot of the, well, basics.
2011-10-31 22:42:14 -04:00
Colin Walters
a160a2a5fa Add support for pulling from remote archives
This necessitated a large set of changes.

We now support an "archive" mode for repositories.  In this mode,
files are stored "packed" rather than hard linked.  This allows one to
e.g. store an OSTree repository with root-owned files as non-root.  It
is also used as the basis for serving repositories via HTTP.

While doing this I realized that GVariant is endianness-dependent; I
decided to just store all data in big endian.
2011-10-31 20:28:47 -04:00
Colin Walters
79cff61ae8 ostree-http-server: Exit when our directory goes away 2011-10-28 16:56:50 -04:00
Colin Walters
dc6a355f76 ostree-http-server: New simple HTTP server for tests 2011-10-28 16:26:37 -04:00
Colin Walters
d2938ad6cc core: Add "ostree remote add" 2011-10-28 10:25:36 -04:00
Colin Walters
ee4edf114b Don't default to "master", require a branch
It doesn't really make sense to have a default branch, since we expect
people to have multiple roots.  Thus, require a branch
specification always.
2011-10-27 21:42:44 -04:00
Colin Walters
dd13d172ef core: Add rev-parse builtin 2011-10-27 15:44:08 -04:00
Colin Walters
7ca1c3d2e7 core: remove HEAD file, use branches instead
HEAD in git describes a working copy, and we don't have those.
Instead, default to a "master" branch.  This also lets us support
multiple branches.
2011-10-27 14:32:05 -04:00
Colin Walters
d0b3a07cf1 core: Fix checksum for symlinks walking off into uninitialized memory 2011-10-26 18:33:33 -04:00
Colin Walters
b27df6fd72 "Hacktree" is now known as "OSTree"
It just sounds better.
2011-10-18 14:44:48 -04:00
Colin Walters
97003b48da Add log builtin
The "less" spawning is buggy for some reason =(
2011-10-15 15:43:43 -04:00
Colin Walters
c768c2a746 Support for committing files from stdin or a file list file 2011-10-15 13:07:26 -04:00
Colin Walters
2bd973f645 Make file deletion work, add test 2011-10-15 09:56:31 -04:00
Colin Walters
05c35f2cf7 Actually checksum xattr values, not just names
We need to call lgetxattr() and not just llistxattr().
2011-10-15 03:03:51 -04:00
Colin Walters
3eb77d4ce8 Importing and checking out nested trees works! 2011-10-15 01:23:01 -04:00
Colin Walters
401ab27c11 checkout: New command 2011-10-15 00:45:07 -04:00
Colin Walters
f16aad3710 We can commit multiple times now 2011-10-14 23:17:50 -04:00
Colin Walters
98a043c671 Add probably working commits 2011-10-14 21:09:11 -04:00
Colin Walters
5e0d58dd72 tests: Support saving temporary directory 2011-10-14 21:09:11 -04:00
Colin Walters
42a3a68d17 Add test for --repo 2011-10-14 21:09:10 -04:00
Colin Walters
f90994320b Add a COPYING, and put GPL headers in more places 2011-10-12 16:50:55 -04:00
Colin Walters
03425c0dcd Initial test suite 2011-10-12 16:46:23 -04:00