Closed Bug 884569 Opened 11 years ago Closed 11 years ago

mozpack support for removing untracked files

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla24

People

(Reporter: gps, Assigned: gps)

References

Details

Attachments

(1 file)

I'm splitting off the mozpack work from bug 850380.

Essentially we want code in mozpack to remove "untracked" files from a directory. Essentially, the build system will be able to say "only these files should exist" and this code will purge files that don't belong. This is very similar to how version control systems clean or purge the working directory.
Since the XPIDL patch, I renamed DirectoryPruner to FilePurger and added a
class to hold the results of the operation. That class is still minimal.
It can expand as needed.
Attachment #764424 - Flags: review?(mh+mozilla)
Assignee: nobody → gps
Blocks: 884587
Comment on attachment 764424 [details] [diff] [review]
Support for removing untracked files from a directory

Review of attachment 764424 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozpack/copier.py
@@ +202,5 @@
> +        return FileCopier.add(self, path, FilePurger.FakeFile())
> +
> +    def purge(self, dest):
> +        """Deletes all files and empty directories not in the registry."""
> +        return FileCopier.copy(self, dest)

Not sure how to do that properly in python, but you may want to make FilePurger.copy not do anything.

::: python/mozbuild/mozpack/test/test_copier.py
@@ +136,5 @@
> +    def setUp(self):
> +        self.tmpdir = mkdtemp()
> +
> +    def tearDown(self):
> +        shutil.rmtree(self.tmpdir)

You can import TestWithTmpDir from test_files.
Attachment #764424 - Flags: review?(mh+mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/ba0b09e110ee
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: