Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpmPrefix has no effect during rpm:packageBin #672

Open
alecswan opened this issue Sep 19, 2015 · 10 comments
Open

rpmPrefix has no effect during rpm:packageBin #672

alecswan opened this issue Sep 19, 2015 · 10 comments

Comments

@alecswan
Copy link

Hello,

I added the following setting in build.sbt
rpmPrefix := Some("/opt/kafka-manager")
and ran
sbt rpm:packageBin
which generated an RPM file but "rpm -qpl target/rpm/RPMS/noarch/kafka-manager-*.rpm" still shows all jars and javadoc files under /usr/share/kafka-manager/. When I install the RPM it does the same thing and puts jars and javadoc under /usr/share/kafka-manager/.

Is this a bug or I'm doing something wrong?

Thanks!

@muuki88
Copy link
Contributor

muuki88 commented Sep 19, 2015

Are you using the latest milestone 1.0.5-M3? There were some fixes around relocatable rpms.

Am 19.09.2015 6:07 nachm. schrieb alecswan notifications@github.com:Hello,

I added the following setting in build.sbt
rpmPrefix := Some("/opt/kafka-manager")
and ran
sbt rpm:packageBin
which generated an RPM file but "rpm -qpl target/rpm/RPMS/noarch/kafka-manager-*.rpm" still shows all jars and javadoc files under /usr/share/kafka-manager/. When I install the RPM it does the same thing and puts jars and javadoc under /usr/share/kafka-manager/.

Is this a bug or I'm doing something wrong?

Thanks!

—Reply to this email directly or view it on GitHub.

@alecswan
Copy link
Author

I upgraded to 1.0.5-M3 but without any success. sbt rpm:packageBin task still produces an RPM with the old paths. I see the following warnings during the task execution which seems to me that 0.7.4 was evicted in favor of 1.0.5-M3, but I am not sure if it has some other side effects:
[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * com.typesafe.sbt:sbt-native-packager:0.7.4 -> 1.0.5-M3
[warn] Run 'evicted' to see detailed eviction warnings

I am running this on CentOS 6.5 with Java 7 and sbt 0.13.9.

@muuki88
Copy link
Contributor

muuki88 commented Sep 20, 2015

Can you post your full build.sbt here?

@alecswan
Copy link
Author

/**

  • Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
  • See accompanying LICENSE file.
    */
    // Comment to get more information during initialization
    logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "
http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.10")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.2")

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0")

// Support packaging plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.5-M3")

resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.4")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.0.0")

On Sun, Sep 20, 2015 at 3:24 PM, Nepomuk Seiler notifications@github.com
wrote:

Can you post your full build.sbt here?


Reply to this email directly or view it on GitHub
#672 (comment)
.

@alecswan
Copy link
Author

And here is build.sbt you asked for:

/**

  • Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
  • See accompanying LICENSE file.
    */
    name := """kafka-manager"""

/* For packaging purposes, -SNAPSHOT MUST contain a digit */
version := "1.2.8"

scalaVersion := "2.11.7"

scalacOptions ++= Seq("-Xlint:-missing-interpolator","-Xfatal-warnings","-deprecation","-feature","-language:implicitConversions","-language:postfixOps")

// From https://www.playframework.com/documentation/2.3.x/ProductionDist
assemblyMergeStrategy in assembly := {
case "play/core/server/ServerWithStop.class" => MergeStrategy.first
case other => (assemblyMergeStrategy in assembly).value(other)
}

libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.3.10",
"org.webjars" %% "webjars-play" % "2.3.0-2",
"org.webjars" % "bootstrap" % "3.3.4",
"org.webjars" % "jquery" % "2.1.4",
"org.webjars" % "backbonejs" % "1.1.2-4",
"org.webjars" % "underscorejs" % "1.8.3",
"org.webjars" % "dustjs-linkedin" % "2.6.1",
"org.apache.curator" % "curator-framework" % "2.7.1" exclude("log4j","log4j") force(),
"org.apache.curator" % "curator-recipes" % "2.7.1" exclude("log4j","log4j") force(),
"org.json4s" %% "json4s-jackson" % "3.2.11",
"org.json4s" %% "json4s-scalaz" % "3.2.11",
"org.slf4j" % "log4j-over-slf4j" % "1.7.7",
"com.adrianhurt" %% "play-bootstrap3" % "0.4",
"org.apache.kafka" %% "kafka" % "0.8.2.1" % "test",
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
"org.apache.curator" % "curator-test" % "2.7.1" % "test" force()
)

net.virtualvoid.sbt.graph.Plugin.graphSettings

LessKeys.compress in Assets := true

pipelineStages := Seq(digest, gzip)

includeFilter in (Assets, LessKeys.less) := "*.less"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

ScoverageSbtPlugin.ScoverageKeys.coverageExcludedPackages := ";controllers.;views.;models.*"

/*

  • Allow packaging as part of the build
    */
    enablePlugins(SbtNativePackager)

/* Debian Settings - to create, run as:
$ sbt debian:packageBin

See here for details:
http://www.scala-sbt.org/sbt-native-packager/formats/debian.html
*/

maintainer := "Yahoo yahoo@example.com"
packageSummary := "A tool for managing Apache Kafka"
packageDescription := "A tool for managing Apache Kafka"

/* End Debian Settings */

/* RPM Settings - to create, run as:
$ sbt rpm:packageBin

See here for details:
http://www.scala-sbt.org/sbt-native-packager/formats/rpm.html
*/

rpmRelease := "1"
rpmVendor := "yahoo"
rpmUrl := Some("https://github.com/yahoo/kafka-manager")
rpmLicense := Some("Apache")
rpmGroup := Some("Applications/Kafka/Manager")
rpmPrefix := Some("/opt/kafka-manager")

/* End RPM Settings */

@justinnichols
Copy link

Any update on this? Would be nice to be able to use rpmPrefix and have the install be self-contained to the location specified.

@justinnichols
Copy link

So I believe this isn't really a bug (except that in the SPECS it's "prefix" instead of "Prefix", which I can create a pull request for shortly). I believe this is due to our misunderstanding of what Prefix is used for. Basically it's not designed to say "install into the 'Prefix' location". It's designed to say "make all paths in the 'Prefix' location relocatable if the installing user requests it as such using --relocate option on rpm".

The real issue is that the rpm packager doesn't support multiple Prefix values: prefix: Option[String] = None in RpmMetadata.scala. If it was instead set up to be prefix: Seq[String] = Seq.empty we could do the following:

rpmPrefix ++= Seq("/usr/share/play-demo", "/var/log/play-demo", "/var/run/play-demo", "/etc/default", "/etc/init.d")

I will try to see if I can come up with that kind of a change and submit it in a pull request.

See http://rpm5.org/docs/api/relocatable.html

@justinnichols
Copy link

I just found a workaround for the current version that also lets the paths to be relocated (basically a space-delimited string):

val packageName = "play-demo"

rpmPrefix := Some("/usr/share/" + packageName + " /var/log/" + packageName + " /var/run/" + packageName + " /etc/default /etc/init.d")

The biggest problem I see is that relocating these packages will break the /etc/init.d script. My best guess is instead to let it install like normal and then create symlinks from the location you would want to see this be housed (for easier maintenance).

EDIT> It occurred to me that maybe the prefixing could work such that the original paths get symlinked to the target self-contained folder during relocation. I haven't tested to see if RPM just does that on its own or not, but if so it would be the solution I think.

@justinnichols
Copy link

Submitted #698 to support multiple prefixes. If it's determined that it's not necessary, I completely understand. It's there if it's useful :)

@muuki88
Copy link
Contributor

muuki88 commented Nov 14, 2015

cc @fsat did some pull requests on this. See #661 #664 #685 #667 and #668

I'm not really familiar this relocate feature ( neither I know why it's needed ). If you and @fsat say this should be that way ( and providing sources that underline this ), I'm fine merging it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Rpm
Bugs
Development

No branches or pull requests

3 participants