Colin Walters
2534714501
core: Make ostree_write_variant_with_size() private
...
More work making the file formats and utilities private.
2013-09-04 07:49:41 -04:00
Colin Walters
0d72168961
libostree: Make the format of file objects private
...
It's now isolated almost entirely to ostree-core.c, except
ostree-repo.c needs to know how to create archive-z2 file headers. So
give it a private API for that.
2013-09-03 18:43:42 -04:00
Tobias Hunger
ed56908ccb
Fix warnings about unused variables
2013-08-30 14:23:45 -04:00
Colin Walters
00c352ba67
libostree: Delete some leftover remnant API for archive files
2013-08-17 14:08:04 -04:00
Colin Walters
0f9d7d2179
libostree: More gtk-doc updates for ostree-core
2013-08-17 10:54:00 -04:00
Colin Walters
abe2320039
libostree: Fix many gtk-doc warnings
2013-08-17 08:41:31 -04:00
Colin Walters
c3121b52bc
libostree: Document more core macros
2013-08-17 08:21:04 -04:00
Colin Walters
17560a57bf
Add gtk-doc support
...
Yes, it's really me. Colin Walters. Writing documentation. You
don't need to do a DNA test.
2013-08-16 22:56:12 -04:00
Colin Walters
a04bda126c
core: Use gs_stream_fstat()
...
Just a cleanup.
2013-08-15 14:21:26 -04:00
Colin Walters
6bb4ea46ab
core: Add some more gtk-doc
2013-08-15 11:17:16 -04:00
Colin Walters
1f35655ac1
core: Add some gtk-doc
...
Just documenting a few functions to get in the habit of things.
2013-08-15 07:04:29 -04:00
Stef Walter
5efb8e86e9
Add ostree_commit_get_parent() to get parent from variant
...
https://bugzilla.gnome.org/show_bug.cgi?id=705973
2013-08-15 06:52:53 +02:00
Colin Walters
d9f59c6fd5
core: Add API to convert checksum -> csum in place
...
We already have the opposite, and this will be used in some
places to avoid a malloc.
https://bugzilla.gnome.org/show_bug.cgi?id=706031
2013-08-14 19:49:54 -04:00
Colin Walters
76cd7ae4ea
libotutil: Add API to create an "ay" GVariant from GBytes
...
We used to have a version of this, but since I'm trying to use
GBytes more, this became a more common operation, and it's annoying
to type out the whole G_VARIANT_TYPE ("ay") each time, and pass
TRUE for trusted.
https://bugzilla.gnome.org/show_bug.cgi?id=706031
2013-08-14 19:23:33 -04:00
Stef Walter
97947373ee
Add some verbose log output when xattr functions fail
...
If any of the system xattr functions fail, clearly write out the
reason in the verbose log output.
https://bugzilla.gnome.org/show_bug.cgi?id=705893
2013-08-14 07:50:49 +02:00
Stef Walter
3f9c150b77
Don't use XATTR_REPLACE with lsetxattr()
...
If we pass XATTR_REPLACE then the attribute must already exist, which
is not our intent. Passing zero creates the attribute if necessary,
or replaces it when it already exists.
https://bugzilla.gnome.org/show_bug.cgi?id=705893
2013-08-13 15:42:54 +02:00
Stef Walter
c246c4194f
Properly separate sorted xattr names
...
We expect to be handling a string delimited by \0 characters, as
returned by llistxattr(). So stick to that behavior here.
https://bugzilla.gnome.org/show_bug.cgi?id=705893
2013-08-13 15:42:54 +02:00
Colin Walters
71c4ea67f7
core: Clean up temporary file creation
...
Use new libgsystem API, don't expose the repo's tmpdir.
2013-08-06 23:58:29 +02:00
Colin Walters
a5d43bb959
Install a shared library
...
This required a fair bit of surgery because previously ostree.h
included otutil.h, but that's supposed to be a private library.
2013-07-26 19:25:07 -04:00
Colin Walters
74b2c7aab3
core: Work around libguestfs/FUSE issue with setuid binaries
...
For some reason, the setuid bits are being stripped. This
workaround is enough for now.
2013-07-26 14:48:15 -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
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
444234e7db
core: Use gsystem API for generating temporary names
...
Drops duplicated code.
2013-07-16 08:51:53 -04:00
Colin Walters
acdf1ca4fe
core: Use gs_file_create()
...
This allows us to drop a chmod() invocation, since the regular file
path was the only thing that didn't handle mode.
2013-07-16 08:51:53 -04:00
Colin Walters
124416d832
Use AC_USE_SYSTEM_EXTENSIONS instead of #define _GNU_SOURCE
...
It's less copy/paste, works everywhere, etc.
Also fix some missing #include "config.h".
2013-07-10 13:25:35 -04:00
Colin Walters
4b170d656c
Switch to libgsystem local allocation macros
...
And drop our compatibility wrapper.
2013-07-07 12:27:44 -04:00
Colin Walters
e8cba55a34
core: Allow '.' in refspecs too
...
For version numbers.
2013-07-05 16:51:47 -04:00
Colin Walters
1ba852ebaa
core: Add "refspec" which is remote:refname
...
This allows an unambiguous reference; otherwise, it was too easy to
have confusion between local heads and remotes.
2013-06-29 12:51:29 -04:00
Colin Walters
a821420711
core: Add API to convert csum -> checksum without malloc()
...
Just doing some profiling, this was in the top malloc() callers.
2013-02-23 11:02:56 -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
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
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
5761733218
Drop some bits from libotutil that are now merged in libgsystem
2012-11-29 16:24:49 -05: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
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
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
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
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
a14ff0aeab
core: Fix mkdtemp invocation
2012-06-06 10:03:15 -04:00
Colin Walters
df54408e5d
core: Fix memory leak
2012-06-05 22:32:03 -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
Colin Walters
27358a8de6
core: [INCOMPATIBLE CHANGE] Re-split archive content into .file and .filecontent
...
This will allow us to use hard links again for user-mode checkouts,
rather than the hackish link cache. It was pretty silly anyways to
have file objects be stored with just a small metadata header
prepended, but uncompressed.
Either they should be hardlinkable, or compressed (in pack files).
2012-05-04 16:10:30 -04:00
Colin Walters
3321fa08d7
core: Handle zero-sized archives, improve fsck error message
2012-05-04 13:40:25 -04:00
Colin Walters
8d926c3e36
core: Add valgrind framework, plug various memory leaks
2012-05-04 10:04:32 -04:00
Colin Walters
7ce587da30
core: Optimize commits to raw repositories
...
Avoid creating a temporary intermediate file in the case where we have
the total object length available.
2012-05-04 06:15:47 -04:00
Colin Walters
67f61976f4
core: Clean up object storage API
...
Rather than passing xattr/file_info for all objects, change the API to
assume we're passing the defined object stream for each type. Namely,
for OSTREE_OBJECT_TYPE_FILE, we're now giving the "archive file" data.
This significantly cleans up the code for committing to archive mode
repositories, at the cost of having to (at present) create an
intermediate temporary file when committing to raw repositories.
2012-05-03 19:59:13 -04:00
Colin Walters
8d6bdaedfe
core: Fix 32/8 bit confusion in pack index listing
2012-05-01 17:44:14 -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
f15c184584
core: Clean up checksumming
...
Don't expose GChecksum in APIs. Add a new stream class which allows
us to pass an input stream somewhere, but gather a checksum as it's
read.
Move some bits of the internals towards binary csums.
2012-04-11 22:04:06 -04:00
Colin Walters
fa4cbc8b89
core: Drop wrapping of metadata variants
2012-04-11 22:04:05 -04:00
Colin Walters
5a82b141ae
core: Split pack files into data/metadata
...
This will allow us to download metadata first (separately), and in the
future we can have an improved metadata pack format that compresses
heavily.
2012-04-11 22:04:05 -04:00
Colin Walters
11c0fbc738
core: Switch to 'ay' for checksums, drop versions/metadata
2012-04-11 22:04:00 -04:00
Colin Walters
0e8149eb83
core: Clean up checksum API
...
We want to move towards guchar * for binary checksums.
2012-04-11 19:54:55 -04:00
Colin Walters
8b6bf09d7a
core: Port libostree to local alloc
2012-04-09 15:57:46 -04:00
Colin Walters
72398ab62c
core: Fix xattr API to conform to coding style
2012-04-09 15:56:27 -04:00
Colin Walters
8792007bc1
core: Validate structure of objects in fsck
2012-04-03 08:52:58 -04:00
Colin Walters
a0b7d94cb6
core: Fix a few memory leaks
2012-04-02 18:32:40 -04:00
Colin Walters
b971ce0dfa
core: Only depend on GLib 2.30
2012-04-02 13:42:09 -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
70afd6011f
core: Add helper functions to convert (checksum, objtype) pair to/from string
2012-03-14 09:37:00 -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
83fb6d56e1
core: Don't call unlink() on directory if it already exists
...
If we fail to make a directory because it exists, we shouldn't call
unlink() on it.
2012-03-06 11:59:06 -05:00
Colin Walters
b783ebc189
core: Add API to validate rev
2012-02-27 08:37:37 -05:00
Colin Walters
5329f1706b
core: Further fix fallout from archive mode files
...
Continuing from 16c0cfe9b5 , we now have
the problem that we're removing the executable bit, which obviously
breaks things when we chroot in for a build. Fix this by masking over
our bits.
2012-02-24 17:50:44 -05:00
Colin Walters
16c0cfe9b5
core: Fix regression when committing symlinks in archive mode
...
Commit 802959f398 broke this because it
made all archived content files be S_IFREG, which is clearly wrong.
2012-02-24 10:05:26 -05:00
Colin Walters
802959f398
core: Ensure .archive-content files are mode 0644
...
We don't want to inherit the permissions of the actual file, otherwise
trying to fetch e.g. /etc/passwd when being served via Apache httpd
will break.
2012-02-23 12:34:43 -05:00
Colin Walters
ebe35dbefe
core: Ensure we delete duplicate files in a transaction
...
If multiple files have the same hash, we need to ensure we're not
overwriting other tempfiles in the same transaction. Instead
just delete them, since we know they're in the repo.
2012-01-15 12:25:52 -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
9bcd4ff8aa
core: Use global random object
...
We were pointlessly creating a new rand (and thus opening /dev/random)
on every temp file creation, but still using the global rand.
2011-12-22 11:23:16 -05:00
Colin Walters
9a71ab187d
core: INCOMPATIBLE CHANGE: Split archive files in two parts (meta and content)
...
This will allow us to have hardlink checkouts of archives. A key use
case here is an archive repo of an OS (with root-owned files etc.)
where we want to do builds in a user tree.
A positive side effect of doing things this way is that now the SHA256
checksums for a given file should be identical regardless of whether
it's stored in an archive or bare repository.
2011-12-15 13:14:06 -05:00
Colin Walters
ecbffd4915
core: Don't insert null byte in temporary file names
2011-12-15 13:10:41 -05:00
Colin Walters
8ab2296a70
core: Add utility functions to convert a OstreeObjectType to/from a string
2011-12-15 13:09:51 -05:00
Colin Walters
b8e8b58585
core: INCOMPATIBLE CHANGE: Name repo files with their type (e.g. .dirmeta)
...
This makes inspection easier. Internally the code gets simpler because
metadata and files are more unified; there is just one object type.
2011-12-12 12:29:09 -05:00
Colin Walters
f6117de8d3
core: s/pack/archived/
...
This completes the rename from the previous commit.
2011-12-08 17:45:37 -05:00
Colin Walters
d6ceb91c35
core: Make ot_transfer_out_value() take a & for the second argument
...
As Ray Strode argued, it's confusing to have something that looks like
a function be magical. And OT_TRANSFER_OUT_VALUE is uglier.
2011-12-08 17:31:45 -05:00
Colin Walters
35fa68a74c
core: INCOMPATIBLE CHANGE: Rename .packfile to .archive
...
It's too confusing that we call the mode "archive" but the actual
files ".packfile". Also, git already has a "packfile" that serves a
totally different purpose.
2011-12-08 17:15:59 -05:00
Colin Walters
7932811fbb
core: Delete some dead code
2011-12-08 14:55:41 -05:00
Colin Walters
a94e0b8bf8
core: Ensure we chown created directories too
2011-12-06 20:16:03 -05:00
Colin Walters
c32141c2bf
core: Remove some useless wrapping of packfile unpacking in checkout
2011-12-06 20:09:09 -05:00
Colin Walters
267bf8ef4a
core: Ensure we initialize checksum in FIFO case too
2011-12-05 11:15:12 -05:00
Colin Walters
9d39517554
core: Add _from_input variant of checksum API
2011-12-05 10:28:42 -05:00
Colin Walters
f9315e8f82
core: Fix a memory leak in checkout
2011-12-04 14:08:55 -05:00
Colin Walters
45addeadf0
core: Handle NULL xattrs in packfile generation, throw error on invalid mode
2011-12-04 13:12:06 -05:00
Colin Walters
1f6d49cdb9
core: Initialize checksums for non-regular files, handle NULL xattrs
2011-12-04 12:11:29 -05:00
Colin Walters
0003e101f6
core: New ot_transfer_out_value() macro
...
This makes out values considerably less typing.
2011-12-02 18:17:06 -05:00
Colin Walters
3ab69101f7
core: Fix packed file creation
...
We were calculating the wrong checksum, and also mistakenly
not using packed files in archive mode for non-regular files.
2011-12-02 17:49:57 -05:00
Colin Walters
0d4df5b3fe
core: Avoid reading regular file data twice when archiving
2011-12-02 14:23:01 -05:00
Colin Walters
d1950da1a0
core: Further unify API to create files
...
We now have just one place which writes to the filesystem. Wrap a
temporary file allocation API on top of that.
2011-12-02 13:42:25 -05:00
Colin Walters
7fc625c967
core: Move pack file parsing into core, add ostree_create_file_from_input() API
...
This moves us closer to consistently passing around a triple of:
(GFileInfo *info, GVariant *xattrs, GInputStream *content)
Which will help the libarchive work.
2011-12-02 10:11:09 -05:00
Colin Walters
f98e2a2ddb
core: Tweak dir metadata importing code for libarchive work
...
This will allow us to share a bit more code.
2011-12-01 19:45:00 -05:00
Colin Walters
177d845f5b
core: Modify pack file importer to also optionally checksum
...
For future work on importing from an archive.
2011-12-01 19:25:35 -05:00
Colin Walters
702c38739e
core: Drop some dead code from packfile writing, expose GInputStream API too
...
We never actually dropped into the bits to write metadata as packfiles,
because such a thing doesn't exist.
Also add a GInputStream-based API for writing packfiles.
2011-11-30 22:15:05 -05:00
Colin Walters
556662b24c
core: Extract stage_and_checksum() internal API
...
This will be used for staging both metadata and data consistently
before actually importing it.
2011-11-30 21:20:15 -05:00
Colin Walters
84562f161f
core: Use ot_clear_checksum()
2011-11-29 14:06:54 -05:00
Colin Walters
2f1490f766
core: Fix a compiler warning
2011-11-27 20:15:07 -05:00
Colin Walters
b0b0ffcd61
core: Add asynchronous checksum API, use it in checksum builtin
2011-11-27 17:21:04 -05:00