[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5-303-gfcfa26a

Elias Lutfallah elias.lutfallah at orbitz.com
Thu Mar 17 10:48:49 UTC 2011


The following commit has been merged in the upstream branch:
commit f4a0af16eaa30571662017cab7e106a96b99988d
Author: Elias Lutfallah <elias.lutfallah at orbitz.com>
Date:   Sat Mar 5 15:07:39 2011 -0600

    Refactoring duplicate code and logic in prep for DESTDIR deprecation.
    
    DESTDIR is slated to be deprecated. The block of code that checks for
    DESTDIR contained duplicate code as the block that checks for --destdir.
    
    The dupe code has been moved out of the destdir checks.
    
    I have also flipped the order of checking. Previously, if the DESTDIR env was set
    it would be used regardless of whether or not the --destdir flag was set.
    
    No env, no flag:
    ./install.rb
    destdir = nil
    
    Env only:
    DESTDIR="foo" ./install.rb
    destdir = foo
    
    Flag only:
    ./install.rb --destdir="bar"
    destdir = bar
    
    Both (uses flag):
    DESTDIR="foo" ./install.rb --destdir="bar"
    destdir = bar

diff --git a/install.rb b/install.rb
index 7627a8d..d20b7cd 100755
--- a/install.rb
+++ b/install.rb
@@ -300,34 +300,28 @@ def prepare_installation
     mandir = Config::CONFIG['mandir']
   end
 
-  # To be deprecated once people move over to using --destdir option
-  if (destdir = ENV['DESTDIR'])
-    configdir = "#{destdir}#{configdir}"
-    bindir = "#{destdir}#{bindir}"
-    sbindir = "#{destdir}#{sbindir}"
-    mandir = "#{destdir}#{mandir}"
-    sitelibdir = "#{destdir}#{sitelibdir}"
-
-    FileUtils.makedirs(configdir) if InstallOptions.configs
-    FileUtils.makedirs(bindir)
-    FileUtils.makedirs(sbindir)
-    FileUtils.makedirs(mandir)
-    FileUtils.makedirs(sitelibdir)
   # This is the new way forward
-  elsif (destdir = InstallOptions.destdir)
-    configdir = "#{destdir}#{configdir}"
-    bindir = "#{destdir}#{bindir}"
-    sbindir = "#{destdir}#{sbindir}"
-    mandir = "#{destdir}#{mandir}"
-    sitelibdir = "#{destdir}#{sitelibdir}"
-
-    FileUtils.makedirs(configdir) if InstallOptions.configs
-    FileUtils.makedirs(bindir)
-    FileUtils.makedirs(sbindir)
-    FileUtils.makedirs(mandir)
-    FileUtils.makedirs(sitelibdir)
+  if not InstallOptions.destdir.nil?
+    destdir = InstallOptions.destdir
+  # To be deprecated once people move over to using --destdir option
+  elsif ENV['DESTDIR'] != nil?
+    destdir = ENV['DESTDIR']
+  else
+    destdir = ''
   end
 
+  configdir = "#{destdir}#{configdir}"
+  bindir = "#{destdir}#{bindir}"
+  sbindir = "#{destdir}#{sbindir}"
+  mandir = "#{destdir}#{mandir}"
+  sitelibdir = "#{destdir}#{sitelibdir}"
+
+  FileUtils.makedirs(configdir) if InstallOptions.configs
+  FileUtils.makedirs(bindir)
+  FileUtils.makedirs(sbindir)
+  FileUtils.makedirs(mandir)
+  FileUtils.makedirs(sitelibdir)
+
   tmpdirs << bindir
 
   InstallOptions.tmp_dirs = tmpdirs.compact

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list