Logo Search packages:      
Sourcecode: falcon version File versions  Download package

def falcon::mirror::Mirror::sync (   self  ) 

Synchronize files to the mirror

Definition at line 126 of file mirror.py.

00126                   :
        """Synchronize files to the mirror"""
        args = ['rsync', '-ruRltO']
        if falcon.conf.no_sync: args.append('-n')
        if falcon.conf.verbose: args.append('--progress')

        # Filter very specifically:
        # - all pockets/components that need to be mirrored
        rfilter = ['--filter', '+ pool/']
        dirs = []
        for p in falcon.pocket.Pocket.objects.filter(realcomponents__mirror = self).distinct():
            rfilter += ['--filter', '+ %s' % p.poolpath]
            dirs.append(p.poolpath)
        for c in self.realcomponents.all():
            rfilter += ['--filter', '+ %s' % c.poolpath]
            dirs.append(c.poolpath)
        # - only package files, exclude everything else 
        rfilter += ['--filter', '+ **deb',
                    '--filter', '+ **dsc',
                    '--filter', '+ **tar.gz',
                    '--filter', '+ **diff.gz',
                    '--filter', '- **']
    
        # Upload data
        try:
            comm = args + rfilter + dirs + [self.rsync]
            falcon.util.run(comm, buffer=False)
        except RuntimeError:
            falcon.util.warning(_("Synchronizing with %s failed") % self.name)
            return
        # Sync metadata
        try:
            comm = args + ['--delete', '--force'] + os.listdir(self.rootdir) + [self.rsync]
            falcon.util.run(comm, wd=self.rootdir,buffer=False)
        except RuntimeError:
            falcon.util.warning(_("Synchronizing with %s failed") % self.name)
            return
        # Sync data, now with --delete to get rid of old packages
        try:
            comm = args + ['--existing', '--delete', '--force', 'pool', self.rsync]
            falcon.util.run(comm, buffer=False)
        except RuntimeError:
            falcon.util.warning(_("Synchronizing with %s failed") % self.name)

def listdir(path, base='', filters=[]):


Generated by  Doxygen 1.6.0   Back to index