Commit graph

18 commits

Author SHA1 Message Date
Stephen Chung
4dc5000106 keywords: return non-zero symlink size
Previously, the symlink size reported by a archive/tar header
was 0. This is incorrect, as the size of a symlink should be
the size of its contents, which is just the path to where
the symlink points to. Thus, the size of this file would just
be len(Linkname).

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-08-02 15:39:54 -04:00
Stephen Chung
877272303b keywords: synonyms of keywords should produce same output
Currently, if you create a manifest with, say 'sha1', and another
manifest with 'sha1digest', gomtree will produce different output
with regard to the keyword name. I.e, `sha1=[...]` vs. `sha1digest=[...]`.
If we want to use synonyms for keywords, as well as align with upstream mtree
output, specifying 'sha1' and 'sha1digest' should impact gomtree's
in the same way.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-27 10:59:58 -04:00
b790afae01 keywords: include list of upstream keywords
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-07-26 14:21:44 -04:00
ed6b293839 debug: add an mtree.Debugf and -debug flag
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-07-26 13:54:45 -04:00
Stephen Chung
656e577ecc *: have gomtree always evaluate tar_time if it is present
if the keyword "tar_time" is present when evaluating
an Entry, gomtree should use the tar_time when evaluating
the "time" keyword as well. This commit also adds a test that
makes sure "tar_time" wins against "time" if both are present.
Some minor clean-ups as well, such as checking if KeywordFunc[keyword]
actually retrieves a function.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-23 12:07:43 -04:00
bc6f3bf902 tar_time: treat time from tar archives special
Since the field in a tar header for each file only preserves seconds
precision, not nanosecond precision, let's handle it special. This will
allow for more custom case handling in Check()

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-07-23 12:07:43 -04:00
Stephen Chung
f0f15a0e49 keywords: return "link" keyword along with its value
Originally only returning `Sys.linkname` when evaluating
a tar header's link field. We want it to be in the form of
keyword=value instead.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-23 12:07:43 -04:00
faa80931af *: refactoring to support streams
when creating a manifest from, or validating, a stream like a tar
archive, it requires thinking about some of the functions differently
than walking a directory tree.

This is the beginning of allowing for such features.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-07-23 12:07:43 -04:00
Stephen Chung
e29b993aa2 keywords: obtain all permission bits
Fixes #7. Upper 3 bits are 'special' mode bits, and are not
included when calling info.Mode().Perm(). Need to mask
the info.Mode() with the corresponding mode bit defined
by the go library to see if these bits are set or not.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-15 15:37:52 -04:00
6adcc98b22 keywords: time keyword 9 postition decimal
Matching with the FreeBSD standard format

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-06-27 13:24:03 -04:00
ac37b23f38 keywords: time can be 0
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-06-27 13:16:24 -04:00
2fd41fb43f check: an initial pass at a validation check
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
3b6cb6e117 *: entry linking and keyword filter
Setting up sibling and parent relationships for entries, so they can be
easier to walk.

Also, making "keyword=value" easier to parse. This helps filtering.

Both of these ready us for checking/validating a hierarchy.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
ef9ba54f10 keywords: accurate nanoseconds for time=
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
d1ddeb8e3d *: close to producing a validating hierarchy
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
ecdf381dd9 keywords: add mode= (only octal first)
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
211687bcc4 keywords: added experimental "xattr" keyword
Initially only on linux platform, but could accommodate BSDs as well.
The keyword is rather a prefix of the key. So xattr keyword will have a
prefix of "xattr." followed by a suffix of its namespace and name.
The value stored in the manifest is the SHA1 digest of the extended
attribute's data.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
b3198b462b keywords: they deserve their own file
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00