Makefile.tarball 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #
  2. # Licensed to Cloudera, Inc. under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. Cloudera, Inc. licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # <<<< DEV ONLY
  18. # Extended packaging rules to support Python version-specific virtualenv outputs.
  19. PROD_INCLUDES := \
  20. apps \
  21. desktop \
  22. ext/thirdparty \
  23. LICENSE.txt \
  24. NOTICE.txt \
  25. Makefile* \
  26. maven \
  27. build \
  28. app.reg \
  29. desktop/conf \
  30. desktop/desktop.db \
  31. tools/app_reg \
  32. tools/virtual-bootstrap \
  33. tools/relocatable.py \
  34. tools/load-balancer \
  35. tools/scripts \
  36. VERSION \
  37. webpack-stats*.json \
  38. package.json \
  39. package-lock.json \
  40. webpack.config*.js \
  41. babel.config.js \
  42. tsconfig.json
  43. # Check for things in BDIST_EXCLUDES in various apps
  44. # Excludes more dev-only content and handles packaging across architectures.
  45. PROD_EXCLUDES := \
  46. apps/beeswax/thrift \
  47. apps/hello \
  48. apps/jframegallery \
  49. desktop/core/regenerate_thrift.sh \
  50. desktop/core/ext-py3 \
  51. desktop/devtools.mk \
  52. desktop/libs/hadoop/regenerate-thrift.sh \
  53. ext/thirdparty/js/manifest.json \
  54. Makefile.tarball
  55. # Macro to remove things we don't want to package
  56. define remove_devtree_exclusions
  57. @find $(1) \( -name '.git' -o \
  58. -name '.gitignore' -o \
  59. -name '.*~' -o \
  60. -name '.#*' -o \
  61. -name '.pylintrc' -o \
  62. -name 'logs' -o \
  63. -name 'tags' -o \
  64. -name 'target' -o \
  65. -name '.*.sw?' \) -not -path '*/boto/*' -prune -exec rm -rf {} \;
  66. endef
  67. ###################################
  68. # Packaging for production release
  69. ###################################
  70. .PHONY: release
  71. release:
  72. @echo "--- Preparing general distribution tree at $@"
  73. @rm -rf $(BLD_DIR_PROD) $(BLD_DIR_PROD_TGZ)
  74. @mkdir -p $(BLD_DIR_PROD)
  75. @tar --exclude="build/release" -chf - $(PROD_INCLUDES) | tar -C $(BLD_DIR_PROD) -xf -
  76. @echo "---- Removing exclusions"
  77. @for i in $(PROD_EXCLUDES) ; do rm -rf $(BLD_DIR_PROD)/$$i ; done
  78. @echo "---- Removing *.py[co] files"
  79. @find $(BLD_DIR_PROD) -iname \*.py[co] -exec rm -f {} \;
  80. @echo "---- Performing remove_devtree_exclusions"
  81. $(call remove_devtree_exclusions,$(BLD_DIR_PROD))
  82. @echo "---- Copying misc files"
  83. @cp $(ROOT)/dist/* $(BLD_DIR_PROD)
  84. @mv $(BLD_DIR_PROD)/desktop/conf{.dist,}
  85. @cp -r $(BLD_DIR_DOC) $(BLD_DIR_PROD)/docs
  86. @echo "---- Stripping Makefiles"
  87. @$(call STRIP_DEV, $(ROOT)/Makefile, $(BLD_DIR_PROD)/Makefile)
  88. @$(call STRIP_DEV, $(ROOT)/Makefile.vars.priv, $(BLD_DIR_PROD)/Makefile.vars.priv)
  89. @$(call STRIP_DEV, $(APPS_DIR)/Makefile, $(BLD_DIR_PROD)/apps/Makefile)
  90. @$(call STRIP_DEV, $(DESKTOP_DIR)/Makefile, $(BLD_DIR_PROD)/desktop/Makefile)
  91. @tar --exclude="build/release" -C $(BLD_DIR_PROD)/.. -chzf $(BLD_DIR_PROD_TGZ) hue-$(DESKTOP_VERSION)
  92. @echo "---- $(BLD_DIR_PROD_TGZ)"
  93. # Make a tarball
  94. .PHONY: prod
  95. prod: $(BLD_DIR_PROD_TGZ)
  96. $(BLD_DIR_PROD_TGZ): $(BLD_DIR_PROD)
  97. @tar --exclude="python" --exclude="build/release/prod" -C $(BLD_DIR_PROD)/.. -czf $(BLD_DIR_PROD_TGZ) hue-$(DESKTOP_VERSION)
  98. @echo "--- Generated $(BLD_DIR_PROD_TGZ)"
  99. .PHONY: $(BLD_DIR_PROD)
  100. $(BLD_DIR_PROD): apps docs locales
  101. @echo "--- Preparing general distribution tree at $@"
  102. @rm -rf $@
  103. @mkdir -p $@
  104. tar --exclude="python" --exclude="build/release/prod" -cf - $(PROD_INCLUDES) | tar -C $(BLD_DIR_PROD) -xf -
  105. @echo "---- Removing exclusions"
  106. @for i in $(PROD_EXCLUDES) ; do rm -rf $(BLD_DIR_PROD)/$$i ; done
  107. $(call remove_devtree_exclusions,$(BLD_DIR_PROD))
  108. @echo "---- Copying misc files"
  109. @cp $(ROOT)/dist/* $(BLD_DIR_PROD)
  110. @mv $(BLD_DIR_PROD)/desktop/conf{.dist,}
  111. cp -r $(BLD_DIR_DOC) $(BLD_DIR_PROD)/docs
  112. @echo "---- Stripping Makefiles"
  113. @$(call STRIP_DEV, $(ROOT)/Makefile, $(BLD_DIR_PROD)/Makefile)
  114. @$(call STRIP_DEV, $(ROOT)/Makefile.vars.priv, $(BLD_DIR_PROD)/Makefile.vars.priv)
  115. @$(call STRIP_DEV, $(APPS_DIR)/Makefile, $(BLD_DIR_PROD)/apps/Makefile)
  116. @$(call STRIP_DEV, $(DESKTOP_DIR)/Makefile, $(BLD_DIR_PROD)/desktop/Makefile)
  117. @echo "---- Removing build directories"
  118. find $(BLD_DIR_PROD) -name build -prune -exec rm -rf {} \;
  119. @PYTHON_VER=$(PYTHON_VER) ENV_PYTHON=$(ENV_PYTHON) VIRTUAL_ENV=$(BLD_DIR_ENV) $(MAKE) -C $(BLD_DIR_PROD) ext-clean
  120. # END DEV ONLY >>>>