Initial add of defaria.com
[clearscm.git] / defaria.com / blogs / Status / archives / 000329.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
4 <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6    <meta name="generator" content="Movable Type 5.2.3" />
7
8    <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles-site.css" type="text/css" />
9    <link rel="alternate" type="application/atom+xml" title="Atom" href="http://defaria.com/blogs/Status/atom.xml" />
10    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://defaria.com/blogs/Status/index.xml" />
11
12    <title>Status for Andrew DeFaria: Building Bluecat on RH 8.0</title>
13
14    <link rel="start" href="http://defaria.com/blogs/Status/" title="Home" />
15    <link rel="prev" href="http://defaria.com/blogs/Status/archives/000328.html" title="Tagged HybridOS/Bluecat RH 8.0 building" />
16    <link rel="next" href="http://defaria.com/blogs/Status/archives/000330.html" title="Hybrid OS" />
17
18    
19
20    
21
22    <script type="text/javascript" src="http://defaria.com/blogs/Status/mt-site.js"></script>
23 </head>
24 <body class="layout-one-column" onload="individualArchivesOnLoad(commenter_name)">
25    <div id="container">
26       <div id="container-inner" class="pkg">
27
28          <div id="banner">
29             <div id="banner-inner" class="pkg">
30                <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
31                <h2 id="banner-description">Searchable status reports and work log</h2>
32             </div>
33          </div>
34
35          <div id="pagebody">
36             <div id="pagebody-inner" class="pkg">
37                <div id="alpha">
38                   <div id="alpha-inner" class="pkg">
39
40                      <p class="content-nav">
41                         <a href="http://defaria.com/blogs/Status/archives/000328.html">&laquo; Tagged HybridOS/Bluecat RH 8.0 building</a> |
42                         <a href="http://defaria.com/blogs/Status/">Main</a>
43                         | <a href="http://defaria.com/blogs/Status/archives/000330.html">Hybrid OS &raquo;</a>
44                      </p>
45
46                      <a id="a000329"></a>
47                      <div class="entry" id="entry-329">
48                         <h3 class="entry-header">Building Bluecat on RH 8.0</h3>
49                         <div class="entry-content">
50                            <div class="entry-body">
51                               <ul>
52   <li>Build local GNUTools on RH 8.0</li>
53
54   <li>Fixed bug in do_it script WRT RH 8.0</li>
55 </ul>
56                            </div>
57                            <div id="more" class="entry-more">
58                               <h3>Building GNUTools on RH 8.0</h3>
59
60 <p>When trying to build Bluecat on RH 8.0 and running mktools (to build the local gnutools) I get the following:</p>
61
62 <div class="code"><pre>
63 [int@europa make]$ autoreconf -f -i
64 autoreconf: `aclocal.m4' is updated
65 Makefile.am: installing `./depcomp'
66 WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
67 WARNING: and `config.h.top', to define templates for `config.h.in'
68 WARNING: is deprecated and discouraged.
69
70 WARNING: Using the third argument of `AC_DEFINE' and
71 WARNING: `AC_DEFINE_UNQUOTED' allows to define a template without
72 WARNING: `acconfig.h':
73
74 WARNING:   AC_DEFINE([NEED_MAIN], 1,
75 WARNING:             [Define if a function `main' is needed.])
76
77 WARNING: More sophisticated templates can also be produced, see the
78 WARNING: documentation.
79 autoheader-2.53: `config.h.in' is updated
80 </pre></div>
81
82 <p>Further, after running configure I get the following odd file in /usr/local/bluecat/eng/bluecat/make/.deps: remote-$(REMOTE).Po which causes the make to fail:</p>
83
84 <div class="code"><pre>
85 [int@europa make]$ make
86 Makefile:329: .deps/remote-stub.Po: No such file or directory
87 make: *** No rule to make target `.deps/remote-stub.Po'.  Stop.
88 </pre></div>
89
90 <p>Renaming .deps/remote-$(REMOTE).Po -> .deps/remote-stub.Po allows the make to proceed.</p>
91
92 <h3>Fun with eval, echo and new shell</h3>
93
94 <p>One of the things that the Bluecat do_it script does is to define the series of "steps" that need to be performed in terms of command lines in variables. Later on the $BUILD_STEP is evaluated to determine which set of commands need to be done as follows:</p>
95
96 <div class="code"><pre>
97 echo "---- Step $BUILD_STEP started at `date` ----"
98 su $BUILD_CMD_OWNER -c "mkdir -p $LOGS_PREFIX/step${BUILD_STEP}"
99 cmd=`eval echo $"STEP${BUILD_STEP}_CMD"`
100 su $BUILD_CMD_OWNER -c "$cmd $*"
101 </pre></div>
102
103 <p>Effectively the name of the environment variable holding the proper command(s) for the step is composed with the echo portion. The eval statement is used to "evaluate" that environment variable thus storing the string of commands into the environment variable cmd. This works well in past versions of the OS but it fails in RH 8.0. First here's the behavior on RH 6.1:</p>
104
105 <div class="code"><pre>
106 <font color="blue"><b>RH6.1:</b></font><u>export STEP1_CMD="ls /tmp"</u>
107 <font color="blue"><b>RH6.1:</b></font><u>export BUILD_STEP=1</u>
108 <font color="blue"><b>RH6.1:</b></font><u>echo $"STEP${BUILD_STEP}_CMD"</u>
109 $STEP1_CMD
110 </pre></div>
111
112 <p>However hears the same commands on RH8.0:</p>
113
114 <div class="code"><pre>
115 <font color="red"><b>RH8.0:</b></font><u>export STEP1_CMD="ls /tmp"</u>
116 <font color="red"><b>RH8.0:</b></font><u>export BUILD_STEP=1</u>
117 <font color="red"><b>RH8.0:</b></font><u>echo $"STEP${BUILD_STEP}_CMD"</u>
118 STEP1_CMD
119 </pre></div>
120
121 <p>As you can see the result is missing a $. Prepending a leading \ before the $ fixes this. Adding in the eval portion also works:</p>
122
123 <div class="code"><pre>
124 <font color="red"><b>RH8.0:</b></font><u>eval echo \$"STEP${BUILD_STEP}_CMD"</u>
125 ls /tmp
126 </pre></div>
127
128 <p>However when this is assigned to another environment variable (i.e. cmd) the result is not correct:</p>
129
130 <div class="code"><pre>
131 <font color="red"><b>RH8.0:</b></font><u>cmd=`eval echo \$"STEP${BUILD_STEP}_CMD"`</u>
132 <font color="red"><b>RH8.0:</b></font><u>echo $cmd</u>
133 STEP1_CMD
134 </pre></div>
135
136 <p>Subsituting the syntax of $(<command>) for `<command` however does work:</p>
137
138 <div class="code"><pre>
139 <font color="red"><b>RH8.0:</b></font><u>cmd=$(eval echo \$"STEP${BUILD_STEP}_CMD")</u>
140 <font color="red"><b>RH8.0:</b></font><u>echo $cmd</u>
141 ls /tmp
142 </pre></div>
143
144 <p>Note that the shell (bash) has been majorly updated for RH8.0:</p>
145
146 <div class="code"><pre>
147 <font color="blue"><b>RH6.1:</b></font><u>bash -version</u>
148 GNU bash, version 1.14.7(1)
149 </pre></div>
150
151 <p>Versus:</p>
152
153 <div class="code"><pre>
154 <font color="red"><b>RH8.0:</b></font><u>bash -version</u>
155 GNU bash, version 2.05b.0(1)-release (i686-pc-linux-gnu)
156 Copyright (C) 2002 Free Software Foundation, Inc.
157 </pre></div>
158
159 <p>Please note that this new syntax also works flawlessly on the older RH 6.1.</p>
160                            </div>
161                         </div>
162                         <p class="entry-footer">
163                            <span class="post-footers">Posted by  on April  4, 2005  2:33 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000329.html">Permalink</a>
164                         </p>
165                      </div>
166
167                      
168
169                      
170                   </div>
171                </div>
172             </div>
173          </div>
174       </div>
175    </div>
176 </body>
177 </html>