LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File conflict with the old installed rpm package while installing new package (https://www.linuxquestions.org/questions/linux-newbie-8/file-conflict-with-the-old-installed-rpm-package-while-installing-new-package-918452/)

sr164w 12-13-2011 02:34 AM

File conflict with the old installed rpm package while installing new package
 
when I am trying to install my rpm application package (2.5-0.1.12 -- Version and revision) If any older version is installed I am getting below file conflict error.

file /opt/compname/product/application.jar from install of comp-prod-2.2-0.1.12 conflicts with file from package comp-prod-2.5-0.1.12

I am getting the above error for jar file and desktop file between older and newer versions.

But when i use update command its overwriting the older version and installing new.

Should i do anything to resolve this in my spec file.

Please tell me why this conflict is coming and how to resolve this?

unSpawn 12-13-2011 04:32 AM

Quote:

Originally Posted by sr164w (Post 4548550)
when I am trying to install my rpm application package (2.5-0.1.12 -- Version and revision) If any older version is installed I am getting below file conflict error. file /opt/compname/product/application.jar from install of comp-prod-2.2-0.1.12 conflicts with file from package comp-prod-2.5-0.1.12
I am getting the above error for jar file and desktop file between older and newer versions.

This is expected and wanted behaviour: of package %{name} one usually does not install a second %{version} on the same machine.


Quote:

Originally Posted by sr164w (Post 4548550)
But when i use update command its overwriting the older version and installing new. Should i do anything to resolve this in my spec file.

This is expected and wanted behaviour as well. Even if some package contents don't change it'll install files anew. The only exception are configuration files which may be protected with the "noreplace" option.
* BTW your version numbering seems odd. Sure you can build and ship a new %{minor} version (on upstream release?) but (especially when patching) the %{build} should start at the lowest incremented number like -0.0.1 and not 12. For example 2.2-0.1.12 leads to 2.2-0.1.13 if patched or to 2.5-0.1.1 if upstream updates it.

sr164w 12-13-2011 11:13 PM

installer upgrade using RPM
 
RPM is taking care of installing older version and also same version scenario.

If I do update instead of installing new version when old is existing then it updates the package so no problem here.

But When I try to install a new version when an older version exists RPM installs the new version separately thus two versions will exist.

I would like to stop the new version installation when an older exists in my spec file by checking in %pre section. How can I know that rpm -ivh is called or rpm -Uvh is called in my spec file?

if [ "$1" = "1" ]; then
echo Perform tasks to prepare for the initial installation
elif [ "$1" = "2" ]; then
echo You already have old version Please use -U to upgrade.
fi

"$1" = "2" true for both new installation when old is present and for upgrade.

Please let me know how to solve this.

unSpawn 12-15-2011 11:43 AM

Quote:

Originally Posted by sr164w (Post 4549382)
I would like to stop the new version installation when an older exists in my spec file by checking in %pre section.

Doesn't make sense as I already told you how RPM prohibits you from doing that, besides you already created another follow-up thread here: http://www.linuxquestions.org/questi...rocess-918662/ where' you've gotten the same answer. * And please note the suggestion in the first reply of using --force rpm never is a proper solution.


All times are GMT -5. The time now is 12:36 PM.