1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-09-28 21:29:48 +00:00
Commit graph

19 commits

Author SHA1 Message Date
Stephen Chung
3d6b74d6f7 tar: populate Entry tree under a common root
Resolves #56. Now, the Entry tree will be populated
under a common root (if necessary), so that a manifest can
be accurately generate from a tar file that has been
created using multiple directories.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-08-09 12:09:36 -04:00
b0c1606133 Merge pull request #37 from vbatts/no_null_json
check: omitempty rather than `null`
2016-07-25 18:51:38 -04:00
Stephen Chung
773763fb87 vis: refactored code to reflect using vis/unvis for file names
Added some more test cases for `vis`ing and `unvis`ing
strings, and a test case that walks/checks a directory with
filenames that require encoding. Had to change Path() to account
for possible errors Unvis() could return. Refactored Vis()/Unvis() into
go-mtree tar functionality as well.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-25 16:41:06 -04:00
898661f983 check: omitempty rather than null
When using `-result-format=json` flag, just show populated fields.

Before:
```bash
$ gomtree -result-format=json -p ./bin -f ./bin.mtree
{"failures":[{"path":"gomtree","keyword":"size","expected":"2646101","got":"2930231"}],"Missing":null,"Extra":null}
```

After:
```bash
$ gomtree -result-format=json -p ./bin -f ./bin.mtree
{"failures":[{"path":"gomtree","keyword":"size","expected":"2646101","got":"2930231"}]}
```

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-07-25 15:39:55 -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
Stephen Chung
decc72b335 tar: create and validate a manifest from a tar stream
This commit contains added features to go-mtree that allows
user to create an mtree spec with '-T' option when specifying
a tar archive. Users can also validate an mtree spec against
a tar archive with an mtree spec. Also for the test archive,
there is a mixture of files, and folders (empty & non-empty),
and symlinks (broken & unbroken).

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
Aleksa Sarai
692f56a830
*: add --result-format=json format
This is far easier to parse than the default raw format, and provides
the full serialised result structure.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-07-22 20:06:32 +10:00
Stephen Chung
c99862ee53 check: creator.curSet pointer aliasing
When iterating over creator.DH.Entries using the variable
e, and then setting creator.curSet to &e, this causes aliasing
that results in the underlying Entry of creator.curSet to
change on each iteration. Instead we want to get the address of
the actual Entry in creator.DH.Entries.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-15 08:58:26 -04:00
a29236e678 Merge pull request #20 from stephen679/validate_correct_path
check: recognize correct path
2016-07-15 11:34:32 +09:00
Stephen Chung
a0b06e0224 check: recognize correct path
Fixes #11. Check() changes its working directory to `root`, which
is specified as an argument. Thus, it shouldn't open
a file using its absolute path; instead it should open the file
with the relative path to the root.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-14 16:33:23 -04:00
Stephen Chung
d06c91220f check: error out on unrecognized keyword
Make sure a keyword is valid before checking if
the keyword exists in the set of KeyVals that
Check() is supposed to validate.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-14 12:21:47 -04:00
b11b9c6a78 check: keyword filtering the checks
Allow for Check() to be narrowed to a set of keywords.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-13 15:50:59 -04:00
05f9b75a19 check: fix the checking of a hierarchy
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 16:20:04 -04:00
b7724b906b check: populate the Result set
allowing the caller to display the results as desired

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 13:05:59 -04:00
b415198978 README: add a README
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-30 16:57:23 -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
1cd7a57573 check: stubbing out the entry Type's
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
455edf6d21 *: loads of walking features
For the most part, all the keywords for a standard mtree spec now have a
function to produce the contents for a creator.

These are used in the "walk" function, and will be used next in the
"check" logic.

This is still a WIP, as the DirectoryHierarchy produced from the current
Walk() is not all-together a valid document.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00