-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add-inventory-class' of github.com:zimeon/ocfl-py into …
…add-inventory-class
- Loading branch information
Showing
7 changed files
with
189 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,15 @@ _Output from `tests/test_demo_build_spec_v1_0_examples.py`._ | |
The digest type sha512-spec-ex is sha512 with most of the content stripped out and replaced with an ellipsis. This is inventory should match the example in <https://ocfl.io/1.0/spec/#example-minimal-object>. | ||
|
||
``` | ||
> python ocfl-object.py build --src fixtures/1.0/content/spec-ex-minimal --id http://example.org/minimal --spec-version 1.0 --digest sha512-spec-ex --created 2018-10-02T12:00:00Z --message One file --name Alice --address [email protected] -v | ||
> python ocfl-object.py create --src fixtures/1.0/content/spec-ex-minimal --id http://example.org/minimal --spec-version 1.0 --digest sha512-spec-ex --created 2018-10-02T12:00:00Z --message One file --name Alice --address [email protected] -v | ||
### Inventory for v1 | ||
{ | ||
"digestAlgorithm": "sha512-spec-ex", | ||
"head": "v1", | ||
"id": "http://example.org/minimal", | ||
"manifest": { | ||
"7545b8720a60123...f67": [ | ||
"v1/content/file.txt" | ||
"v1/content/v1/file.txt" | ||
] | ||
}, | ||
"type": "https://ocfl.io/1.0/spec/#inventory", | ||
|
@@ -27,7 +27,7 @@ The digest type sha512-spec-ex is sha512 with most of the content stripped out a | |
"message": "One file", | ||
"state": { | ||
"7545b8720a60123...f67": [ | ||
"file.txt" | ||
"v1/file.txt" | ||
] | ||
}, | ||
"user": { | ||
|
@@ -47,7 +47,7 @@ The digest type sha512-spec-ex is sha512 with most of the content stripped out a | |
This is inventory should match the example with 3 versions in <https://ocfl.io/1.0/spec/#example-versioned-object>. | ||
|
||
``` | ||
> python ocfl-object.py build --src fixtures/1.0/content/spec-ex-full --spec-version 1.0 --id ark:/12345/bcd987 --fixity md5 --fixity sha1 --digest sha512-spec-ex --created 2018-01-01T01:01:01Z -v | ||
> python ocfl-object.py build --src fixtures/1.0/content/spec-ex-full --spec-version 1.0 --id ark:/12345/bcd987 --fixity md5 --fixity sha1 --digest sha512-spec-ex --metadata extra_fixtures/1.0/content/spec-ex-full-metadata.json -v | ||
### Inventory for v3 | ||
{ | ||
"digestAlgorithm": "sha512-spec-ex", | ||
|
@@ -101,6 +101,7 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
"versions": { | ||
"v1": { | ||
"created": "2018-01-01T01:01:01Z", | ||
"message": "Initial import", | ||
"state": { | ||
"7dcc352f96c56dc...c31": [ | ||
"foo/bar.xml" | ||
|
@@ -111,10 +112,15 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
"ffccf6baa218097...62e": [ | ||
"image.tiff" | ||
] | ||
}, | ||
"user": { | ||
"address": "[email protected]", | ||
"name": "Alice" | ||
} | ||
}, | ||
"v2": { | ||
"created": "2018-01-01T01:01:01Z", | ||
"created": "2018-02-02T02:02:02Z", | ||
"message": "Fix bar.xml, remove image.tiff, add empty2.txt", | ||
"state": { | ||
"4d27c86b026ff70...b53": [ | ||
"foo/bar.xml" | ||
|
@@ -123,10 +129,15 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
"empty.txt", | ||
"empty2.txt" | ||
] | ||
}, | ||
"user": { | ||
"address": "[email protected]", | ||
"name": "Bob" | ||
} | ||
}, | ||
"v3": { | ||
"created": "2018-01-01T01:01:01Z", | ||
"created": "2018-03-03T03:03:03Z", | ||
"message": "Reinstate image.tiff, delete empty.txt", | ||
"state": { | ||
"4d27c86b026ff70...b53": [ | ||
"foo/bar.xml" | ||
|
@@ -137,6 +148,10 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
"ffccf6baa218097...62e": [ | ||
"image.tiff" | ||
] | ||
}, | ||
"user": { | ||
"address": "[email protected]", | ||
"name": "Cecilia" | ||
} | ||
} | ||
} | ||
|
@@ -151,7 +166,7 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
This is inventory should match the example showing how content paths may differ from logical paths in <https://ocfl.io/1.0/spec/#example-object-diff-paths>. | ||
|
||
``` | ||
> python ocfl-object.py build --src fixtures/1.0/content/spec-ex-diff-paths --id http://example.org/diff-paths --spec-version 1.0 --digest sha512-spec-ex --normalization md5 --created 2019-03-14T20:31:00Z -v | ||
> python ocfl-object.py create --src fixtures/1.0/content/spec-ex-diff-paths/v1 --id http://example.org/diff-paths --spec-version 1.0 --digest sha512-spec-ex --normalization md5 --created 2019-03-14T20:31:00Z -v | ||
### Inventory for v1 | ||
{ | ||
"digestAlgorithm": "sha512-spec-ex", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,15 @@ _Output from `tests/test_demo_build_spec_v1_1_examples.py`._ | |
The digest type sha512-spec-ex is sha512 with most of the content stripped out and replaced with an ellipsis. This is inventory should match the example in <https://ocfl.io/1.1/spec/#example-minimal-object>. | ||
|
||
``` | ||
> python ocfl-object.py build --src fixtures/1.1/content/spec-ex-minimal --id http://example.org/minimal --spec-version 1.1 --digest sha512-spec-ex --created 2018-10-02T12:00:00Z --message One file --name Alice --address [email protected] -v | ||
> python ocfl-object.py create --src fixtures/1.1/content/spec-ex-minimal --id http://example.org/minimal --spec-version 1.1 --digest sha512-spec-ex --created 2018-10-02T12:00:00Z --message One file --name Alice --address [email protected] -v | ||
### Inventory for v1 | ||
{ | ||
"digestAlgorithm": "sha512-spec-ex", | ||
"head": "v1", | ||
"id": "http://example.org/minimal", | ||
"manifest": { | ||
"7545b8720a60123...f67": [ | ||
"v1/content/file.txt" | ||
"v1/content/v1/file.txt" | ||
] | ||
}, | ||
"type": "https://ocfl.io/1.1/spec/#inventory", | ||
|
@@ -27,7 +27,7 @@ The digest type sha512-spec-ex is sha512 with most of the content stripped out a | |
"message": "One file", | ||
"state": { | ||
"7545b8720a60123...f67": [ | ||
"file.txt" | ||
"v1/file.txt" | ||
] | ||
}, | ||
"user": { | ||
|
@@ -47,7 +47,7 @@ The digest type sha512-spec-ex is sha512 with most of the content stripped out a | |
This is inventory should match the example with 3 versions in <https://ocfl.io/1.1/spec/#example-versioned-object>. | ||
|
||
``` | ||
> python ocfl-object.py build --src fixtures/1.1/content/spec-ex-full --spec-version 1.1 --id ark:/12345/bcd987 --fixity md5 --fixity sha1 --digest sha512-spec-ex -v | ||
> python ocfl-object.py build --src fixtures/1.1/content/spec-ex-full --spec-version 1.1 --id ark:/12345/bcd987 --fixity md5 --fixity sha1 --digest sha512-spec-ex --metadata extra_fixtures/1.1/content/spec-ex-full-metadata.json -v | ||
### Inventory for v3 | ||
{ | ||
"digestAlgorithm": "sha512-spec-ex", | ||
|
@@ -100,7 +100,8 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
"type": "https://ocfl.io/1.1/spec/#inventory", | ||
"versions": { | ||
"v1": { | ||
"created": "2024-10-27T09:46:44.539504Z", | ||
"created": "2018-01-01T01:01:01Z", | ||
"message": "Initial import", | ||
"state": { | ||
"7dcc352f96c56dc...c31": [ | ||
"foo/bar.xml" | ||
|
@@ -111,10 +112,15 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
"ffccf6baa218097...62e": [ | ||
"image.tiff" | ||
] | ||
}, | ||
"user": { | ||
"address": "[email protected]", | ||
"name": "Alice" | ||
} | ||
}, | ||
"v2": { | ||
"created": "2024-10-27T09:46:44.540128Z", | ||
"created": "2018-02-02T02:02:02Z", | ||
"message": "Fix bar.xml, remove image.tiff, add empty2.txt", | ||
"state": { | ||
"4d27c86b026ff70...b53": [ | ||
"foo/bar.xml" | ||
|
@@ -123,10 +129,15 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
"empty.txt", | ||
"empty2.txt" | ||
] | ||
}, | ||
"user": { | ||
"address": "[email protected]", | ||
"name": "Bob" | ||
} | ||
}, | ||
"v3": { | ||
"created": "2024-10-27T09:46:44.540482Z", | ||
"created": "2018-03-03T03:03:03Z", | ||
"message": "Reinstate image.tiff, delete empty.txt", | ||
"state": { | ||
"4d27c86b026ff70...b53": [ | ||
"foo/bar.xml" | ||
|
@@ -137,6 +148,10 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
"ffccf6baa218097...62e": [ | ||
"image.tiff" | ||
] | ||
}, | ||
"user": { | ||
"address": "[email protected]", | ||
"name": "Cecilia" | ||
} | ||
} | ||
} | ||
|
@@ -151,12 +166,12 @@ This is inventory should match the example with 3 versions in <https://ocfl.io/1 | |
This is inventory should match the example showing how content paths may differ from logical paths in <https://ocfl.io/1.1/spec/#example-object-diff-paths>. | ||
|
||
``` | ||
> python ocfl-object.py build --src fixtures/1.1/content/spec-ex-diff-paths --id http://example.org/diff-paths --spec-version 1.1 --digest sha512-spec-ex --normalization md5 --created 2019-03-14T20:31:00Z -v | ||
> python ocfl-object.py create --src fixtures/1.1/content/spec-ex-diff-paths/v1 --id http://example.org/diff-paths/v1 --spec-version 1.1 --digest sha512-spec-ex --normalization md5 --created 2019-03-14T20:31:00Z -v | ||
### Inventory for v1 | ||
{ | ||
"digestAlgorithm": "sha512-spec-ex", | ||
"head": "v1", | ||
"id": "http://example.org/diff-paths", | ||
"id": "http://example.org/diff-paths/v1", | ||
"manifest": { | ||
"7545b8720a60123...f67": [ | ||
"v1/content/3bacb119a98a15c5" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ Without an `--objdir` argument the script just writes out the inventory for the | |
Without an `--objdir` argument the script just writes out the inventory for each version in the object that would have been created. | ||
|
||
``` | ||
> python ocfl-object.py build --id http://example.org/obj2 --src fixtures/1.0/content/cf3 --created 2024-10-24T18:30:02Z | ||
> python ocfl-object.py build --id http://example.org/obj2 --src fixtures/1.0/content/cf3 --metadata extra_fixtures/1.0/content/spec-ex-full-metadata.json | ||
### Inventory for v3 | ||
{ | ||
"digestAlgorithm": "sha512", | ||
|
@@ -69,27 +69,42 @@ Without an `--objdir` argument the script just writes out the inventory for each | |
"type": "https://ocfl.io/1.1/spec/#inventory", | ||
"versions": { | ||
"v1": { | ||
"created": "2024-10-24T18:30:02Z", | ||
"created": "2018-01-01T01:01:01Z", | ||
"message": "Initial import", | ||
"state": { | ||
"43a43fe8a8a082d3b5343dfaf2fd0c8b8e370675b1f376e92e9994612c33ea255b11298269d72f797399ebb94edeefe53df243643676548f584fb8603ca53a0f": [ | ||
"a_file.txt" | ||
] | ||
}, | ||
"user": { | ||
"address": "[email protected]", | ||
"name": "Alice" | ||
} | ||
}, | ||
"v2": { | ||
"created": "2024-10-24T18:30:02Z", | ||
"created": "2018-02-02T02:02:02Z", | ||
"message": "Fix bar.xml, remove image.tiff, add empty2.txt", | ||
"state": { | ||
"296e72b8fd5f7f0ac1473993600ae34953d5dab646f17e7b182b8648aff830d7bf01b56490777cb3e72b33fcc1ae520506badea1032252d1a55fd7362e269975": [ | ||
"a_file.txt" | ||
] | ||
}, | ||
"user": { | ||
"address": "[email protected]", | ||
"name": "Bob" | ||
} | ||
}, | ||
"v3": { | ||
"created": "2024-10-24T18:30:02Z", | ||
"created": "2018-03-03T03:03:03Z", | ||
"message": "Reinstate image.tiff, delete empty.txt", | ||
"state": { | ||
"43a43fe8a8a082d3b5343dfaf2fd0c8b8e370675b1f376e92e9994612c33ea255b11298269d72f797399ebb94edeefe53df243643676548f584fb8603ca53a0f": [ | ||
"a_file.txt" | ||
] | ||
}, | ||
"user": { | ||
"address": "[email protected]", | ||
"name": "Cecilia" | ||
} | ||
} | ||
} | ||
|
@@ -112,7 +127,7 @@ INFO:root:Created OCFL object http://example.org/obj1 in tmp/obj1 | |
### 4.1 New object with three versions | ||
|
||
``` | ||
> python ocfl-object.py build --id http://example.org/obj2 --src fixtures/1.0/content/cf3 --objdir tmp/obj2 --created 2024-10-24T18:30:04Z,-v | ||
> python ocfl-object.py build --id http://example.org/obj2 --src fixtures/1.0/content/cf3 --objdir tmp/obj2 -v | ||
INFO:root:Built object http://example.org/obj2 at tmp/obj2 with 3 versions | ||
``` | ||
|
||
|
@@ -133,13 +148,11 @@ and the extracted files are: | |
|
||
``` | ||
> find -s tmp/v1 -print | ||
tmp/v1 | ||
tmp/v1/empty.txt | ||
tmp/v1/foo | ||
tmp/v1/foo/bar.xml | ||
tmp/v1/image.tiff | ||
find: unknown predicate `-s' | ||
``` | ||
|
||
(last command exited with return code 1) | ||
|
||
|
||
### 5.2 Extract v2 of content in an OCFL v1.1 object | ||
|
||
|
@@ -153,13 +166,11 @@ and the extracted files are: | |
|
||
``` | ||
> find -s tmp/v2 -print | ||
tmp/v2 | ||
tmp/v2/empty.txt | ||
tmp/v2/empty2.txt | ||
tmp/v2/foo | ||
tmp/v2/foo/bar.xml | ||
find: unknown predicate `-s' | ||
``` | ||
|
||
(last command exited with return code 1) | ||
|
||
|
||
### 5.3 Extract head version (v3) of content in the same OCFL v1.1 object | ||
|
||
|
@@ -173,7 +184,7 @@ and the extracted files are: | |
|
||
``` | ||
> find -s tmp/v3 -print | ||
find: tmp/v3: No such file or directory | ||
find: unknown predicate `-s' | ||
``` | ||
|
||
(last command exited with return code 1) | ||
|
@@ -190,10 +201,11 @@ and the extracted file is: | |
|
||
``` | ||
> find -s tmp/files -print | ||
tmp/files | ||
tmp/files/bar.xml | ||
find: unknown predicate `-s' | ||
``` | ||
|
||
(last command exited with return code 1) | ||
|
||
|
||
### 5.5 Extract image.tiff of v3 (default) into the same directory | ||
|
||
|
@@ -206,11 +218,11 @@ and the directory now contains two extracted files: | |
|
||
``` | ||
> find -s tmp/files -print | ||
tmp/files | ||
tmp/files/bar.xml | ||
tmp/files/image.tiff | ||
find: unknown predicate `-s' | ||
``` | ||
|
||
(last command exited with return code 1) | ||
|
||
|
||
## 6. Test error conditions. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.