HaikuPorts
  • Login
  • Preferences
  • Help/Guide
  • Wiki
  • Timeline
  • Roadmap
  • View Tickets
  • Search
  • Port Log
  • Blog

Context Navigation

  • Back to Ticket #476

Ticket #476: changeset_r1289.diff

File changeset_r1289.diff, 2.1 KB (added by jrabbit, 5 years ago)
  • haikuporter/trunk/haikuporter

     
    2727from subprocess import check_call, Popen, CalledProcessError 
    2828from optparse import OptionParser 
     29try: 
     30    import paramiko 
     31except ImportError: 
     32    pass 
    2933 
    3034# -- HaikuPorts options ------------------------------------------------------- 
    … …  
    6064confTypes['PACKAGES_PATH'] = [types.StringType] 
    6165confTypes['PATCH_OPTIONS'] = [types.StringType] 
     66confTypes['SSH_KEY'] = [types.StringType] 
     67confTypes['SSH_USER'] = [types.StringType] 
     68confTypes['SSH_PORT'] = [types.IntType] 
     69confTypes['SFTP_TARGET'] = [types.StringType] 
     70confTypes['SFTP_FOLDER'] = [types.StringType] 
    6271 
    6372# allowed types of the BepFile values 
    … …  
    10451054 
    10461055        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() 
    10471082 
    10481083    def makePatchedArchive(self): 
    … …  
    10891124            'cvs': 'cvs', 
    10901125            'bzr': 'bazaar', 
     1126            'paramiko' : 'pycrypto paramiko' 
    10911127            } 
    10921128        if self.options.yes: 

Download in other formats:

  • Original Format

Trac Powered

Powered by Trac 0.13dev-r10686
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/