jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Mojo RPM Plugin
  • MRPM-14

Specifying <directory> of a pre-exising system directory results in an RPM which can't be installed due to conflicts

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.0-beta-2
  • Component/s: rpm
  • Labels:
    None
  • Environment:
    CentOS release 5 (Final)

Description

<mapping> currently specifies the destination directory for the files. This directory is always listed as part of the installed files.

This presents a problem when trying to install a startup script for the application:
<mapping>
<directory>/etc/init.d</directory>
[...]
</mapping>

Trying to install the RPM results in the following error:

  1. rpm -Uvh dummy-1.0-1.i386.rpm
    file /etc/init.d from install of dummy-1.0-1 conflicts with file from package chkconfig-1.3.30.1-1

$ rpm -qlvp dummy-1.0-1.i386.rpm
[..]
drwxr-xr-x 2 root root 0 Oct 17 10:50 /etc/init.d
-rwxr-xr-x 1 root root 15060 Oct 17 10:50 /etc/init.d/dummy
[..]

Current workarounds:

  • Use the postinstall script to create the file in /etc/init.d, removing this <mapping> altogether.
    or
  • Use --force during the installation
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    rpm-filelist.patch
    27/Feb/08 6:47 AM
    2 kB
    John Erik Halse
  2. Text File
    rpm-single-sourcefile.patch
    23/Nov/07 4:17 AM
    23 kB
    jh
  3. Text File
    rpm-single-sourcefile-v2.patch
    26/Nov/07 1:22 AM
    3 kB
    jh

Issue Links

is duplicated by

Improvement - An improvement or enhancement to an existing feature or task. MRPM-28 Specify individual files (when appropriate) in the generated .spec file.

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
supercedes

Improvement - An improvement or enhancement to an existing feature or task. MRPM-22 Various solutions for: MOJO-929, MOJO-972, MOJO-931

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Sönke Nommensen added a comment - 17/Oct/07 6:30 AM

This is because /etc/init.d/ is a link to /etc/rc.d/init.d/, thus a mapping to the latter should work.

Show
Sönke Nommensen added a comment - 17/Oct/07 6:30 AM This is because /etc/init.d/ is a link to /etc/rc.d/init.d/, thus a mapping to the latter should work.
Hide
Permalink
Shmulik Fishman added a comment - 17/Oct/07 7:17 AM

This does fix the specific conflict on /etc/init.d. Thanks.

However, it does not address the real problem: This directory is always listed as part of the installed files, which means we reset its permissions during installation.

So the question remains:

How do I install files only, without the containing directory?

Show
Shmulik Fishman added a comment - 17/Oct/07 7:17 AM This does fix the specific conflict on /etc/init.d. Thanks. However, it does not address the real problem: This directory is always listed as part of the installed files, which means we reset its permissions during installation. So the question remains: How do I install files only, without the containing directory?
Hide
Permalink
jh added a comment - 23/Nov/07 2:50 AM

I have the same issue but my /etc/init.d is not a link. So I'm probably stuck to the suggested workaround.

Show
jh added a comment - 23/Nov/07 2:50 AM I have the same issue but my /etc/init.d is not a link. So I'm probably stuck to the suggested workaround.
Hide
Permalink
jh added a comment - 23/Nov/07 4:17 AM

I went ahead checked out the code and added the possibility to create mappings based on one file. This makes it possible to quickly add one-file mappings and will result in file based lines in the rpm spec.

<mapping>
<directory>/etc/init.d</directory>
<configuration>true</configuration>
<username>root</username>
<groupname>root</groupname>
<sourceFile>${project.build.directory}/mystartupscript</sourceFile>
</mapping>

generates:

%config %dir %attr(-,root,root) /etc/init.d/mystartupscript

I bypassed the sources property because this seemed an easier way. Another option was to add something like a handlePerFile property to generate one line per file in the spec, but this means duplicating the DirectoryArchiver functionality.

Please advise if this patch/solution is not to your liking.

Show
jh added a comment - 23/Nov/07 4:17 AM I went ahead checked out the code and added the possibility to create mappings based on one file. This makes it possible to quickly add one-file mappings and will result in file based lines in the rpm spec. <mapping> <directory>/etc/init.d</directory> <configuration>true</configuration> <username>root</username> <groupname>root</groupname> <sourceFile>${project.build.directory}/mystartupscript</sourceFile> </mapping> generates: %config %dir %attr(-,root,root) /etc/init.d/mystartupscript I bypassed the sources property because this seemed an easier way. Another option was to add something like a handlePerFile property to generate one line per file in the spec, but this means duplicating the DirectoryArchiver functionality. Please advise if this patch/solution is not to your liking.
Hide
Permalink
Bob Allison added a comment - 23/Nov/07 6:03 AM

Your patch has a lot of "changes" where the change updates a blank line. This makes it difficult to locate the real changes.

Can you create a new patch file with the -b option to ignore these changes?

Show
Bob Allison added a comment - 23/Nov/07 6:03 AM Your patch has a lot of "changes" where the change updates a blank line. This makes it difficult to locate the real changes. Can you create a new patch file with the -b option to ignore these changes?
Hide
Permalink
jh added a comment - 26/Nov/07 1:22 AM

No problem, I've removed the blanks, the patch should be fine now.

Show
jh added a comment - 26/Nov/07 1:22 AM No problem, I've removed the blanks, the patch should be fine now.
Hide
Permalink
John Erik Halse added a comment - 27/Feb/08 6:47 AM

Another solution to this bug.

Show
John Erik Halse added a comment - 27/Feb/08 6:47 AM Another solution to this bug.
Hide
Permalink
John Erik Halse added a comment - 27/Feb/08 6:49 AM

The last comment hit the road a little to early. Here is the whole story:

I have the same problem. It is especially annoying when you want to add a configuration file in /etc and you want your rpm to only handle this single file.

It seems like nothing has happened after jh submitted the patch. In case you want another proposal for how to deal with this, I have made a patch as well rpm-filelist.patch .

The main difference from jh's patch is that mine doesn't alter the configuration format. It checks if the sources for a mapping contains only references to files. If so, it generates one line in the spec for each file. Otherwise it uses the old behavior.

Example:

<mapping>
<directory>/etc/init.d</directory>
<configuration>true</configuration>
<username>root</username>
<groupname>root</groupname>
<sources>
 <source>
  <location>src/etc/somefile</location>
 </source>
 <source>
  <location>src/etc/anotherfile</location>
 </source>
</sources>
</mapping>

generates:

%config %dir %attr(-,root,root) /etc/init.d/somefile
%config %dir %attr(-,root,root) /etc/init.d/anotherfile

With a directory in the sources:

<mapping>
<directory>/etc/init.d</directory>
<configuration>true</configuration>
<username>root</username>
<groupname>root</groupname>
<sources>
 <source>
  <location>src/etc/somefile</location>
 </source>
 <source>
  <location>src/etc/somedirectory</location>
 </source>
</sources>
</mapping>

generates:

%config %dir %attr(-,root,root) /etc/init.d
Show
John Erik Halse added a comment - 27/Feb/08 6:49 AM The last comment hit the road a little to early. Here is the whole story: I have the same problem. It is especially annoying when you want to add a configuration file in /etc and you want your rpm to only handle this single file. It seems like nothing has happened after jh submitted the patch. In case you want another proposal for how to deal with this, I have made a patch as well rpm-filelist.patch . The main difference from jh's patch is that mine doesn't alter the configuration format. It checks if the sources for a mapping contains only references to files. If so, it generates one line in the spec for each file. Otherwise it uses the old behavior. Example:
<mapping>
<directory>/etc/init.d</directory>
<configuration>true</configuration>
<username>root</username>
<groupname>root</groupname>
<sources>
 <source>
  <location>src/etc/somefile</location>
 </source>
 <source>
  <location>src/etc/anotherfile</location>
 </source>
</sources>
</mapping>
generates:
%config %dir %attr(-,root,root) /etc/init.d/somefile
%config %dir %attr(-,root,root) /etc/init.d/anotherfile
With a directory in the sources:
<mapping>
<directory>/etc/init.d</directory>
<configuration>true</configuration>
<username>root</username>
<groupname>root</groupname>
<sources>
 <source>
  <location>src/etc/somefile</location>
 </source>
 <source>
  <location>src/etc/somedirectory</location>
 </source>
</sources>
</mapping>
generates:
%config %dir %attr(-,root,root) /etc/init.d
Hide
Permalink
Michael Hirsch added a comment - 26/Mar/08 11:03 PM

What I would really like is a way to include or exclude the top directory. It could be something explicit like an <includeDir/> tag, or something implicit like <location>foo/bar</location> means to include the directory in the rpm file list and <location>foo/bar/</location> would mean to include the contents of foo/bar, but not the directory itself. This is similar to the way rsync distinguishes the two cases for it's source directory and it is quite convenient.

Show
Michael Hirsch added a comment - 26/Mar/08 11:03 PM What I would really like is a way to include or exclude the top directory. It could be something explicit like an <includeDir/> tag, or something implicit like <location>foo/bar</location> means to include the directory in the rpm file list and <location>foo/bar/</location> would mean to include the contents of foo/bar, but not the directory itself. This is similar to the way rsync distinguishes the two cases for it's source directory and it is quite convenient.
Hide
Permalink
Chris Ryan added a comment - 18/May/08 7:48 PM

I have a solution based on Michael Hirsch's comment (using includeDir) - http://jira.codehaus.org/browse/MOJO-1125

Under the <mapping> element you can add an optional element: <includeDir>boolean</includeDir>. By default it's true. If false, the directory specified in the mapping is not included.

Show
Chris Ryan added a comment - 18/May/08 7:48 PM I have a solution based on Michael Hirsch's comment (using includeDir) - http://jira.codehaus.org/browse/MOJO-1125 Under the <mapping> element you can add an optional element: <includeDir>boolean</includeDir>. By default it's true. If false, the directory specified in the mapping is not included.
Hide
Permalink
Jens Persson added a comment - 17/Nov/08 5:45 AM

It seems it has to be <includeDirectory> rather than just <includeDir>

Show
Jens Persson added a comment - 17/Nov/08 5:45 AM It seems it has to be <includeDirectory> rather than just <includeDir>
Hide
Permalink
Chris Ryan added a comment - 17/Nov/08 6:27 AM

Yes, that's correct includeDirectory, not includeDir. Sorry about the mistake.

Show
Chris Ryan added a comment - 17/Nov/08 6:27 AM Yes, that's correct includeDirectory, not includeDir. Sorry about the mistake.
Hide
Permalink
Carlos Sanchez added a comment - 02/Jan/09 11:47 AM

Fixed in 2.0-beta-2-SNAPSHOT. Thanks

Show
Carlos Sanchez added a comment - 02/Jan/09 11:47 AM Fixed in 2.0-beta-2-SNAPSHOT. Thanks

People

  • Assignee:
    Carlos Sanchez
    Reporter:
    Shmulik Fishman
Vote (3)
Watch (3)

Dates

  • Created:
    17/Oct/07 4:37 AM
    Updated:
    12/Feb/10 8:03 AM
    Resolved:
    02/Jan/09 11:47 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.