Bug 207875 - fetch-list does not store into DIST_SUBDIR
Summary: fetch-list does not store into DIST_SUBDIR
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-10 07:37 UTC by Daniel O'Connor
Modified: 2016-03-12 13:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel O'Connor 2016-03-10 07:37:45 UTC
I use fetch-recursive-list to get distfiles to non-networked jails, however I have to move anything using DIST_SUBDIR manually as it just puts them in CWD.

Perusing fetch-list I see...

                                DIR=${DIST_SUBDIR};\
                                CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \
                                case $${file} in \
                                */*)    args="-o $${file} $${site}$${file}";; \
                                *)              args=$${site}$${file};; \
                                esac; \
                                ${ECHO_CMD} -n ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} "${FETCH_AFTER_ARGS}" '|| ' ; \

Which looks odd as 'DIR' is never used - was this feature removed or broken by mistake?

I would expect (ho ho ho) it to be relatively easy to check if DIST_SUBDIR is set and if so add something like if [ ! -d ${DIST_SUBDIR} ]; then; mkdir ${DIST_SUBDIR}; fi; ( cd ${DIST_SUBDIR} ; .... )
Comment 1 Mathieu Arnold freebsd_committer freebsd_triage 2016-03-10 16:32:54 UTC
You are right, DIR is not used, it must be a remnant of some other thing.  There's some ECHO_CMD missing that would contains a cd ${_DISTDIR}.  I'll have a closer look.
Comment 2 commit-hook freebsd_committer freebsd_triage 2016-03-10 16:48:45 UTC
A commit references this bug:

Author: mat
Date: Thu Mar 10 16:48:23 UTC 2016
New revision: 410767
URL: https://svnweb.freebsd.org/changeset/ports/410767

Log:
  Fix fetch-list.

  PR:		207875
  Sponsored by:	Absolight

Changes:
  head/Mk/bsd.port.mk
Comment 3 Daniel O'Connor 2016-03-12 00:40:08 UTC
Is there a way to make it relative directories only? Otherwise it generates absolute paths for cd which makes my use case impossible.

ie I want to run 'make fetch-recursive-list >/fetchlist' in a jail, then run this in the host..

cd /path/to/jail/var/ports/distfiles
sh /path/to/jail/fetchlist
Comment 4 Mathieu Arnold freebsd_committer freebsd_triage 2016-03-12 10:37:30 UTC
Well, no, because, then, it would need to parse DIST_DIR to know how to get back to where it started, and such.

Your best bet is either to sed -e 's|^cd /usr/ports|cd /some/where/else|'

Well, your better bet would be to null mount /usr/ports/distfiles in all your jails so that you have only one copy of each distfile, and it has the same path on the host, and in the jails.
Comment 5 Daniel O'Connor 2016-03-12 10:47:44 UTC
(In reply to Mathieu Arnold from comment #4)
I don't think it needs to know that - just use subshells
eg..
(cd foo ; fetch XXX || fetch YYY | ....)
Comment 6 Mathieu Arnold freebsd_committer freebsd_triage 2016-03-12 11:06:07 UTC
No, it has to work wherever it's ran from.
Comment 7 Daniel O'Connor 2016-03-12 11:07:33 UTC
(In reply to Mathieu Arnold from comment #6)

So you mean it *has* to have an absolute path? (even though previously it was purely relative)
Comment 8 Mathieu Arnold freebsd_committer freebsd_triage 2016-03-12 13:36:28 UTC
(In reply to darius from comment #7)
> So you mean it *has* to have an absolute path? (even though previously it
> was purely relative)

Well, previously, it was broken, so I can't say if it was by design... It may, or may not, have worked in the past, if you want to sieve through the history to find out... :-)