Date: Wed, 28 Apr 2021 19:09:25 GMT From: Rainer Hurling <rhurlin@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: 05e3a02e1fc8 - main - New port: sysutils/discus: Similar to df but nicer output Message-ID: <202104281909.13SJ9Pa5025788@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by rhurlin: 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 | 32 ++++++++++++++++++++++++ sysutils/discus/distinfo | 3 +++ sysutils/discus/files/patch-README.md | 36 +++++++++++++++++++++++++++ sysutils/discus/files/patch-discus.1 | 43 ++++++++++++++++++++++++++++++++ sysutils/discus/files/patch-discus.py | 47 +++++++++++++++++++++++++++++++++++ sysutils/discus/files/patch-discusrc | 25 +++++++++++++++++++ sysutils/discus/pkg-descr | 13 ++++++++++ sysutils/discus/pkg-plist | 5 ++++ 8 files changed, 204 insertions(+) diff --git a/sysutils/discus/Makefile b/sysutils/discus/Makefile new file mode 100644 index 000000000000..9e0d121f42a4 --- /dev/null +++ b/sysutils/discus/Makefile @@ -0,0 +1,32 @@ +PORTNAME= discus +DISTVERSION= 0.4.0 +CATEGORIES= sysutils + +MAINTAINER= freebsd@ny-central.org +COMMENT= Discus is a program to display hard drive space usage + +LICENSE= GPLv2 + +USES= python:3.6+ shebangfix +USE_GITHUB= yes +GH_ACCOUNT= ncarrier + +SHEBANG_FILES= discus.py + +NO_BUILD= yes + +OPTIONS_DEFINE= DOCS + +do-install: + ${MKDIR} ${STAGEDIR}/${ETCDIR}/ + ${MKDIR} ${STAGEDIR}/${DOCSDIR} + ${MKDIR} ${STAGEDIR}/${PREFIX}/sbin + ${INSTALL_DATA} ${WRKSRC}/discusrc ${STAGEDIR}/${ETCDIR}/discusrc.sample + ${INSTALL_MAN} ${WRKSRC}/discus.1 ${STAGEDIR}/${MANPREFIX}/man/man1 + ${INSTALL_SCRIPT} ${WRKSRC}/discus.py ${STAGEDIR}/${PREFIX}/sbin/discus + +do-install-DOCS-on: + ${INSTALL_MAN} ${WRKSRC}/README.md ${STAGEDIR}/${DOCSDIR} + ${INSTALL_MAN} ${WRKSRC}/AUTHORS ${STAGEDIR}/${DOCSDIR} + +.include <bsd.port.mk> diff --git a/sysutils/discus/distinfo b/sysutils/discus/distinfo new file mode 100644 index 000000000000..e5db97b5fe4b --- /dev/null +++ b/sysutils/discus/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1619608755 +SHA256 (ncarrier-discus-0.4.0_GH0.tar.gz) = bf9b9e94da6751a9b9f849b44d65cd7809e5d4814ac24f67353c70f09f743485 +SIZE (ncarrier-discus-0.4.0_GH0.tar.gz) = 16392 diff --git a/sysutils/discus/files/patch-README.md b/sysutils/discus/files/patch-README.md new file mode 100644 index 000000000000..9a2ff6a32508 --- /dev/null +++ b/sysutils/discus/files/patch-README.md @@ -0,0 +1,36 @@ +--- README.md.orig 2021-04-26 14:05:27 UTC ++++ README.md +@@ -11,9 +11,9 @@ Features include color, bar graphs, and smart formatti + gigabytes, or terabytes). Or choose your own size, along with specifying the + number of decimal places you'd like to see. + +-To configure Discus on a system-wide basis, edit the **/etc/discusrc** file. ++To configure Discus on a system-wide basis, edit the **/usr/local/etc/discusrc** file. + But you should probably change things just for yourself, by copying +-**/etc/discusrc** to **~/.discusrc** and editing that. ++**/usr/local/etc/discusrc** to **~/.discusrc** and editing that. + + The source code is contained in the discus.py file itself, as it is a Python + code encapsulated in a shell script. +@@ -52,13 +52,14 @@ for more information. + ## Installation + + ``` +-cp discus.py /usr/local/bin +-chmod a+rx /usr/local/bin/discus +-cp discusrc /etc +-chmod a+r /etc/discusrc +-gzip -9 discus.1 +-cp discus.1.gz /usr/local/man/man1 +-chmod a+r /usr/local/man/man1/discus.1.gz ++pkg install discus ++``` ++ ++or ++ ++``` ++cd /usr/ports/sysutils/discus ++make install; make clean + ``` + + ## Test diff --git a/sysutils/discus/files/patch-discus.1 b/sysutils/discus/files/patch-discus.1 new file mode 100644 index 000000000000..a584b8016503 --- /dev/null +++ b/sysutils/discus/files/patch-discus.1 @@ -0,0 +1,43 @@ +--- discus.1.orig 2020-04-13 07:05:40 UTC ++++ discus.1 +@@ -2,7 +2,7 @@ + .\" DISCUS + .\" 1 + .\" other parameters are allowed: see man(7), man(1) +-.TH DISCUS 1 "October 20, 2003" ++.TH DISCUS 1 "April 26, 2021" + .\" Please adjust this date whenever revising the manpage. + .\" + .\" Some roff macros, for reference: +@@ -26,9 +26,8 @@ discus \- print a report of disk space usage + 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. You may also copy /etc/discusrc to $HOME/.discusrc and customize things to +-your preference. +- ++see. You may also copy /usr/local/etc/discus/discusrc to $HOME/.discusrc and ++customize things to your preference. + .SH OPTIONS + .TP + .B \-h, \-\-help +@@ -56,14 +55,15 @@ Show version of program. + .B \-r + Takes into account even the reserved space to root; it will be counted in percentage and in available columns only (Used is for real used space). + .SH FILES +-.SH FILES +-.BR /etc/discusrc, ++.BR /usr/local/etc/discus/discusrc, + .BR $HOME/.discusrc + .SH SEE ALSO +-.BR df (1), +-.BR pydf (1). ++df(1) + .br + .SH AUTHOR + This manual page was adapted by Ron Farrer <rbf@debian.org> from one + written by Stormy Henderson <stormy@raincrazy.com> for the Debian + GNU/Linux system (but may be used by others). ++ ++This manual page was later updated by Chris Moerz <freebsd@ny-central.org> ++for FreeBSD. diff --git a/sysutils/discus/files/patch-discus.py b/sysutils/discus/files/patch-discus.py new file mode 100644 index 000000000000..9c9051e4efc6 --- /dev/null +++ b/sysutils/discus/files/patch-discus.py @@ -0,0 +1,47 @@ +--- discus.py.orig 2020-04-13 07:05:40 UTC ++++ discus.py +@@ -437,16 +437,8 @@ def read_mounts(mtab, skip_list): + """Read the mounts file.""" + mounts = [] + +- # If the first letter of the mtab file begins with a !, it is a +- # shell command to be executed, and not a file to be read. Idea +- # provided by John Soward. +- if mtab[0] == "!": +- mtab = subprocess.getoutput(mtab[1:]) +- mtab = str.split(mtab, "\n") +- else: +- fp = open(mtab) +- mtab = fp.readlines() +- fp.close() ++ mtab = subprocess.getoutput('/sbin/mount -p') ++ mtab = str.split(mtab, "\n") + + # Extract the mounted filesystems from the read file. + for entry in mtab: +@@ -534,7 +526,7 @@ def get_layout(headers, reports): + def main(): + """Define main program.""" + parse_options() +- mounts = read_mounts(opts["mtab"], opts["skip_list"]) ++ mounts = read_mounts(None, opts["skip_list"]) + headers = get_header(opts["graph"]) + stats_factory = StatsFactory(opts["reserved"]) + size_formatter = SizeFormatter(opts["smart"], opts["placing"], +@@ -559,13 +551,13 @@ def main(): + + if __name__ == "__main__": + # Before starting, we need to load the configuration files which +- # contain global objects. First the global /etc file, then the user's ++ # contain global objects. First the global /usr/local/etc file, then the user's + # file, if exists. + try: +- exec(compile(open("/etc/discusrc", "rb").read(), "/etc/discusrc", ++ exec(compile(open("/usr/local/etc/discus/discusrc", "rb").read(), "/usr/local/etc/discus/discusrc", + 'exec')) + except IOError: +- usage(EX_CONFIG, "/etc/discusrc must exist and be readable.") ++ usage(EX_CONFIG, "/usr/local/etc/discus/discusrc must exist and be readable.") + + try: + exec(compile(open(os.environ['HOME'] + "/.discusrc", "rb").read(), diff --git a/sysutils/discus/files/patch-discusrc b/sysutils/discus/files/patch-discusrc new file mode 100644 index 000000000000..74647e6e275b --- /dev/null +++ b/sysutils/discus/files/patch-discusrc @@ -0,0 +1,25 @@ +--- discusrc.orig 2021-04-27 15:52:50 UTC ++++ discusrc +@@ -17,11 +17,6 @@ opts["graph"] = 1 + opts["graph_char"] = "*" + opts["graph_fill"] = "-" + +-## Example mtab entry that uses a shell command (always use a ! as +-## first character) rather than a file: +-## opts["mtab"] = "!/bin/mount |awk '{print $1, $3}'" +-opts["mtab"] = "/etc/mtab" +- + ## Number of decimal places to display, same as -p + opts["places"] = 1 + +@@ -30,10 +25,6 @@ opts["skip_list"] = ["/dev/pts", "/proc", "/dev", "/pr + + ## Use smart formatting of numbers. + opts["smart"] = 1 +- +-## Location of stat program in lieu of Python's statvfs module. +-# Deprecated starting from version 0.3.0 +-#opts["stat_prog"] = "stat -ft" + + ## These colors should work on VT100-type displays. Change them if you use + ## something else. diff --git a/sysutils/discus/pkg-descr b/sysutils/discus/pkg-descr new file mode 100644 index 000000000000..fcf9cca358b9 --- /dev/null +++ b/sysutils/discus/pkg-descr @@ -0,0 +1,13 @@ +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. + +To configure Discus on a system-wide basis, edit the /usr/local/etc/discusrc +file. But you should probably change things just for yourself, by copying +/usr/local/etc/discusrc to ~/.discusrc and editing that. + +WWW: https://github.com/ncarrier/discus diff --git a/sysutils/discus/pkg-plist b/sysutils/discus/pkg-plist new file mode 100644 index 000000000000..feef3e0f7c5c --- /dev/null +++ b/sysutils/discus/pkg-plist @@ -0,0 +1,5 @@ +@sample %%ETCDIR%%/discusrc.sample +man/man1/discus.1.gz +sbin/discus +%%PORTDOCS%%%%DOCSDIR%%/AUTHORS +%%PORTDOCS%%%%DOCSDIR%%/README.mdhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104281909.13SJ9Pa5025788>
