Hello,

This is an initial kick on adding support for /System/Index to
ChrootCompile and Scripts. If one supplies a flag named '--new-names'
to ChrootCompile, the chroot environment is created with the
/System/Index hierarchy. When GoboPath is sourced and  directory with
that name is found in the rootfs, $goboVariables are automatically
exported according to that dir.

I decided to keep the legacy entries at /System/Links so that I could
use the existing base_dependencies (Glibc, GCC, ...) while trying to
compile GoboHide, which is an easier and faster package to recompile
than Glibc.

The patchset has been tested with GoboHide on a native compilation and
worked pretty well. The only problem I saw with it were leftovers from
unionfs inside some directories, such as  .wh.__dir_opaque, but that
can be easily fixed later.

Patches follow. Any comments are _greatly_ appreciated!

--
Lucas
powered by /dev/dsp
Index: bin/GoboPath
===================================================================
RCS file: /sources/goboscripts/tools/Scripts/bin/GoboPath,v
retrieving revision 1.11
diff -u -u -r1.11 GoboPath
--- bin/GoboPath	19 Dec 2006 21:19:33 -0000	1.11
+++ bin/GoboPath	8 Jan 2007 04:35:18 -0000
@@ -25,18 +25,34 @@
 
 export goboScripts=${goboPrograms}/Scripts/Current/bin
 
-export goboLinks=${goboSystem}/Links
-export goboVariable=${goboSystem}/Variable
-export goboSettings=${goboSystem}/Settings
+if [ -d ${goboSystem}/Index ]
+then
+   export goboIndex=${goboSystem}/Index
+   export goboExecutables=${goboIndex}/bin
+   export goboLibraries=${goboIndex}/lib
+   export goboHeaders=${goboIndex}/include
+   export goboShared=${goboIndex}/share
+   export goboManuals=${goboIndex}
+   export goboSettings=${goboIndex}/etc
+   export goboVariable=${goboIndex}/var
+
+   # backwards compatibility
+   export goboLinks=${goboSystem}/Index
+else
+   export goboLinks=${goboSystem}/Links
+   export goboExecutables=${goboLinks}/Executables
+   export goboLibraries=${goboLinks}/Libraries
+   export goboHeaders=${goboLinks}/Headers
+   export goboShared=${goboLinks}/Shared
+   export goboManuals=${goboLinks}/Manuals
+   export goboSettings=${goboSystem}/Settings
+   export goboVariable=${goboSystem}/Variable
+fi
+
 export goboKernel=${goboSystem}/Kernel
 
-export goboExecutables=${goboLinks}/Executables
 export goboDaemons=${goboLinks}/Daemons
 export goboTasks=${goboLinks}/Tasks
-export goboLibraries=${goboLinks}/Libraries
-export goboHeaders=${goboLinks}/Headers
-export goboManuals=${goboLinks}/Manuals
-export goboShared=${goboLinks}/Shared
 export goboEnvironment=${goboLinks}/Environment
 
 export goboTemp=${goboVariable}/tmp
Index: bin/PrepareProgram
===================================================================
RCS file: /sources/goboscripts/tools/Scripts/bin/PrepareProgram,v
retrieving revision 1.34
diff -u -u -r1.34 PrepareProgram
--- bin/PrepareProgram	29 Nov 2006 21:09:48 -0000	1.34
+++ bin/PrepareProgram	8 Jan 2007 04:35:18 -0000
@@ -219,6 +219,17 @@
 rm -f config.cache
 
 Exists "$configureprogram" || Die "configure script "`[ $configureprogram != "./configure" ] && echo " ($configureprogram) "`"not found."
+   
+if [ "$goboIndex" ]
+then
+   configureprefix="$goboIndex"
+   configuresettings="$goboSettings"
+   configurevariable="$goboVariable"
+else
+   configureprefix="$programdir"
+   configuresettings="$settingsdir"
+   configurevariable="$variabledir"
+fi
 
 if Boolean "no-default-options"
 then
@@ -227,9 +238,9 @@
 then
    Log_Normal "Autoconf configure script detected."
    configure_options=(
-      --prefix="$programdir"
-      --sysconfdir="$settingsdir"
-      --localstatedir="$variabledir"
+      --prefix="$configureprefix"
+      --sysconfdir="$configuresettings"
+      --localstatedir="$configurevariable"
    )
    if [ "$goboCrossCompiling" = "yes" ]
    then
@@ -247,7 +258,7 @@
 then
    Log_Normal "Non-autoconf configure script detected (accepts --prefix)."
    configure_options=(
-      --prefix="$programdir"
+      --prefix="$configureprefix"
    )
 else
    configure_options=()
Index: bin/SandboxInstall
===================================================================
RCS file: /sources/goboscripts/tools/Scripts/bin/SandboxInstall,v
retrieving revision 1.35
diff -u -u -r1.35 SandboxInstall
--- bin/SandboxInstall	7 Jan 2007 18:55:16 -0000	1.35
+++ bin/SandboxInstall	8 Jan 2007 04:35:18 -0000
@@ -159,6 +159,21 @@
    rm -f System/Kernel/Devices/null
    find -type d | xargs rmdir -p --ignore-fail-on-non-empty &> /dev/null
    Quiet popd
+   if [ -d $sandbox_rw/System/Index ]
+   then
+      Quiet pushd $sandbox_rw/System/Index
+      for dir in *
+      do
+         mkdir -p "$installPackageDir/$version/$dir"
+         if [ $dir = "etc" ]
+         then cp -a $dir/* "$default_settings/"
+         else cp -a $dir/* "$installPackageDir/$version/$dir"
+         fi
+      done
+      Quiet popd
+      rm -rf "$sandbox_rw/System/Index"
+      rmdir "$sandbox_rw/System" 2> /dev/null
+   fi
    leftovers=`(cd $sandbox_rw; find *) 2>/dev/null`
    [ "$leftovers" ] && {
       Log_Normal "Left over files:\n$leftovers"
Index: bin/ChrootCompile
===================================================================
RCS file: /sources/goboscripts/tools/ChrootCompile/bin/ChrootCompile,v
retrieving revision 1.33
diff -u -u -r1.33 ChrootCompile
--- bin/ChrootCompile	7 Jan 2007 19:02:56 -0000	1.33
+++ bin/ChrootCompile	8 Jan 2007 04:35:28 -0000
@@ -14,6 +14,7 @@
 scriptCredits="Copyright (C) 2005-2006 Hisham H. Muhammad. Released under the GNU GPL."
 Add_Option_Boolean "l" "local-repository" "Look at the local repository for recipes." ""
 Add_Option_Boolean "p" "local-programs" "Take entries from /Programs (use with care)." ""
+Add_Option_Boolean "n" "new-names" "Compile using new names from /System/Index hierarchy." ""
 Add_Option_Entry "X" "cross-compile" "Use a cross-compiler according to the configuration in Cross-<parameter>.conf." ""
 Add_Option_Entry "d" "use-directory" "Use specified directory as root for ChrootCompile." ""
 Parse_Options "$@"
@@ -55,7 +56,7 @@
 then
     arch_conf=`Entry "cross-compile"`
     crossopts="--cross-compile $arch_conf"
-    crossconf="/System/Settings/Compile/Cross/Cross-$arch_conf.conf"
+    crossconf="$goboSettings/Compile/Cross/Cross-$arch_conf.conf"
     [ ! -f $crossconf ] && Die "$crossconf: file not found."
 
     eval `cat $crossconf | grep "cross_prefix_dir=" | sed 's/"//g'`
@@ -221,18 +222,31 @@
    local prefix="$2"
    local rootdir="$1/$2"
    mkdir -p $rootdir
-   mkdir -p $rootdir/System/Links/Executables
+   if Boolean "new-names"
+   then
+      mkdir -p $rootdir/System/Index/bin
+      mkdir -p $rootdir/System/Index/sbin
+      mkdir -p $rootdir/System/Index/lib
+      mkdir -p $rootdir/System/Index/include
+      mkdir -p $rootdir/System/Index/share
+      mkdir -p $rootdir/System/Index/etc
+      mkdir -p $rootdir/System/Index/var
+      mkdir -p $rootdir/System/Index/var/tmp
+      mkdir -p $rootdir/System/Index/var/log
+      mkdir -p $rootdir/System/Index/var/lock
+   else
+      mkdir -p $rootdir/System/Links/Executables
+      mkdir -p $rootdir/System/Links/Libraries
+      mkdir -p $rootdir/System/Links/Headers
+      mkdir -p $rootdir/System/Links/Manuals
+      mkdir -p $rootdir/System/Links/Shared
+      mkdir -p $rootdir/System/Settings
+      mkdir -p $rootdir/System/Variable/tmp
+      mkdir -p $rootdir/System/Variable/log
+      mkdir -p $rootdir/System/Variable/lock
+   fi
    mkdir -p $rootdir/System/Links/Environment
-   mkdir -p $rootdir/System/Links/Libraries
-   mkdir -p $rootdir/System/Links/Headers
-   mkdir -p $rootdir/System/Links/Manuals
-   mkdir -p $rootdir/System/Links/Shared
    mkdir -p $rootdir/System/Links/Tasks
-   mkdir -p $rootdir/System/Settings
-   mkdir -p $rootdir/System/Variable
-   mkdir -p $rootdir/System/Variable/tmp
-   mkdir -p $rootdir/System/Variable/log
-   mkdir -p $rootdir/System/Variable/lock
    mkdir -p $rootdir/System/Kernel
    mkdir -p $rootdir/System/Kernel/Boot
    mkdir -p $rootdir/System/Kernel/Objects
@@ -254,21 +268,47 @@
    ln -nfs $prefix/System/Kernel/Objects $rootdir/sys
    ln -nfs $prefix/System/Kernel/Devices $rootdir/dev
    ln -nfs $prefix/System/Kernel/Status $rootdir/proc
-   ln -nfs $prefix/System/Variable $rootdir/var
-   ln -nfs $prefix/System/Variable/tmp $rootdir/tmp
-   ln -nfs $prefix/System/Links/Libraries $rootdir/lib
-   ln -nfs $prefix/System/Settings $rootdir/etc
-   ln -nfs $prefix/System/Links/Executables $rootdir/bin
-   ln -nfs $prefix/System/Links/Executables $rootdir/sbin
+
+   if Boolean "new-names"
+   then
+      ln -nfs $prefix/System/Index/var $rootdir/var
+      ln -nfs $prefix/System/Index/var/tmp $rootdir/tmp
+      ln -nfs $prefix/System/Index/lib $rootdir/lib
+      ln -nfs $prefix/System/Index/etc $rootdir/etc
+      ln -nfs $prefix/System/Index/bin $rootdir/bin
+      ln -nfs $prefix/System/Index/sbin $rootdir/sbin
+   
+      ln -nfs $prefix/System/Index/bin $rootdir/usr/bin
+      ln -nfs $prefix/System/Index/include $rootdir/usr/include
+      ln -nfs $prefix/System/Index/lib $rootdir/usr/lib
+      ln -nfs $prefix/System/Index/man $rootdir/usr/man
+      ln -nfs $prefix/System/Index/sbin $rootdir/usr/sbin
+      ln -nfs $prefix/System/Index/share $rootdir/usr/share
+
+      # compatibility links
+      ln -nfs $prefix/System/Index/bin $rootdir/System/Links/Executables
+      ln -nfs $prefix/System/Index/lib $rootdir/System/Links/Libraries
+      ln -nfs $prefix/System/Index/share $rootdir/System/Links/Shared
+      ln -nfs $prefix/System/Index/etc $rootdir/System/Settings
+      ln -nfs $prefix/System/Index/var $rootdir/System/Variable
+   else
+      ln -nfs $prefix/System/Variable $rootdir/var
+      ln -nfs $prefix/System/Variable/tmp $rootdir/tmp
+      ln -nfs $prefix/System/Links/Libraries $rootdir/lib
+      ln -nfs $prefix/System/Settings $rootdir/etc
+      ln -nfs $prefix/System/Links/Executables $rootdir/bin
+      ln -nfs $prefix/System/Links/Executables $rootdir/sbin
+   
+      ln -nfs $prefix/System/Links/Executables $rootdir/usr/bin
+      ln -nfs $prefix/System/Links/Headers $rootdir/usr/include
+      ln -nfs $prefix/System/Links/Libraries $rootdir/usr/lib
+      ln -nfs $prefix/System/Links/Manuals $rootdir/usr/man
+      ln -nfs $prefix/System/Links/Executables $rootdir/usr/sbin
+      ln -nfs $prefix/System/Links/Shared $rootdir/usr/share
+   fi
 
    ln -nfs . $rootdir/usr/X11R6
    ln -nfs . $rootdir/usr/local
-   ln -nfs $prefix/System/Links/Executables $rootdir/usr/bin
-   ln -nfs $prefix/System/Links/Headers $rootdir/usr/include
-   ln -nfs $prefix/System/Links/Libraries $rootdir/usr/lib
-   ln -nfs $prefix/System/Links/Manuals $rootdir/usr/man
-   ln -nfs $prefix/System/Links/Executables $rootdir/usr/sbin
-   ln -nfs $prefix/System/Links/Shared $rootdir/usr/share
 
    if [ ! -z "$prefix" ]
    then
@@ -278,11 +318,21 @@
        # these are needed by Compile and need to point to chrootcompile's rootfs;
        # note that at run time /System/Settings represents chrootcompile's Scripts
        # version and not the one from the host
-       ln -s /System/Settings/Compile $rootdir/System/Settings/
-       ln -s /System/Settings/Scripts $rootdir/System/Settings/
+       if Boolean "new-names"
+       then
+          ln -s /System/Index/etc/Compile $rootdir/System/Index/etc/
+          ln -s /System/Index/etc/Scripts $rootdir/System/Index/etc/
+       else
+          ln -s /System/Settings/Compile $rootdir/System/Settings/
+          ln -s /System/Settings/Scripts $rootdir/System/Settings/
+      fi
    fi
 
-   chmod 777 $rootdir/System/Variable/tmp # Fibo also wants to write temp files
+   # Fibo also wants to write temp files
+   if Boolean "new-names"
+   then chmod 777 $rootdir/System/Index/var/tmp
+   else chmod 777 $rootdir/System/Variable/tmp
+   fi
 }
 
 create_root $root
@@ -415,7 +465,9 @@
    then params=""
    else params=$crossprefixdir
    fi
-   $sudo MiniInstallPackage $realcopy $verbose "$unpacked" "$root" $params
+   unset usenewnames
+   Boolean "new-names" && usenewnames="--new-names"
+   $sudo MiniInstallPackage $realcopy $verbose $usenewnames "$unpacked" "$root" $params
 }
 
 function is_blacklisted() {
@@ -507,14 +559,19 @@
    fi
 }
 
-sudo_rm_if_e $root/System/Settings/passwd
-cat <<EOF > $root/System/Settings/passwd
+if Boolean "new-names"
+then settingsdir=/System/Index/etc
+else settingsdir=/System/Settings
+fi
+
+sudo_rm_if_e $root/$settingsdir/passwd
+cat <<EOF > $root/$settingsdir/passwd
 root:x:0:0:Gobo:/Users/root:/bin/bash
 fibo:x:21:21:Fibo:/tmp:/bin/bash
 EOF
 
-sudo_rm_if_e $root/System/Settings/group
-cat <<EOF > $root/System/Settings/group
+sudo_rm_if_e $root/$settingsdir/group
+cat <<EOF > $root/$settingsdir/group
 root:x:0:root
 sys:x:2:root
 tty:x:4:
@@ -522,8 +579,8 @@
 EOF
 
 hostname=`hostname`
-sudo_rm_if_e $root/System/Settings/hosts
-cat <<EOF > $root/System/Settings/hosts
+sudo_rm_if_e $root/$settingsdir/hosts
+cat <<EOF > $root/$settingsdir/hosts
 127.0.0.1 localhost $hostname
 EOF
 
@@ -537,11 +594,11 @@
 $sudo chmod 440 $root/$goboPrograms/Sudo/Settings/sudoers
 $sudo chown 0:0 $root/$goboPrograms/Sudo/Settings/sudoers
 sudo_rm_if_e $root/System/Settings/sudoers
-ln -nfs /$goboPrograms/Sudo/Settings/sudoers $root/System/Settings/sudoers
-touch $root/System/Settings/fstab
+ln -nfs /$goboPrograms/Sudo/Settings/sudoers $root/$settingsdir/sudoers
+touch $root/$settingsdir/fstab
 
 # This should limit network access inside the chroot
-#cp /etc/resolv.conf $root/System/Settings/resolv.conf
+#cp /etc/resolv.conf $root/$settingsdir/resolv.conf
 
 #############################################################################
 # Binding /dev, /proc and ./Archives inside root directory
@@ -633,7 +690,13 @@
 #############################################################################
 # Setting LD_LIBRARY_PATH variable which will be used on chrooted operations
 #############################################################################
-export LD_LIBRARY_PATH=/System/Links/Libraries
+if Boolean "new-names"
+then
+   export LD_LIBRARY_PATH=/System/Index/lib
+   export PATH=$PATH:/System/Index/bin:/System/Index/sbin
+else
+   export LD_LIBRARY_PATH=/System/Links/Libraries
+fi
 
 function in_chroot() {
    $sudo chroot $root "$@"
Index: bin/MiniInstallPackage
===================================================================
RCS file: /sources/goboscripts/tools/ChrootCompile/bin/MiniInstallPackage,v
retrieving revision 1.3
diff -u -u -r1.3 MiniInstallPackage
--- bin/MiniInstallPackage	3 Nov 2006 14:04:08 -0000	1.3
+++ bin/MiniInstallPackage	8 Jan 2007 04:35:28 -0000
@@ -6,7 +6,7 @@
 }
 
 [ "$2" ] || {
-   echo "Usage:   `basename $0` <package-file> <root> [cross prefix dir]"
+   echo "Usage:   `basename $0` [--real-copy] [--verbose] [--new-names] <package-file> <root> [cross prefix dir]"
    echo "Example: `basename $0` Glibc--2.3.2--i686.tar.bz2 /Mount/Disk/"
    echo "         `basename $0` Glibc--2.3.2--i686.tar.bz2 /Mount/Disk/ /System/ARM"
    exit 1
@@ -26,6 +26,15 @@
    shift
 fi
 
+unset newnames
+unset usenewnames
+if [ "$1" = "--new-names" ]
+then
+   newnames=true
+   usenewnames="--new-names"
+   shift
+fi
+
 if [ -d "$1" ] 
 then
    dir=`readlink -f "$1"`
@@ -81,4 +90,4 @@
 fi
 popd &> /dev/null
 
-MiniSymlinkProgram $verbose $goboPrograms/$name/$version $root $crossprefixdir 2>&1 | grep -v "/CVS/"
+MiniSymlinkProgram $verbose $usenewnames $goboPrograms/$name/$version $root $crossprefixdir 2>&1 | grep -v "/CVS/"
Index: bin/MiniSymlinkProgram
===================================================================
RCS file: /sources/goboscripts/tools/ChrootCompile/bin/MiniSymlinkProgram,v
retrieving revision 1.3
diff -u -u -r1.3 MiniSymlinkProgram
--- bin/MiniSymlinkProgram	3 Nov 2006 13:53:27 -0000	1.3
+++ bin/MiniSymlinkProgram	8 Jan 2007 04:35:28 -0000
@@ -15,7 +15,7 @@
 then
    echo "MiniSymlinkProgram" 1>&2
    echo "A minimal functionality SymlinkProgram" 1>&2
-   echo "Usage:   `basename $0` [--verbose] <program_path> <root> [cross prefix dir]" 1>&2 
+   echo "Usage:   `basename $0` [--verbose] [--new-names] <program_path> <root> [cross prefix dir]" 1>&2 
    echo "Example: `basename $0` /Programs/Glibc/Current /Mount/Disk" 1>&2 
    echo "         `basename $0` /Programs/Glibc/Current /Mount/Disk /System/ARM" 1>&2 
    exit 1
@@ -28,10 +28,21 @@
     shift
 fi
 
+unset newnames
+if [ "$1" = "--new-names" ]
+then
+    newnames=yes
+    shift
+fi
+
 crossprefixdir="$3"
 full_path="$1"
 root="`readlink -f $2`"
-gobolinks="$crossprefixdir/System/Links"
+
+if [ "$newnames" ]
+then gobolinks="$crossprefixdir/System/Index"
+else gobolinks="$crossprefixdir/System/Links"
+fi
 
 [ "$verbose" ] && echo " MiniSymlinkProgram: Linking ${full_path} inside ${gobolinks}" 1>&2
 
@@ -58,13 +69,24 @@
    fi
 }
 
-do_link ${full_path}/bin ${gobolinks}/Executables
-do_link ${full_path}/sbin ${gobolinks}/Executables
-do_link ${full_path}/Resources/Wrappers ${gobolinks}/Executables
-do_link ${full_path}/lib ${gobolinks}/Libraries
-do_link ${full_path}/include ${gobolinks}/Headers
-do_link ${full_path}/../Settings ${gobolinks}/../Settings
-do_link ${full_path}/Shared ${gobolinks}/Shared
+if [ "$newnames" ]
+then
+   do_link ${full_path}/bin ${gobolinks}/bin
+   do_link ${full_path}/sbin ${gobolinks}/sbin
+   do_link ${full_path}/Resources/Wrappers ${gobolinks}/bin
+   do_link ${full_path}/lib ${gobolinks}/lib
+   do_link ${full_path}/include ${gobolinks}/include
+   do_link ${full_path}/../Settings ${gobolinks}/etc
+   do_link ${full_path}/Shared ${gobolinks}/share
+else
+   do_link ${full_path}/bin ${gobolinks}/Executables
+   do_link ${full_path}/sbin ${gobolinks}/Executables
+   do_link ${full_path}/Resources/Wrappers ${gobolinks}/Executables
+   do_link ${full_path}/lib ${gobolinks}/Libraries
+   do_link ${full_path}/include ${gobolinks}/Headers
+   do_link ${full_path}/../Settings ${gobolinks}/../Settings
+   do_link ${full_path}/Shared ${gobolinks}/Shared
+fi
 
 ln -nfs $(basename ${full_path}) $root/$(dirname ${full_path})/Current
 
_______________________________________________
gobolinux-devel mailing list
[email protected]
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

Reply via email to