nebula-plugins / gradle-ospackage-plugin

Gradle plugin for constructing linux packages, specifically RPM and DEBs.
Apache License 2.0
369 stars 129 forks source link

Generated RPMs do not have OS set to Linux (ospackage-application-spring-boot) #435

Open flozano opened 9 months ago

flozano commented 9 months ago

I'm building packages in a github action (and thus Linux).

My build looks like this:

build.gradle:

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.2.1'
    id 'io.spring.dependency-management' version '1.1.4'
    id 'com.netflix.nebula.ospackage-application-spring-boot' version '11.6.0'
}

group = 'com.mycompany'

repositories {
    mavenCentral()
}

java {
    sourceCompatibility = '21'
}

application {
    mainClass = 'com.mycompany.MyApp'
}

dependencies {
// ...
}

and when I generate an RPM with buildRpm task, I get:

# rpm -Uvh /tmp/myapp-0.1.5.noarch.rpm
Preparing...                          ################################# [100%]
    package myapp-0:0.1.5-.noarch is intended for a different operating system

# rpm -q --qf "%{OS}\n" -p /tmp/myapp-0.1.5.noarch.rpm
unknown

I understand the os should be set to linux instead... but I see no way to do it cleanly with the ospackage-application-spring-boot plugin. Any hint?

(adding settings.gradle for completion, but I don't think it's related):

plugins {
    id 'org.ajoberstar.reckon.settings' version '0.18.2'
}

reckon {
    defaultInferredScope = 'patch'
    parallelBranchScope = 'minor'
    scopeCalc = calcScopeFromProp().or(calcScopeFromCommitMessages())
    stageCalc = calcStageFromProp()
    snapshots()
}

rootProject.name = 'myapp'
flozano commented 9 months ago

I've followed advice in https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/384

and added:

ospackage {
    os = org.redline_rpm.header.Os.LINUX
}

and it worked.

I think this should be the default, "unknown" OS RPMs are not common.