machine:~ # rpm -i my-package-1.0.0-1.noarch.rpm
Preparing packages...
package my-package-0:1.0.0-1.noarch is intended for a different operating system
file /srv/www from install of my-package-0:1.0.0-1.noarch conflicts with file from package filesystem-13.1-11.13.x86_64
file /srv/www/htdocs from install of my-package-0:1.0.0-1.noarch conflicts with file from package filesystem-13.1-11.13.x86_64
Why is it saying the package is intended for a different operating system?
Why does it conflicts with filesystem?
Using Gradle 3.4.1
plugins {
id "eclipse"
id "nebula.ospackage" version "4.4.0"
}
group = 'com.company'
version = '1.0.0'
description = 'Project description'
ospackage {
release = '1'
license = 'Commercial'
vendor = 'Company LLC'
url = 'http://www.company.com'
user 'meos'
permissionGroup = 'myApp'
packageGroup 'Applications/Communications'
packageDescription 'Description'
summary 'Summary'
packager = 'User Name <user.name@company.com>'
prefix '/srv/www/htdocs'
into('/srv/www/htdocs/myApp/layout') {
from('src/layout') {
include '*.xml'
fileMode 0644
}
from('src/layout/images') {
into 'images'
include '*.png'
fileMode 0644
}
from('src/layout/scripts') {
into 'scripts'
include '*.js'
fileMode 0644
}
from('src/layout/css') {
into 'css'
include '*.css'
fileMode 0644
}
}
}
If you look at the ouptut of rpm -qlvp my-package-1.0.0-1.noarch.rpm, you’ll probably see directory entries for /srv/www and /srv/www/htdocs, which means your rpm will try to claim ownership of them.
You can stop that behaviour by setting addParentDirs to false in the buildRpm task.
I am building on one Linux and installing the package on another Linux
The command rpm -q --qf “%{OS}\n” -p returns unknown
Setting the os property to LINUX then returns linux, but should it really be necessary to set it?
Setting the following additional properties gives me an RPM I can install without trouble.
addParentDirs = false
os = “LINUX”
Not sure if it worked with addParentDirs=false last time. Just tried now and it still complains about conflict with the filesystem package. Installing with the rpm command.
However though installing with zypper works without conflict. Do not know why.
Using gradle task buildRpm from ospackage will create following directories:
/srv/www
/srv/www/htdocs
Even though addParentDirs is set to false.
So to remove the buildRpm task I could change the plugin to
id “nebula.rpm” version "4.4.0"
Then define my own rpm task which will build a proper RPM. However why doesn’t ospackage work with its default buildRpm task?