Commit bc2315d8 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev
Browse files

for preferred protocol look into .git/config

parent 114aa078
Loading
Loading
Loading
Loading
+43 −18
Original line number Diff line number Diff line
@@ -117,6 +117,28 @@ def read_local_conf_dev(conf_file,pattern):
                      ret = line.split("=")[1].strip().strip("\"")
    return ret

# reads protocol from the current repository and converts all other projects to this protocol
# https - user/password access
# git   - key-based access
def read_git_proto(conf_file,pattern):
  ret = "0"
  if os.path.isfile(conf_file):
    with open(conf_file,"r") as f:
      lines = f.readlines()
      for line in lines:
        if len(line)!=0:
          if line.strip()[0]!="#":
            pars = line.strip().split("=")
            if (len(pars)>1):
              # simple test
              if pars[0].strip()=='url':
                test = pars[1].find(pattern)
                if test!=-1:
                  ret = "1"
                  print("ogogo! "+pars[1].strip())

  return ret

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

    # GIT host is defined in projects.json,
@@ -155,7 +177,10 @@ else:
  print("ok")

project_branches = read_local_conf("poky/build/conf/local.conf","ELPHEL393_branches")
git_proto = read_local_conf_dev("poky/build/conf/local.conf","ELPHEL393_DEV")

#git_proto = read_local_conf_dev("poky/build/conf/local.conf","ELPHEL393_DEV")
git_proto = read_git_proto(".git/config","git@")

i=0
for p,v in Projects.items():
    i = i + 1