-1

I'd like to improve the distribution and versioning of a program I've inherited, which is currently distributed as a .tar.gz file, by building a .rpm for RHEL7 that just extracts the contents to /usr/bin/. The tarball is not small, consisting in around 120 MB worth of files.

I'm new around package building so I've been following the bello example from https://rpm-packaging-guide.github.io, but the example is too simple for my needs.

So far I have this .spec file:

Name:           my-app
Version:        2.0 
Release:        1%{?dist}
Summary:        My application

License:        Internal license
URL:            <my-website>
Source0:        <my-website>/%{name}-%{version}.rhel7.x86_64.tar.gz

Requires:       bash

BuildArch:      x86_64

%description
My application

%prep
%setup -q

%build

%install
mkdir -p %{buildroot}/%{_bindir}
install -m 0755 %{name} %{buildroot}/%{_bindir}/%{name}

%files
%{_bindir}/%{name}

Which generates a very small .rpm with just /usr/bin/my-app. On installation if complains about many missing dependencies that are inside the tarball's lib directory, but of course not in my package.

As far as I understand, the %files directive must contain a list of all the files that are supposed to be inside the .rpm, but those are hundreds. So I'm assuming there's a better way to build the package, after all is just decompressing the tarball.

Do you have any pointers?

Armaggedon
  • 399
  • 4
  • 14
  • 1
    `%prep, %setup -q, %build, %install` is used when building from source. .... Example spec file : build **rpm** from files (~1400 files **!** ) https://www.dropbox.com/s/bv9k29xlhsr6xlp/gcc63-c%2B%2B.spec?dl=0 .... Written automatically with pkgtools2 https://drive.google.com/file/d/0B7S255p3kFXNQ0ZEbHB1V1BUa0E/view?usp=sharing – Knud Larsen Feb 28 '20 at 10:02

1 Answers1

1
install -m 0755 %{name} %{buildroot}/%{_bindir}/%{name}

you are only installing the binary. You should also install the dependencies if they are in your tgz, Then make sure to package them as well under %files.

Chris Maes
  • 35,025
  • 12
  • 111
  • 136