sabotage
sabotage copied to clipboard
Installing into / instead of /opt
I read somewhere, someone asking this question, maybe it was on the mail-list. The reply was, yes, it can be done. Is that still the case? If If so, for the default set to install into /, what variable would I have to change? Perhaps some recipes are hard-coded to install into /opt? -- when I first started writing recipes, I am guilty of that. But then, that should be ok, some packages can be installed into /opt, even though the default is /.
Just an extra note: I wrote some code that converts all of the symlinks into /opt, to hard-links. And symlinks-to-symlinks changed to symlink to the local hard-link -- for example /bin/ls was a symlink to /opt/busybox/bin/ls, now becomes symlink to /bin/busybox. The result is faster operation, smaller size (as hard-links are smaller than symlinks), and looking at the file with a graphical file manager, it looks like a normal filesystem, instead of a window full of symlinks.
In fact, after doing that, most of /opt can be deleted, if desired for any reason. Although there is /opt/busybox/bin/busybox and /bin/busybox, they are hard-links to the same inode, the same file, and deleting one of them does not delete the file. Both hard-links have to be deleted.
...this is actually a very roundabout way of ending up with a "normal" filesystem, with most pkgs in /.
In KEEP/butch_template_configure_cached.txt, there is this line:
butch_do_custom_destdir=true
If I was to change that to "false", it sets:
butch_install_dir=""
butch_do_relocate=false
That looks like it. I was wondering though, if that variable butch_do_custom_destdir could be made available in the 'config' file, and in KEEP/butch_template_configure_cached.txt have a test:
[ -z butch_do_custom_destdir ] && butch_do_custom_destdir=true
Would that be do-able, or is there more to it?
The result is faster operation, smaller size (as hard-links are smaller than symlinks)
do you have any comparison results, or is this just a "feeling" ?
Would that be do-able, or is there more to it?
yes, that is the intended way. it was never tested though so there may be some gotchas (or packages with hardcoded assumptions) that would need to be fixed, however i think those should be easy to fix and few of them.
There were some posts that I read on the old mail-list, that quantified the speed penalty of Sabotage's symlinks, though it was commented that it would not be noticeable. With hard-links, there is no speed penalty at all, there is no link to follow. A hard link is the actual file.
A hard-link is just a directory entry, whereas a soft link has its own inode. Meaning that the hard link is smaller.
More explanation here: http://www.geekride.com/hard-link-vs-soft-link/
Regarding the installing to /, I'll give it a go, see what recipes give trouble.
i pushed a commit that makes butch_do_custom_destdir overridable, so you can play with it: https://github.com/sabotage-linux/sabotage/commit/23ecfa37e0ce967899582e18e46e61e8cb13dbc7 . the commit message mentions another approach that could be preferable.
i pushed a commit that makes butch_do_custom_destdir overridable, so you can play with it: 23ecfa3 .
Why have you removed this line, in the case of butch_do_custom_destdir=false:
butch_do_relocate=false
Wouldn't it have to be set to either true or false, for later tests?
the variable will never be used when butch_do_custom_destdir is false due to the early exit i added (before echo "post buildscript phase...")
Trying it now, with "export butch_do_custom_destdir=false" in config , running "./build-stage0":
2016-05-25 07:28:22 downloading gcc3 (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/dl_gcc3.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/dl_gcc3.log
2016-05-25 07:28:24 building gcc3 (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/build_gcc3.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/build_gcc3.log
2016-05-25 07:31:01 building stage0-gcc (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/build_stage0-gcc.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/build_stage0-gcc.log
2016-05-25 07:31:05 building sabotage-core (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/build_sabotage-core.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/build_sabotage-core.log
2016-05-25 07:31:09 WARNING: sabotage-core failed to build! wait for other jobs to finish.
It isn't flagging an error, but build_gcc3.log has this at the end:
make[1]: Leaving directory '/mnt/sdb5/projects/bk-sabotage_builddir/src/build/gcc3/gcc-3.4.6/gcc'
mv: target ‘lib/’ is not a directory
Wed May 25 07:31:01 GMT-8 2016: end build
build_sabotage-core.log has this:
Wed May 25 07:31:09 GMT-8 2016: start
Wed May 25 07:31:09 GMT-8 2016: sourcing user defined optimization config /mnt/sdb5/projects/bk-sabotage_builddir/etc/butch-optflags.sh
Wed May 25 07:31:09 GMT-8 2016: start build
cp: cannot create directory ‘’: No such file or directory
I inserted a line into sabotage-core recipe:
[build]
dest="$butch_install_dir""$butch_prefix"
for i in "$K"/bin/*; do
install -Dm 755 "$i" "$dest"/bin/$(basename "$i")
done
[ -z "$dest" ] && dest=/
cp -rf "$K"/share "$dest"
Getting a bit further this time:
2016-05-25 07:51:45 downloading gcc3 (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/dl_gcc3.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/dl_gcc3.log
2016-05-25 07:51:46 building gcc3 (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/build_gcc3.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/build_gcc3.log
2016-05-25 07:54:06 building stage0-gcc (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/build_stage0-gcc.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/build_stage0-gcc.log
2016-05-25 07:54:10 building sabotage-core (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/build_sabotage-core.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/build_sabotage-core.log
2016-05-25 07:54:14 building services (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/build_services.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/build_services.log
2016-05-25 07:51:46 downloading stage0-musl (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/dl_stage0-musl.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/dl_stage0-musl.log
2016-05-25 07:54:18 building stage0-musl (/mnt/sdb5/projects/bk-sabotage_builddir/src/build/build_stage0-musl.sh) -> /mnt/sdb5/projects/bk-sabotage_builddir/src/logs/build_stage0-musl.log
2016-05-25 07:54:22 WARNING: stage0-musl failed to build! wait for other jobs to finish.
build_stage0-musl.log has this:
Wed May 25 07:54:22 GMT-8 2016: start
Wed May 25 07:54:22 GMT-8 2016: sourcing user defined optimization config /mnt/sdb5/projects/bk-sabotage_builddir/etc/butch-optflags.sh
Wed May 25 07:54:22 GMT-8 2016: starting to untar
Wed May 25 07:54:22 GMT-8 2016: untar done
Wed May 25 07:54:22 GMT-8 2016: start build
patching file src/regex/regcomp.c
checking for C compiler... /mnt/sdb5/projects/bk-sabotage_builddir/bin/gcc
checking whether C compiler works... no; compiler output follows:
./configure: line 228: /mnt/sdb5/projects/bk-sabotage_builddir/bin/gcc: No such file or directory
So, the problem goes back to gcc3.
It looks like recipe for gcc3 needs this also inserted near the end:
[ -z "$dest" ] && dest=/
This problem might come up frequently. I'll try something else:
butch_install_dir=/
I know, it creates paths like "//lib", not nice.
OK, running "./build-stage0", with "butch_install_dir=/" in butch_template_configure_cached.txt.
No, stage0-musl fails with the same error. gcc has failed moves, like this:
mv: ‘//lib64/udev’ and ‘/lib/udev’ are the same file
In butch_template_configure_cached.txt, perhaps it is more logical to leave:
butch_install_dir=
and instead change this line further down:
#[ "$butch_prefix" = "/" ] && butch_prefix=
if $butch_do_custom_destdir ; then butch_prefix= ; fi
...no, that's not right either, it is going to end up with lots of "make DESTDIR= install"
Got it! I made what seems to me to be a very logical change to butch_template-configure_cached.txt: https://github.com/bkauler/sabotage/commit/de2eed892f18f58e7b75a4d01699510d8f8a1745
...I don't know how to submit a pull request for an individual commit!
Running "./build-stage0", it still fails, but gets much further. Success with gcc3, stage0-gcc, sabotage-core, services, stage0-musl, but jobflow failed.
Unfortunately, I have other things to do right now, will get back to this in the afternoon.
I am able to get back on my computer for a short time, looking why jobflow failed:
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc: line 4: /mnt/sdb5/projects/bk-sabotage_builddir/bin/../../../bin/rawcc: No such file or directory
$R/bin/musl-gcc has this in it:
#!/bin/sh
self=`readlink -f "$0"`
selfdir=`dirname "$self"`/../../../bin
exec "$selfdir/rawcc" "$@" -specs "$selfdir/../lib/musl-gcc.specs"
What generates that file? It isn't what is supposed to be there. The recipe for musl copies $K/musl-gcc to $R/bin, which is a very different file.
Looking at build_jobflow.log, it seems to start off executing musl-gcc ok:
Wed May 25 09:25:22 GMT-8 2016: start build
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptr/stringptr_fromchar.o libulz/include/../src/stringptr/stringptr_fromchar.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptr/stringptr_eq.o libulz/include/../src/stringptr/stringptr_eq.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptr/stringptr_tofile.o libulz/include/../src/stringptr/stringptr_tofile.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o jobflow.o jobflow.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/filelib/getfilesize.o libulz/include/../src/filelib/getfilesize.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/optparser/op_init.o libulz/include/../src/optparser/op_init.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/sblist/sblist.o libulz/include/../src/sblist/sblist.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptr/stringptr_here.o libulz/include/../src/stringptr/stringptr_here.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/strlib/uint64ToString.o libulz/include/../src/strlib/uint64ToString.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptr/stringptr_fromfile.o libulz/include/../src/stringptr/stringptr_fromfile.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/strlib/ulz_snprintf.o libulz/include/../src/strlib/ulz_snprintf.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptr/stringptr_shiftleft.o libulz/include/../src/stringptr/stringptr_shiftleft.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/strlib/ulz_vsnprintf.o libulz/include/../src/strlib/ulz_vsnprintf.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/strlib/conv_cypher.o libulz/include/../src/strlib/conv_cypher.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/strlib/isNumber.o libulz/include/../src/strlib/isNumber.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/filelib/ulz_mkdtemp.o libulz/include/../src/filelib/ulz_mkdtemp.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/filelib/mktempdir.o libulz/include/../src/filelib/mktempdir.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/strlib/numberToString.o libulz/include/../src/strlib/numberToString.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptr/stringptr_new.o libulz/include/../src/stringptr/stringptr_new.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptr/stringptr_rchr.o libulz/include/../src/stringptr/stringptr_rchr.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptr/stringptr_chomp.o libulz/include/../src/stringptr/stringptr_chomp.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/optparser/op_get.o libulz/include/../src/optparser/op_get.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/timelib/mspassed.o libulz/include/../src/timelib/mspassed.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/timelib/msleep.o libulz/include/../src/timelib/msleep.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/stringptrlist/stringptr_splitc.o libulz/include/../src/stringptrlist/stringptr_splitc.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/optparser/op_hasflag.o libulz/include/../src/optparser/op_hasflag.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc -Wall -D_GNU_SOURCE -std=c99 -fdata-sections -ffunction-sections -Os -g0 -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -c -o libulz/include/../src/timelib/gettimestamp.o libulz/include/../src/timelib/gettimestamp.c
/mnt/sdb5/projects/bk-sabotage_builddir/bin/musl-gcc: line 4: /mnt/sdb5/projects/bk-sabotage_builddir/bin/../../../bin/rawcc: No such file or directory
Makefile:51: recipe for target 'libulz/include/../src/stringptr/stringptr_eq.o' failed
make: *** [libulz/include/../src/stringptr/stringptr_eq.o] Error 127
...then musl-gcc self-destructs.
OK, found the cause. Recipe stage0-musl is assuming installation of musl is in /opt. What confused me, is $R/bin/musl-gcc seeming to have the wrong content -- but it is different in stage0 than later.
I have modified recipe stage0-musl, running "./build-stage0" now...
Yes, another one bites the dust! build-stage0 has now completed with zero errors. Two more commits: https://github.com/bkauler/sabotage/commit/add1be727bec093330c23296fe5fe81fcd1d7e09 https://github.com/bkauler/sabotage/commit/aab416a399deddb64ba9c158d7fa3e90f4ca4dd2
I still haven't figured out how to submit to you a pull request for my individual commits. Can't see anything in the github GUI for doing that.
There is a show-stopper in stage1. The 'config' file worked in stage0, I had this in it:
export butch_do_custom_destdir=false
However, that doesn't carry over to the 'config' file in the build directory. Whereabouts is that 'config' file created?
Ah ha! Have nailed that bug too. Stage1 should compile and install correctly now. Testing...
Yep, packages in stage1 now installing correctly. Here is my fix: https://github.com/bkauler/sabotage/commit/007e35dc217d3af312b98bacfbe7b50d8757cf7d
Yikes! The recipe for kbd wiped out the entire /bin directory. Have fixed it, have to start again from the beginning...
OK, kbd has compiled, stage1 completed zero errors. Here is the fix for kbd: https://github.com/bkauler/sabotage/commit/593d445b7946a99650402349cba315f02c6d68f3
There is a problem though. Previously, only a cut-down "slitaz_set" was installed. Now, we have the whole lot.
Ha ha, have finished compiling stage1, all is well, except I just noticed folder $R/x86_64-unknown-linux-gnu. That would be a gcc thing? Where is it supposed to go? Packages are still compiling with it there.
$R/x86_64-unknown-linux-gnu/bin has ar, as, ld, etc.
Compiled about 60 packages so far, looking good!
EDIT: Got through my entire build, 348 packages. A few more packages needed fixing, but superb, the vast majority handled installing into / The only problem is firefox, the very last package in my build. An error with "virtualenv". I'm looking into it.
Firefox is now compiling.
I installed my Sabotage build on a USB stick and booted it. Running great. I tried to build firefox, same broken virtualenv message. I thought that there is probably something wrong in the recipe for Python when installed to /, so I did a rebuild installing to /opt. Yep, that fixed it, firefox has been compiling away for the last hour -- really flogging my poor little flash stick.
I'm on another laptop right now, as the flash stick currently doesn't have a browser. Gets on the Internet OK though.
This has been an extremely interesting exercise. I wanted to build a host system from Sabotage, with everything installed to /. Then running in that host system, compile lots more packages, installed to /opt, and create binary tarballs. This is so others, running the same host system, can use the Puppy Package Manager to install them (instead of building from source with butch) -- but that's another topic. Lots of interesting ideas to play with.
I still haven't uploaded the latest package fixes.
EDIT: Fantastic, now running firefox on my flash stick!