Merge lp:~james-w/linaro-image-tools/set-content-mtime into lp:linaro-image-tools/11.11
Proposed by
James Westby
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 82 | ||||
Proposed branch: | lp:~james-w/linaro-image-tools/set-content-mtime | ||||
Merge into: | lp:linaro-image-tools/11.11 | ||||
Prerequisite: | lp:~james-w/linaro-image-tools/fix-package-regex | ||||
Diff against target: |
111 lines (+27/-5) 4 files modified
hwpack/hardwarepack.py (+3/-0) hwpack/tarfile_matchers.py (+12/-4) hwpack/testing.py (+5/-1) hwpack/tests/test_tarfile_matchers.py (+7/-0) |
||||
To merge this branch: | bzr merge lp:~james-w/linaro-image-tools/set-content-mtime | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zygmunt Krynicki (community) | Approve | ||
Review via email:
|
Description of the change
Hi,
Here's another small branch to set an mtime for all the files that we
are putting in the hardware pack.
I opted to just allow a skew from the current time in the matchers, rather
than trying to construct things such that I could do an exact match.
While it's not ideal, I don't think it will actually cause us any issues.
Thanks,
James
To post a comment you must log in.
Looks good but I'd simplify one piece:
65 + if self.mtime is not None: ueMismatch( ueMismatch(
66 + if self.mtime_skew is None:
67 + if self.mtime != info.mtime:
68 + return TarfileWrongVal
69 + "mtime", tarball, self.path, self.mtime, info.mtime)
70 + else:
71 + if ((self.mtime > info.mtime
72 + and self.mtime - self.mtime_skew > info.mtime)
73 + or (self.mtime <= info.mtime
74 + and self.mtime + self.mtime_skew < info.mtime)):
75 + return TarfileWrongVal
76 + "mtime", tarball, self.path, self.mtime,
77 + info.mtime)
Instead:
mtime_skew = self.mtime_skew or 0 ueMismatch( ...)
...
if abs(self.mtime - info.mtime) > mtime_skew:
return TarfileWrongVal
This is much easier than your code while doing roughly the same thing (less conditions, less comparisons to track)