Add support to be able to create a patch easily, when inside a debug
environment.
Once a new patch is created, user can run sandbox_rebuild_pkg to test
rebuilding the package for bugs.
Index: scripts/Build-Pkg
===================================================================
--- scripts/Build-Pkg (revision 40824)
+++ scripts/Build-Pkg (working copy)
@@ -188,6 +188,13 @@
mkdir -p "TOOLCHAIN/src.$pkg.$config.$id"
ln -s "$PWD/TOOLCHAIN/src.$pkg.$config.$id" "$builddir"
+ # Stamp our build directory so we can just get to it easily
+ mkdir -p $xroot/../cache
+ cat > $xroot/../cache/build.dir <<- EOT
+ export LAST_BUILDDIR="$builddir"
+ cd $builddir
+ EOT
+
cat > $builddir/chroot.sh <<- EOT
export SDE_THIS_IS_CHROOT=1; cd /TOOLCHAIN
./scripts/Build-Pkg $options -chr-sub -root "/" "$1"
@@ -553,6 +560,49 @@
diff -u \$x \${x/.vanilla/}
done
}
+
+ sandbox_fixfilediff() {
+ find -name '*.vanilla' -printf '%P\n' | while read x ; do
+ diff -u ./\$x ./\${x/.vanilla/}
+ done
+ }
+
+ sandbox_create_patch_from_fixfiles(){
+ patchfilename=$1
+ descpath=\${desc%/*}
+ echo "Current Patch(es):"
+ ls -l \$descpath/*.patch* 2> /dev/null
+ echo "Creating a patch at \$descpath"
+ read -p "Enter Patch Name: " patchfilename
+ sandbox_fixfilediff | tee \$patchfilename
+ if [ \`cat \$patchfilename | wc -l\` -eq 0 ]; then
+ echo "No patch created. Most likely you did not use fixfile command to make changes";
+ return;
+ fi
+ if [ -f "\$descpath/\$patchfilename" ]; then
+ read -p "Would you like to overwrite the current patch \$patchfilename [y/n]:" overwrite
+ [ "\$overwrite" != "y" ] && { echo "Operation canceled"; return; } # Default not to overwrite
+ fi
+ install \$patchfilename "\$descpath/\$patchfilename"
+ [ $? -eq 0 ] || echo "Failed to install patch file \$descpath/\$patchfilename"
+ echo "Patch file created successfully at \$descpath/\$patchfilename"
+ echo "You can now run sandbox_rebuild_pkg to test the new patch"
+ }
+ sandbox_rebuild_pkg(){
+ cd $builddir
+ [ -d "$builddir/$xpkg" ] || mv "$builddir/$xpkg" "$builddir/$xpkg.dev"
+ detect_patchfiles
+ apply_patchfiles
+ build_this_package
+ }
+
+ sandbox(){
+ echo "You're already in a sandbox environment to debug $pkg"
+ echo " COMMAND - USAGE"
+ echo " sandbox_create_patch_from_fixfiles - all changes you made using fixfile <file> will be consolidated into a single patch file"
+ echo " sandbox_rebuild_pkg - test a complete rebuild of a package with all patches, generally used followed by sandbox_create_patch_from_fixfiles"
+ }
+
EOT
} > $builddir/debug.buildenv
#
@@ -831,6 +881,7 @@
(
echo "[CONFIG] ${SDECFG_ID#*-}"
descfile=$base/package/*/$pkg/$pkg.desc
+ [ -f $base/target/$target/package/$pkg/$pkg.desc ] && descfile=$base/target/$target/package/$pkg/$pkg.desc
while read x ; do
if [ "${x#\[}" != "$x" ] ; then
x="`echo ${x// */} | tr -d '[]'`"
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[email protected] with a subject of: unsubscribe t2