← Back to team overview

yellow team mailing list archive

[Merge] lp:~gary/juju-gui/pwd into lp:juju-gui

 

Gary Poster has proposed merging lp:~gary/juju-gui/pwd into lp:juju-gui.

Requested reviews:
  Juju GUI Hackers (juju-gui)

For more details, see:
https://code.launchpad.net/~gary/juju-gui/pwd/+merge/140560

Fix intermittent d3.v2.min.js Makefile error

This file failed intermittently because the symlink was wrong.  The symlink was wrong because our use of PWD was fragile.  This is a simple fix.

https://codereview.appspot.com/6954043/

-- 
https://code.launchpad.net/~gary/juju-gui/pwd/+merge/140560
Your team Juju GUI Hackers is requested to review the proposed merge of lp:~gary/juju-gui/pwd into lp:juju-gui.
=== modified file 'Makefile'
--- Makefile	2012-12-18 20:31:15 +0000
+++ Makefile	2012-12-18 22:21:22 +0000
@@ -118,12 +118,13 @@
 DATE=$(shell date -u)
 APPCACHE=build/juju-ui/assets/manifest.appcache
 
-# Some environments, notably sudo, do not populate the PWD environment
-# variable, which is used to set $(PWD); however, getting the current
-# directory from `pwd` can get expensive, so we set it once here.
-ifeq ($(PWD),)
-	PWD=$(shell pwd)
-endif
+# Some environments, notably sudo, do not populate the default PWD environment
+# variable, which is used to set $(PWD).  Worse, in some situations, such as
+# using make -C [directory], $(PWD) is set to a value we don't want: the
+# directory in which make was invoked, rather than the directory of this file.
+# Therefore, we want to run the shell's pwd to get this Makefile's directory.
+# As an optimization, we stash this value in the local PWD variable.
+PWD=$(shell pwd)
 
 all: build
 	@echo "\nDebug and production environments built."


Follow ups