Browse code

Create proper client packages for mac and windows

Give each archive better names

Clayton Coleman authored on 2015/12/10 15:32:39
Showing 4 changed files
... ...
@@ -41,6 +41,8 @@ Getting Started
41 41
 
42 42
 ### Installation
43 43
 
44
+If you have downloaded the client tools, place the included binaries in your PATH.
45
+
44 46
 * For a quick install of Origin, see the [Getting Started Install guide](https://docs.openshift.org/latest/getting_started/administrators.html).
45 47
 * For an advanced installation using [Ansible](https://github.com/openshift/openshift-ansible), follow the [Advanced Installation guide](https://docs.openshift.org/latest/install_config/install/advanced_install.html)
46 48
 * To build and run from source, see [CONTRIBUTING.adoc](CONTRIBUTING.adoc)
... ...
@@ -28,15 +28,15 @@ if [[ ! -d _output/local/releases ]]; then
28 28
 fi
29 29
 
30 30
 # Extract the release achives to a staging area.
31
-os::build::detect_local_release_tars "linux-amd64"
31
+os::build::detect_local_release_tars "linux-64bit"
32 32
 
33 33
 echo "Building images from release tars for commit ${OS_RELEASE_COMMIT}:"
34 34
 echo " primary: $(basename ${OS_PRIMARY_RELEASE_TAR})"
35 35
 echo " image:   $(basename ${OS_IMAGE_RELEASE_TAR})"
36 36
 
37 37
 imagedir="$(mktemp -d 2>/dev/null || mktemp -d -t imagedir.XXXXXX)"
38
-tar xzpf "${OS_PRIMARY_RELEASE_TAR}" -C "${imagedir}"
39
-tar xzpf "${OS_IMAGE_RELEASE_TAR}" -C "${imagedir}"
38
+tar xzpf "${OS_PRIMARY_RELEASE_TAR}" --strip-components=1 -C "${imagedir}"
39
+tar xzpf "${OS_IMAGE_RELEASE_TAR}" --strip-components=1 -C "${imagedir}"
40 40
 
41 41
 # Copy primary binaries to the appropriate locations.
42 42
 cp -pf "${imagedir}/openshift" images/origin/bin
... ...
@@ -86,9 +86,23 @@ readonly OPENSHIFT_BINARY_COPY=(
86 86
 readonly OC_BINARY_COPY=(
87 87
   kubectl
88 88
 )
89
-readonly OS_BINARY_RELEASE_WINDOWS=(
89
+readonly OS_BINARY_RELEASE_CLIENT_WINDOWS=(
90 90
   oc.exe
91
-  kubectl.exe
91
+  README.md
92
+)
93
+readonly OS_BINARY_RELEASE_CLIENT_MAC=(
94
+  oc
95
+  README.md
96
+)
97
+readonly OS_BINARY_RELEASE_CLIENT_LINUX=(
98
+  ./oc
99
+  ./README.md
100
+)
101
+readonly OS_BINARY_RELEASE_SERVER_LINUX=(
102
+  './*'
103
+)
104
+readonly OS_BINARY_RELEASE_CLIENT_EXTRA=(
105
+  ${OS_ROOT}/README.md
92 106
 )
93 107
 
94 108
 # os::build::binaries_from_targets take a list of build targets and return the
... ...
@@ -290,7 +304,6 @@ os::build::place_bins() {
290 290
     fi
291 291
 
292 292
     os::build::export_targets "$@"
293
-
294 293
     for platform in "${platforms[@]}"; do
295 294
       # The substitution on platform_src below will replace all slashes with
296 295
       # underscores.  It'll transform darwin/amd64 -> darwin_amd64.
... ...
@@ -354,22 +367,55 @@ os::build::place_bins() {
354 354
 
355 355
       # Create the release archive.
356 356
       local platform_segment="${platform//\//-}"
357
-      if [[ $platform == "windows/amd64" ]]; then
358
-        local archive_name="${OS_RELEASE_ARCHIVE}-${OS_GIT_VERSION}-${OS_GIT_COMMIT}-${platform_segment}.zip"
359
-        echo "++ Creating ${archive_name}"
360
-        for file in "${OS_BINARY_RELEASE_WINDOWS[@]}"; do
361
-          zip "${OS_LOCAL_RELEASEPATH}/${archive_name}" -qj "${release_binpath}/${file}"
357
+      if [[ ${OS_RELEASE_ARCHIVE} == "openshift-origin" ]]; then
358
+        for file in "${OS_BINARY_RELEASE_CLIENT_EXTRA[@]}"; do
359
+          cp "${file}" "${release_binpath}/"
362 360
         done
361
+        if [[ $platform == "windows/amd64" ]]; then
362
+          platform="windows" OS_RELEASE_ARCHIVE="openshift-origin-client-tools" os::build::archive_zip "${OS_BINARY_RELEASE_CLIENT_WINDOWS[@]}"
363
+        elif [[ $platform == "darwin/amd64" ]]; then
364
+          platform="mac" OS_RELEASE_ARCHIVE="openshift-origin-client-tools" os::build::archive_zip "${OS_BINARY_RELEASE_CLIENT_MAC[@]}"
365
+        elif [[ $platform == "linux/386" ]]; then
366
+          platform="linux/32bit" OS_RELEASE_ARCHIVE="openshift-origin-client-tools" os::build::archive_tar "${OS_BINARY_RELEASE_CLIENT_LINUX[@]}"
367
+        elif [[ $platform == "linux/amd64" ]]; then
368
+          platform="linux/64bit" OS_RELEASE_ARCHIVE="openshift-origin-client-tools" os::build::archive_tar "${OS_BINARY_RELEASE_CLIENT_LINUX[@]}"
369
+          platform="linux/64bit" OS_RELEASE_ARCHIVE="openshift-origin-server" os::build::archive_tar "${OS_BINARY_RELEASE_SERVER_LINUX[@]}"
370
+        else
371
+          echo "++ ERROR: No release type defined for $platform"
372
+        fi
363 373
       else
364
-        local archive_name="${OS_RELEASE_ARCHIVE}-${OS_GIT_VERSION}-${OS_GIT_COMMIT}-${platform_segment}.tar.gz"
365
-        echo "++ Creating ${archive_name}"
366
-        tar -czf "${OS_LOCAL_RELEASEPATH}/${archive_name}" -C "${release_binpath}" .
374
+        if [[ $platform == "linux/amd64" ]]; then
375
+          platform="linux/64bit" os::build::archive_tar "./*"
376
+        else
377
+          echo "++ ERROR: No release type defined for $platform"
378
+        fi
367 379
       fi
368 380
       rm -rf "${release_binpath}"
369 381
     done
370 382
   )
371 383
 }
372 384
 
385
+os::build::archive_zip() {
386
+  local platform_segment="${platform//\//-}"
387
+  local default_name="${OS_RELEASE_ARCHIVE}-${OS_GIT_VERSION}-${OS_GIT_COMMIT}-${platform_segment}.zip"
388
+  local archive_name="${archive_name:-$default_name}"
389
+  echo "++ Creating ${archive_name}"
390
+  for file in "$@"; do
391
+    zip "${OS_LOCAL_RELEASEPATH}/${archive_name}" -qj "${release_binpath}/${file}"
392
+  done
393
+}
394
+
395
+os::build::archive_tar() {
396
+  local platform_segment="${platform//\//-}"
397
+  local base_name="${OS_RELEASE_ARCHIVE}-${OS_GIT_VERSION}-${OS_GIT_COMMIT}-${platform_segment}"
398
+  local default_name="${base_name}.tar.gz"
399
+  local archive_name="${archive_name:-$default_name}"
400
+  echo "++ Creating ${archive_name}"
401
+  pushd "${release_binpath}" &> /dev/null
402
+  tar -czf "${OS_LOCAL_RELEASEPATH}/${archive_name}" --transform="s,^\.,${base_name}," $@
403
+  popd &>/dev/null
404
+}
405
+
373 406
 # os::build::make_openshift_binary_symlinks makes symlinks for the openshift
374 407
 # binary in _output/local/bin/${platform}
375 408
 os::build::make_openshift_binary_symlinks() {
... ...
@@ -400,14 +446,14 @@ os::build::detect_local_release_tars() {
400 400
     echo "There is no release .commit identifier ${OS_LOCAL_RELEASEPATH}"
401 401
     exit 2
402 402
   fi
403
-  local primary=$(find ${OS_LOCAL_RELEASEPATH} -maxdepth 1 -type f -name openshift-origin-*-${platform}* | grep -v image)
404
-  if [[ $(echo "${primary}" | wc -l) -ne 1 ]]; then
405
-    echo "There should be exactly one ${platform} primary tar in $OS_LOCAL_RELEASEPATH"
403
+  local primary=$(find ${OS_LOCAL_RELEASEPATH} -maxdepth 1 -type f -name openshift-origin-server-*-${platform}*)
404
+  if [[ $(echo "${primary}" | wc -l) -ne 1 || -z "${primary}" ]]; then
405
+    echo "There should be exactly one ${platform} server tar in $OS_LOCAL_RELEASEPATH"
406 406
     exit 2
407 407
   fi
408 408
 
409 409
   local image=$(find ${OS_LOCAL_RELEASEPATH} -maxdepth 1 -type f -name openshift-origin-image*-${platform}*)
410
-  if [[ $(echo "${image}" | wc -l) -ne 1 ]]; then
410
+  if [[ $(echo "${image}" | wc -l) -ne 1 || -z "${image}" ]]; then
411 411
     echo "There should be exactly one ${platform} image tar in $OS_LOCAL_RELEASEPATH"
412 412
     exit 3
413 413
   fi
... ...
@@ -15,10 +15,10 @@ cd "${OS_ROOT}"
15 15
 
16 16
 # Copy the linux release archives release back to the local _output/local/bin/linux/amd64 directory.
17 17
 # TODO: support different OS's?
18
-os::build::detect_local_release_tars "linux-amd64"
18
+os::build::detect_local_release_tars "linux-64bit"
19 19
 
20 20
 mkdir -p "${OS_OUTPUT_BINPATH}/linux/amd64"
21
-tar mxzf "${OS_PRIMARY_RELEASE_TAR}" -C "${OS_OUTPUT_BINPATH}/linux/amd64"
22
-tar mxzf "${OS_IMAGE_RELEASE_TAR}" -C "${OS_OUTPUT_BINPATH}/linux/amd64"
21
+tar mxzf "${OS_PRIMARY_RELEASE_TAR}" --strip-components=1 -C "${OS_OUTPUT_BINPATH}/linux/amd64"
22
+tar mxzf "${OS_IMAGE_RELEASE_TAR}" --strip-components=1 -C "${OS_OUTPUT_BINPATH}/linux/amd64"
23 23
 
24 24
 os::build::make_openshift_binary_symlinks