Ejemplo n.º 1
0
def progress_jarmaker():
    if debug > 1:
        print '    JarMaker()'
    else:
        echo('.')
    jm = JarMaker()
    jm.outputFormat = 'jar'
    jm.useChromeManifest = True
    jm.useJarfileManifest = False
    return jm
Ejemplo n.º 2
0
def progress_jarmaker():
    if debug > 1:
        print "    JarMaker()"
    else:
        echo(".")
    jm = JarMaker()
    jm.outputFormat = "jar"
    jm.useChromeManifest = True
    jm.useJarfileManifest = False
    return jm
Ejemplo n.º 3
0
    def test_a_simple_symlink(self):
        '''Test a simple jar.mn with a symlink'''
        if not symlinks_supported(self.srcdir):
            return

        self._create_simple_setup()
        jm = JarMaker(outputFormat='symlink')
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jardir = os.path.join(self.builddir, 'chrome')
        jm.makeJar(os.path.join(self.srcdir,'jar.mn'), jardir)
        # All we do is check that srcdir/bar points to builddir/chrome/test/dir/foo
        srcbar = os.path.join(self.srcdir, 'bar')
        destfoo = os.path.join(self.builddir, 'chrome', 'test', 'dir', 'foo')
        self.assertTrue(is_symlink_to(destfoo, srcbar),
                        "%s is not a symlink to %s" % (destfoo, srcbar))
Ejemplo n.º 4
0
    def test_a_simple_symlink(self):
        '''Test a simple jar.mn with a symlink'''
        if not symlinks_supported(self.srcdir):
            return

        self._create_simple_setup()
        jm = JarMaker(outputFormat='symlink')
        kwargs = {
            'sourcedirs': [self.srcdir],
            'topsourcedir': self.srcdir,
            'jardir': os.path.join(self.builddir, 'chrome'),
        }
        jm.makeJars((os.path.join(self.srcdir, 'jar.mn'), ), tuple(), **kwargs)
        # All we do is check that srcdir/bar points to builddir/chrome/test/dir/foo
        srcbar = os.path.join(self.srcdir, 'bar')
        destfoo = os.path.join(self.builddir, 'chrome', 'test', 'dir', 'foo')
        self.assertTrue(is_symlink_to(destfoo, srcbar),
                        "%s is not a symlink to %s" % (destfoo, srcbar))
Ejemplo n.º 5
0
 def _jar_and_compare(self, infile, **kwargs):
     jm = JarMaker(outputFormat='jar')
     jardir = os.path.join(self.builddir, 'chrome')
     if 'topsourcedir' not in kwargs:
         kwargs['topsourcedir'] = self.srcdir
     for attr in ('topsourcedir', 'sourcedirs'):
         if attr in kwargs:
             setattr(jm, attr, kwargs[attr])
     jm.makeJar(infile, jardir)
     cwd = os.getcwd()
     os.chdir(self.builddir)
     try:
         # expand build to stage
         for path, dirs, files in os.walk('.'):
             stagedir = os.path.join(self.stagedir, path)
             if not os.path.isdir(stagedir):
                 os.mkdir(stagedir)
             for file in files:
                 if file.endswith('.jar'):
                     # expand jar
                     stagepath = os.path.join(stagedir, file)
                     os.mkdir(stagepath)
                     zf = ZipFile(os.path.join(path, file))
                     # extractall is only in 2.6, do this manually :-(
                     for entry_name in zf.namelist():
                         segs = entry_name.split('/')
                         fname = segs.pop()
                         dname = os.path.join(stagepath, *segs)
                         if not os.path.isdir(dname):
                             os.makedirs(dname)
                         if not fname:
                             # directory, we're done
                             continue
                         _c = zf.read(entry_name)
                         open(os.path.join(dname, fname), 'wb').write(_c)
                     zf.close()
                 else:
                     copy2(os.path.join(path, file), stagedir)
         # compare both dirs
         os.chdir('..')
         td = _TreeDiff('ref', 'stage')
         return td.allResults('reference', 'build')
     finally:
         os.chdir(cwd)
Ejemplo n.º 6
0
 def _jar_and_compare(self, infile, **kwargs):
     jm = JarMaker(outputFormat='jar')
     jardir = os.path.join(self.builddir, 'chrome')
     if 'topsourcedir' not in kwargs:
         kwargs['topsourcedir'] = self.srcdir
     for attr in ('topsourcedir', 'sourcedirs'):
         if attr in kwargs:
             setattr(jm, attr, kwargs[attr])
     jm.makeJar(infile, jardir)
     cwd = os.getcwd()
     os.chdir(self.builddir)
     try:
         # expand build to stage
         for path, dirs, files in os.walk('.'):
             stagedir = os.path.join(self.stagedir, path)
             if not os.path.isdir(stagedir):
                 os.mkdir(stagedir)
             for file in files:
                 if file.endswith('.jar'):
                     # expand jar
                     stagepath = os.path.join(stagedir, file)
                     os.mkdir(stagepath)
                     zf = ZipFile(os.path.join(path, file))
                     # extractall is only in 2.6, do this manually :-(
                     for entry_name in zf.namelist():
                         segs = entry_name.split('/')
                         fname = segs.pop()
                         dname = os.path.join(stagepath, *segs)
                         if not os.path.isdir(dname):
                             os.makedirs(dname)
                         if not fname:
                             # directory, we're done
                             continue
                         _c = zf.read(entry_name)
                         open(os.path.join(dname, fname), 'wb').write(_c)
                     zf.close()
                 else:
                     copy2(os.path.join(path, file), stagedir)
         # compare both dirs
         os.chdir('..')
         td = _TreeDiff('ref', 'stage')
         return td.allResults('reference', 'build')
     finally:
         os.chdir(cwd)
Ejemplo n.º 7
0
    def test_a_simple_symlink(self):
        '''Test a simple jar.mn with a symlink'''
        if not symlinks_supported(self.srcdir):
            return

        self._create_simple_setup()
        jm = JarMaker(outputFormat='symlink')
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jardir = os.path.join(self.builddir, 'chrome')
        jm.makeJar(os.path.join(self.srcdir, 'jar.mn'), jardir)
        # All we do is check that srcdir/bar points to builddir/chrome/test/dir/foo
        srcbar = os.path.join(self.srcdir, 'bar')
        destfoo = os.path.join(self.builddir, 'chrome', 'test', 'dir', 'foo')
        self.assertTrue(is_symlink_to(destfoo, srcbar),
                        "{0} is not a symlink to {1}".format(destfoo, srcbar))
Ejemplo n.º 8
0
 def setUp(self):
     self.jm = JarMaker()
     self.jm.topsourcedir = '/TOPSOURCEDIR'
     self.jm.relativesrcdir = 'browser/locales'
     self.fake_empty_file = StringIO()
     self.fake_empty_file.name = 'fake_empty_file'