You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by br...@apache.org on 2012/04/04 10:40:09 UTC

svn commit: r1309286 - in /archiva/sandbox/rpm: ./ pom.xml src/ src/main/ src/main/patches/ src/main/patches/archiva.patch src/main/rpm/ src/main/rpm/etc/ src/main/rpm/etc/profile.d/ src/main/rpm/etc/profile.d/archiva.sh

Author: brett
Date: Wed Apr  4 08:40:09 2012
New Revision: 1309286

URL: http://svn.apache.org/viewvc?rev=1309286&view=rev
Log:
[MRM-1525] add a basic POM to create an RPM

Added:
    archiva/sandbox/rpm/   (with props)
    archiva/sandbox/rpm/pom.xml   (with props)
    archiva/sandbox/rpm/src/
    archiva/sandbox/rpm/src/main/
    archiva/sandbox/rpm/src/main/patches/
    archiva/sandbox/rpm/src/main/patches/archiva.patch   (with props)
    archiva/sandbox/rpm/src/main/rpm/
    archiva/sandbox/rpm/src/main/rpm/etc/
    archiva/sandbox/rpm/src/main/rpm/etc/profile.d/
    archiva/sandbox/rpm/src/main/rpm/etc/profile.d/archiva.sh   (with props)

Propchange: archiva/sandbox/rpm/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Apr  4 08:40:09 2012
@@ -0,0 +1,3 @@
+target
+.vagrant
+Vagrantfile

Added: archiva/sandbox/rpm/pom.xml
URL: http://svn.apache.org/viewvc/archiva/sandbox/rpm/pom.xml?rev=1309286&view=auto
==============================================================================
--- archiva/sandbox/rpm/pom.xml (added)
+++ archiva/sandbox/rpm/pom.xml Wed Apr  4 08:40:09 2012
@@ -0,0 +1,252 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.archiva</groupId>
+    <artifactId>archiva-parent</artifactId>
+    <version>8</version>
+  </parent>
+
+  <groupId>org.apache.archiva.rpm</groupId>
+  <artifactId>archiva</artifactId>
+  <version>1.4-M3-SNAPSHOT</version>
+  <packaging>rpm</packaging>
+  <name>Apache Archiva :: RPM</name>
+  <description>Apache Archiva RPM distribution</description>
+
+  <properties>
+    <rpm.source.location>${project.build.directory}/rpm-unpack/apache-archiva-${project.version}</rpm.source.location>
+    <rpm.chkconfig>2345\ 90\ 10</rpm.chkconfig>
+    <rpm.username>archiva</rpm.username>
+    <rpm.groupname>archiva</rpm.groupname>
+    <rpm.installationPath>/usr/share</rpm.installationPath>
+    <rpm.varPath>/var/lib</rpm.varPath>
+    <rpm.installationFolder>${project.artifactId}</rpm.installationFolder>
+  </properties>
+
+  <!-- TODO: 
+       - link /etc/archiva to conf directory and /var/log/archiva to logs directory 
+       - split by architecture, with correct wrapper lib to avoid x86-32 problems on x86-64
+    -->
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>unpack-tarballs</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${project.build.directory}/rpm-unpack</outputDirectory>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.apache.archiva</groupId>
+                  <artifactId>archiva-jetty-js</artifactId>
+                  <version>${project.version}</version>
+                  <type>tar.gz</type>
+                  <classifier>bin</classifier>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-patch-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>patch</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>apply</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <targetDirectory>${rpm.source.location}</targetDirectory>
+          <naturalOrderProcessing>true</naturalOrderProcessing>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rpm-maven-plugin</artifactId>
+        <version>2.1-alpha-1</version>
+        <extensions>true</extensions>
+        <configuration>
+          <group>Development/Tools</group>
+          <defaultUsername>${rpm.username}</defaultUsername>
+          <defaultGroupname>${rpm.groupname}</defaultGroupname>
+          <defaultFilemode>644</defaultFilemode>
+          <defaultDirmode>755</defaultDirmode>
+          <copyright>Copyright ${project.inceptionYear} ${project.organization.name}.</copyright>
+          <mappings>
+            <mapping>
+              <directory>${rpm.installationPath}/${rpm.installationFolder}</directory>
+            </mapping>
+            <!-- license -->
+            <mapping>
+              <directory>${rpm.installationPath}/${rpm.installationFolder}</directory>
+              <sources>
+                <source>
+                  <location>${rpm.source.location}</location>
+                  <includes>
+                    <include>*</include>
+                  </includes>
+                </source>
+              </sources>
+            </mapping>
+            <!-- apps, lib folders -->
+            <mapping>
+              <directory>${rpm.installationPath}/${rpm.installationFolder}/apps</directory>
+              <sources>
+                <source>
+                  <location>${rpm.source.location}/apps</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${rpm.installationPath}/${rpm.installationFolder}/lib</directory>
+              <sources>
+                <source>
+                  <location>${rpm.source.location}/lib</location>
+                </source>
+              </sources>
+            </mapping>
+            <!-- bin files -->
+            <mapping>
+              <directory>${rpm.installationPath}/${rpm.installationFolder}/bin</directory>
+              <filemode>755</filemode>
+              <sources>
+                <source>
+                  <location>${rpm.source.location}/bin</location>
+                </source>
+              </sources>
+            </mapping>
+            <!-- config and data files -->
+            <mapping>
+              <directory>${rpm.varPath}/${rpm.installationFolder}/conf</directory>
+              <configuration>noreplace</configuration>
+              <sources>
+                <source>
+                  <location>${rpm.source.location}/conf</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${rpm.varPath}/${rpm.installationFolder}/logs</directory>
+              <configuration>noreplace</configuration>
+              <sources>
+                <source>
+                  <location>${rpm.source.location}/logs</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${rpm.varPath}/${rpm.installationFolder}/temp</directory>
+              <configuration>noreplace</configuration>
+              <sources>
+                <source>
+                  <location>${rpm.source.location}/temp</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${rpm.varPath}/${rpm.installationFolder}</directory>
+              <filemode>700</filemode>
+            </mapping>
+ 
+            <!-- Add links from the app to ${rpm.varPath} -->
+            <mapping>
+              <directory>${rpm.installationPath}/${rpm.installationFolder}/conf</directory>
+              <directoryIncluded>false</directoryIncluded>
+              <sources>
+                <softlinkSource>
+                  <location>${rpm.varPath}/${rpm.installationFolder}/conf</location>
+                </softlinkSource>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${rpm.installationPath}/${rpm.installationFolder}/data</directory>
+              <directoryIncluded>false</directoryIncluded>
+              <sources>
+                <softlinkSource>
+                  <location>${rpm.varPath}/${rpm.installationFolder}/data</location>
+                </softlinkSource>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${rpm.installationPath}/${rpm.installationFolder}/logs</directory>
+              <directoryIncluded>false</directoryIncluded>
+              <sources>
+                <softlinkSource>
+                  <location>${rpm.varPath}/${rpm.installationFolder}/logs</location>
+                </softlinkSource>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${rpm.installationPath}/${rpm.installationFolder}/temp</directory>
+              <directoryIncluded>false</directoryIncluded>
+              <sources>
+                <softlinkSource>
+                  <location>${rpm.varPath}/${rpm.installationFolder}/temp</location>
+                </softlinkSource>
+              </sources>
+            </mapping>
+
+            <mapping>
+              <directory>/etc/init.d</directory>
+              <directoryIncluded>false</directoryIncluded>
+              <filemode>755</filemode>
+              <sources>
+                <softlinkSource>
+                  <location>${rpm.installationPath}/${rpm.installationFolder}/bin/${project.artifactId}</location>
+                </softlinkSource>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>/etc/profile.d</directory>
+              <directoryIncluded>false</directoryIncluded>
+              <filemode>755</filemode>
+              <sources>
+                <source>
+                  <location>${basedir}/src/main/rpm/etc/profile.d</location>
+                </source>
+              </sources>
+            </mapping>
+          </mappings>
+          <preinstallScriptlet>
+            <script>
+# add user
+/usr/sbin/groupadd -r -f archiva
+/usr/bin/id archiva >/dev/null 2>&amp;1 || /usr/sbin/useradd -M -r -g archiva -d ${rpm.varPath}/${rpm.installationFolder} -s /bin/bash -c "Apache Archiva" archiva > /dev/null 2>&amp;1
+            </script>
+          </preinstallScriptlet>
+          <postinstallScriptlet>
+            <script>
+# add service
+/sbin/chkconfig --add ${project.artifactId}
+/sbin/chkconfig ${project.artifactId} on
+
+# HACK: include here until there is a global option in the RPM plugin
+%global _binaries_in_noarch_packages_terminate_build   0
+            </script>
+          </postinstallScriptlet>
+          <preremoveScriptlet>
+            <script>
+# stop and delete service
+/sbin/service ${project.artifactId} stop
+/sbin/chkconfig --del ${project.artifactId}
+            </script>
+          </preremoveScriptlet>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: archiva/sandbox/rpm/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: archiva/sandbox/rpm/src/main/patches/archiva.patch
URL: http://svn.apache.org/viewvc/archiva/sandbox/rpm/src/main/patches/archiva.patch?rev=1309286&view=auto
==============================================================================
--- archiva/sandbox/rpm/src/main/patches/archiva.patch (added)
+++ archiva/sandbox/rpm/src/main/patches/archiva.patch Wed Apr  4 08:40:09 2012
@@ -0,0 +1,20 @@
+--- bin/archiva	2012-03-22 15:50:17.000000000 +1100
++++ bin/archiva	2012-04-04 17:12:46.000000000 +1000
+@@ -10,6 +10,8 @@
+ #-----------------------------------------------------------------------------
+ # These settings can be modified to fit the needs of your application
+ 
++. /etc/profile.d/archiva.sh 
++
+ # Application
+ APP_NAME="archiva"
+ APP_LONG_NAME="Apache Archiva JS"
+@@ -50,7 +52,7 @@
+ 
+ # The following two lines are used by the chkconfig command. Change as is
+ #  appropriate for your application.  They should remain commented.
+-# chkconfig: 2345 20 80
++# chkconfig: 2345 90 10
+ # description: Apache Archiva JS
+ 
+ # Do not modify anything beyond this point

Propchange: archiva/sandbox/rpm/src/main/patches/archiva.patch
------------------------------------------------------------------------------
    svn:eol-style = native

Added: archiva/sandbox/rpm/src/main/rpm/etc/profile.d/archiva.sh
URL: http://svn.apache.org/viewvc/archiva/sandbox/rpm/src/main/rpm/etc/profile.d/archiva.sh?rev=1309286&view=auto
==============================================================================
--- archiva/sandbox/rpm/src/main/rpm/etc/profile.d/archiva.sh (added)
+++ archiva/sandbox/rpm/src/main/rpm/etc/profile.d/archiva.sh Wed Apr  4 08:40:09 2012
@@ -0,0 +1,2 @@
+export RUN_AS_USER=archiva
+export ARCHIVA_BASE=/var/lib/archiva

Propchange: archiva/sandbox/rpm/src/main/rpm/etc/profile.d/archiva.sh
------------------------------------------------------------------------------
    svn:eol-style = native