Bug 212097 - [NEW PORT] www/apt-cacher-ng: Specialized http/s proxy for caching software distribution sites (FreeBSD Version)
Summary: [NEW PORT] www/apt-cacher-ng: Specialized http/s proxy for caching software d...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs mailing list
URL: https://github.com/kevemueller/apt-ca...
Keywords: feature, needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2016-08-24 07:32 UTC by keve
Modified: 2018-12-17 07:35 UTC (History)
1 user (show)

See Also:
koobs: maintainer-feedback? (keve)


Attachments
apt-cacher-ng port shar file (23.51 KB, text/plain)
2016-08-24 07:32 UTC, keve
no flags Details
Updated shar to upstream version 3.1 and FreeBSD 11.1 (25.19 KB, text/plain)
2018-02-23 11:19 UTC, keve
no flags Details
apt-cacher-ng port shar file upstream 3.1 / FreeBSD 10.4/11.1 (27.40 KB, text/plain)
2018-02-23 18:58 UTC, keve
no flags Details
apt-cacher-ng port shar file upstream 3.2/FreeBSD 11.2-R-p4 and 12.0-RC1 (26.55 KB, text/plain)
2018-11-25 13:36 UTC, keve
no flags Details
apt-cacher-ng port shar file upstream 3.2/FreeBSD 11.2-R-p4 and 12.0-RC2 (26.78 KB, text/plain)
2018-12-10 08:27 UTC, keve
no flags Details
apt-cacher-ng.diff (32.47 KB, patch)
2018-12-10 09:54 UTC, Tobias Kortkamp
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description keve 2016-08-24 07:32:19 UTC
Created attachment 174003 [details]
apt-cacher-ng port shar file

apt-cacher-ng while originating from Debian is usable as a specialized caching http/https proxy for many other software distribution sites.
This port patches upstream apt-cacher-ng to compile cleanly on FreeBSD and add FreeBSD installer as well as pkg(ng) related configuration, so that apt-cacher-ng can be used right away in a FreeBSD context.
Comment 1 keve 2018-02-23 11:19:57 UTC
Created attachment 190914 [details]
Updated shar to upstream version 3.1 and FreeBSD 11.1

Updated version following upstream changes and FreeBSD changes
Comment 2 keve 2018-02-23 18:58:54 UTC
Created attachment 190927 [details]
apt-cacher-ng port shar file upstream 3.1 / FreeBSD 10.4/11.1

fixed MANDIR
Comment 3 Tobias Kortkamp freebsd_committer 2018-11-15 05:50:23 UTC
XLICENSE_FILE=	${WRKSRC}/COPYING

Setting LICENSE_FILE without also setting LICENSE is useless.

XDEFAULT_VERSIONS+=	ssl=openssl

This is a red flag.  A default version effects the entire ports
collection.  It cannot be set in an individual port.

XSSL_BUILD_DEPENDS=	pkg-config:${PORTSDIR}/devel/pkgconf openssl:${PORTSDIR}/security/openssly

If the port needs openssl then add USES=ssl (or SSL_USES=ssl) and
nothing else.  Since the port already always has USES=ssl maybe the
SSL option isn't really needed and SSL support could always be on.

- All of the ${PORTSDIR} things are old school and should be removed.

XFUSE_CMAKE_ON=	-DUSE_FUSE:BOOL=ON
XFUSE_CMAKE_OFF=	-DUSE_FUSE:BOOL=OFF

Replace with (and the other *_CMAKE_{ON,OFF}):

FUSE_CMAKE_BOOL=	USE_FUSE

Can you confirm that this passes portlint and a Poudriere test
build?  In particular a test build on 12.0-BETA4 would be good to
make sure it still builds against OpenSSL 1.1.1.
Comment 4 Tobias Kortkamp freebsd_committer 2018-11-15 05:50:50 UTC
(In reply to Tobias Kortkamp from comment #3)
s/effects/affects/
Comment 5 keve 2018-11-18 13:17:10 UTC
Hey Tobias,
thanks for looking into it and the suggestions. 
I will set-up a 12.0 machine and also update the upstream changes since last submission.
Cheers,
Keve
Comment 6 keve 2018-11-25 13:36:25 UTC
Created attachment 199542 [details]
apt-cacher-ng port shar file upstream 3.2/FreeBSD 11.2-R-p4 and 12.0-RC1

Included comments from review, thank you for the feedback.

Builds on a 12.0-RC1 system with poudriere+portshaker against 11.2-RELEAE-p4 and 12.0-RC1.
portlint -A only complains about the use of hyphen in the name, something many official ports also do.
Please let me know if there is anything else I can do.
Comment 7 Tobias Kortkamp freebsd_committer 2018-11-29 10:34:37 UTC
ould you order the variables according to [1]? 

XThis is a port of apt-cacher-ng, a caching http/s proxy specialized in

Never start pkg-descr with "This is a port".  How about starting
with "apt-cacher-ng is a caching ..." instead?  There are also some
typos in pkg-descr.

XMore details are on the original projects web page.

I think this sentence is superfluous and could be dropped.  It's
pretty much why pkg-descr always ends with WWW.

XOPTIONS_DEFAULT=	SSL DOCS

DOCS is always enabled by default, so it doesn't need to be here.

X#SSL_BUILD_DEPENDS=	pkg-config:devel/pkgconf
X#SSL_BUILD_DEPENDS=	pkg-config:devel/pkgconf openssl:security/openssl
X#SSL_LIB_DEPENDS=	libcrypto.so:security/openssl

Please remove all the commented out variables.  Especially these
very wrong bits.

XSSL_DESC=	Include SSL support to allow proxying https sites.

Remove the dot at the end.

XFUSE_DESC=	Include FUSE support.

FUSE already has a better common description.  What does the
option do in the context of the port (maybe mention acngfs)?

XDISTNAME=	${PORTNAME}_${PORTVERSION}.orig

You can eliminate setting WRKSRC below if you use

DISTFILES=	${PORTNAME}_${PORTVERSION}.orig${EXTRACT_SUFX}

instead here.

Xpost-stage:

Use post-install

X	${INSTALL_MAN} ${WRKSRC}/COPYING ${STAGEDIR}${DOCSDIR}
X	${INSTALL_MAN} ${WRKSRC}/ChangeLog ${STAGEDIR}${DOCSDIR}
X	${INSTALL_MAN} ${WRKSRC}/TODO ${STAGEDIR}${DOCSDIR}

Use INSTALL_DATA to install documentation.

COPYING is already installed via LICENSE_FILE.  No need to install
it twice.  Does the ChangeLog and TODO really contain useful
information for users?

X	${INSTALL_MAN} ${WRKDIR}/Readme.FreeBSD ${STAGEDIR}${DOCSDIR}

I think this should be a pkg-message instead, so that users see it
after installation.

[1] https://www.freebsd.org/doc/en/books/porters-handbook/porting-order.html
Comment 8 Tobias Kortkamp freebsd_committer 2018-12-07 06:49:48 UTC
Ping.
Comment 9 keve 2018-12-08 10:19:30 UTC
Hey Tobias, thanks for your heads-up. Will do the changes very soon.
Cheers,
Keve
Comment 10 keve 2018-12-09 16:34:59 UTC
Hi Tobias, 

I have applied most of your remarks, I have troubles applying some.

COPYING - if I leave it out the file is not copied and the build breaks.
DISTFILES - if I set it 

DISTFILES=      ${PORTNAME}_${PORTVERSION}.orig${EXTRACT_SUFX}
and remove DISTNAME and WRKSRC the build is ok, but running portlint -A I get

WARN: Makefile: use of DISTFILES with single file discouraged. distribution filename should be set by DISTNAME and EXTRACT_SUFX.
WARN: Makefile: do not use DISTFILES and DISTNAME to control WRKSRC. how about "WRKSRC=${WRKDIR}/${PORTNAME}-${PORTVERSION}"?

So portlint says the exact opposite as your recommendation.

Please clarify.

Cheers,

Keve
Comment 11 Tobias Kortkamp freebsd_committer 2018-12-09 16:41:55 UTC
(In reply to keve from comment #10)
> COPYING - if I leave it out the file is not copied and the build breaks.

Remove it from pkg-plist too?

> So portlint says the exact opposite as your recommendation.

So?
Comment 12 Tobias Kortkamp freebsd_committer 2018-12-09 16:53:01 UTC
To clarify, portlint is a linting tool that often gets things wrong.  The
Porter's Handbook specifically recommend setting DISTFILES in this case as well:

From [1]
  Note:
  PKGNAMEPREFIX and PKGNAMESUFFIX do not affect DISTNAME. Also note that if 
  WRKSRC is equal to ${WRKDIR}/${DISTNAME} while the original source archive is 
  named something other than ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}, leave 
  DISTNAME alone— defining only DISTFILES is easier than both DISTNAME and WRKSRC   
  (and possibly EXTRACT_SUFX).

[1] https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html
Comment 13 keve 2018-12-10 08:27:26 UTC
Created attachment 200001 [details]
apt-cacher-ng port shar file upstream 3.2/FreeBSD 11.2-R-p4 and 12.0-RC2

Here are the changes implemented.

Please file a bug report against portlint as you seem to have a point that it is getting things wrong. Having portlint report problems that should be ignored renders it useless.
Comment 14 Tobias Kortkamp freebsd_committer 2018-12-10 09:54:03 UTC
Created attachment 200002 [details]
apt-cacher-ng.diff

With respect to hier(7), I think a more appropriate place for the
files in lib/apt-cacher-ng would be ${DATADIR} (share/apt-cacher-ng)
or libexec/apt-cacher-ng.

Is it ok if we set LIBDIR to something else or will it break at
runtime?
Comment 15 Tobias Kortkamp freebsd_committer 2018-12-10 09:55:31 UTC
+%%ETCDIR%%/backends_debian
+%%ETCDIR%%/backends_freebsd
+%%ETCDIR%%/backends_ubuntu

Are these supposed to be user editable too?
Comment 16 Tobias Kortkamp freebsd_committer 2018-12-10 17:18:45 UTC
Giving it back to the pool for lack of time.  I might pick this up again over
the holidays or next year if nobody takes it in the meantime.
Comment 17 keve 2018-12-10 18:13:52 UTC
On #14, I will give it a try. Generally speaking it should be possible.
On #15, Yes, these are first class configurable files. In fact these are the files  with which the administrator can set his preference on which particular upstream mirror to fetch distribution files from. They are pre-populated with sensible defaults.
On #16, this is a pity, I hope it will not take another 2 years until it is picked up again.

shar -> diff any reason why? I can certainly submit diffs from now on as well.
Comment 18 Kubilay Kocak freebsd_committer freebsd_triage 2018-12-17 07:35:21 UTC
(In reply to keve from comment #17)

If you can run this port through the standard QA processes/tools (at least portlint and poudriere), and confirm that it passesd, it will go a long way to signaling that it's ready to commit.

For details and instructions see: 

https://www.freebsd.org/doc/en/books/porters-handbook/testing.html

If you need any help, #freebsd-ports on freenode IRC :)