Commit graph

3302 commits

Author SHA1 Message Date
Sebastien Awwad
fca27122ef
Add specification version to TIMESTAMP_SCHEMA
It was excluded from the Timestamp schema definition in error.

In the process of making metadata writing use the Timestamp schema
strictly, this bug was discovered.  Metadata previously written
included specification version, but the schema check did not.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-03-29 11:37:30 -04:00
Sebastien Awwad
b4d274f527
Indicate the TUF spec version we conform to, in a tuf variable
Add a tuf-level variable in tuf/__init__.py indicating the version
of the TUF specification that the code in this repository is
intended and expected to conform to.

This will be used when writing metadata.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-03-29 11:37:30 -04:00
Sebastien Awwad
b315aba018
Replace six classes with one function in formats.py
Kills classes MetaFile, RootFile, TargetsFile, MirrorsFile,
SnapshotFile, and TimestampFile.  They each had an unused
from_ method and a used make_ method.  They were all additional,
unnecessary representations of the same metadata, and it is
very important that metadata formats be defined once in the
reference implementation, in the schemas that are already used
more broadly, in foramts.py.

Replaces the classes, their methods, and some associated variables
with a single short function called build_dict_conforming_to_schema
that takes keyword arguments and builds a dictionary, then checks
to make sure that the result conforms to the given schema.

This commit shifts repository_lib from use of the old classes to
the new function.

In later commits, we should use this function more broadly, since it
can be of use in all schema construction.

There are several TODOs added to the code, mostly for post-#660
tasks.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-03-29 11:36:50 -04:00
Sebastien Awwad
3a4c6134fe
Merge pull request #844 from theupdateframework/improve_spec_version_handling_2
Specification version support code cleanup
2019-03-29 11:32:18 -04:00
Sebastien Awwad
d58bcf9c62
spec version support code cleanup
Specification version now only lives in tuf/__init__.py, and will only be
derived from there.

Specification version info is no longer in tuf.formats, where it was
previously moved from tuf.updater, since this was redundant.

Also finally corrects spec version testing in test_updater.py.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-03-29 11:08:43 -04:00
Sebastien Awwad
7a3b04cb89
Merge branch 'fix_try_except_else_in_tests' into develop
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-03-28 19:12:34 -04:00
Sebastien Awwad
2c1ca1e5c1
test: Patch some holes in testing due to bad try/except/else
syntax/understanding.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-03-28 19:03:46 -04:00
Sebastien Awwad
2d2e401ecd
Merge pull request #842 from theupdateframework/improve_spec_version_handling
Improve the way specification version is checked in metadata
2019-03-28 18:55:10 -04:00
Sebastien Awwad
18ef3b419d
Improve the way specification version is checked in metadata
and generate more friendly errors.  Prior to this, a test in
test_updater.py was written in such a way to not actually be
testing whether or not specification version checking was
working correctly -- the error updater.py raised if a specification
version number was not supported was the same as would be raised
if a role version was not the expected version, and, amusingly,
the test could not distinguish between these two scenarios and
was providing the wrong role version......

Specification version mismatch now raises a particular error:
UnsupportedSpecificationError.

The specification version supported by this code is now also all
in one place, tuf.formats rather than tuf.updater.

Related error messages and testing were improved (with some
edge cases closed).

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-03-28 18:30:03 -04:00
Sebastien Awwad
a4cf9c95c2
Merge pull request #833 from theupdateframework/roadmap_corrections
DOC: Update the outdated ROADMAP.md
2019-03-28 15:29:11 -04:00
Sebastien Awwad
58be640faf
Merge pull request #839 from theupdateframework/pylint_fix_exception_subscripting
Resolve pylint error: remove outdated exception subscript
2019-03-26 13:32:19 -04:00
Sebastien Awwad
a7cb2dd4ce
Resolve pylint error: remove outdated exception subscript
Python3 does not support exception subscripting:
  e.g. except ... as e:
         e[1]       # does not work in Python3

This line of code was presumably not covered by testing,
allowing it to persist.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-03-26 12:10:15 -04:00
Sebastien Awwad
24618a956b
DOC: Clarify repository_tool interface to delegated roles
Add note to make clear what was implicit: that once a delegated role is created,
it can be accessed (for the same purposes as you'd access the Targets role
using `repository.targets`) as: `repository.targets("<delegated rolename>")`.

Also add that specific note to the add_targets section of the tutorial.
2019-03-25 10:47:11 -04:00
Justin Cappos
37d5833760
Update README.md 2019-03-13 17:18:41 -04:00
Sebastien Awwad
e541d05f08
DOC: Note client dir creation in CLI instructions
Note that the `repo.py --init` call also sets up a client directory.

A student recently ran into some confusion on this point, and it's not properly documented here.
2019-03-11 10:31:24 -04:00
Sebastien Awwad
e97b0b091d
Merge pull request #824 from HavardLine/patch-1
Context to QUICKSTART.md
2019-02-26 12:51:11 -05:00
Sebastien Awwad
4847783001
DOC: Update the outdated ROADMAP.md
- refer to the authoritative sources for the latest releases
- include new packager information
- add tasks for upcoming releases
- generalize release schedule

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-02-26 11:22:47 -05:00
Justin Cappos
bcde77c85d
Merge pull request #832 from truongnh1992/fix-typo
Remove redundant words in comment
2019-02-26 10:10:07 -05:00
Nguyen Hai Truong
d36a4e5621 Remove redundant words in comment
Although it is spelling mistakes, it might make an affects
while reading.

Signed-off-by: Nguyen Hai Truong <truongnh@vn.fujitsu.com>
2019-02-26 14:35:30 +07:00
Justin Cappos
882f084ff1
Merge pull request #831 from tuanvcw/update_deprecated_links_docs
Update deprecated links in docs
2019-02-25 22:25:09 -05:00
Vu Cong Tuan
0d58fae3a8 Update deprecated links in docs
Signed-off-by: Vu Cong Tuan <tuanvc@vn.fujitsu.com>
2019-02-26 08:58:59 +07:00
Justin Cappos
c23a083195
Merge pull request #830 from tuanvcw/fix_typos_doc
Fix some typos in docs
2019-02-25 13:38:40 -05:00
Vu Cong Tuan
bc50deb865 Fix some typos in docs
Signed-off-by: Vu Cong Tuan <tuanvc@vn.fujitsu.com>
2019-02-25 17:00:26 +07:00
lukpueh
cbde728875
Merge pull request #828 from huynq0911/fix_http_https
Update deprecated url
2019-02-22 09:35:23 +01:00
Nguyen Quang Huy
4ad02f45ff Add signoff to commit
By the site support certification, so need update http to https url

Signed-off-by: Nguyen Quang Huy <huynq0911@gmail.com>
2019-02-22 09:08:52 +07:00
Nguyen Quang Huy
6a4d222df5 Update deprecated url
Update deprecated url to new url

Signed-off-by: Nguyen Quang Huy <huynq0911@gmail.com>
2019-02-21 16:50:19 +07:00
lukpueh
c3e28e7082
Merge pull request #827 from huynq0911/fix_some_typos
Fix some typos
2019-02-21 09:56:48 +01:00
Justin Cappos
9f5c401f87
Merge pull request #826 from huynq0911/fix_http_https
Change http to https for security links
2019-02-21 00:49:48 -05:00
huynq0911
3772ed3d2d Fix some typos
Correct some words spelling for reading more easily.

Signed-off-by: huynq0911 <huynq0911@gmail.com>
2019-02-21 00:02:24 +07:00
huynq0911
4af9cf5899 Change http to https for security links
For security, we should change http into https links.

Signed-off-by: huynq0911 <huynq0911@gmail.com>
2019-02-20 23:47:26 +07:00
Sebastien Awwad
1fc7da7d42
Merge pull request #825 from theupdateframework/quieter_tests_2
Reduce test spam by using unittest output buffering
2019-02-20 11:42:37 -05:00
Sebastien Awwad
eb60084ebe
Reduce test spam by using unittest output buffering
Thanks go to @lukpueh for this helpful tip.

After merge, stdout should only appear if a test has failed. This
functionality is provided by `unittest.TextTestRunner` argument `buffer=True`.
This functions like the `--buffer` command line argument listed here:
https://docs.python.org/3/library/unittest.html#command-line-options

std out is discarded if a test succeeds.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-02-19 13:38:10 -05:00
Havard
7cc150af40 Context to QUICKSTART.md
Hi, I did the quick-start today and missed some context. This is my suggestion.

Thanks for a cool framework!
Regards Håvard

Signed-off-by: Håvard B Line <havard.line@gmail.com>
2019-02-17 20:05:38 +01:00
Sebastien Awwad
0b82d9a8a7
Merge branch 'release_v0.11.2.dev3' into develop 2019-01-10 11:54:52 -05:00
Sebastien Awwad
847f20df9e
Update version to 0.11.2.dev3
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-01-10 11:52:42 -05:00
Sebastien Awwad
34790634ec
DOC: Clarify update instructions for requirements files
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-01-08 10:58:17 -05:00
Sebastien Awwad
cfa8a57b09
Merge pull request #818 from theupdateframework/update_dependencies
Update deps using pip-compile and manual checking in Python2&3
2019-01-07 12:27:09 -05:00
Sebastien Awwad
39e4674e4c
Update deps using pip-compile and manual checking in Python2&3
Also add note about how this is done.

The dev-requirements.txt dependencies that do not appear in
requirements.txt have not been updated.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-01-07 11:31:07 -05:00
Walter Lee
1dabb0e046
fixed 404 in last Security link
should be https://github.com/theupdateframework/tuf/blob/develop/docs/SECURITY.md instead of
https://github.com/theupdateframework/tuf/blob/develop/SECURITY.md which is 404
2019-01-07 10:33:10 -05:00
Justin Cappos
12de53e8c2
Merge pull request #811 from theupdateframework/avoid_unnecessary_delegated_targets_role_dls
Avoid unnecessary delegated role downloads
2018-12-31 12:30:05 -05:00
Sebastien Awwad
3b4e0e6458
Fix unnecessary delegated role downloads w/ targets_of_role
If the role you're fetching the targets of is the 'targets' role,
do not download all delegated targets roles....

Continue to do that only if you're fetching the targets of a
delegated targets role, for historical reasons until this
deprecated function is removed / replaced.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-12-07 12:43:04 -05:00
Sebastien Awwad
42689d203f
DOC: loudly mark deprecations of all_targets and targets_of_role
in comments that explain a bit about why, in updater.py.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-12-07 12:42:12 -05:00
Sebastien Awwad
d910c0865a
Merge pull request #809 from theupdateframework/remove_unnecessary_pass_in_exceptions
Satisfy new pylint version by removing 'pass' in class defs...
2018-11-28 12:02:32 -05:00
Sebastien Awwad
4fb4d73093
minor: satisfy new pylint version by removing pass in class defs...
in tuf/exceptions.py, since those class definitions have docstrings,
and that is apparently sufficient in a class definition to make a
'pass' statement unnecessary.  pylint version 2.2.0 complains about
unnecessary pass statements in this situation, so this resolves that.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-28 10:18:49 -05:00
Sebastien Awwad
ea224024d3
Merge pull request #796 from michizhou/develop
Added command-line option explanations and usage examples for CLI scripts
2018-11-19 11:07:03 -05:00
Sebastien Awwad
fffc53321b
Merge pull request #803 from theupdateframework/test_delay_increases
test: Remove port collison chance and lengthen delays for AppVeyor
2018-11-14 13:39:23 -05:00
Sebastien Awwad
dab9a733e7
Merge pull request #792 from theupdateframework/clarify_updated_targets_docstring
DOC: Clarify docstring of updater.updated_targets
2018-11-14 11:42:38 -05:00
Sebastien Awwad
90a1b77a46
DOC: correct outdated comments in test_proxy_use.py
relevant to the version of Python required for the proxy tests.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-14 11:39:31 -05:00
Sebastien Awwad
37919cb30a
Merge branch 'update_deps' into develop
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-14 11:38:58 -05:00
Sebastien Awwad
8866abbb83
test: remove port collison chance and lengthen delays for AppVeyor
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-14 10:54:02 -05:00