def test_process_manifest(self):
        source = self.tmppath('source')
        os.mkdir(source)
        os.mkdir('%s/base' % source)
        os.mkdir('%s/base/foo' % source)
        os.mkdir('%s/base2' % source)

        with open('%s/base/foo/file1' % source, 'a'):
            pass

        with open('%s/base/foo/file2' % source, 'a'):
            pass

        with open('%s/base2/file3' % source, 'a'):
            pass

        m = InstallManifest()
        m.add_pattern_link('%s/base' % source, '**', '')
        m.add_link('%s/base2/file3' % source, 'foo/file3')

        p = self.tmppath('m')
        m.write(path=p)

        dest = self.tmppath('dest')
        track = self.tmppath('track')

        for i in range(2):
            process_install_manifest.process_manifest(dest, [p], track)

            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file1')))
            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file2')))
            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file3')))
    def test_process_manifest2(self):
        self.test_process_manifest()
        m = InstallManifest()
        p = self.tmppath('m')
        m.write(path=p)

        dest = self.tmppath('dest')
        track = self.tmppath('track')

        for i in range(2):
            process_install_manifest.process_manifest(dest, [p], track)

            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file1')))
            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file2')))
            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file3')))
Esempio n. 3
0
    def test_process_manifest(self):
        source = self.tmppath("source")
        os.mkdir(source)
        os.mkdir("%s/base" % source)
        os.mkdir("%s/base/foo" % source)
        os.mkdir("%s/base2" % source)

        with open("%s/base/foo/file1" % source, "a"):
            pass

        with open("%s/base/foo/file2" % source, "a"):
            pass

        with open("%s/base2/file3" % source, "a"):
            pass

        m = InstallManifest()
        m.add_pattern_link("%s/base" % source, "**", "")
        m.add_link("%s/base2/file3" % source, "foo/file3")

        p = self.tmppath("m")
        m.write(path=p)

        dest = self.tmppath("dest")
        track = self.tmppath("track")

        for i in range(2):
            process_install_manifest.process_manifest(dest, [p], track)

            self.assertTrue(os.path.exists(self.tmppath("dest/foo/file1")))
            self.assertTrue(os.path.exists(self.tmppath("dest/foo/file2")))
            self.assertTrue(os.path.exists(self.tmppath("dest/foo/file3")))

        m = InstallManifest()
        m.write(path=p)

        for i in range(2):
            process_install_manifest.process_manifest(dest, [p], track)

            self.assertFalse(os.path.exists(self.tmppath("dest/foo/file1")))
            self.assertFalse(os.path.exists(self.tmppath("dest/foo/file2")))
            self.assertFalse(os.path.exists(self.tmppath("dest/foo/file3")))
    def test_process_manifest(self):
        source = self.tmppath('source')
        os.mkdir(source)
        os.mkdir('%s/base' % source)
        os.mkdir('%s/base/foo' % source)
        os.mkdir('%s/base2' % source)

        with open('%s/base/foo/file1' % source, 'a'):
            pass

        with open('%s/base/foo/file2' % source, 'a'):
            pass

        with open('%s/base2/file3' % source, 'a'):
            pass

        m = InstallManifest()
        m.add_pattern_link('%s/base' % source, '**', '')
        m.add_link('%s/base2/file3' % source, 'foo/file3')

        p = self.tmppath('m')
        m.write(path=p)

        dest = self.tmppath('dest')
        track = self.tmppath('track')

        for i in range(2):
            process_install_manifest.process_manifest(dest, [p], track)

            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file1')))
            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file2')))
            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file3')))

        m = InstallManifest()
        m.write(path=p)

        for i in range(2):
            process_install_manifest.process_manifest(dest, [p], track)

            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file1')))
            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file2')))
            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file3')))
Esempio n. 5
0
    def build(self):
        print("Start building")
        manifest_install = {
            'build': 'build',
            'dist': 'dist',
            'tests': '_tests',
        }

        COMPLETE = 'From {dest}: Kept {existing} existing; Added/updated {updated}; ' \
            'Removed {rm_files} files and {rm_dirs} directories.'

        config = self.environment
        for d in sorted(manifest_install.keys()):
            dest_dir = mozpath.join(config.topobjdir, manifest_install[d])
            manifests_filepath = mozpath.join(self.manifests_root, d)
            result = process_manifest(dest_dir, [manifests_filepath], remove_all_directory_symlinks=False)
            print(COMPLETE.format(dest=dest_dir,
                existing=result.existing_files_count,
                updated=result.updated_files_count,
                rm_files=result.removed_files_count,
                rm_dirs=result.removed_directories_count))

        self.loadDependencies()

        IDL_PARSER_DIR = mozpath.join(config.substs['top_srcdir'], 'xpcom', 'idl-parser')
        #TODO, generate IDL_PARSER_DIR manually

        sys.path[0:0] = [IDL_PARSER_DIR, self.IDL_PARSER_CACHE_DIR]

        for idl_name in sorted(list(self._idl_set)):
            self.generateXpcomCppHeader(config, idl_name, self.IDL_PARSER_CACHE_DIR)

        for xpt_path, xpt_deps, xpt_dep_file in self._xpt_list:
            target_path = mozpath.join(config.topobjdir, xpt_path)
            self.generateXpcomXpt(config, target_path, xpt_deps, self.IDL_PARSER_CACHE_DIR)

        buildFinished = True
        for backend_file in self.backend_input_files:
            if self.targetNeedBuild(backend_file):
                buildFinished = False
                self.addDependencies(backend_file, [backend_file])
        self.dumpDependencies()
        return buildFinished