Ticket #476: changeset_r1289.diff
| File changeset_r1289.diff, 2.1 KB (added by jrabbit, 5 years ago) |
|---|
-
haikuporter/trunk/haikuporter
27 27 from subprocess import check_call, Popen, CalledProcessError 28 28 from optparse import OptionParser 29 try: 30 import paramiko 31 except ImportError: 32 pass 29 33 30 34 # -- HaikuPorts options ------------------------------------------------------- … … 60 64 confTypes['PACKAGES_PATH'] = [types.StringType] 61 65 confTypes['PATCH_OPTIONS'] = [types.StringType] 66 confTypes['SSH_KEY'] = [types.StringType] 67 confTypes['SSH_USER'] = [types.StringType] 68 confTypes['SSH_PORT'] = [types.IntType] 69 confTypes['SFTP_TARGET'] = [types.StringType] 70 confTypes['SFTP_FOLDER'] = [types.StringType] 62 71 63 72 # allowed types of the BepFile values … … 1045 1054 1046 1055 print 'Package saved to: ' + zipFile 1056 1057 if self.confKeys['SFTP_TARGET']: 1058 if paramiko: 1059 print 'Uploading package to %s' % self.confKeys['SFTP_TARGET'] 1060 sendFile(zipfile) 1061 else: 1062 self.prompt_installer(paramiko) 1063 1064 def sendFile(self, zipfile): 1065 """upload file to SFTP server""" 1066 1067 key = self.confKeys['SSH_KEY'] 1068 user = self.confKeys['SSH_USER'] 1069 port = self.confKeys['SSH_PORT'] 1070 host = self.confKeys['SFTP_TARGET'] 1071 dest_folder = self.confKeys['SFTP_FOLDER'] 1072 1073 t = paramiko.Transport((host, port)) 1074 pkey = paramiko.RSAKey.from_private_key_file(key) 1075 t.connect(username=user, pkey=pkey) 1076 sftp = paramiko.SFTPClient.from_transport(t) 1077 1078 stfp.put(zipfile, os.join(dest_folder,self.portCategory, 1079 os.path.split(zipfile)[1])) 1080 sftp.close() 1081 t.close() 1047 1082 1048 1083 def makePatchedArchive(self): … … 1089 1124 'cvs': 'cvs', 1090 1125 'bzr': 'bazaar', 1126 'paramiko' : 'pycrypto paramiko' 1091 1127 } 1092 1128 if self.options.yes:
