Browse Source

AMBARI-4979. Limiting Ambari version to 3 digits (dlysnichenko)

Lisnichenko Dmitro 11 năm trước cách đây
mục cha
commit
60dc78f95d

+ 3 - 3
ambari-agent/pom.xml

@@ -89,8 +89,8 @@
             <configuration>
               <name>ambariVersion</name>
               <value>${project.version}</value>
-              <regex>-SNAPSHOT</regex>
-              <replacement></replacement>
+              <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-).*</regex>
+              <replacement>$1.$2.$3</replacement>
               <failIfNoMatch>false</failIfNoMatch>
             </configuration>
           </execution>
@@ -397,7 +397,7 @@
         </executions>
         <configuration>
           <controlDir>${basedir}/src/main/package/deb/control</controlDir>
-          <deb>${basedir}/target/${artifactId}_${version}.deb</deb>
+          <deb>${basedir}/target/${artifactId}_${package-version}-${package-release}.deb</deb>
           <dataSet>
             <data>
               <src>${project.build.directory}/${project.artifactId}-${project.version}/ambari_agent</src>

+ 1 - 1
ambari-agent/src/main/package/deb/control/control

@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License
 Package: [[artifactId]]
-Version: [[version]]
+Version: [[package-version]]-[[package-release]]
 Section: [[deb.section]]
 Priority: [[deb.priority]]
 Depends: [[deb.dependency.list]]

+ 1 - 1
ambari-project/src/main/package/deb/control/control

@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License
 Package: [[artifactId]]
-Version: [[version]]
+Version: [[package-version]]-[[package-release]]
 Section: [[deb.section]]
 Priority: [[deb.priority]]
 Architecture: [[deb.architecture]]

+ 3 - 4
ambari-server/pom.xml

@@ -56,8 +56,8 @@
             <configuration>
               <name>ambariVersion</name>
               <value>${project.version}</value>
-              <regex>-SNAPSHOT</regex>
-              <replacement></replacement>
+              <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-).*</regex>
+              <replacement>$1.$2.$3</replacement>
               <failIfNoMatch>false</failIfNoMatch>
             </configuration>
           </execution>
@@ -196,7 +196,6 @@
         </executions>
         <configuration>
           <copyright>2012, Apache Software Foundation</copyright>
-          <version>${project.version}</version>
           <group>Development</group>
           <description>Maven Recipe: RPM Package.</description>
           <requires>
@@ -472,7 +471,7 @@
         </executions>
         <configuration>
           <controlDir>${basedir}/src/main/package/deb/control</controlDir>
-          <deb>${basedir}/target/${artifactId}_${version}.deb</deb>
+          <deb>${basedir}/target/${artifactId}_${package-version}-${package-release}.deb</deb>
           <dataSet>
             <data>
               <type>template</type>

+ 1 - 1
ambari-server/src/main/package/deb/control/control

@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License
 Package: [[artifactId]]
-Version: [[version]]
+Version: [[package-version]]-[[package-release]]
 Section: [[deb.section]]
 Priority: [[deb.priority]]
 Depends: [[deb.dependency.list]]

+ 2 - 1
ambari-views/pom.xml

@@ -71,7 +71,8 @@
                         <configuration>
                             <name>ambariVersion</name>
                             <value>${project.version}</value>
-                            <regex>-SNAPSHOT</regex>
+                            <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-).*</regex>
+                            <replacement>$1.$2.$3</replacement>
                             <failIfNoMatch>false</failIfNoMatch>
                         </configuration>
                     </execution>

+ 2 - 2
ambari-web/pom.xml

@@ -54,8 +54,8 @@
             <configuration>
               <name>ambariVersion</name>
                 <value>${project.version}</value>
-                <regex>-SNAPSHOT</regex>
-                <replacement></replacement>
+                <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-).*</regex>
+                <replacement>$1.$2.$3</replacement>
               <failIfNoMatch>false</failIfNoMatch>
             </configuration>
           </execution>

+ 35 - 0
pom.xml

@@ -76,6 +76,39 @@
       </plugins>
     </pluginManagement>
     <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.8</version>
+        <executions>
+          <execution>
+            <id>parse-package-version</id>
+            <goals>
+              <goal>regex-property</goal>
+            </goals>
+            <configuration>
+              <name>package-version</name>
+              <value>${project.version}</value>
+              <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-).*</regex>
+              <replacement>$1.$2.$3</replacement>
+              <failIfNoMatch>true</failIfNoMatch>
+            </configuration>
+          </execution>
+          <execution>
+            <id>parse-package-release</id>
+            <goals>
+              <goal>regex-property</goal>
+            </goals>
+            <configuration>
+              <name>package-release</name>
+              <value>${project.version}</value>
+              <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-)(([0-9]+)|(SNAPSHOT)).*</regex>
+              <replacement>$5</replacement>
+              <failIfNoMatch>true</failIfNoMatch>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
@@ -119,6 +152,8 @@
           <copyright>2012, Apache Software Foundation</copyright>
           <group>Development</group>
           <description>Maven Recipe: RPM Package.</description>
+          <release>${package-release}</release>
+          <version>${package-version}</version>
           <mappings/>
         </configuration>
       </plugin>