• Ismo Puustinen's avatar
    build: fix building with spaces in directory names. · 231f79f8
    Ismo Puustinen authored
    Fix kubernetes build scripts to work in case the source directory is in
    a directory path which contains a space.
    
    You can prepare such a directory like this:
    
        $ mkdir '/tmp/test dir/'
        $ cd '/tmp/test dir/'
        $ git clone https://github.com/kubernetes/kubernetes.git
        $ cd kubernetes
    
    Then, without the fix:
    
    $ KUBE_FASTBUILD=true KUBE_RELEASE_RUN_TESTS=n build/release.sh
    cat: /tmp/test: No such file or directory
    cat: dir/kubernetes/build/build-image/cross/VERSION: No such file or directory
    cat: /tmp/test: No such file or directory
    cat: dír/kubernetes/build/build-image/VERSION: No such file or directory
    +++ [0307 18:10:33] Verifying Prerequisites....
    cp: target '/tmp/test dir/kubernetes/_output/images/kube-build:build-7c7cd10a18--/Dockerfile' is not a directory
    !!! [0307 18:10:33] Call tree:
    !!! [0307 18:10:33]  1: build/release.sh:35
    kube::build::build_image(...)
    !!! Error in build/../build/common.sh:454
      Error in build/../build/common.sh:454. '((i<3-1))' exited with status 1
    Call stack:
      1: build/../build/common.sh:454 kube::build::build_image(...)
      2: build/release.sh:35 main(...)
    Exiting with status 1
    
    With the fix the compilation succeeds. The fix is done adding double
    quotes to required places (and also just in case to other places where
    shellcheck recommended adding them).
    
    Note that this fix doesn't help with the official make-based build:
    it's tricky to make makefiles work with targets with spaces in their
    names.
    231f79f8
common.sh 27.8 KB