Skip to content

Commit cd85271

Browse files
authored
Merge pull request #208 from openpreserve/refact/remove-sigs
FEAT: Automatic Signature Updates:
2 parents f5941d7 + e97bd64 commit cd85271

File tree

8 files changed

+255
-58
lines changed

8 files changed

+255
-58
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ python:
77

88
install:
99
- "pip install -U pip flake8 pep257 pytest-cov codecov codacy-coverage pluggy"
10-
- "python setup.py build"
11-
- "python setup.py bdist --formats=zip"
12-
- "python setup.py install"
10+
- "pip install ."
1311

1412
script:
1513
- "flake8 ./fido"

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM python:3.6-alpine as builder
2+
3+
LABEL maintainer="carl.wilson@openpreservation.org" \
4+
org.openpreservation.vendor="Open Preservation Foundation" \
5+
version="0.1"
6+
7+
RUN apk update && apk --no-cache --update-cache add gcc build-base libxml2-dev libxslt-dev git
8+
9+
WORKDIR /src
10+
11+
COPY setup.py setup.py
12+
COPY requirements.txt requirements.txt
13+
COPY README.md README.md
14+
COPY fido/* fido/
15+
16+
RUN mkdir /install && pip install -U pip && pip install -r requirements.txt --prefix=/install && pip install --prefix=/install .
17+
18+
FROM python:3.6-alpine
19+
20+
RUN apk update && apk add --no-cache --update-cache libc6-compat libstdc++ bash libxslt
21+
RUN install -d -o root -g root -m 755 /opt && adduser --uid 1000 -h /opt/fido_sigs -S eark && pip install -U pip python-dateutil
22+
23+
WORKDIR /opt/fido_sigs
24+
25+
COPY --from=builder /install /usr/local
26+
COPY . /opt/fido_sigs/
27+
RUN chown -R eark:users /opt/fido_sigs
28+
29+
USER eark
30+
31+
EXPOSE 5000
32+
ENV FLASK_APP='fido.signatures'
33+
ENTRYPOINT flask run --host "0.0.0.0" --port "5000"

README.md

Lines changed: 67 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,34 @@ FIDO is a command-line tool to identify the file formats of digital objects.
99
It is designed for simple integration into automated work-flows.
1010

1111
FIDO uses the UK National Archives (TNA) PRONOM File Format and Container descriptions.
12-
PRONOM is available from http://www.nationalarchives.gov.uk/pronom/
12+
PRONOM is available from <http://www.nationalarchives.gov.uk/pronom/>
1313
See [LICENSE](LICENSE.txt) for license information.
1414

15-
* Download from: https://github.com/openpreserve/fido/releases
16-
* Usage guide: http://wiki.opf-labs.org/display/KB/FIDO+usage+guide
15+
* Download from: <https://github.com/openpreserve/fido/releases>
16+
* Usage guide: <http://wiki.opf-labs.org/display/KB/FIDO+usage+guide>
1717
* Author: Adam Farquhar (BL), 2010
1818
* Maintainer: Maurice de Rooij (OPF/NANETH), 2011, 2012, 2013, Misty de Meo 2014, 2015, 2016, Holly Becker 2016
1919

2020
Usage
2121
-----
2222

23-
```
24-
usage: fido.py [-h] [-v] [-q] [-recurse] [-zip] [-nocontainer] [-pronom_only]
25-
[-input INPUT] [-filename FILENAME] [-useformats INCLUDEPUIDS]
26-
[-nouseformats EXCLUDEPUIDS] [-matchprintf FORMATSTRING]
27-
[-nomatchprintf FORMATSTRING] [-bufsize BUFSIZE]
28-
[-container_bufsize CONTAINER_BUFSIZE]
29-
[-loadformats XML1,...,XMLn] [-confdir CONFDIR]
30-
[FILE [FILE ...]]
23+
```shell
24+
usage: fido [-h] [-v] [-q] [-recurse] [-zip] [-noextension] [-nocontainer]
25+
[-pronom_only] [-input INPUT] [-filename FILENAME]
26+
[-useformats INCLUDEPUIDS] [-nouseformats EXCLUDEPUIDS]
27+
[-matchprintf FORMATSTRING] [-nomatchprintf FORMATSTRING]
28+
[-bufsize BUFSIZE] [-sigs SIG_ACT]
29+
[-container_bufsize CONTAINER_BUFSIZE]
30+
[-loadformats XML1,...,XMLn] [-confdir CONFDIR]
31+
[FILE [FILE ...]]
3132
```
3233
3334
positional arguments:
35+
3436
* `FILE`: files to check. If the file is -, then read content from stdin. In this case, python must be invoked with `-u` or it may convert the line terminators.
3537
3638
optional arguments:
39+
3740
* `-h`, `--help`: show this help message and exit
3841
* `-v`: show version information
3942
* `-q`: run (more) quietly
@@ -48,18 +51,22 @@ optional arguments:
4851
* `-matchprintf FORMATSTRING`: format string (Python style) to use on match. See nomatchprintf, README.txt.
4952
* `-nomatchprintf FORMATSTRING`: format string (Python style) to use if no match. See README.txt
5053
* `-bufsize BUFSIZE`: size (in bytes) of the buffer to match against (default=131072 bytes)
54+
* `-sigs SIG_ACT`: SIG_ACT "check" for new version of signature file for download.
55+
SIG_ACT "list" list all available sig file versions.
56+
SIG_ACT "update" to automatically update to latest available sig file.
57+
SIG_ACT "n" download and use version n.
5158
* `-container_bufsize CONTAINER_BUFSIZE`: size (in bytes) of the buffer to match against (default=524288 bytes)
5259
* `-loadformats XML1,...,XMLn`: comma separated string of XML format files to add.
5360
* `-confdir CONFDIR`: configuration directory to load_fido_xml, for example, the format specifications from.
5461
5562
Installation
5663
------------
5764
58-
(also see: http://wiki.opf-labs.org/display/KB/FIDO+usage+guide)
65+
(also see: <http://wiki.opf-labs.org/display/KB/FIDO+usage+guide>)
5966
6067
Any platform
6168
62-
1. Download the latest zip release from https://github.com/openpreserve/fido/releases
69+
1. Download the latest zip release from <https://github.com/openpreserve/fido/releases>
6370
2. Unzip into some directory
6471
3. Open a command shell, cd to the directory that you placed the zip contents into
6572
4. Run `python setup.py install` to install FIDO and dependencies. This may require sudo on Linux/OSX or admin privileges on Windows.
@@ -75,11 +82,42 @@ Using pip
7582
Updating signatures
7683
-------------------
7784
78-
To update FIDO with the latest PRONOM file format definitions, run:
79-
`fido-update-signatures`
80-
This is an interactive CLI script which downloads the latest PRONOM signature file and signatures. Please note that it can take a while to download all PUID signatures.
85+
Signatures can be updated from the OPF's signature service.
86+
The service is pull only and iit's location is in the `versions.xml`
87+
configuration file as
88+
89+
```xml
90+
<updateSite>https://fidosigs.openpreservation.org</updateSite>
91+
```
92+
93+
To check what version of the PRONOM signatures you are using
94+
type: `fido -v` and you'll see something like:
8195
82-
If you are having trouble running the script due to firewall restrictions, see OPF wiki: http://wiki.opf-labs.org/display/PT/Command+Line+Interface+proxy+usage
96+
```shell
97+
FIDO v1.6.0 (pronom-xml-95.zip, container-signature-20200121.xml, format_extensions.xml)
98+
```
99+
100+
Here `pronom-xml-95.zip` denotes PRONOM version 95. To see if a more recent
101+
set of signatures is available type `fido -sigs check` which will report back:
102+
103+
```shell
104+
Updated signatures v104 are available, current version is v95
105+
```
106+
107+
if new signatures are available or
108+
109+
```shell
110+
Your signature files are up to date, current version is v104
111+
```
112+
113+
if not. To update signatures to the latest version type `fido -sigs update`:
114+
115+
```shell
116+
Updated signatures v104 are available, current version is v95
117+
Updating signatures
118+
```
119+
120+
If you are having trouble due to firewall restrictions, see OPF wiki: <http://wiki.opf-labs.org/display/PT/Command+Line+Interface+proxy+usage>
83121
84122
Please note that this WILL NOT update the container signature file located in the 'conf' folder.
85123
The reason for this that the PRONOM container signature file contains special types
@@ -97,6 +135,8 @@ or a pip installation will handle dependencies.
97135
98136
FIDO 1.3.3 and later have experimental Python 3 support.
99137
138+
FIDO 1.4 and later have Python 3 support.
139+
100140
Format Definitions
101141
------------------
102142
@@ -118,11 +158,12 @@ an object called info with the following fields:
118158
* `printnomatch`: `info.count` (file N)
119159
120160
The defaults for FIDO 1.0 are:
161+
121162
* `printmatch`:
122-
* `"OK,%(info.time)s,%(info.puid)s,%(info.formatname)s,%(info.signaturename)s,%(info.filesize)s,\"%(info.filename)s\",\"%(info.mimetype)s\",\"%(info.matchtype)s\"\n"`
163+
* `"OK,%(info.time)s,%(info.puid)s,%(info.formatname)s,%(info.signaturename)s,%(info.filesize)s,\"%(info.filename)s\",\"%(info.mimetype)s\",\"%(info.matchtype)s\"\n"`
123164
124165
* `printnomatch`:
125-
* `"KO,%(info.time)s,,,,%(info.filesize)s,\"%(info.filename)s\",,\"%(info.matchtype)s\"\n"`
166+
* `"KO,%(info.time)s,,,,%(info.filesize)s,\"%(info.filename)s\",,\"%(info.matchtype)s\"\n"`
126167
127168
It can be useful to provide an empty string for either, for example to ignore all failed matches, or all successful ones (see examples below).
128169
Note that a newline needs to be added to the end of the string using \n.
@@ -131,10 +172,11 @@ Matchtypes
131172
-----------
132173
133174
FIDO returns the following matchtypes:
134-
- fail: the object could not be identified with signature or file extension
135-
- extension: the object could only be identified by file extension
136-
- signature: the object has been identified with (a) PRONOM signature(s)
137-
- container: the object has been idenfified with (a) PRONOM container signature(s)
175+
176+
* fail: the object could not be identified with signature or file extension
177+
* extension: the object could only be identified by file extension
178+
* signature: the object has been identified with (a) PRONOM signature(s)
179+
* container: the object has been idenfified with (a) PRONOM container signature(s)
138180
139181
In some cases multiple results are returned.
140182
@@ -152,14 +194,14 @@ Take input from a list of files:
152194
153195
Linux:
154196
155-
```
197+
```shell
156198
ls > files.txt
157199
python fido.py -input files.txt
158200
```
159201
160202
Windows:
161203
162-
```
204+
```shell
163205
dir /b > files.txt
164206
python fido.py -input files.txt
165207
```

RELEASENOTES.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,38 @@ Copyright 2010 The Open Preservation Foundation
88
Fido is made available under the Apache License, Version 2.0; see the file
99
LICENSE.txt for details.
1010

11+
Fido 1.6.0rc1
12+
-------------
13+
14+
2022-03-29
15+
16+
New command line options for updating signatures, see
17+
18+
- PRONOM signatures can now be updated from a web service [[#202][]].
19+
- PRONOM v104 support with successful signature compilation (see issue [#203][]) [[#204][]].
20+
- Closed issue [#100][], Added Unicode support for Windows Python 2.7 [[#200][]].
21+
- Generated signature file now validated against XSD schema [[#197][]].
22+
- Refactoring and cleared final PEP and FLAKE code lint warnings [[#197][]].
23+
- Closed issue [#150][], trapped some of the signature compliation issues [[#197][]].
24+
- Closed issue [#179][], [#198][]: Crash on XLS format by updating olefile version to 0.46 [[#195][]].
25+
- Closed issue [#179][]: Crash on XLS format by updating olefile version to 0.46 [[#195][]].
26+
- Closed issue [#192][]: Fixed signature file defaults [[#193][]].
27+
28+
[#100]: https://github.com/openpreserve/fido/issues/100
29+
[#150]: https://github.com/openpreserve/fido/issues/150
30+
[#179]: https://github.com/openpreserve/fido/issues/179
31+
[#192]: https://github.com/openpreserve/fido/issues/192
32+
[#193]: https://github.com/openpreserve/fido/pull/193
33+
[#195]: https://github.com/openpreserve/fido/pull/195
34+
[#198]: https://github.com/openpreserve/fido/issues/198
35+
[#200]: https://github.com/openpreserve/fido/pull/200
36+
[#202]: https://github.com/openpreserve/fido/pull/202
37+
[#203]: https://github.com/openpreserve/fido/issues/203
38+
[#204]: https://github.com/openpreserve/fido/pull/204
39+
1140
Fido 1.4.0
1241
-------------
42+
1343
2018-12-19
1444

1545
- Python 3 support [[#156][]]

fido/conf/versions.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version='1.0' encoding='utf-8'?>
22
<versions>
3-
<pronomVersion>96</pronomVersion>
4-
<pronomSignature>formats-v96.xml</pronomSignature>
3+
<pronomVersion>104</pronomVersion>
4+
<pronomSignature>pronom-xml-104.zip</pronomSignature>
55
<pronomContainerSignature>container-signature-20200121.xml</pronomContainerSignature>
66
<fidoExtensionSignature>format_extensions.xml</fidoExtensionSignature>
7-
<updateScript>1.4.1</updateScript>
7+
<updateScript>1.6.0rc1</updateScript>
8+
<updateSite>https://fidosigs.openpreservation.org</updateSite>
89
</versions>

0 commit comments

Comments
 (0)