def del_repo(alias):
 repos = list_repos()
 if repos:
  deleted_from = dict()
  for repo in repos:
   source = repos[repo][0]
   if (source['name'] == alias):
    deleted_from[source['file']] = 0
    _del_repo_from_file(alias, source['file'])
  if deleted_from:
   ret = ''
   for repo in repos:
    source = repos[repo][0]
    if (source['file'] in deleted_from):
     deleted_from[source['file']] += 1
   for (repo_file, count) in six.iteritems(deleted_from):
    msg = "Repo '{0}' has been removed from {1}.\n"
    if ((count == 1) and os.path.isfile(repo_file)):
     msg = "File {1} containing repo '{0}' has been removed.\n"
     try:
      os.remove(repo_file)
     except OSError:
      pass
    ret += msg.format(alias, repo_file)
   refresh_db()
   return ret
 return "Repo {0} doesn't exist in the opkg repo lists".format(alias)

def del_repo ( alias ) : repos = list_repos ( ) if repos : deleted_from = dict ( ) for repo in repos : source = repos [ repo ] [ 0 ] if ( source [ 'name' ] == alias ) : deleted_from [ source [ 'file' ] ] = 0 _del_repo_from_file ( alias , source [ 'file' ] ) if deleted_from : ret = '' for repo in repos : source = repos [ repo ] [ 0 ] if ( source [ 'file' ] in deleted_from ) : deleted_from [ source [ 'file' ] ] += 1 for ( repo_file , count ) in six . iteritems ( deleted_from ) : msg = "Repo '{0}' has been removed from {1}.\n" if ( ( count == 1 ) and os . path . isfile ( repo_file ) ) : msg = "File {1} containing repo '{0}' has been removed.\n" try : os . remove ( repo_file ) except OSError : pass ret += msg . format ( alias , repo_file ) refresh_db ( ) return ret return "Repo {0} doesn't exist in the opkg repo lists" . format ( alias )
delete a repo .