Remove unused crosutils scripts.

Change-Id: I56b70a363426cd36edd81b6c3e12d98620a8a16e

BUG=chromium-os:11172
TEST=NA

Review URL: http://codereview.chromium.org/6732044
This commit is contained in:
Chris Sosa 2011-03-24 17:06:36 -07:00
parent fd2cdec118
commit ca2d1d3328
2 changed files with 0 additions and 210 deletions

View File

@ -1,92 +0,0 @@
#!/usr/bin/python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script to grab a list of ebuilds which cannot be safely mirrored.
Some ebuilds do not have the proper versioning magic to be able to be safely
mirrored. We would like to phase them out gradually, by updating a list which
can be safely cached.
"""
import os
import re
import StringIO
import tarfile
import urllib
def main():
# Get a tarball of chromiumos-overlay.
fh = urllib.urlopen('http://src.chromium.org/cgi-bin/gitweb.cgi?'
'p=chromiumos-overlay.git;a=snapshot;h=HEAD;sf=tgz')
tgz = fh.read()
fh.close()
# Prepare a set of files to clobber.
clobber_list = set()
# Prepare a set of files to exempt from clobbering.
exempt_list = set()
# Walk the tarball looking for SAFE_TO_CACHE lists and ebuilds containing
# CHROMEOS_ROOT.
tgzf = StringIO.StringIO(tgz)
tar = tarfile.open(fileobj=tgzf, mode='r')
for tinfoi in tar:
if not tinfoi.isdir():
original_name = tinfoi.name
tinfo = tinfoi
while tinfo.islnk() or tinfo.issym():
path = os.path.normpath(os.path.join(os.path.dirname(tinfo.name),
tinfo.linkname))
tinfo = tar.getmember(path)
if tinfo.name.endswith('.ebuild'):
# Load each ebuild.
fh = tar.extractfile(tinfo)
ebuild_data = fh.read()
fh.close()
# Add to the clobber list if it contains CHROMEOS_ROOT.
if 'CHROMEOS_ROOT' in ebuild_data:
filename = os.path.split(original_name)[1]
basename = os.path.splitext(filename)[0]
clobber_list.add(basename)
elif tinfo.name.endswith('/SAFE_TO_CACHE'):
fh = tar.extractfile(tinfo)
for line in fh:
if len(line) > 1 and line[0] != '#':
exempt_list.add(line.strip())
fh.close()
tar.close()
tgzf.close()
# Don't clobber ebuilds listed in SAFE_TO_CACHE.
clobber_list -= exempt_list
# Scan the current directory for any Packages files, modify to remove
# packages that shouldn't be cached.
for root, _, files in os.walk('.', topdown=False):
for name in files:
filename = os.path.join(root, name)
basename = os.path.split(filename)[1]
if basename == 'Packages':
# Filter out entries involving uncache-able ebuilds.
allowed = True
nlines = []
fh = open(filename, 'r')
for line in fh:
m = re.match('^CPV\: [^\n]+/([^/]+)[\n]$', line)
if m:
allowed = m.group(1) not in clobber_list
if allowed:
nlines.append(line)
fh.close()
# Write out new contents.
fh = open(filename, 'w')
for line in nlines:
fh.write(line)
fh.close()
if __name__ == '__main__':
main()

View File

@ -1,118 +0,0 @@
#!/usr/bin/env python
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generates and passes authentication credentials to Chromium.
This script can be used to simulate the login manager's process of
passing authentication credentials to Chromium. Running this script
will authenticate with Google Accounts with the provided login
credentials and then write the result to the specified pipe. The
script will then block until the pipe is read. To launch Chromium,
use the command:
./chrome --cookie-pipe=/tmp/cookie_pipe
"""
from optparse import OptionParser
import getpass
import os
import sys
import urllib
import urllib2
DEFAULT_COOKIE_PIPE = '/tmp/cookie_pipe'
GOOGLE_ACCOUNTS_URL = 'https://www.google.com/accounts'
LOGIN_SOURCE = 'test_harness'
class CookieCollectorRedirectHandler(urllib2.HTTPRedirectHandler):
def __init__(self):
self.__cookie_headers = []
@property
def cookie_headers(self):
return self.__cookie_headers
def http_error_302(self, req, fp, code, msg, headers):
self.__cookie_headers.extend(fp.info().getallmatchingheaders('Set-Cookie'))
result = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp,
code, msg, headers)
return result
def Authenticate(email, password):
opener = urllib2.build_opener()
payload = urllib.urlencode({'Email': email,
'Passwd': password,
'PersistentCookie': 'true',
'accountType' : 'HOSTED_OR_GOOGLE',
'source' : LOGIN_SOURCE})
request = urllib2.Request(GOOGLE_ACCOUNTS_URL + '/ClientLogin', payload)
response = opener.open(request)
data = response.read().rstrip()
# Convert the SID=xxx\nLSID=yyy\n response into a dict.
l = [p.split('=') for p in data.split('\n')]
cookies = dict((i[0], i[1]) for i in l)
payload = urllib.urlencode({'SID': cookies['SID'],
'LSID': cookies['LSID'],
'source': LOGIN_SOURCE,
'service': 'gaia'})
request = urllib2.Request(GOOGLE_ACCOUNTS_URL + '/IssueAuthToken', payload)
response = opener.open(request)
auth_token = response.read().rstrip()
url = '/TokenAuth?continue=http://www.google.com/&source=%s&auth=%s' % \
(LOGIN_SOURCE, auth_token)
# Install a custom redirect handler here so we can catch all the
# cookies served as the redirects get processed.
cookie_collector = CookieCollectorRedirectHandler()
opener = urllib2.build_opener(cookie_collector)
request = urllib2.Request(GOOGLE_ACCOUNTS_URL + url)
response = opener.open(request)
cookie_headers = cookie_collector.cookie_headers
cookie_headers.extend(response.info().getallmatchingheaders('Set-Cookie'))
cookies = [s.replace('Set-Cookie: ', '') for s in cookie_headers]
return cookies
def WriteToPipe(pipe_path, data):
if os.path.exists(pipe_path):
os.remove(pipe_path)
os.mkfifo(pipe_path)
f = open(pipe_path, 'w')
f.write(data)
f.close()
def main():
usage = "usage: %prog [options]"
parser = OptionParser(usage)
parser.add_option('--email', dest='email',
help='email address used for login')
parser.add_option('--password', dest='password',
help='password used for login (will prompt if omitted)')
parser.add_option('--cookie-pipe', dest='cookiepipe',
default=DEFAULT_COOKIE_PIPE,
help='path of cookie pipe [default: %default]')
(options, args) = parser.parse_args()
if options.email is None:
parser.error("You must supply an email address.")
if options.password is None:
options.password = getpass.getpass()
cookies = Authenticate(options.email, options.password)
data = ''.join(cookies)
print 'Writing to "%s":' % options.cookiepipe
print data
WriteToPipe(options.cookiepipe, data)
if __name__ == '__main__':
main()