pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [n.o] pkgin Quiet Mode?



>> I've added a -p (parsable) option to address that issue in pkgin
>> 0.7.0, already
>> available in pkgsrc-wip, soon to be commited in pkgsrc.
>>
>> Thanks for your feedback!
>
> Allow me to make another suggestion:
>
> The percentage-progress printouts (ending with a bare carriage
> return) can probably with benefit be dropped by default if the
> standard output isn't a tty.

I tried committing a patch to do this to pkgsrc-wip, but apparently
there's a lock held by root in the CVS repository which doesn't look
like it'll go away by itself, so for the time being let me suggest the
attached patch.  The two fixes to Makefile were suggested by pkglint.

Regards,

- Håvard
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc-wip/wip/pkgin/Makefile,v
retrieving revision 1.74
diff -u -r1.74 Makefile
--- Makefile	5 Jan 2015 18:20:20 -0000	1.74
+++ Makefile	6 Jan 2015 10:32:23 -0000
@@ -3,6 +3,7 @@
 GHCOMMIT=		554e8b7cc1ff8e9d824ed06833653586fabfb89e
 DISTNAME=		${GHCOMMIT}
 PKGNAME=		pkgin-0.7.0.20150105
+PKGREVISION=		1
 CATEGORIES=		pkgtools
 MASTER_SITES=		https://github.com/NetBSDfr/pkgin/archive/
 
@@ -21,6 +22,7 @@
 WRKSRC=			${WRKDIR}/pkgin-${GHCOMMIT}
 
 BUILD_DEFS+=		PKGIN_REPOSITORY_URL
+BUILD_DEFS+=		VARBASE
 
 SUBST_CLASSES+=		path
 SUBST_STAGE.path=	pre-configure
@@ -55,7 +57,7 @@
 # those have official repositories
 .if !empty(PKGIN_REPOSITORY_URL)
 pre-install:
-	echo ${PKGIN_REPOSITORY_URL} >> ${WRKSRC}/repositories.conf
+	${ECHO} ${PKGIN_REPOSITORY_URL} >> ${WRKSRC}/repositories.conf
 .elif ${OPSYS} == "NetBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "Minix"
 pre-install:
 	${GREP} -i ${OPSYS} ${WRKSRC}/REPOSITORIES >> 			\
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc-wip/wip/pkgin/distinfo,v
retrieving revision 1.71
diff -u -r1.71 distinfo
--- distinfo	5 Jan 2015 18:20:20 -0000	1.71
+++ distinfo	6 Jan 2015 10:32:23 -0000
@@ -3,3 +3,5 @@
 SHA1 (554e8b7cc1ff8e9d824ed06833653586fabfb89e.tar.gz) = f847323cb063f4e2af2a56fe49488c0e469df81c
 RMD160 (554e8b7cc1ff8e9d824ed06833653586fabfb89e.tar.gz) = 085a3b932154cea42ce9104e9e04280b0073d58d
 Size (554e8b7cc1ff8e9d824ed06833653586fabfb89e.tar.gz) = 189578 bytes
+SHA1 (patch-impact.c) = 595835ac027158bc10cd38741261bf07e651a67a
+SHA1 (patch-main.c) = b2d5657304e9b0dba9463f3f9b261738c2e05c0f
--- /dev/null	2015-01-06 11:18:43.000000000 +0100
+++ patches/patch-main.c	2015-01-06 11:15:05.000000000 +0100
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Default to not doing \r progress printouts if stdout isn't a tty.
+
+--- main.c.orig	2015-01-05 17:51:34.000000000 +0000
++++ main.c
+@@ -59,6 +59,9 @@ main(int argc, char *argv[])
+ 	if (argc < 2 || *argv[1] == 'h')
+ 		usage();
+ 
++	/* Default to not doing \r printouts if we don't send to a tty */
++	parsable = !isatty(fileno(stdout));
++
+ 	while ((ch = getopt(argc, argv, "dhyfFPvVl:nc:t:p")) != -1) {
+ 		switch (ch) {
+ 		case 'f':
--- /dev/null	2015-01-06 11:18:43.000000000 +0100
+++ patches/patch-impact.c	2015-01-06 11:14:39.000000000 +0100
@@ -0,0 +1,42 @@
+$NetBSD$
+
+Don't do \r prinout if output isn't a tty.
+
+--- impact.c.orig	2015-01-05 17:51:34.000000000 +0000
++++ impact.c
+@@ -335,6 +335,7 @@ pkg_impact(char **pkgargs, int *rc)
+ 	Plisthead	*impacthead, *pdphead = NULL;
+ 	Pkglist		*pimpact, *tmpimpact, *pdp;
+ 	char		**ppkgargs, *pkgname;
++	int		istty;
+ #ifndef DEBUG
+ 	char		tmpicon;
+ #endif
+@@ -349,6 +350,8 @@ pkg_impact(char **pkgargs, int *rc)
+ 
+ 	impacthead = init_head();
+ 
++	istty = isatty(fileno(stdout));
++
+ 	/* retreive impact list for all packages listed in the command line */
+ 	for (ppkgargs = pkgargs; *ppkgargs != NULL; ppkgargs++) {
+ 
+@@ -366,11 +369,13 @@ pkg_impact(char **pkgargs, int *rc)
+ 		TRACE("[+]-impact for %s\n", pkgname);
+ 
+ #ifndef DEBUG
+-		tmpicon = *icon++;
+-		printf(MSG_CALCULATING_DEPS" %c", tmpicon);
+-		fflush(stdout);
+-		if (*icon == '\0')
+-			icon = icon - strlen(ICON_WAIT);
++		if (istty) {
++			tmpicon = *icon++;
++			printf(MSG_CALCULATING_DEPS" %c", tmpicon);
++			fflush(stdout);
++			if (*icon == '\0')
++				icon = icon - strlen(ICON_WAIT);
++		}
+ #else
+ 		printf(MSG_CALCULATING_DEPS, pkgname);
+ #endif


Home | Main Index | Thread Index | Old Index