Bug 911375 - Part 2: Convert uses of PurgeManifest to InstallManifest; r=glandium

This commit is contained in:
Gregory Szorc 2013-09-16 17:49:44 -07:00
Родитель bd6b0afca8
Коммит 2c8e8832bd
3 изменённых файлов: 43 добавлений и 62 удалений

Просмотреть файл

@ -55,8 +55,20 @@ ifndef MOZ_PROFILE_USE
libs export tools:: CLOBBER $(topsrcdir)/configure config.status backend.RecursiveMakeBackend.built
$(call SUBMAKE,backend.RecursiveMakeBackend.built,js/src,1)
export::
$(call py_action,purge_manifests,-d _build_manifests/purge .)
.PHONY: install-manifests
export:: install-manifests
install_manifests := bin idl include public private sdk
.PHONY: $(addprefix install-dist-,$(install_manifests))
install-manifests: $(addprefix install-dist-,$(install_manifests))
$(addprefix install-dist-,$(install_manifests)): install-dist-%: CLOBBER $(topsrcdir)/configure config.status backend.RecursiveMakeBackend.built
$(call py_action,process_install_manifest,$(DIST)/$* _build_manifests/install/dist_$* js/src/_build_manifests/install/dist_$*)
.PHONY: install-tests
install-manifests: install-tests
install-tests: CLOBBER $(topsrcdir)/configure config.status backend.RecursiveMakeBackend.built
$(call py_action,process_install_manifest,_tests _build_manifests/install/tests js/src/_build_manifests/install/tests)
endif
CLOBBER: $(topsrcdir)/CLOBBER
@ -79,17 +91,11 @@ config.status: $(topsrcdir)/configure
@echo "but your build might not succeed."
@exit 1
export::
$(RM) -r $(DIST)/sdk
ifdef ENABLE_TESTS
# Additional makefile targets to call automated test suites
include $(topsrcdir)/testing/testsuite-targets.mk
endif
export::
$(call py_action,process_install_manifest,$(DIST)/include _build_manifests/install/dist_include js/src/_build_manifests/install/dist_include)
default all::
$(call BUILDSTATUS,TIERS export compile libs tools)

Просмотреть файл

@ -12,7 +12,6 @@ import types
from mozpack.copier import FilePurger
from mozpack.manifests import (
InstallManifest,
PurgeManifest,
)
import mozpack.path as mozpath
@ -147,19 +146,17 @@ class RecursiveMakeBackend(CommonBackend):
self.backend_input_files.add(os.path.join(self.environment.topobjdir,
'config', 'autoconf.mk'))
self._purge_manifests = dict(
dist_bin=PurgeManifest(relpath='dist/bin'),
dist_private=PurgeManifest(relpath='dist/private'),
dist_public=PurgeManifest(relpath='dist/public'),
dist_sdk=PurgeManifest(relpath='dist/sdk'),
tests=PurgeManifest(relpath='_tests'),
xpidl=PurgeManifest(relpath='config/makefiles/xpidl'),
)
self._install_manifests = dict(
dist_idl=InstallManifest(),
dist_include=InstallManifest(),
)
self._install_manifests = {
k: InstallManifest() for k in [
'dist_bin',
'dist_idl',
'dist_include',
'dist_public',
'dist_private',
'dist_sdk',
'tests',
'xpidl',
]}
def _update_from_avoid_write(self, result):
existed, updated = result
@ -353,7 +350,6 @@ class RecursiveMakeBackend(CommonBackend):
self.summary.managed_count += 1
self._write_manifests('install', self._install_manifests)
self._write_manifests('purge', self._purge_manifests)
def _process_directory_traversal(self, obj, backend_file):
"""Process a data.DirectoryTraversal instance."""
@ -419,11 +415,11 @@ class RecursiveMakeBackend(CommonBackend):
namespace=namespace + subdir)
def _handle_idl_manager(self, manager):
build_files = self._purge_manifests['xpidl']
build_files = self._install_manifests['xpidl']
for p in ('Makefile', 'backend.mk', '.deps/.mkdir.done',
'xpt/.mkdir.done'):
build_files.add(p)
build_files.add_optional_exists(p)
for idl in manager.idls.values():
self._install_manifests['dist_idl'].add_symlink(idl['source'],
@ -432,8 +428,10 @@ class RecursiveMakeBackend(CommonBackend):
% idl['root'])
for module in manager.modules:
build_files.add(mozpath.join('xpt', '%s.xpt' % module))
build_files.add(mozpath.join('.deps', '%s.pp' % module))
build_files.add_optional_exists(mozpath.join('xpt',
'%s.xpt' % module))
build_files.add_optional_exists(mozpath.join('.deps',
'%s.pp' % module))
modules = manager.modules
xpt_modules = sorted(modules.keys())
@ -462,7 +460,7 @@ class RecursiveMakeBackend(CommonBackend):
# Create dependency for output header so we force regeneration if the
# header was deleted. This ideally should not be necessary. However,
# some processes (such as PGO at the time this was implemented) wipe
# out dist/include without regard to our install/purge manifests.
# out dist/include without regard to our install manifests.
out_path = os.path.join(self.environment.topobjdir, 'config',
'makefiles', 'xpidl', 'Makefile')

Просмотреть файл

@ -8,7 +8,6 @@ import os
from mozpack.manifests import (
InstallManifest,
PurgeManifest,
)
from mozunit import main
@ -271,22 +270,21 @@ class TestRecursiveMakeBackend(BackendTester):
"""Ensure xpidl files and directories are written out."""
env = self._consume('xpidl', RecursiveMakeBackend)
# Purge manifests should contain entries.
purge_dir = os.path.join(env.topobjdir, '_build_manifests', 'purge')
# Install manifests should contain entries.
install_dir = os.path.join(env.topobjdir, '_build_manifests',
'install')
self.assertTrue(os.path.isfile(os.path.join(purge_dir, 'xpidl')))
self.assertTrue(os.path.isfile(os.path.join(install_dir, 'dist_idl')))
m = PurgeManifest(path=os.path.join(purge_dir, 'xpidl'))
self.assertIn('.deps/my_module.pp', m.entries)
self.assertIn('xpt/my_module.xpt', m.entries)
self.assertTrue(os.path.isfile(os.path.join(install_dir, 'xpidl')))
m = InstallManifest(path=os.path.join(install_dir, 'dist_idl'))
self.assertEqual(len(m), 2)
self.assertIn('bar.idl', m)
self.assertIn('foo.idl', m)
m = InstallManifest(path=os.path.join(install_dir, 'xpidl'))
self.assertIn('.deps/my_module.pp', m)
self.assertIn('xpt/my_module.xpt', m)
m = InstallManifest(path=os.path.join(install_dir, 'dist_include'))
self.assertIn('foo.h', m)
@ -307,35 +305,14 @@ class TestRecursiveMakeBackend(BackendTester):
'; THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.',
''] + ['[include:%s/xpcshell.ini]' % x for x in expected])
def test_purge_manifests_written(self):
env = self._consume('stub0', RecursiveMakeBackend)
purge_dir = os.path.join(env.topobjdir, '_build_manifests', 'purge')
self.assertTrue(os.path.exists(purge_dir))
expected = [
'dist_bin',
'dist_private',
'dist_public',
'dist_sdk',
'tests',
]
for e in expected:
full = os.path.join(purge_dir, e)
self.assertTrue(os.path.exists(full))
m = PurgeManifest(path=os.path.join(purge_dir, 'dist_bin'))
self.assertEqual(m.relpath, 'dist/bin')
def test_old_purge_manifest_deleted(self):
# Simulate a purge manifest from a previous backend version. Ensure it
# is deleted.
def test_old_install_manifest_deleted(self):
# Simulate an install manifest from a previous backend version. Ensure
# it is deleted.
env = self._get_environment('stub0')
purge_dir = os.path.join(env.topobjdir, '_build_manifests', 'purge')
purge_dir = os.path.join(env.topobjdir, '_build_manifests', 'install')
manifest_path = os.path.join(purge_dir, 'old_manifest')
os.makedirs(purge_dir)
m = PurgeManifest()
m = InstallManifest()
m.write(path=manifest_path)
self.assertTrue(os.path.exists(manifest_path))