Commit 28b16c4b authored by Oleg Dzhimiev's avatar Oleg Dzhimiev
Browse files

removed hardcoded git host

parent c070acae
Loading
Loading
Loading
Loading
+28 −12
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@ import subprocess
import os
import os
import sys
import sys
import shutil
import shutil
import re


import json
import json
from collections import OrderedDict
from collections import OrderedDict
@@ -117,20 +118,30 @@ def read_local_conf_dev(conf_file,pattern):
    return ret
    return ret


def update_branch(names_from_conf,name_from_list,pars,git_proto):
def update_branch(names_from_conf,name_from_list,pars,git_proto):

    # GIT host is defined in projects.json, 
    # https or git is defined in local.conf
    # get host
    s0 = re.search("^(https:\/\/|git@)(.+)(\/|:)Elphel.*",pars[0])
    if s0:
      host = s0.group(2)
      print("git host: "+host)
      if (git_proto=="1"):
      if (git_proto=="1"):
        tmp = "https://git.elphel.com/Elphel"
          tmp = "https://"+host+"/Elphel"
          if pars[0].find(tmp)!=-1:
          if pars[0].find(tmp)!=-1:
            pars[0] = "git@git.elphel.com:Elphel"+pars[0][len(tmp):]
              pars[0] = "git@"+host+":Elphel"+pars[0][len(tmp):]
      else:
      else:
        tmp = "git@git.elphel.com:Elphel"
          tmp = "git@"+host+":Elphel"
          if pars[0].find(tmp)!=-1:
          if pars[0].find(tmp)!=-1:
            pars[0] = "https://git.elphel.com/Elphel"+pars[0][len(tmp):]
              pars[0] = "https://"+host+"/Elphel"+pars[0][len(tmp):]
              
              
      for p in names_from_conf:
      for p in names_from_conf:
          if name_from_list in p:
          if name_from_list in p:
              pars[1] = p[1]
              pars[1] = p[1]
    return pars
    return pars




#main
#main


#self pull?
#self pull?
@@ -266,6 +277,11 @@ MIRRORS =+ "http://.*/.* http://mirror.elphel.com/elphel393_mirror/ \\n "
# 0 (or commented) - for https:// - access using a password
# 0 (or commented) - for https:// - access using a password
# ELPHEL393_DEV = "1"
# ELPHEL393_DEV = "1"


# To change git host edit: projects.json (a copy of projects-default.json)
# New git host must match "^(https:\/\/|git@)(.+)(\/|:)Elphel.*", e.g.: 
# "https://something.com/Elphel/someproject" or
#     "git@something.com:Elphel/someproject"

REMOTE_USER ?= "root"
REMOTE_USER ?= "root"
IDENTITY_FILE ?= "~/.ssh/id_rsa"
IDENTITY_FILE ?= "~/.ssh/id_rsa"
COPY_TO_NAND = "0"
COPY_TO_NAND = "0"