You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gitian 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/python
  2. import subprocess
  3. import sys
  4. import os
  5. sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), "../lib"))
  6. sys.path.append('/usr/lib/gitian')
  7. from gitian_util import *
  8. def check_command(command):
  9. if commands.get(command) is None:
  10. print>>sys.stderr, "usage: %s CMD\ntry: %s help"%(prog, prog)
  11. exit(1)
  12. return find_command(command)
  13. args = sys.argv[:]
  14. prog = args.pop(0)
  15. if len(args) < 1:
  16. print>>sys.stderr, "usage: %s CMD\n\ntry:\n %s help\nor:\n %s help CMD"%(prog, prog, prog)
  17. exit(1)
  18. commands = {
  19. "release-build": "Build all packages into the 'dist' directory",
  20. "package-build": "Build a single package into the 'dist' directory",
  21. "package-new": "Insert a new package into the distribution",
  22. "release-upload": "Upload a release to a web server",
  23. }
  24. if args[0] == "help":
  25. if len(args) == 1:
  26. for command in commands.keys():
  27. print command, " - ", commands[command]
  28. else:
  29. command = args[1]
  30. command_path = find_command(command)
  31. ret = subprocess.call([command_path, "-h"])
  32. elif args[0] == 'shell-complete':
  33. if len(args) == 1 or args[1] == "help":
  34. for command in commands.keys():
  35. print "%s:%s"%(command, commands[command])
  36. else:
  37. command = args[1]
  38. command_path = find_command(command)
  39. ret = subprocess.call([command_path, "--shell-complete"])
  40. else:
  41. command = args.pop(0)
  42. command_path = find_command(command)
  43. args.insert(0, command_path)
  44. os.execv(command_path, args)