diff options
author | dennis@bratac.ausil.us <dennis@bratac.ausil.us> | 2007-11-20 19:18:25 -0600 |
---|---|---|
committer | dennis@bratac.ausil.us <dennis@bratac.ausil.us> | 2007-11-20 19:18:25 -0600 |
commit | 2a4da0fa1b9f3439c82b18840391ad1c9b4f4942 (patch) | |
tree | a46da7355de4c6cb7b2c3913b22b56d6d3fca5c5 /scripts/fedora-cvs | |
parent | 80d8d643dc3563f89e794a08a2f63e7cc71f5155 (diff) | |
download | fedora-packager-2a4da0fa1b9f3439c82b18840391ad1c9b4f4942.tar.gz fedora-packager-2a4da0fa1b9f3439c82b18840391ad1c9b4f4942.tar.xz fedora-packager-2a4da0fa1b9f3439c82b18840391ad1c9b4f4942.zip |
add initial draft of script that does cvs checkouts for you
Diffstat (limited to 'scripts/fedora-cvs')
-rwxr-xr-x | scripts/fedora-cvs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/fedora-cvs b/scripts/fedora-cvs new file mode 100755 index 0000000..eb0a7b4 --- /dev/null +++ b/scripts/fedora-cvs @@ -0,0 +1,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) + |