Ugarit archive mode progress (by )

Ugarit's archive mode is getting along nicely. I now have importing from a manifest file that specifies properties for the import as a whole, and a list of files to import with their own properties, and basic browsing of the audit trail of an archive in the virtual file system. That includes access to the properties of an import via the virtual "properties.sexpr" file. Note also that lots of import and file properties are automatically added, such as the hostname we import from, the input path for each file, a MIME type deduced from the extension, and so on.

Below the fold is a transcript of it in use, which probably won't mean much to many people...

[alaric@ahusai ugarit]$ cat test.manifest
(test-phase = "1")
(eating-cheese = #t)
(object "/etc/passwd"
        (name = "passwd"))

(object "/etc/passwd"
        (try = 2)
        (mime-type = "text/plain"))

(object "artwork")

(object "artwork/logo.png")
[alaric@ahusai ugarit]$ cat test.conf 
(storage "backend-sqlite /tmp/ugarit-test.vault")
(file-cache "/tmp/file-cache")
[alaric@ahusai ugarit]$ ugarit import test.conf arch test.manifest
Loading manifest file test.manifest...
Importing from test.manifest to tag arch...
Importing artwork/logo.png...
...imported with key 485abf4dc2b7c8783ec070d6593d33645ba256f71f433f48
Importing artwork...
...imported with key 65e74a797c226e2e1f3e93d7e9900908f7a9cd56d4785da1
Importing /etc/passwd...
...imported with key 363330acb22b950ca3296ff0109d392e55acec9342b60425
Importing /etc/passwd...
...already exists with key 363330acb22b950ca3296ff0109d392e55acec9342b60425
Committing import...
Imported successfully to tag arch with import key 2c1a1717baf5d41cba5049e282390b441e38e71835607638
Written 21KiB to the vault in 7 blocks, and reused 0B in 0 blocks (before compression)
File cache has saved us 2 file hashings / 20KiB (before compression)
[alaric@ahusai ugarit]$ ugarit explore test.conf 
> ls
arch <tag>
> cd arch
/arch> ls
history <archive-history>
/arch> cd history
/arch/history> ls
2014-10-12 23:58:27 <import>
/arch/history> cd 2014-10-12 23:58:27
/arch/history/2014-10-12 23:58:27> ls
log.sexpr <file>
properties.sexpr <inline>
imported-objects <dir>
/arch/history/2014-10-12 23:58:27> cat properties.sexpr
((stats (blocks-stored . 6)
        (bytes-stored . 21210)
        (blocks-skipped . 0)
        (bytes-skipped . 0)
        (file-cache-hits . 2)
        (file-cache-bytes . 20471))
 (log . "b2a920f962c12848352f33cf32941e5313bcc5f209219c1a")
 (mtime . 1413154707.0)
 (contents . "cb15e61503a99fe33c0cc1606376a58ed6e6a3438c8a7a96")
 (import-host . "ahusai")
 (eating-cheese . #t)
 (test-phase . "1"))
/arch/history/2014-10-12 23:58:27> cd imported-objects
/arch/history/2014-10-12 23:58:27/imported-objects> ls
485abf4dc2b7c8783ec070d6593d33645ba256f71f433f48:logo.png <file>
65e74a797c226e2e1f3e93d7e9900908f7a9cd56d4785da1:artwork <dir>
363330acb22b950ca3296ff0109d392e55acec9342b60425:passwd <file>
363330acb22b950ca3296ff0109d392e55acec9342b60425:passwd <file>
/arch/history/2014-10-12 23:58:27/imported-objects> get 485abf4dc2b7c8783ec070d6593d33645ba256f71f433f48:logo.png                                  
Extracted 485abf4dc2b7c8783ec070d6593d33645ba256f71f433f48:logo.png into .
/arch/history/2014-10-12 23:58:27/imported-objects> ls -ll
-r-------- - - - -: 485abf4dc2b7c8783ec070d6593d33645ba256f71f433f48:logo.png
key: #f
contents: "485abf4dc2b7c8783ec070d6593d33645ba256f71f433f48"
filename: "logo.png"
mime-type: "image/png"
import-path: "artwork/logo.png"
[...rest snipped...]
/arch/history/2014-10-12 23:58:27/imported-objects> quit
[alaric@ahusai ugarit]$ file 485abf4dc2b7c8783ec070d6593d33645ba256f71f433f48\:logo.png 
485abf4dc2b7c8783ec070d6593d33645ba256f71f433f48:logo.png: PNG image data, 250 x 250, 8-bit/color RGBA, non-interlaced

1 Comment

  • By John Cowan, Tue 14th Oct 2014 @ 3:08 am

    I recommend you grab the Apache magic_mime_type module and use the modified /etc/magic file therein, rather than depending on the suffix.

Other Links to this Post

RSS feed for comments on this post.

Leave a comment

WordPress Themes

Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales