Closed Bug 860499 Opened 11 years ago Closed 11 years ago

manifestparser should have a way of comparing manifests with directory structure

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 683660

People

(Reporter: k0scist, Assigned: k0scist)

References

Details

It is desirable to have a method to compare what is listed in a
(set of) manifest(s) with the files present on disk.  There are two
possibilities for differences:

1. files exist on disk that are not listed in the manifest (bug 857012)
2. files are referenced in the manifest that do not exist on disk
   (bug 857966)

Currently, the only notion manifestparser.py has internally of any of
these things is the `exists` argument to
`TestManifest.active_tests`. xpcchecky.py (see bug 683660 and
http://mxr.mozilla.org/mozilla-central/source/build/xpccheck.py ) does
check for files not included in the manifest and should be ported to
manifestparser.py as per bug 683660 .

ManifestParser should include a new method in its API:

  def diff(self, paths=None):
    """
    compare the contents of the ManifestParser to
    a set of paths.
    Returns a 2-tuple of
    ([paths,on,disk,not,in,manifest],
     [paths,in,manifest,not,on,disk])
    - paths : iterable of paths; if not given taken from a superset of
      paths from manifest items
    """

There should be a command line frontend `manifestparser.py compare` or
`manifestparser.py diff`, e.g.:

  manifestparser diff [options] manifest1 <manifest2> <...> [--path=path1] [--patpath2] [...]

I've chosen this form as, in general, you'll want to compare (a set of
manifests) with (a set of paths [probably mostly directories]). At
least one manifest.ini is needed.

Currently, TestManifest silently ignores test files that do not exist
by default (`exists=False` for `TestManifest.active_tests`) (bug
857966) and there is no internal checking for tests in the directory
that are not in the manifest.  I recommend changing the default of
this flag such that missing tests are an error by default, though it
is important to retain the ability to run with missing tests.  In
addition, the above API can/should be used, as applicable, by the
runner to do as desired for the case where the manifest != what is on
disc. It may be a good idea to mark tests missing on disk as
missing....somehow.

This all should have tests, of course
Blocks: 857012, 857996, 860005
Depends on: 683660
Please be careful with dependencies when cloning :-)
No longer blocks: 857996
Not a clone at all, just a typo.  Sorry about that!
Blocks: 857966
There are a number of places in the tree (especially in the build system) where we'd like to perform a "directory diff" against a manifest and optionally reconcile the differences. I started coding some Python to facilitate this:

https://hg.mozilla.org/users/gszorc_mozilla.com/mq-sc/file/f410d76a18db/mozbuild-directory-enforcer

Feel free to steal my code, finish it up, and check it into mozbase!
(In reply to Gregory Szorc [:gps] from comment #3)
> There are a number of places in the tree (especially in the build system)
> where we'd like to perform a "directory diff" against a manifest and
> optionally reconcile the differences. I started coding some Python to
> facilitate this:
> 
> https://hg.mozilla.org/users/gszorc_mozilla.com/mq-sc/file/f410d76a18db/
> mozbuild-directory-enforcer
> 
> Feel free to steal my code, finish it up, and check it into mozbase!

That overlaps with mozpack.copier.FileCopier.
(In reply to Jeff Hammel [:jhammel] from comment #2)
> Not a clone at all, just a typo.  Sorry about that!

Ah true (think I was remembering the one from the other day). No problem :-)
(In reply to Mike Hommey [:glandium] from comment #4)
> That overlaps with mozpack.copier.FileCopier.

Somewhat, yes. I'm trying to think of why I started that version instead of adapting FileCopier. Nothing is coming to me. Perhaps I was drinking.
Assignee: nobody → jhammel
this was done in the porting of xpccheck -> mozbase
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.