From 32d45e5251b928e92261d36d05bb90d2b9bf7561 Mon Sep 17 00:00:00 2001 From: Subhaditya Nath Date: Thu, 28 Apr 2022 22:04:43 +0530 Subject: [PATCH] lsof: update to 4.95.0, fix manpage & tests, adopt --- srcpkgs/lsof/patches/Lsof.8.patch | 25 ++++++++++++++++++ srcpkgs/lsof/patches/fix-tests.patch | 16 ++++++++++++ srcpkgs/lsof/template | 38 +++++++++++++--------------- 3 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 srcpkgs/lsof/patches/Lsof.8.patch create mode 100644 srcpkgs/lsof/patches/fix-tests.patch diff --git a/srcpkgs/lsof/patches/Lsof.8.patch b/srcpkgs/lsof/patches/Lsof.8.patch new file mode 100644 index 000000000000..fdac059a9751 --- /dev/null +++ b/srcpkgs/lsof/patches/Lsof.8.patch @@ -0,0 +1,25 @@ +diff --git a/Lsof.8.orig b/Lsof.8 +index 76bf0fa3..e82e837b 100644 +--- a/Lsof.8 ++++ b/Lsof.8 +@@ -1,7 +1,7 @@ + .so ./version + .TH LSOF 8 Revision-\*(VN +-\" Register )P is used neither by this file nor any groff macro. However, +-\" some versions of nroff require it. ++.\" Register )P is used neither by this file nor any groff macro. However, ++.\" some versions of nroff require it. + .if !\n(.g \{\ + . if !\n()P .nr )P 1v + .\} +@@ -967,8 +967,8 @@ where: + .br + applies to all IP versions. + .br +- \fIprotocol\fP is a protocol name \- \fBTCP\fP, \fBUDP\fP +-.br or \fBUDPLITE\fP. ++ \fIprotocol\fP is a protocol name \- \fBTCP\fP, \fBUDP\fP or \fBUDPLITE\fP. ++.br + .br + \fIhostname\fP is an Internet host name. Unless a + .br diff --git a/srcpkgs/lsof/patches/fix-tests.patch b/srcpkgs/lsof/patches/fix-tests.patch new file mode 100644 index 000000000000..8670c7361f92 --- /dev/null +++ b/srcpkgs/lsof/patches/fix-tests.patch @@ -0,0 +1,16 @@ +diff --git a/LTsock.c.orig b/LTsock.c +index bc0750f3..d8d9af6e 100644 +--- a/tests/LTsock.c ++++ b/tests/LTsock.c +@@ -255,10 +255,7 @@ main(argc, argv) + * Get the host name and its IP address. Convert the IP address to dotted + * ASCII form. + */ +- if (gethostname(hnm, sizeof(hnm) - 1)) { +- cem = "ERROR!!! can't get this host's name"; +- goto print_errno; +- } ++ strncpy(hnm, "localhost", sizeof(hnm) - 1); + hnm[sizeof(hnm) - 1] = '\0'; + if (!(hp = gethostbyname(hnm))) { + (void) snprintf(buf, bufl - 1, "ERROR!!! can't get IP address for %s", diff --git a/srcpkgs/lsof/template b/srcpkgs/lsof/template index 2c13c23beed4..2956678d5e46 100644 --- a/srcpkgs/lsof/template +++ b/srcpkgs/lsof/template @@ -1,17 +1,24 @@ # Template file for 'lsof' pkgname=lsof -version=4.94.0 +version=4.95.0 revision=1 build_style=configure configure_script="./Configure" configure_args="-n linux" -hostmakedepends="perl which" +make_check_target="all" +make_check_args="-C tests" +hostmakedepends="perl which groff" short_desc="LiSt Open Files" -maintainer="Orphaned " +maintainer="Subhaditya Nath " license="custom:lsof" -homepage="https://people.freebsd.org/~abe/" -distfiles="https://fossies.org/linux/misc/lsof-${version}.tar.gz" -checksum=a9865eeb581c3abaac7426962ddb112ecfd86a5ae93086eb4581ce100f8fa8f4 +homepage="https://github.com/lsof-org/lsof" +distfiles="https://github.com/lsof-org/lsof/archive/${version}.tar.gz" +checksum=8ff4c77736cc7d9556da9e2c7614cc4292a12f1979f20bd520d3c6f64b66a4d7 + +post_extract() { + rm tests/CkTestDB + ln -s /bin/true tests/CkTestDB +} pre_configure() { export LSOF_CC="$CC" @@ -19,28 +26,17 @@ pre_configure() { export LSOF_CFGL="$LDFLAGS" export LSOF_INCLUDE="${XBPS_CROSS_BASE}/usr/include" - vsed "s|/\* #define\tHASSECURITY\t1 \*/|#define\tHASSECURITY\t1|" \ + vsed -e "s|/\* \(#define\tHASSECURITY\t1\) \*/|\1|" \ -i dialects/linux/machine.h } -pre_check() { - # test resolves hostname - cp /etc/hosts ./hosts - printf '# +++ xbps-src +++ required for lsof tests\n127.0.0.100 %s\n' "$(hostname)" >> /etc/hosts - # write current config to test db - cd tests && ./Add2TestDB -} -do_check() { - make -C tests -} -post_check() { - # cleanup polluted hosts file - mv ./hosts /etc/hosts +post_build() { + soelim Lsof.8 >lsof.8 } do_install() { vbin lsof - vman Lsof.8 lsof.8 + vman lsof.8 # extract license from readme sed -n 00README -e '/^License/,/\*\/$/p' > License