RFC: svn for make fetch

Mel Flynn mel.flynn+fbsd.ports at mailing.thruhere.net
Wed Nov 18 19:54:27 UTC 2009


On Wed, 18 Nov 2009 11:43:07 +0000, Thomas Sandford
<freebsduser at paradisegreen.co.uk> wrote:
> (Sorry, Ive lost track of the higher level attributions, but)
> Eitan Adler wrote:
>>>> Creating deterministic tars (ignoring "metadeta") sounds like it
>>>> should be a solved problem by now. If it isn't then I will have to
>>>> make it my next project ;)
>>>>
>>> Instead of creating tar files, create zip files and then run them
>>> through torrentzip
>>>
>>> http://www.freebsd.org/cgi/cvsweb.cgi/ports/archivers/torrentzip/
>>>
>>> Torrentzip resets the date/time on the files and directories in the
>>> zip archive so that the checksum of the file will match, no matter who
>>> builds the zip file using the same set of files.
>>>
>>> Scot
>>>
>> 
>> Does such a tool exist for tar archives?
> 
> Couldn't you achieve the same thing by the use of touch(1)

Probably, but my idea was at the time to provide a simple way to support
non-releases (like mplayer) and devel snapshots for which a tarball is
not or rarely rolled, with minimal change to bsd.port.mk.

Hence the abuse of FETCH_*. I found it again, I'll clean it up when I have
more time - there's more stuff in my bsd.local.mk so not a clean diff, but
the crux is this:
FETCH_BINARY=${SVN_CMD}
FETCH_ARGS=${SVN_QUIET} export
FETCH_BEFORE_ARGS=-r${SVN_REVISION}
DISABLE_SIZE=yes # screws with FETCH_BEFORE_ARGS
# cwd at this point is ${_DISTDIR}
FETCH_AFTER_ARGS=${_SVN_STAGE} && ${TAR} -C ${SVN_STAGE} -czf \
    ${PORTNAME}-${PORTVERSION}.tar.gz ${PORTNAME}-${PORTVERSION} \
    WRKSRC?=${WRKDIR}/${SVN_ROOT}

FETCH_NO_APPEND_FILE=yes

pre-fetch:
    @${MKDIR} ${SVN_STAGE}

# Once bsdtar supports remove after archiving, we don't need this anymore.
post-fetch:
    @${RM} -rf ${_SVN_STAGE}

(Yes, I realize I should inject my own targets and not abuse
pre|post-fetch).

bsd.port.mk diff snippet (long line):
--- Mk/bsd.port.mk   21 Sep 2009 19:13:51 -0000 1.629
+++ Mk/bsd.port.mk   22 Sep 2009 01:21:26 -0000
@@ -3490,11 +3490,15 @@
         for site in `eval $$SORTED_MASTER_SITES_CMD_TMP
${_RANDOMIZE_SITES}`; do \
             ${ECHO_MSG} "=> Attempting to fetch from $${site}."; \
            CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \
-           case $${file} in \
-           */*)  ${MKDIR} $${file%/*}; \
-                 args="-o $${file} $${site}$${file}";; \
-           *)    args=$${site}$${file};; \
-           esac; \
+           if test x"${FETCH_NO_APPEND_FILE}" != x"yes"; then \
+              case $${file} in \
+              */*)  ${MKDIR} $${file%/*}; \
+                    args="-o $${file} $${site}$${file}";; \
+              *)    args=$${site}$${file};; \
+              esac; \
+           else \
+              args=$${site}; \
+           fi; \
            if ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS}
$${args} ${FETCH_AFTER_ARGS}; then \
               continue 2; \
            fi; \

-- 
--
Mel



More information about the freebsd-ports mailing list