blob: eb0a7b4e66373ed85112077ff189b47a2f4611e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/usr/bin/python
import os
import string
import sys
import commands
def readUser():
''' samle line "Subject: C=US, ST=North Carolina, O=Fedora Project, OU=Dennis Gilmore, CN=ausil/emailAddress=dennis@ausil.us" '''
userCert = ""
if os.access(os.path.join(os.path.expanduser('~'),".fedora.cert"), os.R_OK):
userCert = open(os.path.join(os.path.expanduser('~'),".fedora.cert"), "r").read()
else:
print "!!! cannot read your ~/.fedora.cert file !!!"
print "!!! Ensure the file is readable and try again !!!"
os.exit(1)
for certLine in userCert.split("\n"):
if not len(certLine):
continue
stripCertLine = certLine.strip()
if stripCertLine.startswith("Subject: "):
subjectLine = certLine.split("CN=")
name = subjectLine[1].split("/")
return name[0]
def cvsco(user, module):
'''CVSROOT=:ext:ausil@cvs.fedoraproject.org:/cvs/extras/'''
(s, o) = commands.getstatusoutput("CVSROOT=:ext:%s@cvs.fedoraproject.org:/cvs/extras/ CVS_RSH=ssh cvs co %s" % (user, module))
if s != 0:
print "Error: %s" % o
else:
print o
def main(pkg):
userName = readUser()
cvsco(userName, pkg)
if __name__ == '__main__':
if len(sys.argv) < 2:
print "you need to specify the module to checkout of cvs"
sys.exit(1)
#the package we want to pull from cvs
pkg = sys.argv[1]
main(pkg)
|