Bug 255442 - New port: sysutils/discus: Similar to df but nicer output
Summary: New port: sysutils/discus: Similar to df but nicer output
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Rainer Hurling
URL: https://github.com/ncarrier/discus/bl...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-27 16:33 UTC by Chris Moerz
Modified: 2021-04-28 19:16 UTC (History)
3 users (show)

See Also:


Attachments
SHAR file with port contents (8.13 KB, application/x-shellscript)
2021-04-27 16:33 UTC, Chris Moerz
no flags Details
patch with corrections and more (2.45 KB, patch)
2021-04-28 13:02 UTC, Rainer Hurling
rhurlin: maintainer-approval? (freebsd)
Details | Diff
SHAR file with port contents (7.97 KB, application/x-shellscript)
2021-04-28 16:24 UTC, Chris Moerz
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Moerz 2021-04-27 16:33:49 UTC
Created attachment 224474 [details]
SHAR file with port contents

Did my best to build a port for it, since it was on the wishlist... portlint looked fine, followed the porter's handbook and tested on amd64 in different constellations / different python versions.

Discus is a program to display hard drive space usage, much like the standard
UNIX command df.

Discus aims to make df(1) prettier. Features include color, bar graphs, and
smart formatting of numbers (automatically choosing the most suitable size
from kilobytes, megabytes, gigabytes, or terabytes). Or choose your own size,
along with specifying the number of decimal places you'd like to see.
Comment 1 Rainer Hurling freebsd_committer freebsd_triage 2021-04-28 13:02:33 UTC
Created attachment 224496 [details]
patch with corrections and more

Hi Chris,

Thanks for the patch.

> Did my best to build a port for it, since it was on the wishlist...
Looks nice for a first shot of a new port ;)

> portlint looked fine, followed the porter's handbook and tested
> on amd64 in different constellations / different python versions.
I stumbled over some issues, while trying to build and test your port.

- The first line in Makefile (# $FreeBSD$) is not needed any
  more, after the ports tree is converted from svn to git

- If you like it, a first line like this
  # Created by: Chris Moerz <freebsd@ny-central.org>
  can be included. Be warned, this is not very common any more

- For me, the port didn't fetch the source. This was because
  of an uncomplete PORTVERSION, which you tried you overcome
  by GH_TAGNAME ...
  Removing the distinfo file and recreating after my changes did it

- The minimal Python 3 version nowadays should be 3.6+

- USE_PYTHON=allflavors is for 'special cases' (Mk/Uses/python.mk):
  "Only to be used for py-* ports that are part of the Python
  distribution, but kept as separate ports"

- LICENSE_FILE not needed for this 'standard license'

- USES=shebangfix and SHEBANGFIX_FILES instead of post-patch

- PORTDOCS not needed here, but something for the case, option
  DOCS is disabled: 'do-install-DOCS-on:' target should do the trick

- New distinfo

- pkg-plist: sbin/discus has the rights already. Adding %%PORTDOCS%%
  makes the DOCS files depending on the option

Probably I did not found every issue so far, but let's see ;)


If you agree with my suggestion, could you please test it and give some feedback?
Comment 2 Rainer Hurling freebsd_committer freebsd_triage 2021-04-28 13:34:29 UTC
(In reply to Rainer Hurling from comment #1)

BTW, DOCSDIR= also is not needed here ...
Comment 3 Daniel Engberg freebsd_committer freebsd_triage 2021-04-28 13:48:56 UTC
Not to discourage you but does it add/offer something unique compared to sysutils/duf ?

FWIW I also have a port of https://github.com/bootandy/dust but I haven't submitted it as I can't reliably build rust on my current hardware fleet.
Comment 4 Chris Moerz 2021-04-28 16:07:35 UTC
(In reply to Rainer Hurling from comment #2)

Wow, thanks for the thorough and quick feedback. I'm working through it right now.

It's my first port. I kind off expected to be off the mark on a few points.  Hence, constructive criticism is more than welcome!

There's a bunch of items in your list that I didn't get during my first run through the docs. Thanks for those hints - shebang in particular; I grabbed that sed command from another port, though that's obviously no guarantee for choosing the best/easiest way to fix things.

I'm removing the header comment in the Makefile. If it ain't common, lets not do that.

One thing I did notice, but am unsure whether it is an actual issue: if I have python37 installed, the current Makefile wants me to install python38 irrespective of the already available python37. Is this expected behavior?

setenv DEFAULT_VERSIONS "python=3.7 python3=3.7" appears to fix it.

I'll be uploading a new shar and diff in a moment. In case a diff suffices and I shouldn't be posting more shars, please let me know so I can do better in the future.

Again, thanks for the inputs!
Comment 5 Chris Moerz 2021-04-28 16:17:30 UTC
(In reply to daniel.engberg.lists from comment #3)

Fair point. I didn't check for alternatives, since I just wanted to try myself at building a port. That one was on the wishlist so it originally wasn't my idea.

Personally, I'm fine with df, but discus is a simple python program, which felt easy enough to try as port. It boils down to personal preference whether one likes this one better than the number of other alternatives.

I suppose the rust port would go through poudriere and different platform tests before submitting? Can imagine that's a lot more complex that just a single python file...
Comment 6 Chris Moerz 2021-04-28 16:24:34 UTC
Created attachment 224507 [details]
SHAR file with port contents

Updated after feedback with suggested fixes
Comment 7 Chris Moerz 2021-04-28 16:31:24 UTC
(In reply to Chris Moerz from comment #6)

After uploading the SHAR I realize that it's possible to obsolete the previous SHAR. I'm assuming that makes another diff obsolete.

Just let me know in case a diff is still desired and I'll follow up asap. thanks.
Comment 8 Rainer Hurling freebsd_committer freebsd_triage 2021-04-28 17:33:15 UTC
(In reply to Chris Moerz from comment #4)

> One thing I did notice, but am unsure whether it is an actual issue:
> if I have python37 installed, the current Makefile wants me to
> install python38 irrespective of the already available python37.
> Is this expected behavior?
Yes, because Python3 v3.8 is default for some days now.

> setenv DEFAULT_VERSIONS "python=3.7 python3=3.7" appears to fix it.
This should be used, if you do not want to upgrade towards python3 v3.8, the default version.


(In reply to Chris Moerz from comment #7)
> After uploading the SHAR I realize that it's possible to obsolete
> the previous SHAR. I'm assuming that makes another diff obsolete.
Yes, while uploading a new attachment, one can declare a present one obsolote.

> Just let me know in case a diff is still desired and I'll follow up asap. thanks.
Most maintainers and committers prefer diff files these days. If your new port is added locally to the ports git repository ('git add sysutils/discus'), you just need to run a 'git diff sysutils/discus > patch-file' to get a diff file that can be uploaded here ;)

In current case it is not necessary, because I already generated it this way my diff file.


Have you been able to test the modified version in the meantime? Does everything work as expected?

If so and if you agree, I can commit the port then ...
Comment 9 Chris Moerz 2021-04-28 18:49:57 UTC
(In reply to Rainer Hurling from comment #8)

> Have you been able to test the modified version in the meantime?
> Does everything work as expected?
Yes, I reran tests with python 3.7 and python 3.8; worked like a charm. Document option works as expected as well. Disabling option via make config leads to /usr/local/share/doc/discus not being created as expected.


> If so and if you agree, I can commit the port then ...
Yes, completely agree. The only thing I changed in the updated shar was removing the header comment with the "created by" statement. I don't mind whether it's in or not.

Thanks for your help!
Comment 10 commit-hook freebsd_committer freebsd_triage 2021-04-28 19:09:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=05e3a02e1fc88ccf60655d50f32f372372ba6bbb

commit 05e3a02e1fc88ccf60655d50f32f372372ba6bbb
Author:     Chris Moerz <freebsd@ny-central.org>
AuthorDate: 2021-04-28 19:06:14 +0000
Commit:     Rainer Hurling <rhurlin@FreeBSD.org>
CommitDate: 2021-04-28 19:06:14 +0000

    New port: sysutils/discus: Similar to df but nicer output

    Changelog: https://github.com/ncarrier/discus/blob/master/changelog

    PR:             255442

 sysutils/discus/Makefile (new)              | 32 ++++++++++++++++++++
 sysutils/discus/distinfo (new)              |  3 ++
 sysutils/discus/files/patch-README.md (new) | 36 ++++++++++++++++++++++
 sysutils/discus/files/patch-discus.1 (new)  | 43 ++++++++++++++++++++++++++
 sysutils/discus/files/patch-discus.py (new) | 47 +++++++++++++++++++++++++++++
 sysutils/discus/files/patch-discusrc (new)  | 25 +++++++++++++++
 sysutils/discus/pkg-descr (new)             | 13 ++++++++
 sysutils/discus/pkg-plist (new)             |  5 +++
 8 files changed, 204 insertions(+)
Comment 11 Rainer Hurling freebsd_committer freebsd_triage 2021-04-28 19:16:11 UTC
Hi Chris,

Congrats on your first port! Have fun.

Committed, thanks :)