question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose the generated rpm filepath

See original GitHub issue

The generated rpm filename should be exposed via a setting.

I generate an rpm via sbt rpm:packageBin in a CI which I then upload to a nexus using curl:

# This generates the rpm but does not log anything to the console
PACKAGE_OUTPUT=$(sbt "print rpm:packageBin") 
echo $PACKAGE_OUTPUT
# Extract the rpm filename full path
RPM_FILE=$(echo $PACKAGE_OUTPUT | tail -n1)
curl --user "$NEXUS_USERNAME:$NEXUS_PASSWORD" --upload-file $RPM_FILE https://nexus.example.com/repository/yum-releases/7/os/$ARCH/$(basename $RPM_FILE)

But its quite clunky as the sbt "print rpm:packageBin" is what actually generates the rpm. It is also the only way to know the generated rpm filename (apart from computing it from the other settings). The code that would be easy to read should be something like:

sbt "rpm:packageBin"
RPM_FILE=$(sbt "rpm:filename" | tail -n1)
curl --user "$NEXUS_USERNAME:$NEXUS_PASSWORD" --upload-file $RPM_FILE https://nexus.example.com/repository/yum-releases/7/os/$ARCH/$(basename $RPM_FILE)

Information

  • What sbt-native-packager are you using: 1.4.1
  • What sbt version: 1.3.2
  • What is your build system: Arch Linux + rpm-org package
  • What package are you building: rpm
  • What version has your build tool: 4.15.0
  • What is your target system: CentOS 7

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Laseringcommented, Dec 4, 2019

@muuki88 yes!

1reaction
nigredo-toricommented, Nov 29, 2019

@muuki88,

returns only the version and nothing else

This also means that we lose most of the log in case anything goes wrong. Also, I don’t think this would work if some task logs something at the error level.

I would argue that the RPM path is well known as well. Not the exact file, but the output directory which only contains one file.

  1. The almost known path is not always convenient. E.g. I have a hand-written Dockerfile that I run after a build (I haven’t switched to DockerPlugin yet), so without a setting like this I would have to either postprocess the build output to move the file to a known path (easy, but annoying), or pass this uncertainty to the resulting docker image.
  2. There is no guarantee that there is only one file, unless the process is happening in CI. E.g. if I package, change version and package again, I will probably get two files. Again, this can be mitigated by cleaning the output folder before the build - but that is also annoying.

I consider this a hack as directory != file

That, indeed, would be a hack. Which is why we should use artifactPath instead:

Rpm / packageBin / artifactPath := ???
Rpm / packageBin := {
   val rpmFile := (Rpm / packageBin / artifactPath).value
}

This also doesn’t require any new settings, but it’s as idiomatic as it gets - you’ll find that Compile / packageBin uses Compile / packageBin / artifactPath for the same purpose, albeit with a bit of indirection.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating an rpm from files and folders from the current directory
I can build the rpm locally without any of the Sources specified but src.rpm fails with an empty set of files to package....
Read more >
Chapter 3. Packaging software Red Hat Enterprise Linux 7
This section describes how to build an RPM after a SPEC file for a program has been created. RPMs are built with the...
Read more >
How to create a RPM Package
To build an rpm file based on the spec file that we just created, we need to use rpmbuild command. rpmbuild command is...
Read more >
Packagers RPM tutorial - Mageia wiki
To build packages, rpm needs a special tree in your home directory. This tree can be created with the following command:
Read more >
RPM: Example Basics of RPM Building - Super User
I have a basic RPM question. I don't know very much about RPM building, besides the basic .rpmmacros file, the build directory etc....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found