← Back to team overview

yellow team mailing list archive

Allow running targets without using bzr (issue 6873071)

 

Reviewers: mp+139518_code.launchpad.net,

Message:
Please take a look.

Description:
Allow running targets without using bzr

Added the flag NO_BZR which lets you run make as `NO_BZR=1 make
[target]` in order to prevent make from running bzr commands, which can
be slow due to network access, providing sensible defaults instead.

https://code.launchpad.net/~makyo/juju-gui/bzr-make-1086794/+merge/139518

(do not edit description out of merge proposal)


Please review this at https://codereview.appspot.com/6873071/

Affected files:
   M Makefile
   A [revision details]
   M docs/process.rst


Index: Makefile
=== modified file 'Makefile'
--- Makefile	2012-12-12 10:05:04 +0000
+++ Makefile	2012-12-12 17:13:48 +0000
@@ -7,10 +7,20 @@
  #OLD_SHELL := $(SHELL)
  #SHELL = $(warning [$@ ($^) ($?) ])$(OLD_SHELL)

-JSFILES=$(shell bzr ls -RV -k file | \
-	grep -E -e '.+\.js(on)?$$|generateTemplates$$' | \
-	grep -Ev -e '^manifest\.json$$' \
-		-e '^test/assets/' \
+# Build a target for JavaScript files.  The find command exclused  
directories
+# as needed through the -prune directive, and the grep command removes
+# individual unwanted JavaScript and JSON files from the list.
+JSFILES=$(shell find . -wholename './node_modules*' -prune \
+	-o -wholename './build*' -prune \
+	-o -wholename './test/assets*' -prune \
+	-o \( \
+    		-name '*.js' \
+    		-o -name '*.json' \
+    		-o -name '*generateTemplates' \
+  	\) -print \
+  	| sort | sed -e 's/^\.\///' \
+	| grep -Ev -e '^manifest\.json$$' \
+		-e '^app/assets/javascripts/d3.v2.*.js$$' \
  		-e '^app/assets/javascripts/reconnecting-websocket.js$$' \
  		-e '^server.js$$')
  THIRD_PARTY_JS=app/assets/javascripts/reconnecting-websocket.js
@@ -25,7 +35,14 @@
  	| tr '\n' ' ')

  ### Release-specific variables - see docs/process.rst for an overview. ###
+# Provide the ability to build a release package without using bzr, for
+# lightweight checkouts.
+ifdef NO_BZR
+BZR_REVNO=0
+BRANCH_IS_GOOD=1
+else
  BZR_REVNO=$(shell bzr revno)
+endif
  # Figure out the two most recent version numbers.
  ULTIMATE_VERSION=$(shell grep '^-' CHANGES.yaml | head -n 1 |  
sed 's/[ :-]//g')
  PENULTIMATE_VERSION=$(shell grep '^-' CHANGES.yaml | head -n 2 | tail -n 1  
\
@@ -61,6 +78,7 @@
  RELEASE_FILE=releases/$(RELEASE_NAME).tgz
  RELEASE_SIGNATURE=releases/$(RELEASE_NAME).asc
  # Is the branch being released a branch of trunk?
+ifndef BRANCH_IS_GOOD
  ifndef IS_TRUNK_BRANCH
  IS_TRUNK_BRANCH=$(shell bzr info | grep \
  	'parent branch: bzr+ssh://bazaar.launchpad.net/+branch/juju-gui/' \
@@ -73,7 +91,6 @@
  # Is it safe to do a release of the branch?  For trial-run releases you can
  # override this check on the command line by setting the BRANCH_IS_GOOD
  # environment variable.
-ifndef BRANCH_IS_GOOD
  ifneq ($(strip $(IS_TRUNK_BRANCH)),)
  ifneq ($(strip $(BRANCH_IS_CLEAN)),)
  BRANCH_IS_GOOD=1
@@ -82,9 +99,9 @@
  endif
  ### End of release-specific variables ###

-TEMPLATE_TARGETS=$(shell bzr ls -k file app/templates)
+TEMPLATE_TARGETS=$(shell find app/templates -type f -print)

-SPRITE_SOURCE_FILES=$(shell bzr ls -R -k file app/assets/images)
+SPRITE_SOURCE_FILES=$(shell find app/assets/images -type f -print)
  SPRITE_GENERATED_FILES=build/juju-ui/assets/sprite.css \
  	build/juju-ui/assets/sprite.png
  BUILD_FILES=build/juju-ui/assets/app.js \


Index: [revision details]
=== added file '[revision details]'
--- [revision details]	2012-01-01 00:00:00 +0000
+++ [revision details]	2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: nicola.larosa@xxxxxxxxxxxxx-20121212134248-36f8i0zjdojpm7qm
+New revision: matthew.scott@xxxxxxxxxxxxx-20121212171348-pikjygtca7exi4wf

Index: docs/process.rst
=== modified file 'docs/process.rst'
--- docs/process.rst	2012-12-12 10:05:04 +0000
+++ docs/process.rst	2012-12-12 17:10:37 +0000
@@ -202,6 +202,24 @@

  You are done!

+Making Targets Quickly Without ``bzr``
+======================================
+
+Within a checkout, a lightweight checkout, or a branch, you may run make as
+``NO_BZR=1 make [target]`` in order to prevent the Makefile from running
+any bzr commands, all of which access the parent branch over the network.
+Where bzr may have provided information such as the revno, sensible  
defaults
+are used instead.  As many of these bzr commands are used to populate
+variables regardless of the target, defining NO_BZR will have an effect on
+all targets.
+
+- Note that this allows one to run any make target from the working copy,
+  even if it is a lightweight checkout, by skipping steps that involve
+  network access through bzr.  Because of this, make will assume that
+  the revno is 0 and that the branch is clean and up to date without
+  checking that it is a checkout of trunk.  The resulting tarball or build
+  may be used to test releases by hand or in the charm.
+
  Checklist for Running a Daily Meeting
  =====================================






-- 
https://code.launchpad.net/~makyo/juju-gui/bzr-make-1086794/+merge/139518
Your team Juju GUI Hackers is requested to review the proposed merge of lp:~makyo/juju-gui/bzr-make-1086794 into lp:juju-gui.


References