Code review comment for lp://staging/~gary/juju-gui/pwd

Revision history for this message
Gary Poster (gary) wrote :

Reviewers: mp+140560_code.launchpad.net,

Message:
Please take a look.

Description:
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://code.launchpad.net/~gary/juju-gui/pwd/+merge/140560

(do not edit description out of merge proposal)

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

Affected files:
   M Makefile
   A [revision details]

Index: Makefile
=== modified file 'Makefile'
--- Makefile 2012-12-18 20:31:15 +0000
+++ Makefile 2012-12-18 22:18:29 +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."

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: <email address hidden>
+New revision: <email address hidden>

« Back to merge proposal