@sync_performer
def perform_create_repository(dispatcher, intent):
 package_type = intent.distribution.package_type()
 if (package_type == PackageTypes.RPM):
  check_call(['createrepo', '--quiet', intent.repository_path.path])
  return _list_new_metadata(repository_path=intent.repository_path)
 elif (package_type == PackageTypes.DEB):
  packages_file = intent.repository_path.child('Packages')
  scan_packages(repository=intent.repository_path.path, packages_file=packages_file.path)
  intent.repository_path.child('Release').setContent('Origin: ClusterHQ\n')
  with intent.repository_path.child('Packages.gz').open('w') as raw_file:
   with GzipFile('Packages.gz', fileobj=raw_file) as gzip_file:
    gzip_file.write(packages_file.getContent())
  return {'Packages.gz', 'Release'}
 else:
  raise NotImplementedError(('Unknown package type: %s' % (package_type,)))

@ sync_performer def perform_create_repository ( dispatcher , intent ) : package_type = intent . distribution . package_type ( ) if ( package_type == PackageTypes . RPM ) : check_call ( [ 'createrepo' , '--quiet' , intent . repository_path . path ] ) return _list_new_metadata ( repository_path = intent . repository_path ) elif ( package_type == PackageTypes . DEB ) : packages_file = intent . repository_path . child ( 'Packages' ) scan_packages ( repository = intent . repository_path . path , packages_file = packages_file . path ) intent . repository_path . child ( 'Release' ) . setContent ( 'Origin: ClusterHQ\n' ) with intent . repository_path . child ( 'Packages.gz' ) . open ( 'w' ) as raw_file : with GzipFile ( 'Packages.gz' , fileobj = raw_file ) as gzip_file : gzip_file . write ( packages_file . getContent ( ) ) return { 'Packages.gz' , 'Release' } else : raise NotImplementedError ( ( 'Unknown package type: %s' % ( package_type , ) ) )
see :class:createrepo .