aboutsummaryrefslogtreecommitdiff
path: root/sysutils/moreutils
diff options
context:
space:
mode:
authorSunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>2014-08-18 12:45:46 +0000
committerSunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>2014-08-18 12:45:46 +0000
commit8284ed607559b76b3aaeccf19eefcc81ad998a66 (patch)
treec583e6e4401b01e7641819cfd45e491e7588dc6c /sysutils/moreutils
parentb40e3f31f2cd137ca90877ed269b314f8f7aa9fb (diff)
downloadports-8284ed607559b76b3aaeccf19eefcc81ad998a66.tar.gz
ports-8284ed607559b76b3aaeccf19eefcc81ad998a66.zip
Notes
Diffstat (limited to 'sysutils/moreutils')
-rw-r--r--sysutils/moreutils/Makefile6
-rw-r--r--sysutils/moreutils/files/moreutils-parallel.184
-rw-r--r--sysutils/moreutils/files/patch-moreutils-parallel.c29
-rw-r--r--sysutils/moreutils/pkg-descr3
-rw-r--r--sysutils/moreutils/pkg-plist2
5 files changed, 122 insertions, 2 deletions
diff --git a/sysutils/moreutils/Makefile b/sysutils/moreutils/Makefile
index 9b0d3c385df0..4b0c8a8e2308 100644
--- a/sysutils/moreutils/Makefile
+++ b/sysutils/moreutils/Makefile
@@ -3,7 +3,7 @@
PORTNAME= moreutils
PORTVERSION= 0.51
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= sysutils
MASTER_SITES= DEBIAN_POOL
DISTNAME= ${PORTNAME}_${PORTVERSION}
@@ -29,6 +29,7 @@ CANNED_MANPAGES=errno.1 \
isutf8.1 \
lckdo.1 \
mispipe.1 \
+ moreutils-parallel.1 \
pee.1 \
sponge.1
PERL_MANPAGES= chronic.1 \
@@ -41,8 +42,11 @@ PERL_MANPAGES= chronic.1 \
SHEBANG_FILES= ${PERL_MANPAGES:R}
post-patch:
+ @${REINPLACE_CMD} -e 's|parallel|moreutils-&|g' ${WRKSRC}/Makefile
@${REINPLACE_CMD} -e 's|__APPLE__|__${OPSYS}__|' ${WRKSRC}/ifdata.c
@cd ${FILESDIR}/ && ${CP} ${CANNED_MANPAGES} ${WRKSRC}/
+ @${MV} ${WRKSRC}/parallel.c ${WRKSRC}/moreutils-parallel.c
+ @${MV} ${WRKSRC}/parallel.docbook ${WRKSRC}/moreutils-parallel.docbook
post-build:
.for man in ${PERL_MANPAGES:R}
diff --git a/sysutils/moreutils/files/moreutils-parallel.1 b/sysutils/moreutils/files/moreutils-parallel.1
new file mode 100644
index 000000000000..f8166176c437
--- /dev/null
+++ b/sysutils/moreutils/files/moreutils-parallel.1
@@ -0,0 +1,84 @@
+'\" t
+.\" Title: parallel
+.\" Author: Joey Hess
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: 2009-07-02
+.\" Manual: moreutils
+.\" Source: moreutils
+.\" Language: English
+.\"
+.TH "PARALLEL" "1" "2009\-07\-02" "moreutils" "moreutils"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+parallel \- run programs in parallel
+.SH "SYNOPSIS"
+.HP \w'\fBparallel\fR\fB\-\-\fR\ 'u
+\fBparallel\fR [options] [command]\fB\-\-\fR [argument\ \&.\&.\&.]
+.HP \w'\fBparallel\fR\fB\-\-\fR\ 'u
+\fBparallel\fR [options]\fB\-\-\fR [command\ \&.\&.\&.]
+.SH "DESCRIPTION"
+.PP
+\fBparallel\fR
+runs the specified command, passing it a single one of the specified arguments\&. This is repeated for each argument\&. Jobs may be run in parallel\&. The default is to run one job per CPU\&.
+.PP
+If no command is specified before the \-\-, the commands after it are instead run in parallel\&.
+.SH "OPTIONS"
+.PP
+\fB\-j maxjobs\fR
+.RS 4
+Use to limit the number of jobs that are run at the same time\&.
+.RE
+.PP
+\fB\-l maxload\fR
+.RS 4
+Wait as needed to avoid starting new jobs when the system\*(Aqs load average is not below the specified limit\&.
+.RE
+.PP
+\fB\-i\fR
+.RS 4
+Normally the command is passed the argument at the end of its command line\&. With this option, any instances of "{}" in the command are replaced with the argument\&.
+.RE
+.PP
+\fB\-n\fR
+.RS 4
+Number of arguments to pass to a command at a time\&. Default is 1\&. Incompatible with \-i
+.RE
+.SH "EXAMPLE"
+.PP
+.HP \w'\fBparallel\ sh\ \-c\ "echo\ hi;\ sleep\ 2;\ echo\ bye"\ \-\-\ 1\ 2\ 3\fR\ 'u \fBparallel sh \-c "echo hi; sleep 2; echo bye" \-\- 1 2 3\fR
+.PP
+This runs three subshells that each print a message, delay, and print another message\&. If your system has multiple CPUs, parallel will run some of the jobs in parallel, which should be clear from the order the messages are output\&.
+.PP
+.HP \w'\fBparallel\ \-j\ 3\ ufraw\ \-o\ processed\ \-\-\ *\&.NEF\fR\ 'u \fBparallel \-j 3 ufraw \-o processed \-\- *\&.NEF\fR
+.PP
+This runs three ufraw processes at the same time until all of the NEF files have been processed\&.
+.PP
+.HP \w'\fBparallel\ \-j\ 3\ \-\-\ ls\ df\ "echo\ hi"\fR\ 'u \fBparallel \-j 3 \-\- ls df "echo hi"\fR
+.PP
+This runs three independent commands in parallel\&.
+.SH "EXIT STATUS"
+.PP
+Its exit status is the combination of the exit statuses of each command ran, ORed together\&. (Thus, if any one command exits nonzero,
+\fBparallel\fR
+as a whole will exit nonzero\&.)
+.SH "AUTHOR"
+.PP
+Tollef Fog Heen
diff --git a/sysutils/moreutils/files/patch-moreutils-parallel.c b/sysutils/moreutils/files/patch-moreutils-parallel.c
new file mode 100644
index 000000000000..5e096a506693
--- /dev/null
+++ b/sysutils/moreutils/files/patch-moreutils-parallel.c
@@ -0,0 +1,29 @@
+--- ./parallel.c.orig 2010-07-06 12:06:47.000000000 -0700
++++ ./parallel.c 2010-11-17 15:49:57.000000000 -0800
+@@ -87,6 +87,7 @@
+ return;
+ }
+
++#ifdef HAVE_WAITID
+ int wait_for_child(int options) {
+ id_t id_ignored = 0;
+ siginfo_t infop;
+@@ -101,6 +102,18 @@
+ }
+ return 1;
+ }
++#else
++int wait_for_child(int options) {
++ int status;
++
++ if(waitpid(-1, &status, options) == -1)
++ return -1; /* nothing to wait for */
++ if(WIFEXITED(status))
++ return WEXITSTATUS(status);
++ return 1;
++}
++#endif
++
+
+ int main(int argc, char **argv) {
+ int maxjobs = -1;
diff --git a/sysutils/moreutils/pkg-descr b/sysutils/moreutils/pkg-descr
index 3a46b5887eca..b9c1d3b12f18 100644
--- a/sysutils/moreutils/pkg-descr
+++ b/sysutils/moreutils/pkg-descr
@@ -10,6 +10,7 @@ Currently it consists of these tools:
- isutf8: check if a file or standard input is utf-8
- lckdo: execute a program with a lock held (deprecated)
- mispipe: pipe two commands, returning the exit status of the first
+- parallel: run multiple jobs at once
- pee: tee standard input to pipes
- sponge: soak up standard input and write to a file
- ts: timestamp standard input
@@ -17,6 +18,6 @@ Currently it consists of these tools:
- vipe: insert a text editor into a pipe
- zrun: automatically uncompress arguments to command
-The 'parallel' utility is split into sysutils/moreutils-parallel.
+Note that the parallel utility is installed as moreutils-parallel.
WWW: http://joeyh.name/code/moreutils/
diff --git a/sysutils/moreutils/pkg-plist b/sysutils/moreutils/pkg-plist
index 200f33a8695d..60718079a38a 100644
--- a/sysutils/moreutils/pkg-plist
+++ b/sysutils/moreutils/pkg-plist
@@ -6,6 +6,7 @@ bin/ifne
bin/isutf8
bin/lckdo
bin/mispipe
+bin/moreutils-parallel
bin/pee
bin/sponge
bin/ts
@@ -20,6 +21,7 @@ bin/zrun
%%MANPAGES%%man/man1/isutf8.1.gz
%%MANPAGES%%man/man1/lckdo.1.gz
%%MANPAGES%%man/man1/mispipe.1.gz
+%%MANPAGES%%man/man1/moreutils-parallel.1.gz
%%MANPAGES%%man/man1/pee.1.gz
%%MANPAGES%%man/man1/sponge.1.gz
%%MANPAGES%%man/man1/ts.1.gz