Jump to content
Forums in Read-Only Mode - Please use Reddit ×

Recommended Posts

If I'm understanding the Metro build process correctly, the profile configured in build.conf is sourced from the portage snapshot, and not the build computer.

 

If that is so, is there a way to insert a profile into metro, like gentoo:funtoo/1.0/linux-musl

 

I have a cut down funtoo profile for musl , just arch (x86_64) / build (current) / flavor (minimal) , and a build env setup, using the new gentoo musl stage3 just posted, with metro installed.

 

I can build a normal gentoo:funtoo/1.0/linux-gnu stage3, but not anything from gentoo:base because of the arch / build / flavor requirements of metro. So I can't use a gentoo:hardened/linux/musl/ profile.

 

By the way, Daniel, and everyone else who worked to get this site backup and running, you guys are awe inspiring, thanks for the hard work rebuilding the site. Amazing job...

 

Link to comment
Share on other sites

I figured out how to inject a linux-musl profile into metro.

I edited the unpack.spec and added a section to copy the linux-gnu profile to linux-musl, and sed / echoed the files a bit.

 

But alas the feeder profile is still a x86_64-pc-linux-gnu so glibc is still there and metro hit me with insanity and double insanity warnings.

 

It will emerge --oneshot emerge and compile python. But crashes with unresolved conflicts with glibc when it tries to emerge world.

 

I also tried the x86_64-gentoo-linux-musl stage3 in a chroot with the above changes to metro unpack.spec, but the problem is the same.

 

I think I have to hand build a stage3 to feed into metro.

Working that out now.

 

Attached is my hack of the unpack.spec

 

[collect ../snapshot/global.spec]

 

[section steps/unpack]

 

source: [

[ ! -d $[path/chroot] ] && install -d $[path/chroot]

[ ! -d $[path/chroot]/tmp ] && install -d $[path/chroot]/tmp --mode=1777 || exit 2

src="$(ls $[path/mirror/source])"

comp="${src##*.}"

 

[ ! -e "$src" ] && echo "Source file $src not found, exiting." && exit 1

echo "Extracting source stage $src..."

 

case "$comp" in

bz2)

if [ -e /usr/bin/pbzip2 ]

then

# Use pbzip2 for multi-core acceleration

pbzip2 -dc "$src" | tar xpf - -C $[path/chroot] || exit 3

else

tar xpf "$src" -C $[path/chroot] || exit 3

fi

;;

gz|xz)

tar xpf "$src" -C $[path/chroot] || exit 3

;;

*)

echo "Unrecognized source compression for $src"

exit 1

;;

esac

]

 

snapshot: [

snap="$(ls $[path/mirror/snapshot] )"

 

[ ! -e "$snap" ] && echo "Required file $snap not found. Exiting" && exit 3

 

scomp="${snap##*.}"

 

[ ! -d $[path/chroot]/usr/portage ] && install -d $[path/chroot]/usr/portage --mode=0755

 

echo "Extracting portage snapshot $snap..."

 

case "$scomp" in

bz2)

if [ -e /usr/bin/pbzip2 ]

then

pbzip2 -dc "$snap" | tar xpf - -C $[path/chroot]/usr || exit 4

else

tar xpf  "$snap" -C $[path/chroot]/usr || exit 4

fi

;;

gz|xz)

tar xpf "$snap" -C $[path/chroot]/usr || exit 4

;;

*)

echo "Unrecognized source compression for $snap"

exit 1

;;

esac

 

# support for "live" git snapshot tarballs:

if [ -e $[path/chroot]/usr/portage/.git ]

then

( cd $[path/chroot]/usr/portage; git checkout $[snapshot/source/branch:lax] || exit 50 )

fi

           

echo "################## injecting musl profile ##################"

echo Unmasking musl in gentoo base

sed -i 's/sys-libs\/musl/#sys-libs\/musl/' $[path/chroot]/usr/portage/profiles/base/package.mask

 

echo Creating $[path/chroot]/funtoo/1.0/linux-musl profile in Metro stage3

#

# create the linux-musl dir and cp the default linux-gnu into it

cd $[path/chroot]/usr/portage/profiles/funtoo/1.0/linux-gnu/

install -d $[path/chroot]/usr/portage/profiles/funtoo/1.0/linux-musl

cp -r * $[path/chroot]/usr/portage/profiles/funtoo/1.0/linux-musl

 

# Enter new dir

cd $[path/chroot]/usr/portage/profiles/funtoo/1.0/linux-musl

 

echo cleaning profile $[path/chroot]/funtoo/1.0/linux-musl profile

    # remove untested arch

        rm -Rf arch/arm-32bit

        rm -Rf arch/pure64

        rm -Rf arch/x86-32bit

 

    # remove build experimental

        rm -Rf build/experimental

 

    # remove untested flavors

        rm -Rf flavor/desktop

        rm -Rf flavor/workstation

 

    # remove mix-ins (building for core / minimal only)

        rm -Rf mix-ins

 

##### Settings

##### All Changes are relative to /usr/portage/profiles/funtoo/1.0

 

# Changes in linux-musl

    # make.defaults

    sed -i 's/glibc/musl/' make.defaults

    sed -i 's/elibc_glibc/elibc_musl/' make.defaults

    echo 'USE="\${USE} static-libs"' >> make.defaults

    echo 'USE="\${USE} -multilib -selinux -hardened -systemtd -pam -glibc"' >> make.defaults

    # use.force

    sed -i 's/elibc_glibc/elibc_musl/' use.force

 

    # x86-64bit {DIR}

 

        # make.defaults

        sed -i 's/x86_64-pc-linux-gnu/x86_64-pc-linux-musl/g' arch/x86-64bit/make.defaults

        sed -i 's/STAGE1_USE="multilib nptl nptlonly unicode"/STAGE1_USE="nptl nptlonly unicode"/g' arch/x86-64bit/make.defaults

        # package.use.force

            # none

        # parent

            # none

        # use.force

            sed -i 's/multilib/#multilib/g' arch/x86-64bit/use.force

           

        # package.use.mask {DIR}

            # 01-gentoo

                # none

            # 02-gentoo

                # none

            # cpu-features

                # none

            # app-emulation

                # none

 

        # use.mask {DIR}

            # 01-gentoo

                # none

            # core

                # none

            # cpu-features

                # none

            # hardware

                # none

 

    # build {DIR}

        # current {DIR}

            # eapi

                # none

            # make.defaults

                # none

            # package.mask

                # none

 

        # stable {DIR}

            # eapi

                # none

            # make.defaults

            # none

            # README

            # none

 

            # package.keywords {DIR}

                # funtoo-stable

                    # none

                # package.mask {DIR}

                    # funtoo

                        # none

                # package.unmask {DIR}

                    # funtoo-stable

                        # none

                # package.use.stable.mask {DIR}

                    # 01-gentoo

                        # none

 

    # flavor {DIR}

        # core {DIR}

            # make.defaults

                # none

            # package.use

                # none

            # parent

                # none

 

        # hardened {DIR}

            # parent

                # none

 

        # minimal {DIR}

            # make.defaults

                # none

            # package.use.force

                # none

            # package.use.mask

                # none

            # packages

                sed -i 's/*virtual/libc//' flavor/minimal/packages

                echo "*sys-apps/getent" >> flavor/minimal/packages

                echo "*sys-libs/musl" >> flavor/minimal/packages

            # packages.build

                sed -i 's/virtual/libc//' flavor/minimal/packages

                echo "sys-apps/getent" >> flavor/minimal/packages.build

                echo "sys-libs/musl" >> flavor/minimal/packages.build

            # profile.bashrc

                # none

 

        # server {DIR}

            # parent

                # none

 

    # package.use {DIR}

        # cherokee

            # none

        # gentoo-syntax

            # noneone

        # python

            # none

 

    # package.use.force {DIR}

        # funtoo-use-force

            # none

 

    # package.use.mask {DIR}

        # .keep

            # none

        # 01-gentoo

            # none

        # funtoo-use-mask

            # none

 

    # use.mask {DIR}

        # .keep

            # none

        # 01-gentoo

            # none

echo "################## injecting musl profile ##################"

]

 

 

            

env: [

install -d $[path/chroot]/etc/portage

if [ "$[profile/format]" = "new" ]; then

cat << "EOF" > $[path/chroot]/etc/portage/make.conf || exit 5

$[[files/make.conf.newprofile]]

EOF

else

cat << "EOF" > $[path/chroot]/etc/portage/make.conf || exit 5

$[[files/make.conf.oldprofile]]

EOF

fi

cat << "EOF" > $[path/chroot]/etc/env.d/99zzmetro || exit 6

$[[files/proxyenv]]

EOF

cat << "EOF" > $[path/chroot]/etc/locale.gen || exit 7

$[[files/locale.gen]]

EOF

for f in /etc/resolv.conf /etc/hosts

do

if [ -e $f ]

then

respath=$[path/chroot]$f

if [ -e $respath ]

then

echo "Backing up $respath..."

cp $respath ${respath}.orig

if [ $? -ne 0 ]

then

echo "couldn't back up $respath" && exit 8

fi

fi

echo "Copying $f to $respath..."

cp $f $respath

if [ $? -ne 0 ]

then

echo "couldn't copy $f into place"

exit 9

fi

fi

done

]

Link to comment
Share on other sites

I think maybe a tuple setting, or a option for a profile will be nice.

 

I'm still learning this stuff, and my coding skills are rough, but I will try to hack out a profile.spec to be called by metro. But it needs to be run between portage untar / emerge --sync and chroot.

 

Generally speaking, I'm going to base any profiles that are injected to metro on the existing up stream linux-gnu profile, and mod that until I can get a working stage3 tested and create a proper linux-musl, before I do any submissions, including a profiles.eselect.desc. Currently just concentrating on arch / current / minimal.

 

But I'm still trying to build a stage3 for musl, so I can work out the kinks.

The tools are there, just the working out the hacks that will successfully create it, and then, I will write the scripts that I used to create it, and help the best that I can to integrate it into funtoo are a whole.

 

Anyone have a working uclibc funtoo stage3?

That might be easier to build a musl stage3 on than a glibc stage3.

 

 

Link to comment
Share on other sites

×
×
  • Create New...