gopkg.in/openshift/source-to-image.v1@v1.2.0/hack/godep-restore.sh (about)

     1  #!/bin/bash
     2  
     3  # Sometimes godep needs 'other' remotes. So add those remotes
     4  preload-remote() {
     5    local orig_org="$1"
     6    local orig_project="$2"
     7    local alt_org="$3"
     8    local alt_project="$4"
     9  
    10    # Go get stinks, which is why we have the || true...
    11    go get -d "${orig_org}/${orig_project}" &>/dev/null || true
    12  
    13    repo_dir="${GOPATH}/src/${orig_org}/${orig_project}"
    14    pushd "${repo_dir}" > /dev/null
    15      git remote add "${alt_org}-remote" "https://${alt_org}/${alt_project}.git" > /dev/null || true
    16      git remote update > /dev/null
    17    popd > /dev/null
    18  }
    19  
    20  pin-godep() {
    21    pushd "${GOPATH}/src/github.com/tools/godep" > /dev/null
    22      git checkout "$1"
    23      "${GODEP}" go install
    24    popd > /dev/null
    25  }
    26  
    27  # build the godep tool
    28  # Again go get stinks, hence || true
    29  go get -u github.com/tools/godep 2>/dev/null || true
    30  GODEP="${GOPATH}/bin/godep"
    31  
    32  # Use to following if we ever need to pin godep to a specific version again
    33  pin-godep 'v79'
    34  
    35  # preload any odd-ball remotes
    36  preload-remote "github.com/docker" "distribution" "github.com/openshift" "docker-distribution"
    37  
    38  # fill out that nice clean place with the origin godeps
    39  echo "Starting to download all godeps. This takes a while"
    40  
    41  pushd "${GOPATH}/src/github.com/openshift/source-to-image" > /dev/null
    42    "${GODEP}" restore "$@"
    43  popd > /dev/null
    44  
    45  echo "Download finished into ${GOPATH}"
    46  echo "######## REMEMBER ########"
    47  echo "You cannot just godep save ./..."
    48  echo "You should use hack/godep-save.sh"
    49  echo "hack/godep-save.sh forces the inclusion of packages that godep alone will not include"