Esempio n. 1
0
    def test__publicinstall_subdir(self):
        fs = FileSystem(path=self.rootpath())
        source = fs.rootdirectory().add(name='source', entry=Directory())
        build = fs.rootdirectory().add(name='build', entry=Directory())
        install = fs.rootdirectory().add(name='install', entry=Directory())

        source.add(name=const.CONFIX2_PKG,
                   entry=File(lines=[
                       "PACKAGE_NAME('test_publicinstall_subdir')",
                       "PACKAGE_VERSION('1.2.3')"
                   ]))
        source.add(name=const.CONFIX2_DIR, entry=File())
        source.add(name='file.idl',
                   entry=File(lines=[
                       'module A {',
                       'module B {',
                       '}; // /module',
                       '}; // /module',
                   ]))

        package = LocalPackage(rootdirectory=source,
                               setups=[
                                   AutoBoilerplate(),
                                   Automake(use_libtool=False,
                                            library_dependencies=False),
                                   IDLSetup()
                               ])
        package.boil(external_nodes=[])
        package.output()
        fs.sync()

        bootstrap.bootstrap(packageroot=source.abspath(),
                            path=None,
                            use_kde_hack=False,
                            argv0=sys.argv[0])
        configure.configure(packageroot=source.abspath(),
                            builddir=build.abspath(),
                            prefix=install.abspath(),
                            readonly_prefixes=[])
        make.make(builddir=build.abspath(), args=['install'])

        scan.rescan_dir(install)

        self.failUnless(install.find(['include', 'A', 'B', 'file.idl']))

        pass
Esempio n. 2
0
    def test__localinstall_not_absolutely_necessary(self):
        fs = FileSystem(path=self.rootpath())
        source = fs.rootdirectory().add(name='source', entry=Directory())
        build = fs.rootdirectory().add(name='build', entry=Directory())

        source.add(
            name=const.CONFIX2_PKG,
            entry=File(lines=[
                "PACKAGE_NAME('test_localinstall_not_absolutely_necessary')",
                "PACKAGE_VERSION('1.2.3')"
            ]))
        source.add(name=const.CONFIX2_DIR, entry=File())
        source.add(name='file.idl', entry=File())

        package = LocalPackage(rootdirectory=source,
                               setups=[
                                   AutoBoilerplate(),
                                   Automake(use_libtool=False,
                                            library_dependencies=False),
                                   IDLSetup()
                               ])
        package.boil(external_nodes=[])
        package.output()
        fs.sync()

        bootstrap.bootstrap(packageroot=source.abspath(),
                            path=None,
                            use_kde_hack=False,
                            argv0=sys.argv[0])
        configure.configure(packageroot=source.abspath(),
                            builddir=build.abspath(),
                            prefix='/dev/null'.split(os.sep),
                            readonly_prefixes=[])
        make.make(builddir=build.abspath(), args=[])

        scan.rescan_dir(build)

        self.failUnless(build.find(['confix-include', 'file.idl']))

        pass
Esempio n. 3
0
    def test__true(self):
        fs = FileSystem(path=self.rootpath())
        source = fs.rootdirectory().add(name='source', entry=Directory())
        build = fs.rootdirectory().add(name='build', entry=Directory())
        install = fs.rootdirectory().add(name='install', entry=Directory())

        source.add(name=const.CONFIX2_PKG,
                   entry=File(lines=[
                       "PACKAGE_NAME('AutomakeTestScriptTest')",
                       "PACKAGE_VERSION('1.2.3')"
                   ]))
        source.add(name=const.CONFIX2_DIR,
                   entry=File(lines=[
                       "ADD_SCRIPT(filename='test-true', what=SCRIPT_CHECK)",
                       "ADD_SCRIPT(filename='install-dummy', what=SCRIPT_BIN)",
                   ]))
        source.add(name='test-true',
                   entry=File(lines=[
                       '#!/bin/sh',
                       'touch I-was-here',
                       'exit 0',
                   ],
                              mode=stat.S_IRUSR | stat.S_IXUSR))
        source.add(name='install-dummy',
                   entry=File(mode=stat.S_IRUSR | stat.S_IXUSR))

        package = LocalPackage(rootdirectory=source,
                               setups=[
                                   Boilerplate(),
                                   Script(),
                                   Automake(use_libtool=False,
                                            library_dependencies=False)
                               ])
        package.boil(external_nodes=[])
        package.output()

        fs.sync()

        bootstrap.bootstrap(packageroot=source.abspath(),
                            path=None,
                            use_kde_hack=False,
                            argv0=sys.argv[0])
        configure.configure(packageroot=source.abspath(),
                            builddir=build.abspath(),
                            prefix=install.abspath(),
                            readonly_prefixes=None)
        make.make(builddir=build.abspath(), args=['check'])
        make.make(builddir=build.abspath(), args=['install'])

        # verify that the script was executed.
        scan.rescan_dir(build)
        self.failUnless(build.find(['I-was-here']))

        scan.rescan_dir(install)

        # verify that the script hasn't been installed.
        self.failIf(install.find(['bin', 'I-was-here']))

        # for completeness (and paranoia), check if scripts are
        # installed at all.
        self.failUnless(install.find(['bin', 'install-dummy']))

        pass
Esempio n. 4
0
    def test__executable_come_and_go(self):
        class TestGuide(Builder):
            """
            Removes executable as it sees it, and checks that the
            accompanying LibraryDependenciesFinder is also removed.
            """
            EXE_NOT_SEEN = 0
            EXE_SEEN = 1
            DEPFINDER_SEEN = 2
            DEPFINDER_DISAPPEARED = 3

            def __init__(self, exename):
                Builder.__init__(self)
                self.__exename = exename
                self.__state = self.EXE_NOT_SEEN
                self.__exe = None
                self.__depfinder = None
                pass

            def locally_unique_id(self):
                return str(self.__class__)

            def state(self):
                return self.__state

            def enlarge(self):
                if self.__state == self.EXE_NOT_SEEN:
                    for b in self.parentbuilder().iter_builders():
                        if isinstance(b, ExecutableBuilder) and b.exename(
                        ) == self.__exename:
                            self.__state = self.EXE_SEEN
                            self.__exe = b
                            self.force_enlarge()
                            return
                        pass
                    pass
                elif self.__state == self.EXE_SEEN:
                    for b in self.parentbuilder().iter_builders():
                        if isinstance(b, LibraryDependenciesFinder):
                            self.__state = self.DEPFINDER_SEEN
                            self.__depfinder = b
                            break
                        pass
                    if self.__state == self.DEPFINDER_SEEN:
                        self.parentbuilder().remove_builder(self.__exe)
                        self.__exe = None
                        pass
                    pass
                elif self.__state == self.DEPFINDER_SEEN:
                    # we removed the executable in the last
                    # round. wait for the depfinder to disappear.
                    for b in self.parentbuilder().iter_builders():
                        if b is self.__depfinder:
                            return  # still there; continue
                        pass
                    else:
                        self.__state = self.DEPFINDER_DISAPPEARED
                        self.__depfinder = None
                        pass
                    pass
                else:
                    self.fail()
                    pass
                pass

            pass

        fs = FileSystem(path=[])
        fs.rootdirectory().add(
            name=const.CONFIX2_PKG,
            entry=File(lines=[
                "PACKAGE_NAME('test_executable_come_and_go')",
                "PACKAGE_VERSION('1.2.3')"
            ]))
        fs.rootdirectory().add(
            name=const.CONFIX2_DIR,
            entry=File(lines=[
                "EXECUTABLE(exename='exe', center=C(filename='main.c'))"
            ]))
        fs.rootdirectory().add(name='main.c', entry=File())
        package = LocalPackage(rootdirectory=fs.rootdirectory(),
                               setups=[
                                   Boilerplate(),
                                   C(),
                                   Automake(use_libtool=False,
                                            library_dependencies=True)
                               ])
        guide = TestGuide(exename='exe')
        package.rootbuilder().add_builder(guide)
        package.boil(external_nodes=[])
        self.failUnlessEqual(guide.state(), guide.DEPFINDER_DISAPPEARED)
        pass
Esempio n. 5
0
    def test(self):
        fs = FileSystem(path=self.rootpath())
        source = fs.rootdirectory().add(name='source', entry=Directory())
        build = fs.rootdirectory().add(name='build', entry=Directory())
        install = fs.rootdirectory().add(name='install', entry=Directory())

        source.add(name=const.CONFIX2_PKG,
                   entry=File(lines=[
                       "PACKAGE_NAME('SimplePlainFileTest')",
                       "PACKAGE_VERSION('1.2.3')"
                   ]))
        source.add(
            name=const.CONFIX2_DIR,
            entry=File(lines=[
                "ADD_PLAINFILE(filename='plainfile_data', ",
                "              datadir=['subdir', 'data'])",  # list of path components
                "ADD_PLAINFILE(filename='plainfile_prefix',",
                "              prefixdir='subdir/prefix')",  # string
            ]))
        source.add(name='plainfile_data', entry=File())
        source.add(name='plainfile_prefix', entry=File())

        package = LocalPackage(rootdirectory=source,
                               setups=[
                                   Boilerplate(),
                                   Plainfile(),
                                   Automake(use_libtool=False,
                                            library_dependencies=False)
                               ])
        package.boil(external_nodes=[])
        package.output()

        automake_output_builder = find_automake_output_builder(
            package.rootbuilder())
        self.failUnless('plainfile_data' in
                        automake_output_builder.makefile_am().extra_dist())
        self.failUnless('plainfile_prefix' in
                        automake_output_builder.makefile_am().extra_dist())

        fs.sync()

        bootstrap.bootstrap(
            packageroot=source.abspath(),
            path=None,
            use_kde_hack=False,  # (same)
            argv0=sys.argv[0])
        configure.configure(packageroot=source.abspath(),
                            builddir=build.abspath(),
                            prefix=install.abspath(),
                            readonly_prefixes=[])
        make.make(builddir=build.abspath(), args=['install'])

        self.failUnless(
            os.path.isfile(
                os.sep.join(install.abspath() +
                            ['share', 'subdir', 'data', 'plainfile_data'])))
        self.failUnless(
            os.path.isfile(
                os.sep.join(install.abspath() +
                            ['subdir', 'prefix', 'plainfile_prefix'])))

        pass