Code Search for Developers
 
 
  

rpm.xml from SmartFrog at Krugle


Show rpm.xml syntax highlighted

<project name="rpm" default="rpm"
    xmlns:m="http://smartfrog.org/macro">

  <description>
    This is a build file that can be used to create RPMs.


    It uses common.xml and is intended to be imported and used
    in a specific target directory

    - root.dir needs to point to the root of the smartfrog OSS build tree,
      the directory with common.xml in it, and a subdirectory called release

    - It only works on systems with the RPM tools. No RPM-tools, no build.

    - It requires the directory metadata/rpm to exist

    - a file, metadata/rpm/rpm.properties can set custom options that override those
      in core/release/metadata/rpm/rpm.properties

    - you must have a file metadata/rpm/rpm.specs containing the RPM .spec file describing
      the module. It will be copied with property expansion taking place before RPM
      runs aganst it. All properties in the rpm.properties files will be set, and ${smartfrog.version}
      will point to the current smartfrog version.

    - It requires rpm.module.name to be set to the name of the module to build.

    - It requires Ivy to set up the build; you must have a configuration called
      package-${rpm.module.name} in the ivy.xml file, which contains all artifacts
      to be included in the RPM. Do not include libraries published by other RPMs;
      depend on the RPMs instead.

    -The artifact can be published with ivy, if that is what you want. This is left as an exercise
     for the reader.


  </description>

  <!--we are a component -->
  <property name="is.component" value="true"/>


  <!-- override point -->
  <property file="build.properties"/>


  <property name="root.dir" location="../.."/>


  <property name="project.name" value="sf-${ant.project.name}"/>
  <property name="artifact.name" value="${project.name}"/>
  <property name="trace.enabled" value="true"/>
  <property name="ivy.artifact.retrieve.pattern"
      value="[conf]/[artifact]-[revision].[ext]"/>

  <import file="state.xml" />
  <import file="ivy-mixin.xml" />
  <import file="macros-mixin.xml" />



  <target name="check-rpm" depends="init">
    <condition property="has.rpm.tools">
      <and>
        <os family="unix"/>
        <available file="rpmbuild" filepath="${env.PATH}"/>
        <not>
          <isset property="rpm.disabled"/>
        </not>
      </and>
    </condition>
    <echo level="verbose">
      has.rpm.tools=${has.rpm.tools}
    </echo>
  </target>

  <target name="require-rpm" depends="check-rpm" unless="has.rpm.tools">
    <fail>
      Step away from the computer now.

      There is no RPM support on this system. If it is a windows box,
      stop trying to build RPMs. If it is a unix/linux system, you
      must have rpmbuild on the path.
    </fail>

  </target>


  <!--the entry point: build the rpm-->
  <target name="rpm" depends="build-rpm"
      description="Create the RPMs"/>
  <target name="dist" depends="rpm"
      description="Default action is to create the RPMs"/>
  <target name="default" depends="dist"
      description="Default action is to create the RPMs"/>

  <!--before we publish, we build the rpm-->
  <target name="ready-to-publish" depends="ivy.ready-to-publish,rpm"/>
  <target name="published" depends="ivy-published" />


  <target name="init-rpm" depends="check-rpm,ivy-init">

    <property name="rpm.metadata.dir" location="metadata/rpm"/>
    <property name="release.dir" location="${root.dir}/release" />
    <property name="release.rpm.metadata.dir" location="${release.dir}/metadata/rpm"/>
    <!-- artifact specific options-->
    <loadproperties srcFile="${rpm.metadata.dir}/rpm.properties"/>

    <!--global options-->
    <loadproperties srcFile="${release.rpm.metadata.dir}/rpm.properties"/>

    <fail unless="rpm.module.name" >
      You must set the property rpm.module.name to the specific name
      of the RPM module that is created. This can be done on the command line
      or in
      ${rpm.metadata.dir}/rpm.properties
    </fail>


    <m:newdir name="build.rpm.dir" location="${build.dir}/rpm"/>

    <m:newdir name="rpm.root.dir" location="${build.rpm.dir}/root/"/>

    <m:newdir name="build.rpm.metadata.dir"
        location="${build.rpm.dir}/metadata"/>
    <m:newdir name="rpm.image.dir"
        location="${build.rpm.dir}/rpm"/>
    <m:newdir name="rpm.SOURCES"
        location="${rpm.image.dir}/SOURCES"/>
    <m:newdir name="rpm.SRPMS"
        location="${rpm.image.dir}/SRPMS"/>
    <m:newdir name="rpm.SPECS"
        location="${rpm.image.dir}/SPECS"/>
    <m:newdir name="rpm.BUILD"
        location="${rpm.image.dir}/BUILD"/>
    <m:newdir name="rpm.RPMS"
        location="${rpm.image.dir}/RPMS"/>
    <m:newdir name="rpm.noarch"
        location="${rpm.RPMS}/noarch"/>
    <property name="rpmfiles.tar"
        location="${rpm.SOURCES}/smartfrog-${rpm.module.name}-${smartfrog.version}.tar"/>
    <property name="rpmfiles.tar.gz"
        location="${rpmfiles.tar}.gz"/>
    <property name="rpm.suffix"
        value="${smartfrog.version}-${rpm.release.version}.noarch.rpm"/>
    <property name="target.rpm.shortname"
        value="smartfrog-${rpm.module.name}-${rpm.suffix}"/>
    <property name="built.rpm"
        location="${rpm.noarch}/${target.rpm.shortname}"/>
    <property name="target.rpm"
        location="${dist.lib.dir}/${target.rpm.shortname}"/>
    <property name="target.rpm.tar"
        location="${build.rpm.dir}/smartfrog-${rpm.module.name}-${smartfrog.version}.tar"/>
    <property name="target.rpm.tar.gz"
        location="${dist.lib.dir}/smartfrog-${rpm.module.name}-${smartfrog.version}.tar.gz"/>

    <macrodef name="rpmpackage">
      <attribute name="package"/>
      <sequential>
        <copy todir="${rpm.lib.dir}">
          <fileset file="${ivy.lib.dir}/package-@{package}/*.jar"/>
        </copy>
      </sequential>
    </macrodef>
  </target>

  <target name="copy-rpm-specs" depends="init-rpm">
    <m:expandingcopy todir="${rpm.SPECS}">
      <fileset dir="${rpm.metadata.dir}" includes="**/*.spec"/>
    </m:expandingcopy>
  </target>

  <!--
  this is a a wierd target as it patches the macros file rpmmacros with the
  location of the output. With ant-contrib's try/finally tasks we could
  copy and restore this -provided only one build per user was live.
  As it is, unless you set the rpm.skip.macros property, your
  ~/.rpmmacros file gets trashed by Ant.

  Notes
   * the specfile attr is the name of the spec file under SPECS; it is not a full path to the file
   * - is not allowed in the version number
  -->
  <target name="rpmmacros" unless="rpm.skip.macros" depends="init-rpm">
    <echo file="${user.home}/.rpmmacros">
      #GENERATED by rpmmacros task in ${basedir}
      %_topdir ${build.rpm.dir}
    </echo>
  </target>


  <target name="create-file-layout" depends="init-rpm">
    <m:newdir name="core.install.dir"
        location="${rpm.root.dir}/${rpm.install.dir}"/>
    <m:newdir name="rpm.bin.dir"
        location="${core.install.dir}/bin"/>
    <m:newdir name="rpm.lib.dir"
        location="${core.install.dir}/lib"/>
    <m:newdir name="rpm.links.dir"
        location="${core.install.dir}/links"/>
  </target>


  <!--target to create all components-->
  <target name="rpm-components" depends="create-file-layout,ivy-retrieve">
    <rpmpackage package="${rpm.module.name}"/>
  </target>


  <!--
  The tar is passed to rpm to create the artifacts
  -->
  <target name="prepare-rpm" depends="copy-rpm-specs,rpm-components">
    <m:tar destfile="${rpmfiles.tar}">
      <fileset dir="${build.rpm.dir}/root/" includes="**/*"/>
    </m:tar>
    <gzip src="${rpmfiles.tar}" destfile="${rpmfiles.tar.gz}"/>
  </target>

  <!-- everything to be done to RPM-->
  <target name="ready-to-rpm" depends="prepare-rpm,rpmmacros"/>



  <target name="build-rpm" depends="ready-to-rpm"
      description="create an RPM file of the target library">
    <!--
    cleanBuildDir="true"
    -->
    <rpm
        specFile="rpm.spec"
        topDir="${rpm.image.dir}"
        failOnError="true"/>
    <copy todir="${dist.lib.dir}" file="${built.rpm}"/>
    <!--tar up the release-->
    <m:tar destfile="${target.rpm.tar}">
      <fileset file="${built.rpm}"/>
    </m:tar>
    <!--and gzip it. This is what gets published-->
    <gzip src="${target.rpm.tar}" destfile="${target.rpm.tar.gz}"/>

  </target>

  <target name="expand-rpm-debian" depends="rpm"
      description="expand the rpm on a debian system, but do not install it">
    <m:newdir name="rpm.expanded.dir" location="${build.rpm.dir}/expanded"/>
    <exec executable="/usr/bin/alien" failonerror="true"
        dir="${rpm.expanded.dir}">
      <arg value="--generate"/>
      <arg value="--scripts"/>
      <arg file="${target.rpm}"/>
    </exec>
    <echo>RPM expanded into ${rpm.expanded.dir}</echo>
  </target>

  <target name="install-rpm-rhat" depends="rpm"
      description="install the rpm on a RedHat system">
    <echo>installing RPM ${target.rpm}</echo>
    <exec executable="rpm" failonerror="true">
      <arg value="--upgrade"/>
      <arg value="--vv"/>
      <arg file="${target.rpm}"/>
    </exec>
    <echo>installed RPM ${target.rpm}</echo>
  </target>


</project>



See more files for this project here

SmartFrog

SmartFrog (Smart Framework for Object Groups) is a framework for configuring and automatically activating distributed applications. \r\nThe SmartFrog framework is released under LGPL license.\r\nMore info at: www.smartfrog.org

Project homepage: http://sourceforge.net/projects/smartfrog
Programming language(s): Java,XML
License: other

  checkstyle/
    checkstyle-config
    checkstyle-frames.xsl
    checkstyle-policy.xml
    checkstyle-text.xsl
    checkstyle-xdoc.xsl
  checkstyle.xml
  classpaths.xml
  compile-and-jar-mixin.xml
  core.xml
  daemon.xml
  dist.xml
  gui.xml
  ivy-mixin.xml
  javadoc-mixin.xml
  m2.xml
  macros-mixin.xml
  maven-v4_0_0.xsd
  rpm.xml
  security-mixin.xml
  sftasks.xml
  state.xml
  systemtest.xml
  unittest.xml