gdu icon indicating copy to clipboard operation
gdu copied to clipboard

RFE: Fedora / RHEL / CentOS package

Open dralley opened this issue 3 years ago • 81 comments

dralley avatar Jun 16 '21 22:06 dralley

I created a preliminary SPEC that will create a RPM that will install the precompiled package. I'll see if I can get a rpm that will build the source instead. gdu.txt

I make a tar.gz with the following name: gdu_linux_amd64-5.3.0.tar.gz And it contains a directory:

 gdu-5.3.0/
 gdu-5.3.0/gdu

I'll let you know if I get a working RPM that will build from Source instead.

daniejstriata avatar Jul 21 '21 18:07 daniejstriata

Compiling the source fails because I am not pointing to the Go files as seen below:

Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.i3M1EY
+ umask 022
+ cd /home/danie.dejager/rpmbuild/BUILD
+ cd gdu-5.3.0
+ go build -trimpath -buildmode=pie -mod=readonly -modcacherw -ldflags '-linkmode external -extldflags "" ' -o gdu
no Go files in /home/builduser/rpmbuild/BUILD/gdu-5.3.0
error: Bad exit status from /var/tmp/rpm-tmp.i3M1EY (%build)

This is the build command I use:

Name: gdu

go build \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -o %{name}

Contents of source after extracted: image Note: git on Centos 7 is too old and needs to be updated to satisfy the go build process. I updated git using this guide: https://computingforgeeks.com/how-to-install-latest-version-of-git-git-2-x-on-centos-7/

daniejstriata avatar Jul 21 '21 20:07 daniejstriata

Thanks for diving into this!

This simple build command should work:

go build \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -o %{name} \
    github.com/dundee/gdu/v5/cmd/gdu

dundee avatar Jul 22 '21 10:07 dundee

It would be great to also add ldflags and disable CGO:

GO111MODULE=on CGO_ENABLED=0 go build \
           -trimpath \
            -buildmode=pie \
            -mod=readonly \
            -modcacherw \
            -ldflags \
              "-s -w \
              -X 'github.com/dundee/gdu/v5/build.Version=$(git describe)' \
              -X 'github.com/dundee/gdu/v5/build.User=$(id -u -n)' \
              -X 'github.com/dundee/gdu/v5/build.Time=$(LC_ALL=en_US.UTF-8 date)'" \
            -o %{name} \
            github.com/dundee/gdu/v5/cmd/gdu

dundee avatar Jul 22 '21 10:07 dundee

@dundee Do you require go 1.16 for building at minimum? Neither EL7 or EL8 comes with it standard. They're limited to 1.15 if using standard repos. Trying to build with go 1.15 failed with this: internal/common/ui.go:4:2: package io/fs is not in GOROOT (/usr/lib/golang/src/io/fs)

I had no issues when I removed version 1.15 installed from EPEL and manually installed go 1.16 and tried with that instead.

I've created a SPEC that installs on EL7 and EL8. You will need to have go 1.16 installed and in path. gdu_5.3.0-2.spec.txt

To build on EL7 you'll also need to install a newer version of git.

pandoc is required and for EL8 found in powertools repo.


Name        : gdu
Version     : 5.3.0
Release     : 2
Architecture: x86_64
Install Date: (not installed)
Group       : Unspecified
Size        : 6051276
License     : MIT
Signature   : (none)
Source RPM  : gdu-5.3.0-2.src.rpm
Build Date  : Thu 22 Jul 2021 23:12:10 SAST
Build Host  : centos8.localdomain
Relocations : (not relocatable)
Packager    : Danie de Jager
Vendor      : 
Summary     : Pretty fast disk usage analyzer written in Go.
Description :
Pretty fast disk usage analyzer written in Go.

→ readelf -h /usr/bin/gdu
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x46dbe0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          6055448 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         12
  Size of section headers:           64 (bytes)
  Number of section headers:         28
  Section header string table index: 27

daniejstriata avatar Jul 22 '21 21:07 daniejstriata

gdu-5.3.0-2.zip RPM and RPM SRC

daniejstriata avatar Jul 22 '21 21:07 daniejstriata

Yes, go 1.16 is required, I use some incompatible changes introduced in this version.

Could we setup automatic building somewhere? For example on https://cbs.centos.org/koji/?

dundee avatar Jul 23 '21 12:07 dundee

It won't be possible. There is not a go 1.16 available for RHEL 7 or 8 in EPEL , you will not be able to achieve your goal. EPEL packages may only be built against specific RH channels + EPEL. I'm trying COPR but not sure if that will work.

daniejstriata avatar Jul 23 '21 13:07 daniejstriata

Ok, if it not works then we can probably wait until RHEL 9.

dundee avatar Jul 23 '21 14:07 dundee

RHEL 9 is built from Fedora 34, which has 1.16, so you should be good there.

dralley avatar Jul 29 '21 04:07 dralley

Can you publish the RPM above with your sources for now? I'll build a RPM when you release. This RPM works on EL6, 7 and 8.

daniejstriata avatar Jul 29 '21 06:07 daniejstriata

Can you publish the RPM above with your sources for now? I'll build a RPM when you release. This RPM works on EL6, 7 and 8.

Yes, added to 5.3.0 release - https://github.com/dundee/gdu/releases/tag/v5.3.0

Could you build for 5.4.0 as well?

dundee avatar Jul 29 '21 09:07 dundee

gdu-5.4.0.zip Here you go.

daniejstriata avatar Jul 29 '21 10:07 daniejstriata

Thanks! Added to release files.

dundee avatar Jul 29 '21 12:07 dundee

@dundee Here it is: gdu-5.5.0.zip

daniejstriata avatar Aug 02 '21 06:08 daniejstriata

@dundee Here it is: gdu-5.5.0.zip

Thank you! Added to release.

dundee avatar Aug 02 '21 06:08 dundee

@dundee Here you go. BTW is the man file up-to-date? It is from Jan 2021. gdu-5.6.0.zip

daniejstriata avatar Aug 23 '21 06:08 daniejstriata

@dundee Here you go. BTW is the man file up-to-date? It is from Jan 2021. gdu-5.6.0.zip

Thanks! Uploaded.

The man file was last changed on 20th Jul according to git history.

dundee avatar Aug 23 '21 21:08 dundee

@dundee The date in the file stills says Jan 2021.

daniejstriata avatar Aug 23 '21 21:08 daniejstriata

@dundee The date in the file stills says Jan 2021.

Ah, you are right, I have missed this one.

dundee avatar Aug 24 '21 09:08 dundee

It will be fixed in next release.

dundee avatar Aug 24 '21 11:08 dundee

@dundee Here is 5.6.1 gdu-5.6.1-1.zip

daniejstriata avatar Aug 27 '21 21:08 daniejstriata

@dundee Here is 5.6.2 gdu-5.6.2-1.zip

daniejstriata avatar Aug 28 '21 19:08 daniejstriata

Thanks!

dundee avatar Aug 31 '21 08:08 dundee

@dundee Here is 5.7.0 gdu-5.7.0-1.zip

daniejstriata avatar Sep 07 '21 04:09 daniejstriata

Thanks!

dundee avatar Sep 07 '21 08:09 dundee

@dundee Here is 5.8.0 gdu-5.8.0-1.zip 0

daniejstriata avatar Sep 23 '21 13:09 daniejstriata

Thanks!

dundee avatar Sep 23 '21 13:09 dundee

@dundee Please pull the 5.8.0-1 version. There is something wrong with the build. I realised that no matter how it ends up version 5.7

https://github.com/dundee/gdu/v5/cmd/gdu does not resolve to a page anymore. Could that be the reason?

daniejstriata avatar Sep 23 '21 21:09 daniejstriata

Ok, deleted.

The src package looks good to me, but the binary indeed contains version 5.7. Not sure why.

dundee avatar Sep 23 '21 21:09 dundee

https://github.com/dundee/gdu/v5/cmd/gdu does not resolve to a page anymore. Could that be the reason?

I don't think so. This was never a page, only a module name.

dundee avatar Sep 23 '21 21:09 dundee

@dundee this is the compile command.

GO111MODULE=on CGO_ENABLED=0 go build \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-ldflags \
"-s -w \
-X 'github.com/dundee/gdu/v5/build.Version=$(git describe)' \
-X 'github.com/dundee/gdu/v5/build.User=$(id -u -n)' \
-X 'github.com/dundee/gdu/v5/build.Time=$(LC_ALL=en_US.UTF-8 date)'" \
-o %{name} github.com/dundee/gdu/v5/cmd/gdu


daniejstriata avatar Sep 24 '21 09:09 daniejstriata

Oh, I see the problem. The 5.8.0 tag is not annotated. Therefore git describe will not show it.

I will have to release 5.8.1

dundee avatar Sep 24 '21 12:09 dundee

I just saw the same thing. Thanks @dundee

daniejstriata avatar Sep 24 '21 13:09 daniejstriata

@dundee I notice that pandoc complains pandoc: Could not parse YAML header: UnexpectedEvent {_received = Just (EventMappingStart Nothing), _expected = Nothing} I think that causes the man to render the header like this: image

Here is the 5.8.1 rpm gdu-5.8.1.zip

daniejstriata avatar Sep 26 '21 05:09 daniejstriata

There is now variable for date in the markdown source for man page: date: {{date}}

I would suggest to use gdu.1, which is contained in the archive a not run pandoc (also remove it from build dependencies as well) at all. I have done the same in Arch package - https://aur.archlinux.org/cgit/aur.git/commit/?h=gdu&id=e3e0b7c48609200413ea88c5c3384bf70a25c803

Pandoc is huge and I am running it anyway for every release localy.

dundee avatar Sep 27 '21 08:09 dundee

@dundee That's been rectified.

Here you go. 5.8.1-2 gdu-5.8.1-2.zip

daniejstriata avatar Sep 27 '21 19:09 daniejstriata

Thanks, added.

dundee avatar Sep 28 '21 15:09 dundee

It won't be possible. There is not a go 1.16 available for RHEL 7 or 8 in EPEL , you will not be able to achieve your goal. EPEL packages may only be built against specific RH channels + EPEL. I'm trying COPR but not sure if that will work.

Do you think we can package for EPEL Next?

dundee avatar Oct 11 '21 19:10 dundee

@dundee I'll check EPEL Next out when they release Centos Stream 9.

Here is 5.9.0. gdu-5.9.0-1.zip

daniejstriata avatar Oct 25 '21 06:10 daniejstriata

Added, thanks!

dundee avatar Oct 25 '21 10:10 dundee

@dundee here is 5.10.0. gdu-5.10.0-1.zip

daniejstriata avatar Nov 10 '21 04:11 daniejstriata

Thanks!

dundee avatar Nov 10 '21 09:11 dundee

@dundee Here is 5.10.1 gdu-5.10.1-1.zip

daniejstriata avatar Nov 23 '21 20:11 daniejstriata

Thank you!

dundee avatar Nov 23 '21 20:11 dundee

@dundee Here is 5.11.0 gdu-5.11.0-1.zip

daniejstriata avatar Nov 28 '21 13:11 daniejstriata

Thanks!

dundee avatar Nov 29 '21 11:11 dundee

@dundee I created a new package for 5.11.0 compiled with go 1.17.4 gdu-5.11.0-2.zip

daniejstriata avatar Dec 03 '21 10:12 daniejstriata

@daniejstriata Great! Uploaded.

dundee avatar Dec 03 '21 12:12 dundee

@dundee Here is 5.12.0 gdu-5.12.0-1.zip

daniejstriata avatar Dec 03 '21 21:12 daniejstriata

Hi @daniejstriata, could you pack 5.12.1?

dundee avatar Dec 13 '21 19:12 dundee

@dundee Here you go. 5.12.1 gdu-5.12.1-1.zip

daniejstriata avatar Dec 14 '21 07:12 daniejstriata

Thanks!

dundee avatar Dec 14 '21 08:12 dundee

@dundee Here is 5.13.0 gdu-5.13.0-1.zip

daniejstriata avatar Jan 29 '22 19:01 daniejstriata

Thank you!

dundee avatar Jan 29 '22 21:01 dundee

@dundee Here is 5.13.1 gdu-5.13.1-1.zip

daniejstriata avatar Feb 10 '22 05:02 daniejstriata

Added, thanks!

dundee avatar Feb 14 '22 14:02 dundee

@dundee Here is 5.13.2 gdu-5.13.2-1.zip

daniejstriata avatar Feb 21 '22 08:02 daniejstriata

Thanks!

dundee avatar Feb 21 '22 09:02 dundee

@dundee Here is 5.14.0. Compiled with go 1.17.10. To add this in to EPEL gdu would need to build against go 1.17.5 gdu-5.14.0-1.zip

daniejstriata avatar May 26 '22 10:05 daniejstriata

Thanks!

dundee avatar May 27 '22 07:05 dundee

@dundee Not making progress adding gdu to Fedora. Will try to submit it again.

here is the latest RPM gdu-5.15.0-1.x86_64.zip

daniejstriata avatar Aug 10 '22 12:08 daniejstriata

Thanks! I appreciate your grit.

dundee avatar Aug 10 '22 13:08 dundee