Exemple #1
0
def libtool_update_preserve_vars (logger, libtool, vars, file):
    printf ('preserve: ', file)
    old = open (file).read ()
    open (file + '.old', 'w').write (old)
    libtool_update (logger, libtool, file)
    new = open (file).read ()
    open (file + '.new', 'w').write (new)
    def subst_vars (o, n):
        for v in vars:
            v_re = '(?m)^%(v)s="([^"]*)"' % locals ()
            orig_m = re.search (v_re, o)
            if not orig_m:
                # some generated libtool thingies only have the first part
                # but vars in the second part must always be substituted
                printf ('from first part')
                orig_m = re.search (v_re, old)
            if orig_m:
                b = n
                n = re.sub (v_re, orig_m.group (0), n)
                printf ('replace:', orig_m.group (0))
                if b == n:
                    printf ('NODIFF:', v_re)
            else:
                printf ('not found:', v_re)
        return n
    # libtool comes in two parts which define the same/similar variables
    marker = '\nexit '
    n1 = subst_vars (old[:old.find (marker)], new[:new.find (marker)])
    n2 = subst_vars (old[old.find (marker):], new[new.find (marker):])
    open (file, 'w').write (n1 + n2)
    loggedos.chmod (logger, file, octal.o755)
Exemple #2
0
def libtool_update_preserve_vars(logger, libtool, vars, file):
    printf('preserve: ', file)
    old = open(file).read()
    open(file + '.old', 'w').write(old)
    libtool_update(logger, libtool, file)
    new = open(file).read()
    open(file + '.new', 'w').write(new)

    def subst_vars(o, n):
        for v in vars:
            v_re = '(?m)^%(v)s="([^"]*)"' % locals()
            orig_m = re.search(v_re, o)
            if not orig_m:
                # some generated libtool thingies only have the first part
                # but vars in the second part must always be substituted
                printf('from first part')
                orig_m = re.search(v_re, old)
            if orig_m:
                b = n
                n = re.sub(v_re, orig_m.group(0), n)
                printf('replace:', orig_m.group(0))
                if b == n:
                    printf('NODIFF:', v_re)
            else:
                printf('not found:', v_re)
        return n

    # libtool comes in two parts which define the same/similar variables
    marker = '\nexit '
    n1 = subst_vars(old[:old.find(marker)], new[:new.find(marker)])
    n2 = subst_vars(old[old.find(marker):], new[new.find(marker):])
    open(file, 'w').write(n1 + n2)
    loggedos.chmod(logger, file, octal.o755)
Exemple #3
0
        def wrap (logger, file):
            dir = os.path.dirname (file)
            base = os.path.basename (file)
            cmd = self.expand ('mv %(file)s %(dir)s/.%(base)s', locals ())
            loggedos.system (logger, cmd)
            loggedos.dump_file (logger, self.expand ('''#!/bin/sh
LD_LIBRARY_PATH=%(system_prefix)s/lib
%(system_prefix)s/bin/.%(base)s "$@"
''', locals ()), file)
            loggedos.chmod (logger, file, octal.o755)
Exemple #4
0
        def wrap(logger, file):
            dir = os.path.dirname(file)
            base = os.path.basename(file)
            cmd = self.expand('mv %(file)s %(dir)s/.%(base)s', locals())
            loggedos.system(logger, cmd)
            loggedos.dump_file(
                logger,
                self.expand(
                    '''#!/bin/sh
LD_LIBRARY_PATH=%(system_prefix)s/lib
%(system_prefix)s/bin/.%(base)s "$@"
''', locals()), file)
            loggedos.chmod(logger, file, octal.o755)
Exemple #5
0
    def execute (self, logger):
        logger.write_log ('Creating shar file from %s\n' % repr (self.kwargs), 'info') 
        name = self.kwargs['name']
        pretty_name = self.kwargs['pretty_name']
        release = self.kwargs['release']
        shar_file = self.kwargs['shar_file']
        shar_head = self.kwargs['shar_head']
        tarball = self.kwargs['tarball']
        version = self.kwargs['version']

        length = os.stat (tarball)[6]
        base_file = os.path.split (tarball)[1]
        script = loggedos.read_file (logger, shar_head)
        header_length = 0
        _z = misc.compression_flag (tarball)
        header_length = len (script % locals ()) + 1
        used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(_z)s'
        used_in_sharhead % locals ()
        loggedos.dump_file (logger, script % locals (), shar_file)
        loggedos.system (logger, 'cat %(tarball)s >> %(shar_file)s' % locals ())
        loggedos.chmod (logger, shar_file, octal.o755)
        loggedos.system (logger, 'rm %(tarball)s' % locals ())
Exemple #6
0
    def execute(self, logger):
        logger.write_log('Creating shar file from %s\n' % repr(self.kwargs),
                         'info')
        name = self.kwargs['name']
        pretty_name = self.kwargs['pretty_name']
        release = self.kwargs['release']
        shar_file = self.kwargs['shar_file']
        shar_head = self.kwargs['shar_head']
        tarball = self.kwargs['tarball']
        version = self.kwargs['version']
        target_cpu = self.kwargs['target_cpu']

        length = os.stat(tarball)[6]
        base_file = os.path.split(tarball)[1]
        script = loggedos.read_file(logger, shar_head)
        header_length = 0
        _z = misc.compression_flag(tarball)
        header_length = len(script % locals()) + 1
        used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(target_cpu)s %(_z)s'
        used_in_sharhead % locals()
        loggedos.dump_file(logger, script % locals(), shar_file)
        loggedos.system(logger, 'cat %(tarball)s >> %(shar_file)s' % locals())
        loggedos.chmod(logger, shar_file, octal.o755)
        loggedos.system(logger, 'rm %(tarball)s' % locals())
Exemple #7
0
 def execute (self, logger):
     loggedos.chmod (logger, *self.args)
Exemple #8
0
 def execute (self, logger):
     loggedos.chmod (logger, self.file, self.mode)
Exemple #9
0
 def execute(self, logger):
     loggedos.chmod(logger, *self.args)
Exemple #10
0
 def execute(self, logger):
     loggedos.chmod(logger, self.file, self.mode)