ports/183768: Port www/adzap fix for perl 5.16 [PATCH]
Horia Racoviceanu
horia at racoviceanu.com
Fri Nov 8 01:10:00 UTC 2013
>Number: 183768
>Category: ports
>Synopsis: Port www/adzap fix for perl 5.16 [PATCH]
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Nov 08 01:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Horia Racoviceanu
>Release: 9.1-RELEASE amd64
>Organization:
>Environment:
FreeBSD horia.lan 9.1-RELEASE-p7 FreeBSD 9.1-RELEASE-p7 #0: Mon Sep 9 21:34:37 UTC 2013 root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
Can't locate flush.pl
>How-To-Repeat:
>Fix:
- Bump PORTREVISION to 1
- Add patch-scripts_squid_redirect-nodata to files to
use IO::Handle instead of flush.pl
Patch obtained from Gentoo:
https://bugs.gentoo.org/show_bug.cgi?id=425196
- Install as "squid_redirect" instead of "squid_redirect-nodata
to match the defaults in the configuration files
- Add BSD LICENSE
- Remove PKGMESSAGE
- Add DOCS option
- Add EXAMPLES option
- Add PORTDOCS
- Use STAGEDIR
- Change pkg-plist to match new OPTIONS and STAGEDIR
- Remove extra spaces from pkg-descr
- Pass maintainership to submitter
Build log:
https://redports.org/buildarchive/20131107230452-78837/
Patch attached with submission follows:
diff -ruN adzap-org/Makefile adzap/Makefile
--- adzap-org/Makefile 2013-09-20 19:36:50.000000000 -0400
+++ adzap/Makefile 2013-11-07 19:50:42.000000000 -0500
@@ -3,36 +3,41 @@
PORTNAME= adzap
PORTVERSION= 20110915
+PORTREVISION= 1
CATEGORIES= www perl5
MASTER_SITES= http://adzapper.sourceforge.net/
-MAINTAINER= ports at FreeBSD.org
+MAINTAINER= horia at racoviceanu.com
COMMENT= Filter out animated ad banners from web pages
+LICENSE= BSD
+
USES= perl5
NO_BUILD= yes
USE_PERL5= run
+OPTIONS_DEFINE= DOCS EXAMPLES
+
+PORTDOCS= index.html update-instructions.txt TODO my-bsd-license.html
SUB_FILES= adzap.conf pkg-message
-PKGMESSAGE= ${WRKDIR}/pkg-message
-NO_STAGE= yes
do-configure:
.for FILE in squid_redirect-nodata wrapzap zapchain
- ${REINPLACE_CMD} -e "s:/usr/bin/perl:${PERL5}:g" \
+ @${REINPLACE_CMD} -e "s:/usr/bin/perl:${PERL5}:g" \
-e "s:%%PREFIX%%:${PREFIX}:g" ${WRKSRC}/scripts/${FILE}
.endfor
do-install:
- ${INSTALL_SCRIPT} ${WRKSRC}/scripts/squid_redirect-nodata ${PREFIX}/libexec/
- ${INSTALL_SCRIPT} ${WRKSRC}/scripts/wrapzap ${PREFIX}/libexec/adzap
- ${INSTALL_SCRIPT} ${WRKSRC}/scripts/zapchain ${PREFIX}/libexec/
- ${INSTALL} -d ${EXAMPLESDIR}
- ${CP} -R ${WRKSRC}/zaps ${EXAMPLESDIR}
- ${CP} -R ${WRKSRC}/rc ${EXAMPLESDIR}
- ${INSTALL_DATA} ${WRKDIR}/adzap.conf ${EXAMPLESDIR}
+ ${INSTALL_SCRIPT} ${WRKSRC}/scripts/squid_redirect-nodata ${STAGEDIR}${PREFIX}/libexec/squid_redirect
+ ${INSTALL_SCRIPT} ${WRKSRC}/scripts/wrapzap ${STAGEDIR}${PREFIX}/libexec/adzap
+ ${INSTALL_SCRIPT} ${WRKSRC}/scripts/zapchain ${STAGEDIR}${PREFIX}/libexec/
+
+ ${INSTALL} -d ${STAGEDIR}${EXAMPLESDIR}
+ ${CP} -R ${WRKSRC}/zaps ${STAGEDIR}${EXAMPLESDIR}
+ ${CP} -R ${WRKSRC}/rc ${STAGEDIR}${EXAMPLESDIR}
+ ${INSTALL_DATA} ${WRKDIR}/adzap.conf ${STAGEDIR}${EXAMPLESDIR}
-post-install:
- @${CAT} ${PKGMESSAGE}
+ @${MKDIR} ${STAGEDIR}${DOCSDIR}
+ ${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>
diff -ruN adzap-org/files/patch-scripts_squid_redirect-nodata adzap/files/patch-scripts_squid_redirect-nodata
--- adzap-org/files/patch-scripts_squid_redirect-nodata 1969-12-31 19:00:00.000000000 -0500
+++ adzap/files/patch-scripts_squid_redirect-nodata 2013-11-07 14:00:36.000000000 -0500
@@ -0,0 +1,107 @@
+--- scripts/squid_redirect-nodata.orig
++++ scripts/squid_redirect-nodata
+@@ -31,7 +31,7 @@ use bytes;
+
+ use POSIX ":sys_wait_h";
+ use Socket;
+-require 'flush.pl';
++use IO::Handle;
+
+ $::IOSIZE=1024;
+
+@@ -232,7 +232,7 @@ while (defined ($_=<STDIN>))
+ {
+ if (defined $::LogFile)
+ { print LOGFILE $_;
+- flush(LOGFILE);
++ LOGFILE->flush();
+ }
+ chomp;
+
+@@ -259,7 +259,7 @@ while (defined ($_=<STDIN>))
+ }
+ }
+
+- flush(STDOUT);
++ STDOUT->flush();
+ }
+
+ exit 0;
+@@ -789,14 +788,16 @@ sub proxy_forkchild($$$)
+ }
+
+ # dispatch request and headers
+- printflush(GCHILD_WRITE,"$method $uri $v1 $v2\n")
++ print GCHILD_WRITE "$method $uri $v1 $v2\n"
+ || die "tell grandchild the request: $!";
++ GCHILD_WRITE->flush();
+
+ print PROXY "$method $uri HTTP/$v1.$v2\r\n";
+ for my $H (@hdrs)
+ { print PROXY $H->[0], ":", $H->[1], "\r\n";
+ }
+- printflush(PROXY,"\r\n");
++ print PROXY "\r\n";
++ PROXY->flush();
+ ##warn "[$$]: sent rq to proxy\n";
+
+ proxy_copybody(CONN,PROXY,$method,$persist,\@hdrs)
+@@ -965,8 +966,9 @@ sub proxy_grandchild($)
+ }
+
+ warn "[$child:$$]: pass response to parent\n";
+- printflush(TOCHILD,($persist ? PERSIST : CLOSE)." $code $info")
++ print TOCHILD ($persist ? PERSIST : CLOSE)." $code $info"
+ || die "[$child:$$]: print(TOCHILD) fails: $!";
++ TOCHILD->flush();
+ warn "[$child:$$]: told parent, passing response to client\n";
+
+ # copy to child
+@@ -974,7 +976,8 @@ sub proxy_grandchild($)
+ for my $H (@hdrs)
+ { print CONN $H->[0], ":", $H->[1], "\r\n";
+ }
+- printflush(CONN,"\r\n");
++ print CONN "\r\n";
++ CONN->flush();
+
+ # see RFC2616 section 10
+ if (
+@@ -1050,11 +1053,13 @@ sub proxy_copycl($$$)
+ )
+ {
+ ##warn "[$$]: read ".length($_)." bytes of request body\n";
+- if (! printflush($to,$_))
+- { warn "$::cmd: [$$]: printflush($to,..): $!";
++ $to->autoflush(1);
++ if (! print $to $_)
++ { warn "$::cmd: [$$]: print $to ..): $!";
+ $ok=0;
+ last COPY;
+ }
++ $to->autoflush(0);
+ $cl-=length if defined $cl;
+ }
+ warn "[$$]: finished unchunked body, ok=$ok";
+@@ -1083,10 +1088,10 @@ sub proxy_copychunked($$)
+ { print $to $_;
+ $chunksize-=length;
+ }
+- flush($to);
++ $to->flush();
+ }
+
+- flush($to);
++ $to->flush();
+
+ # pass trailer headers
+ while (defined($_=<$from>) && !/^\r?\n/)
+@@ -1096,7 +1101,7 @@ sub proxy_copychunked($$)
+ { ##warn "[$$]: final trailer: $_";
+ print $to $_;
+ }
+- flush($to);
++ $to->flush();
+
+ return (1,"");
+ }
diff -ruN adzap-org/pkg-descr adzap/pkg-descr
--- adzap-org/pkg-descr 2013-03-28 12:28:59.000000000 -0400
+++ adzap/pkg-descr 2013-11-07 17:42:44.000000000 -0500
@@ -1,7 +1,7 @@
- Adzap is a http-redirector script for squid, that zaps by replacing
+Adzap is a http-redirector script for squid, that zaps by replacing
those annoying ad banners from web pages with placeholder GIFs.
It lives in the web proxy and so requires no special browser
-facilities. It's readily customizable, small, fast, and easy to
+facilities. It's readily customizable, small, fast, and easy to
install.
WWW: http://adzapper.sourceforge.net/
diff -ruN adzap-org/pkg-plist adzap/pkg-plist
--- adzap-org/pkg-plist 2012-07-14 10:29:18.000000000 -0400
+++ adzap/pkg-plist 2013-11-07 17:35:26.000000000 -0500
@@ -1,47 +1,3 @@
libexec/adzap
-libexec/squid_redirect-nodata
+libexec/squid_redirect
libexec/zapchain
-%%EXAMPLESDIR%%/adzap.conf
-%%EXAMPLESDIR%%/rc/proxy-home.pac
-%%EXAMPLESDIR%%/rc/proxy-zip.pac
-%%EXAMPLESDIR%%/rc/patterns
-%%EXAMPLESDIR%%/rc/squid/ERR_ACCESS_DENIED
-%%EXAMPLESDIR%%/rc/squid/Mykefile
-%%EXAMPLESDIR%%/rc/squid/ip-ranges at zip.raw
-%%EXAMPLESDIR%%/rc/squid/tplt
-%%EXAMPLESDIR%%/rc/squid/tplt-home
-%%EXAMPLESDIR%%/rc/squid/tplt-zip
-%%EXAMPLESDIR%%/zaps/ad-clear.gif
-%%EXAMPLESDIR%%/zaps/ad-clear.mp3
-%%EXAMPLESDIR%%/zaps/ad-clear.swf
-%%EXAMPLESDIR%%/zaps/ad-grey.gif
-%%EXAMPLESDIR%%/zaps/ad-old.gif
-%%EXAMPLESDIR%%/zaps/ad.gif
-%%EXAMPLESDIR%%/zaps/ad.mp3
-%%EXAMPLESDIR%%/zaps/ad.swf
-%%EXAMPLESDIR%%/zaps/adbg-clear.gif
-%%EXAMPLESDIR%%/zaps/adbg.gif
-%%EXAMPLESDIR%%/zaps/closepopup-clear.html
-%%EXAMPLESDIR%%/zaps/closepopup.html
-%%EXAMPLESDIR%%/zaps/counter-clear.gif
-%%EXAMPLESDIR%%/zaps/counter-clear.js
-%%EXAMPLESDIR%%/zaps/counter.gif
-%%EXAMPLESDIR%%/zaps/counter.js
-%%EXAMPLESDIR%%/zaps/no-op-clear.html
-%%EXAMPLESDIR%%/zaps/no-op-clear.js
-%%EXAMPLESDIR%%/zaps/no-op-counter-clear.html
-%%EXAMPLESDIR%%/zaps/no-op-counter-clear.js
-%%EXAMPLESDIR%%/zaps/no-op-counter.html
-%%EXAMPLESDIR%%/zaps/no-op-counter.js
-%%EXAMPLESDIR%%/zaps/no-op.html
-%%EXAMPLESDIR%%/zaps/no-op.js
-%%EXAMPLESDIR%%/zaps/webbug-clear.gif
-%%EXAMPLESDIR%%/zaps/webbug-clear.html
-%%EXAMPLESDIR%%/zaps/webbug-clear.js
-%%EXAMPLESDIR%%/zaps/webbug.gif
-%%EXAMPLESDIR%%/zaps/webbug.html
-%%EXAMPLESDIR%%/zaps/webbug.js
- at dirrm %%EXAMPLESDIR%%/rc/squid
- at dirrm %%EXAMPLESDIR%%/rc
- at dirrm %%EXAMPLESDIR%%/zaps
- at dirrm %%EXAMPLESDIR%%
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list