Parcourir la source

AMBARI-3302. Parameterize the repo url for latest stack.

Sumit Mohanty il y a 11 ans
Parent
commit
a9a4fe4575

+ 42 - 21
ambari-server/pom.xml

@@ -29,6 +29,7 @@
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <python.ver>python &gt;= 2.6</python.ver>
+    <hdpUrlForCentos6>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos6</hdpUrlForCentos6>
   </properties>
   <build>
     <plugins>
@@ -132,24 +133,6 @@
           </excludes>
         </configuration>
       </plugin>
-      <!--<plugin>-->
-        <!-- Will be used for DDL file update on server version update-->
-        <!--<artifactId>maven-antrun-plugin</artifactId>-->
-        <!--<executions>-->
-          <!--<execution>-->
-            <!--<id>Copy-server-version-file</id>-->
-            <!--<phase>process-test-resources</phase>-->
-            <!--<configuration>-->
-              <!--<tasks>-->
-                <!--<copy file="../version" todir="${project.build.directory}/"/>-->
-              <!--</tasks>-->
-            <!--</configuration>-->
-            <!--<goals>-->
-              <!--<goal>run</goal>-->
-            <!--</goals>-->
-          <!--</execution>-->
-        <!--</executions>-->
-      <!--</plugin>-->
       <plugin>
         <!--Static -->
         <artifactId>maven-antrun-plugin</artifactId>
@@ -393,7 +376,7 @@
               <directory>/var/lib/ambari-server/resources/stacks/HDP</directory>
               <sources>
                 <source>
-                  <location>src/main/resources/stacks/HDP</location>
+                  <location>target/classes/stacks/HDP</location>
                 </source>
               </sources>
             </mapping>
@@ -402,7 +385,7 @@
               <configuration>noreplace</configuration>
               <sources>
                 <source>
-                  <location>src/main/resources/stacks/HDPLocal</location>
+                  <location>target/classes/stacks/HDPLocal</location>
                 </source>
               </sources>
             </mapping>
@@ -504,7 +487,45 @@
                   </goals>
               </execution>
           </executions>
-      </plugin>      
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <id>set-hdp-url-classes</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target name="ambari-server-compile">
+                <exec dir="${basedir}" executable="sh" failonerror="true">
+                  <arg value="${basedir}/set-hdp-repo-url.sh"/>
+                  <arg value="${hdpUrlForCentos6}"/>
+                </exec>
+              </target>
+            </configuration>
+          </execution>
+          <execution>
+            <id>set-hdp-url-packages</id>
+            <phase>package</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target name="ambari-server-compile">
+                <exec dir="${basedir}" executable="sh" failonerror="true">
+                  <arg value="${basedir}/set-hdp-repo-url.sh"/>
+                  <arg value="${hdpUrlForCentos6}"/>
+                  <arg value="${project.build.directory}/ambari-server-${project.version}-dist/ambari-server-${project.version}"/>
+                </exec>
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
     <resources>
       <resource>

+ 57 - 0
ambari-server/set-hdp-repo-url.sh

@@ -0,0 +1,57 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+if [ "$1" != '${hdpUrlForCentos6}' ]
+then
+  # Updating for new stack version:
+  #  Create the new stack definition with parameterized repoinfo.xml files.
+  #  Typically, copying the files from the previous version will work.
+  #  Modify the VERSION variable in this file to match the new version
+  #  Modify the previous version to store concrete public repo url
+
+  VERSION=2.0.6
+  C6URL="$1"
+  C5URL="${C6URL/centos6/centos5}"
+  S11URL="${C6URL/centos6/suse11}"
+
+  if [ "$#" != 2 ]
+  then
+    HDPREPO=target/classes/stacks/HDP/${VERSION}/repos
+    HDPLOCALREPO=target/classes/stacks/HDPLocal/${VERSION}/repos
+  else
+    HDPREPO=$2/var/lib/ambari-server/resources/stacks/HDP/${VERSION}/repos
+    HDPLOCALREPO=$2/var/lib/ambari-server/resources/stacks/HDPLocal/${VERSION}/repos
+  fi
+
+  echo "Processing '${HDPREPO}/repoinfo.xml' and '${HDPLOCALREPO}/repoinfo.xml'"
+  echo "$2"
+
+  echo "Setting centos5 stack url to '$C5URL'"
+  sed "s;REPLACE_WITH_CENTOS5_URL;$C5URL;" ${HDPREPO}/repoinfo.xml >  ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
+  sed "s;REPLACE_WITH_CENTOS5_URL;$C5URL;" ${HDPLOCALREPO}/repoinfo.xml >  ${HDPLOCALREPO}/repoinfo.xml.tmp; mv ${HDPLOCALREPO}/repoinfo.xml.tmp ${HDPLOCALREPO}/repoinfo.xml
+
+  echo "Setting centos6 stack url to '$C6URL'"
+  sed "s;REPLACE_WITH_CENTOS6_URL;$C6URL;" ${HDPREPO}/repoinfo.xml >  ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
+  sed "s;REPLACE_WITH_CENTOS6_URL;$C6URL;" ${HDPLOCALREPO}/repoinfo.xml >  ${HDPLOCALREPO}/repoinfo.xml.tmp; mv ${HDPLOCALREPO}/repoinfo.xml.tmp ${HDPLOCALREPO}/repoinfo.xml
+
+  echo "Setting suse11 stack url to '$S11URL'"
+  sed  "s;REPLACE_WITH_SUSE11_URL;$S11URL;" ${HDPREPO}/repoinfo.xml >  ${HDPREPO}/repoinfo.xml.tmp; mv ${HDPREPO}/repoinfo.xml.tmp ${HDPREPO}/repoinfo.xml
+  sed  "s;REPLACE_WITH_SUSE11_URL;$S11URL;" ${HDPLOCALREPO}/repoinfo.xml >  ${HDPLOCALREPO}/repoinfo.xml.tmp; mv ${HDPLOCALREPO}/repoinfo.xml.tmp ${HDPLOCALREPO}/repoinfo.xml
+fi

+ 8 - 8
ambari-server/src/main/resources/stacks/HDP/2.0.6/repos/repoinfo.xml

@@ -18,56 +18,56 @@
 <reposinfo>
   <os type="centos6">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos6</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS6_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="centos5">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos5</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS5_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="redhat6">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos6</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS6_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="redhat5">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos5</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS5_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
    <os type="oraclelinux6">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos6</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS6_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="oraclelinux5">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos5</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS5_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="suse11">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/suse11</baseurl>
+      <baseurl>REPLACE_WITH_SUSE11_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="sles11">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/suse11</baseurl>
+      <baseurl>REPLACE_WITH_SUSE11_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>

+ 8 - 8
ambari-server/src/main/resources/stacks/HDPLocal/2.0.6/repos/repoinfo.xml

@@ -18,56 +18,56 @@
 <reposinfo>
   <os type="centos6">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos6</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS6_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="centos5">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos5</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS5_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="redhat6">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos6</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS6_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="redhat5">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos5</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS5_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
    <os type="oraclelinux6">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos6</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS6_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="oraclelinux5">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/centos5</baseurl>
+      <baseurl>REPLACE_WITH_CENTOS5_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="suse11">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/suse11</baseurl>
+      <baseurl>REPLACE_WITH_SUSE11_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
   <os type="sles11">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-2.0.6.0/repos/suse11</baseurl>
+      <baseurl>REPLACE_WITH_SUSE11_URL</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>