Bug 191673 - [stage] www/squid32
Summary: [stage] www/squid32
Status: Closed DUPLICATE of bug 189902
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-06 21:28 UTC by Dan Lukes
Modified: 2014-08-11 13:20 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Lukes 2014-07-06 21:28:56 UTC
www/squid32 require staging or will be removed

Fix:
Patch is attached. 
Note 1: the plist is generated dynamically, all handling is done in Makefile
Note 2: the upstreams install phase will create *.conf.default configuration 
   files as well as *.conf files. The second one is removed during
   post-install and replaced by conditional "@exec if  [ ! -f" copy logic

--- www/squid32/Makefile.orig	2014-07-06 16:28:30.000000000 +0200
+++ www/squid32/Makefile	2014-07-06 23:13:14.000000000 +0200
@@ -52,8 +52,8 @@
 USERS=		squid
 GROUPS=		squid
 
-MAN1=		squidclient.1
-MAN8=		cachemgr.cgi.8 squid.8
+PLIST_FILES+=	man/man1/squidclient.1.gz
+PLIST_FILES+=	man/man8/cachemgr.cgi.8.gz man/man8/squid.8.gz
 docs=		QUICKSTART README RELEASENOTES.html doc/debug-sections.txt
 PORTDOCS=	${docs:T}
 PORTEXAMPLES=	*
@@ -103,13 +103,13 @@
 
 ECAP_USES=		pkgconfig:build
 
-etc_files=	squid/cachemgr.conf.default \
-		squid/errorpage.css.default \
-		squid/mib.txt \
-		squid/mime.conf.default \
-		squid/msntauth.conf.default \
-		squid/squid.conf.default \
-		squid/squid.conf.documented
+etc_files=	cachemgr.conf.default \
+		errorpage.css.default \
+		mib.txt \
+		mime.conf.default \
+		msntauth.conf.default \
+		squid.conf.default \
+		squid.conf.documented
 
 icon_silk_files=	application.png arrow_up.png bomb.png box.png \
 			bricks.png bullet_red.png cd.png chart_line.png \
@@ -203,7 +203,6 @@
 		--disable-linux-tproxy \
 		--disable-translation
 
-NO_STAGE=	yes
 .include <bsd.port.pre.mk>
 
 .if ${CC:T:Mclang} == "clang" || ${CXX:T:Mclang++} == "clang++" || ${OSVERSION} >= 1000024
@@ -231,15 +230,15 @@
 		ext_unix_group_acl \
 		ntlm_fake_auth \
 		ntlm_smb_lm_auth
-MAN8+=		basic_getpwnam_auth.8 basic_ncsa_auth.8 basic_pam_auth.8 \
-		basic_radius_auth.8 basic_db_auth.8 \
-		digest_file_auth.8 \
-		ext_file_userip_acl.8 ext_unix_group_acl.8
+PLIST_FILES+=	man/man8/basic_getpwnam_auth.8.gz man/man8/basic_ncsa_auth.8.gz man/man8/basic_pam_auth.8.gz \
+		man/man8/basic_radius_auth.8.gz man/man8/basic_db_auth.8.gz \
+		man/man8/digest_file_auth.8.gz \
+		man/man8/ext_file_userip_acl.8.gz man/man8/ext_unix_group_acl.8.gz
 .if ${PORT_OPTIONS:MAUTH_LDAP}
 USE_OPENLDAP=	yes
 CFLAGS+=	-I${LOCALBASE}/include
 LDFLAGS+=	-L${LOCALBASE}/lib
-MAN8+=		basic_ldap_auth.8 ext_ldap_group_acl.8
+PLIST_FILES+=	man/man8/basic_ldap_auth.8/gz man/man8/ext_ldap_group_acl.8/gz
 basic_auth+=	LDAP
 external_acl+=	LDAP_group
 libexec+=	basic_ldap_auth ext_ldap_group_acl
@@ -249,7 +248,7 @@
 CFLAGS+=	-I${LOCALBASE}/include
 CPPFLAGS+=	-I${LOCALBASE}/include
 LDFLAGS+=	-L${LOCALBASE}/lib
-MAN8+=		basic_sasl_auth.8
+PLIST_FILES+=	man/man8/basic_sasl_auth.8/gz
 basic_auth+=	SASL
 libexec+=	basic_sasl_auth
 .endif
@@ -260,7 +259,7 @@
 external_acl+=	wbinfo_group
 libexec+=	basic_smb_auth basic_smb_auth.sh \
 		ext_wbinfo_group_acl
-MAN8+=		ext_wbinfo_group_acl.8
+PLIST_FILES+=	man/man8/ext_wbinfo_group_acl.8.gz
 .endif
 # POLA: allow the old global make.conf(5) (pre src.conf(5)) defines, too:
 .if ${PORT_OPTIONS:MAUTH_NIS} && !defined(NO_NIS) && !defined(WITHOUT_NIS)
@@ -272,7 +271,7 @@
 negotiate_auth=	kerberos wrapper
 libexec+=	negotiate_kerberos_auth negotiate_kerberos_auth_test \
 		negotiate_wrapper_auth
-MAN8+=		negotiate_kerberos_auth.8
+PLIST_FILES+=	man/man8/negotiate_kerberos_auth.8.gz
 # the kerberos_ldap_group external helper depends on LDAP and SASL:
 .if ${PORT_OPTIONS:MAUTH_LDAP} && ${PORT_OPTIONS:MAUTH_SASL}
 external_acl+=	kerberos_ldap_group
@@ -280,7 +279,7 @@
 		cert_tool
 # XXX: this manpage is present in Squid's source but is not being
 # built/installed yet (Squid 3.2.3 as at 11/2012).
-#MAN8+=		ext_kerberos_ldap_group_acl.8
+#PLIST_FILES+=		man/man8/ext_kerberos_ldap_group_acl.8.gz
 .endif
 .else
 negotiate_auth=	none
@@ -466,20 +465,18 @@
 # Finally, add additional user specified configuration options:
 CONFIGURE_ARGS+=	${SQUID_CONFIGURE_ARGS}
 
-PLIST_DIRS=	%%ETCDIR%%/icons/silk %%ETCDIR%%/icons libexec/squid
-PLIST_FILES=	${etc_files:S,^,etc/,} \
-		%%ETCDIR%%/icons/SN.png \
-		${icon_silk_files:S,^,%%ETCDIR%%/icons/silk/,} \
+PLIST_DIRS=	${ETCDIR_REL}/icons/silk ${ETCDIR_REL}/icons libexec/squid
+PLIST_FILES+=	${ETCDIR_REL}/icons/SN.png \
+		${icon_silk_files:S,^,${ETCDIR_REL}/icons/silk/,} \
 		${libexec:S,^,libexec/squid/,} ${sbin:S,^,sbin/,}
 
-PLIST_FILES+=	%%ETCDIR%%/errors/COPYRIGHT %%ETCDIR%%/errors/TRANSLATORS
+PLIST_FILES+=	${ETCDIR_REL}/errors/COPYRIGHT ${ETCDIR_REL}/errors/TRANSLATORS
 .for d in ${error_dirs}
-PLIST_DIRS+=	%%ETCDIR%%/errors/${d}
-PLIST_FILES+=	${error_files:S,^,%%ETCDIR%%/errors/${d}/,}
+PLIST_DIRS+=	${ETCDIR_REL}/errors/${d}
+PLIST_FILES+=	${error_files:S,^,${ETCDIR_REL}/errors/${d}/,}
 .endfor
-PLIST_FILES+=	${error_dir_links:S,^,%%ETCDIR%%/errors/,}
-PLIST_DIRS+=	%%ETCDIR%%/errors
-PLIST_DIRSTRY+=	%%ETCDIR%%
+PLIST_FILES+=	${error_dir_links:S,^,${ETCDIR_REL}/errors/,}
+PLIST_DIRS+=	${ETCDIR_REL}/errors
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
@@ -491,21 +488,37 @@
 	@${FIND} ${WRKSRC} -name '*.orig' -delete
 
 pre-su-install:
-	@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX=${PREFIX} \
+	@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX=${STAGEDIR}${PREFIX} \
 	    ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
 
 post-install:
+.for f in ${etc_files:M*.default}
+	@${RM} ${STAGEDIR}${PREFIX}/${ETCDIR_REL}/${f:R}
+	${ECHO_CMD} "@exec if [ ! -f %D/${ETCDIR_REL}/${f:R} ]; then cp -p %D/${ETCDIR_REL}/${f} %D/${ETCDIR_REL}/${f:R}; fi" >> ${TMPPLIST}
+	${ECHO_CMD} "${ETCDIR_REL}/${f}" >> ${TMPPLIST}
+	${ECHO_CMD} "@unexec if cmp -s %D/${ETCDIR_REL}/${f:R} %D/${ETCDIR_REL}/${f}; then rm %D/${ETCDIR_REL}/${f:R}; fi" >> ${TMPPLIST}
+.endfor
+.for f in ${etc_files:N*.default}
+	${ECHO_CMD} "${ETCDIR_REL}/${f}" >> ${TMPPLIST}
+.endfor
+	@${ECHO_CMD} "@dirrmtry ${ETCDIR_REL}" >> ${TMPPLIST}
+	@${ECHO_CMD} "@unexec rmdir \"/var/log/squid\" >/dev/null 2>&1 || :" >> ${TMPPLIST}
+	@${ECHO_CMD} "@unexec rmdir \"/var/run/squid\" >/dev/null 2>&1 || :" >> ${TMPPLIST}
+	@${ECHO_CMD} "@unexec rmdir \"/var/squid/cache/squid\" >/dev/null 2>&1 || :" >> ${TMPPLIST}
+	@${ECHO_CMD} "@unexec rmdir \"/var/squid/cache\" >/dev/null 2>&1 || :" >> ${TMPPLIST}
+	@${ECHO_CMD} "@unexec rmdir \"/var/squid\" >/dev/null 2>&1 || :" >> ${TMPPLIST}
+
 .if ${PORT_OPTIONS:MEXAMPLES}
-	@${MKDIR} ${EXAMPLESDIR}
-	${INSTALL_DATA} ${WRKSRC}/helpers/basic_auth/DB/passwd.sql ${EXAMPLESDIR}
+	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/helpers/basic_auth/DB/passwd.sql ${STAGEDIR}${EXAMPLESDIR}
 .endif
 .if ${PORT_OPTIONS:MICMP}
-	${CHMOD} 4510 ${PREFIX}/libexec/squid/pinger; \
-	${CHGRP} squid ${PREFIX}/libexec/squid/pinger
+	${CHMOD} 4510 ${STAGEDIR}${PREFIX}/libexec/squid/pinger; \
+	${CHGRP} squid ${STAGEDIR}${PREFIX}/libexec/squid/pinger
 .endif
 .if ${PORT_OPTIONS:MDOCS}
-	@${MKDIR} ${DOCSDIR}
-	cd ${WRKSRC} && ${INSTALL_DATA} ${docs} ${DOCSDIR}
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	cd ${WRKSRC} && ${INSTALL_DATA} ${docs} ${STAGEDIR}${DOCSDIR}
 .endif
 	@${SETENV} PKG_PREFIX=${PREFIX} \
 	    ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
Comment 1 Raphael Kubo da Costa freebsd_committer 2014-07-08 14:31:32 UTC
Can you please attach a diff to the bug?
Comment 2 Adam Weinberger freebsd_committer 2014-07-14 15:31:06 UTC
Why use complicated "@exec if [ ! -f" logic instead of a simple @sample?

And if you're using a dynamically-generated plist (are you sure you really need to do that?), why not remove the endless libexec/error_files/etc+= stuff?
Comment 3 Dan Lukes 2014-07-14 17:01:15 UTC
I followed "Convert a port to Stage" instructions published on https://wiki.freebsd.org/ports/StageDir

Despite I recognize your advices valuable, the overall style of the port's Makefile is sovereignty of maintainer. 

In advance, independent issues should not be mixed in one PR.

The only goal of this PR is to move the port to stage era, not to change the style or functionality of the port in question. 

Create of NO_STAGE remove PR is time consuming task for someone not so familiar with such kind of job like me. And it's not so funny. 

I'm not in position to push a maintainer to any particular style. It will increase the risk the PR will be rejected because of different personal style preference and the time I spend into it become wasted.
Comment 4 Adam Weinberger freebsd_committer 2014-07-14 17:21:37 UTC
I'm not really following. The "@exec if [ ! -f ..." stuff wasn't there before. You're adding it. So what does it have to do with the original maintainer's sovereignty?

Secondary to adding STAGE support, there is also a major project underway to modernize ports, cutting down on things like hand-rolled conf file handling and preferring simple and modular interfaces like @sample. You may find that adopting those things increases the speed that your patches get accepted, not slow it down.

Additionally, please take the advice that rakuco has given to all your PR's and attach the patchs, not paste them in. As a favour to us... it makes it easier for us to apply the patches and test them.
Comment 5 Dan Lukes 2014-07-14 18:42:36 UTC
http://www.freebsd.org/doc/en/books/porters-handbook/plist-config.html
claim the @sample construct can be used for .sample suffix. Squid is using .default suffix so I followed the workaround mentioned on the same page.

I don't know why the maintainer user the .default suffix, I just followed the porters handbook and handled the particular case the recommended way. 

Well, I'm not so familiar with the new @sample construct, so I didn't used it even in some cases it can be used, but it's not the case of this PR.

According inline patches. I followed the latest revision of http://www.freebsd.org/doc/en/articles/problem-reports/article.html#pr-writing-sending

Once more I followed document (current version of document) found on www.freebsd.org 

And again, you consider it to be wrong decision.

OK. I'm not experienced port maintainer. I would be happy of someone else, more skilled, will provide better quality patches to you. I tried to save the ports I wish they should be saved, but nobody is going to take the job. I spend time to learn how to do it and I did it the recommended way. And it's considered wrong way.

I understand you are volunteer and it would be better to have patch attached than inlined. Be sure I recognize it apply apply even in the case the processing of inline patch will take just few seconds more. 

I have no copy of patches already sent, so I can't attach them again even as favor. I explained it already. 

I wished that even less-than-excelent (but still working well) patch is more helpful than no patch at all. But I'm not in the position to decide, it's commiters your job. 

Don't misunderstand me, please, I'm listening to all the advices you kindly offered to me, but I really have no sufficient spare time to become #1 expert in this area. Especially in the case it's wrong way to follow published handbooks.

If you are unable to use my PRs, either because you are unable extract the patch or because the patch is so low quality, then close the PR, please. May be someone else will take the job and do it better than me.


Cheers

Dan
Comment 6 Adam Weinberger freebsd_committer 2014-07-14 18:48:38 UTC
Dan, relax, you've contributed great patches and they'll all get committed soon enough. Our job is to flag anything unusual and talk it through with you before it gets committed. Don't confuse advice with negative criticism. If nobody thought your patches were quality stuff, you wouldn't be receiving advice.

As far as the @sample business goes, nobody cares what method you use. But my job is to flag the fact that you didn't use it, and see whether it was intentional, or whether you just weren't aware of it.
Comment 7 Dan Lukes 2014-07-14 19:20:40 UTC
English is not my native language. I'm not sure if my writing sounds as intended all the times. Be sure I'm not upset. 

There are 26 PR submitted by me (not counting those related to ports), the oldest  9 years old that are touched by no one. Any time I'm submitting the PR I'm aware it may be ignored, but it's tiring somewhat.

I'm more happy with questions and criticism and even with rejected PR than just total silence.


Thank you

Dan
Comment 8 John Marino freebsd_committer 2014-08-11 10:35:23 UTC
Adding the listed maintainer ( tmseck@FreeBSD.org ) to the PR.
There's no sense in assigning the PR to him, he should know that this port is going to be deleted in 2 weeks.

Maybe Adam will take pity on this PR and convert the comment into an attachment.  I'm not going to and apparently Dan isn't going to either.

So if nothing changes, bye-bye squid32
Comment 9 Dan Lukes 2014-08-11 11:33:10 UTC
(In reply to John Marino from comment #8)
> Dan isn't going to either.

At least not now. I returned from trip yesterday and now I need to do some postponed jobs. It will take two weeks or so. Just now I have no spare time to do it, sorry. 

On the other side, it's rather simple task that require just few minutes of time and almost no special skills. Anyone can take the job. If no one will take the job, we should consider that this port is important for no one. In such case, it should be removed to free resources.

Note that I'm no user of www/squid32.
Comment 10 John Marino freebsd_committer 2014-08-11 13:20:02 UTC
Turns out this was much ado about nothing, there was a prior PR.

*** This bug has been marked as a duplicate of bug 189902 ***