Bug 211564 - distributeworld (and other distribuction functions) failing for custom DESTDIR
Summary: distributeworld (and other distribuction functions) failing for custom DESTDIR
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: Normal Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: needs-qa, patch
Depends on:
Blocks:
 
Reported: 2016-08-04 01:48 UTC by Vinícius Zavam
Modified: 2017-05-02 08:57 UTC (History)
1 user (show)

See Also:
koobs: mfc-stable11?
koobs: mfc-stable10?


Attachments
Enforce the use of ${DESTDIR} during world distribution. (1.77 KB, patch)
2016-08-04 01:48 UTC, Vinícius Zavam
no flags Details | Diff
Enforce the use of ${DESTDIR} during world distribution; r305890. (1.77 KB, patch)
2016-09-16 18:35 UTC, Vinícius Zavam
no flags Details | Diff
Enforce the use of ${DESTDIR} during world distribution; r308747 (1.77 KB, patch)
2016-11-17 17:47 UTC, Vinícius Zavam
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vinícius Zavam freebsd_committer freebsd_triage 2016-08-04 01:48:16 UTC
Created attachment 173260 [details]
Enforce the use of ${DESTDIR} during world distribution.

After a complete 'buildworld' build, if DESTDIR is set to any other (existing) directory, it fails to 'distributeworld'. Attached patch proposes a solution.

root@box:/usr/src # svn info
Path: .
Working Copy Root Path: /usr/src
URL: svn://svnmir.geo.freebsd.org/base/head
Relative URL: ^/head
Repository Root: svn://svnmir.geo.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 303717
Node Kind: directory
Schedule: normal
Last Changed Author: des
Last Changed Rev: 303716
Last Changed Date: 2016-08-03 13:08:21 -0300 (Wed, 03 Aug 2016)

root@box:/usr/src # mkdir -p /freebsd/12.0-current/mydestdir

root@box:/usr/src # make -s distributeworld DESTDIR="/freebsd/12.0-current/mydestdir"

    (...)

--------------------------------------------------------------
>>> Distributing everything
--------------------------------------------------------------
===> lib (distribute)
===> lib/csu (distribute)
===> lib/csu/amd64 (distribute)
install: target directory `/base/usr/lib/' does not exist
usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 file2
       install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 ... fileN directory
       install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               directory ...
*** Error code 64

Stop.
make[7]: stopped in /usr/src/lib/csu/amd64
*** Error code 1

Stop.
make[6]: stopped in /usr/src/lib/csu/amd64
*** Error code 1

Stop.
make[5]: stopped in /usr/src/lib/csu
*** Error code 1

Stop.
make[4]: stopped in /usr/src/lib
*** Error code 1

Stop.
make[3]: stopped in /usr/src
*** Error code 1

Stop.
make[2]: stopped in /usr/src
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src

root@box:/usr/src # svn patch ~egypcio/freebsd/base.HEAD.r303717.patch
U         Makefile.inc1
U         etc/Makefile
U         share/mk/bsd.subdir.mk

root@box:/usr/src # make -s distributeworld DESTDIR="/freebsd/12.0-current/mydestdir"
mkdir: /freebsd/12.0-current/mydestdir//doc: File exists
*** Error code 1 (ignored)
mkdir: /freebsd/12.0-current/mydestdir//lib32: File exists
*** Error code 1 (ignored)
mkdir: /freebsd/12.0-current/mydestdir//base: File exists
*** Error code 1 (ignored)
--------------------------------------------------------------
>>> Distributing everything
--------------------------------------------------------------

    (...)

===> libssl (distribute)
===> libssh (distribute)
===> libasn1 (distribute)
===> libgssapi_krb5 (distribute)
===> libgssapi_ntlm (distribute)
===> libgssapi_spnego (distribute)
===> libhdb (distribute)
===> libheimntlm (distribute)
===> libhx509 (distribute)
===> libkadm5clnt (distribute)
===> libkadm5srv (distribute)
===> libkrb5 (distribute)
===> libroken (distribute)
===> libsl (distribute)
===> libvers (distribute)
===> libkdc (distribute)
===> libwind (distribute)
===> libheimbase (distribute)
===> libheimipcc (distribute)
===> libheimipcs (distribute)
===> libkafs5 (distribute)

root@box:/usr/src # echo $?
0

root@box:/usr/src # uname -ai
FreeBSD box 12.0-CURRENT FreeBSD 12.0-CURRENT #2 r303717: Wed Aug  3 15:18:06 BRT 2016     root@box:/usr/obj/usr/src/sys/BOX  amd64 GENERIC-NODEBUG
Comment 1 Vinícius Zavam freebsd_committer freebsd_triage 2016-09-16 18:35:22 UTC
Created attachment 174857 [details]
Enforce the use of ${DESTDIR} during world distribution; r305890.

Patch update to handle HEAD, r305890.

M Makefile.inc1 (Last Changed Rev: 305256)
M etc/Makefile (Last Changed Rev: 301553)
M share/mk/bsd.subdir.mk (Last Changed Rev: 305670)
Comment 2 Vinícius Zavam freebsd_committer freebsd_triage 2016-10-07 19:03:51 UTC
Still working patch.

# uname -ai
FreeBSD box 12.0-CURRENT FreeBSD 12.0-CURRENT #9 r306748: Thu Oct  6 00:50:33 BRT 2016     root@box:/usr/obj/usr/src/sys/BOX  amd64 GENERIC-NODEBUG

# svn info /usr/src
Path: /usr/src
Working Copy Root Path: /usr/src
URL: svn://svnmir.geo.freebsd.org/base/head
Relative URL: ^/head
Repository Root: svn://svnmir.geo.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 306813
Node Kind: directory
Schedule: normal
Last Changed Author: oshogbo
Last Changed Rev: 306813
Last Changed Date: 2016-10-07 14:56:57 -0300 (Fri, 07 Oct 2016)

# cd /usr/src
# svn patch /tmp/pr211564.patch_r305890
U         Makefile.inc1
U         etc/Makefile
U         share/mk/bsd.subdir.mk

Feedback appreciated. IMHO ports like poudriere, iocage, ezjail, cbsd, and bsdploy can get more comfy world distribution (also counting on a cross compiled base system for arm, i386, and/or mips).
Comment 3 Vinícius Zavam freebsd_committer freebsd_triage 2016-11-17 17:47:15 UTC
Created attachment 177121 [details]
Enforce the use of ${DESTDIR} during world distribution; r308747

Patch updated to work on r308747. Obsoletes last one :)

root@mandanudes:/usr/src # make -s buildworld

	...

--------------------------------------------------------------
>>> World build completed on Thu Nov 17 11:20:57 BRT 2016
--------------------------------------------------------------

root@mandanudes:/usr/src # mkdir -p /freebsd/12.0-current/r308747

root@mandanudes:/usr/src # make -s distributeworld DESTDIR="/freebsd/12.0-current/r308747"

	...

--------------------------------------------------------------
>>> Distributing everything
--------------------------------------------------------------
===> lib (distribute)
===> lib/csu (distribute)
===> lib/csu/amd64 (distribute)
install: target directory `/base/usr/lib/' does not exist
usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 file2
       install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 ... fileN directory
       install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               directory ...
*** Error code 64

Stop.
make[7]: stopped in /usr/src/lib/csu/amd64
*** Error code 1

Stop.
make[6]: stopped in /usr/src/lib/csu/amd64
*** Error code 1

Stop.
make[5]: stopped in /usr/src/lib/csu
*** Error code 1

Stop.
make[4]: stopped in /usr/src/lib
*** Error code 1

Stop.
make[3]: stopped in /usr/src
*** Error code 1

Stop.
make[2]: stopped in /usr/src
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src

root@mandanudes:/usr/src # svn patch /root/bug211564.r308747.patch 
U         Makefile.inc1
U         etc/Makefile
U         share/mk/bsd.subdir.mk

mkdir: /freebsd/12.0-current/r308747//doc: File exists
*** Error code 1 (ignored)
mkdir: /freebsd/12.0-current/r308747//lib32: File exists
*** Error code 1 (ignored)
mkdir: /freebsd/12.0-current/r308747//base: File exists
*** Error code 1 (ignored)
--------------------------------------------------------------
>>> Distributing everything
--------------------------------------------------------------
===> lib (distribute)
===> lib/csu (distribute)
===> lib/csu/amd64 (distribute)
===> lib/libcompiler_rt (distribute)
===> lib/libc (distribute)

	...

===> libvers (distribute)
===> libkdc (distribute)
===> libwind (distribute)
===> libheimbase (distribute)
===> libheimipcc (distribute)
===> libheimipcs (distribute)
===> libkafs5 (distribute)

root@mandanudes:/usr/src # ls -l /freebsd/12.0-current/r308747
total 10
drwxr-xr-x  17 root  wheel  21 Nov 17 14:36 base
drwxr-xr-x   3 root  wheel   3 Nov 17 14:36 doc
drwxr-xr-x   4 root  wheel   4 Nov 17 14:36 lib32

root@mandanudes:/usr/src # du -sh /freebsd/12.0-current/r308747
494M    /freebsd/12.0-current/r308747
Comment 4 Vinícius Zavam freebsd_committer freebsd_triage 2017-05-02 08:09:17 UTC
I would like to report it as working!

A "FreeBSD-12.0-CURRENT-amd64-20170420-r317181" jail was used to test it again;

root@host:~ # fetch ftp://ftp.geo.freebsd.org/pub/FreeBSD/snapshots/amd64/amd64/12.0-CURRENT/base.txz
root@host:~ # fetch ftp://ftp.geo.freebsd.org/pub/FreeBSD/snapshots/amd64/amd64/12.0-CURRENT/lib32.txz
root@host:~ # fetch ftp://ftp.geo.freebsd.org/pub/FreeBSD/snapshots/amd64/amd64/12.0-CURRENT/src.txz
root@host:~ # mkdir -p /builder/mandanudes
root@host:~ # tar --unlink -xJpf base.txz -C /builder/mandanudes
root@host:~ # tar --unlink -xJpf lib32.txz -C /builder/mandanudes
root@host:~ # tar --unlink -xJpf src.txz -C /builder/mandanudes
root@host:~ # mount -t devfs devfs /builder/mandanudes/dev
root@host:~ # jail -cmr exec.clean allow.chflags=1 path=/builder/mandanudes host.hostname=mandanudes.hue.com.br command=/bin/sh

# make -s -C /usr/src -j16 buildworld
# make -s -C /usr/src -j16 buildkernel
# mkdir /mydist
# make -s -C /usr/src -j16 distributeworld DISTDIR=/mydist
# make -s -C /usr/src -j16 distributekernel DISTDIR=/mydist
# make -s -C /usr/src -j16 packageworld DISTDIR=/mydist
# make -s -C /usr/src -j16 packagekernel DISTDIR=/mydist

# ls -1 /builder/mandanudes/mydist
base
base-dbg.txz
base.txz
doc
doc.txz
kernel
kernel-dbg.txz
kernel.txz
lib32
lib32-dbg.txz
lib32.txz
tests
tests.txz

NOTE: The targets can't be lined up; they must be executed separated (as above).

# mkdir /mydist
# make -s -C /usr/src buildworld buildkernel distributeworld distributekernel packageworld packagekernel DISTDIR=/mydist

make[1]: "/usr/src/Makefile.inc1" line 160: SYSTEM_COMPILER: Determined that CC=cc matches the source tree.  Not bootstrapping a cross-compiler.
cd: //mydist/base: No such file or directory
--- packageworld ---
*** [packageworld] Error code 2

make[1]: stopped in /usr/src
1 error

make[1]: stopped in /usr/src
--- packageworld ---
*** [packageworld] Error code 2

make: stopped in /usr/src
A failure has been detected in another branch of the parallel make

make[1]: stopped in /usr/src
--- buildworld ---
*** [buildworld] Error code 2

make: stopped in /usr/src
A failure has been detected in another branch of the parallel make

make[1]: stopped in /usr/src
--- distributekernel ---
*** [distributekernel] Error code 2

make: stopped in /usr/src
A failure has been detected in another branch of the parallel make

make[1]: stopped in /usr/src
--- packagekernel ---
*** [packagekernel] Error code 2

make: stopped in /usr/src
4 errors

make: stopped in /usr/src