Commit graph

203 commits

Author SHA1 Message Date
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
Stephen Chung
992a4757b0 main: 'type' keyword should always be evaluated
Resolves #21. When using `-k` option, gomtree should use
only the keywords specified by the user, as well as the 'type'
keyword if it wasn't specified.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-15 09:59:18 -04: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
30ee5d29fe Merge pull request #18 from stephen679/metadata_entries
Create and insert metadata Entry's
2016-07-15 11:25:17 +09:00
818b9227d7 Merge pull request #19 from stephen679/check_valid_keyword
check: error out on unrecognized keyword
2016-07-15 11:08:20 +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
Stephen Chung
06a8e86273 Create and insert metadata Entry's
Create Entry's that detail the file spec signature.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-14 09:57:37 -04:00
3dc8a31929 Merge pull request #17 from vbatts/improve_flag_branches
gomtree: ensure validating a populated hierarchy
2016-07-13 22:26:36 -04:00
2d227512a5 gomtree: ensure validating a populated hierarchy
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-07-14 02:24:29 +00:00
d5aab78911 Merge pull request #9 from vbatts/fix_time_comparison
Fix time comparison
2016-06-27 13:27:10 -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
fca9d4b5b6 check: failing test case for #8
https://github.com/vbatts/go-mtree/issues/8

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-06-27 13:19:23 -04:00
ac37b23f38 keywords: time can be 0
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-06-27 13:16:24 -04:00
be2b0574a6 Merge pull request #6 from vbatts/check_keywords
check: keyword filtering the checks
2016-04-13 16:08:12 -04:00
5399fd04d0 check: add an example for the docs
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-13 16:04:48 -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
a544d45c4c Merge pull request #4 from vbatts/fix_base_dir_path
walk: when directory is root, use "."
2016-04-13 15:39:09 -04:00
410c0d60c1 walk: when directory is root, use "."
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-13 15:38:04 -04:00
9f0a9fd6c0 Merge pull request #5 from vbatts/travis_vet
travis: go1.5 and go1.6 have vet builtin
2016-04-13 15:37:21 -04:00
8240bc683b travis: go1.5 and go1.6 have vet builtin
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-13 15:34:50 -04:00
d3a4dc6d72 Merge pull request #3 from vbatts/add_travis
travis: add travis checks
2016-04-06 14:00:03 -04:00
c3855dab6d travis: add travis check
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-06 13:57:11 -04:00
b595e50fec Merge pull request #2 from vbatts/testing
Tests pass
2016-04-06 12:47:56 -04:00
99dcd25a7e walk: test passes and validates parse
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-06 12:45:08 -04:00
9c6b4257f4 check: now the simple test passes
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 18:13:27 -04:00
34b9f4dc46 hierarchy: testing works
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 17:16:44 -04:00
7777d9a010 cksum: test is fine. commenting.
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 16:47:36 -04:00
e7673b617d Merge pull request #1 from vbatts/check_results
Check results
2016-04-05 16:21:46 -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
0898fd6d90 mtree: non-relative import path
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-31 14:04:53 -04:00
73625f1a09 cmd/gomtree: non-relative import path
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-31 14:03:56 -04:00
b415198978 README: add a README
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-30 16:57:23 -04:00
1e18d74876 cmd/gomtree: cli with basic functionality
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -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
6db2f462a1 walk: insert comments regarding directory path
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
a05d8ebbbd *: cleaner Parent handling
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
2d3aea8623 xattr: simple wrapper for syscalls
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
ec1977017d cksum: comment
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
bdf5887f64 cksum: golint
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
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