mojohaus / rpm-maven-plugin

http://www.mojohaus.org/rpm-maven-plugin/
Other
56 stars 48 forks source link

Unable to use macros in mapping/directory #60

Open lpouget-zz opened 8 years ago

lpouget-zz commented 8 years ago

Hi,

If I define my rpm like this :

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>rpm-maven-plugin</artifactId>
        <version>2.1.5</version>
        <configuration>
          <defineStatements>
            <defineStatement>_unpackaged_files_terminate_build 0</defineStatement>
            <defineStatement>myappsysconf %_sysconfdir/my-app</defineStatement>
          </defineStatements>
          <mappings>
            <mapping>
              <configuration>noreplace</configuration>
              <directory>%{myappsysconf}/conf.d/</directory>
              <filemode>440</filemode>
              <sources>
                <source>
                  <location>src/main/resources/test.conf</location>
                </source>
              </sources>
            </mapping>
          </mappings>
        </configuration>
      </plugin>

And I have this error :

[INFO] --- rpm-maven-plugin:2.1.5:attached-rpm (attach-rpm) @ my-app ---
[WARNING] rpm version string truncated to 1.0.0
[INFO] Creating directory <...>/target/rpm/my-app
[INFO] Creating directory <...>/target/rpm/my-app/BUILD
[INFO] Creating directory <...>/target/rpm/my-app/RPMS
[INFO] Creating directory <...>/target/rpm/my-app/SOURCES
[INFO] Creating directory <...>/target/rpm/my-app/SPECS
[INFO] Creating directory <...>/target/rpm/my-app/SRPMS
[INFO] Creating directory <...>/target/rpm/my-app/tmp-buildroot
[INFO] Creating directory <...>/target/rpm/my-app/buildroot
[INFO] Copying files to <...>/target/rpm/my-app/tmp-buildroot/%_sysconfdir/my-app/conf.d
[INFO] Creating spec file <...>/target/rpm/my-app/SPECS/my-app.spec
[INFO] Construction pour plate-formes cibles: noarch-redhat-linux
[INFO] Construction pour cible noarch-redhat-linux
[INFO] Exécution_de(%install) : /bin/sh -e /var/tmp/rpm-tmp.4YrAHs
[INFO] + umask 022
[INFO] + cd <...>/target/rpm/my-app/BUILD
[INFO] + '[' <...>/target/rpm/my-app/buildroot '!=' / ']'
[INFO] + rm -rf <...>/target/rpm/my-app/buildroot
[INFO] ++ dirname <...>/target/rpm/my-app/buildroot
[INFO] + mkdir -p <...>/target/rpm/my-app
[INFO] + mkdir <...>/target/rpm/my-app/buildroot
[INFO] + '[' -d <...>/target/rpm/my-app/buildroot ']'
[INFO] + mv <...>/target/rpm/my-app/tmp-buildroot/%_sysconfdir <...>/target/rpm/my-app/buildroot
[INFO] + /usr/lib/rpm/check-buildroot
[INFO] + /usr/lib/rpm/redhat/brp-compress
[INFO] + /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
[INFO] + /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
[INFO] + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
[INFO] + /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
[INFO] + /usr/lib/rpm/redhat/brp-python-hardlink
[INFO] Traitement des fichiers : my-app-1.0.0-SNAPSHOT20160803141244.noarch
[INFO] 
[INFO] 
[INFO] Erreur de construction de RPM :
[INFO] erreur : Répertoire introuvable : <...>/target/rpm/my-app/buildroot/etc/my-app/conf.d
[INFO]     Répertoire introuvable : <...>/target/rpm/my-app/buildroot/etc/my-app/conf.d

Is there a way to handle this configuration ?

lpouget-zz commented 8 years ago

After some investigations, it seems not possible to "chain" macro.

If I replace %{myappsysconf} by %{_sysconfdir}/my-app in directory, all are working fine.

Is it intended that %{myappsysconf} was not completely resolved ?

dantran commented 8 years ago

correct, it is not possible for Maven to resolve RPM variables