Re: Creating patches
"Hylke Donker" <[email protected]>
| Newsgroups | gmane.comp.autopackage.devel |
|---|---|
| Message-ID | <[email protected]> |
I've created(and attached it to this email) a little bash file that can create patches. Add the following line at the end of your BuildPrepare section: bash autopackage/CreatePatch.sh $build_root my_package_to_patch_against.package What it does is: It removes all the files from $build_root that have an exact copy(same md5sum) in my_package_to_patch_against.package. So it doesn't create fancy binary patches or anything, it simply excludes files that were included in the previous package. One thing though, in order to be able to install the patch, the patch needs to have a different(unique) shortname. I hope somebody finds use in it. Hylke On Fri, Mar 7, 2008 at 1:04 PM, Isak Savo <[email protected]> wrote: > 2008/3/7, Hylke Donker <[email protected]>: > > > > > > On Fri, Mar 7, 2008 at 10:49 AM, Jan Niklas Hasse <[email protected]> > wrote: > > > Hi, > > > > > > Hm.. Maybe you could just use "bspatch" directly. Just create a patch > for > > every changed file (and import it), and install new files. > > > I don't know how large your program is, but i think it would be easy > to > > write a script which helps you. > > > The problem is that you will need bsdiff installed on the destination > > system. > > > How does autopackage handle binary patches for C++ programs? > > > > It replaces the current binary file with the one in the package and > keeps a > > backup of the old file, if I am not mistaken(correct me if I'm wrong). > > > > I don't know the name of the tool we use, but inside the package, we > keep one version of the binary plus a binary diff so that we can > re-create the other version on demand. > > So, at installation, installExe does: > 1) Check system what c++ abi it supports > 2a) If c++ abi v1 => copy binary to install dir > 2b) else, apply diff to the binary and install the created file to > installdir. > > The binary diff is much smaller than the full binary, so we save quite > some space for large binaries by using diff instead of having both > binaries in the payload. > > -Isak > -Isak > > --------------------------------------------------------------------- > To unsubscribe, e-mail: autopackage-dev-unsubscribe-OfajU3CKLf1/[email protected] > For additional commands, e-mail: autopackage-dev-help-OfajU3CKLf1/[email protected] > > -- Blog: http://www.donkerdump.nl --------------------------------------------------------------------- To unsubscribe, e-mail: autopackage-dev-unsubscribe-OfajU3CKLf1/[email protected] For additional commands, e-mail: autopackage-dev-help-OfajU3CKLf1/[email protected]
CreatePatch.sh
(application/x-sh, 1.1 KB)
#!/bin/bash
# Created by Hylke Donker
if [ ! $1 ] || [ ! $2 ]; then # if either of the arguments is not available
echo "CreatePatch.sh requires atleast two parameters: "
echo "CreatePatch.sh dir autopackage"
exit 1
fi
patch_dir=$1
autopackage=$2
# create temporary directory
tmpdir=`mktemp -d` || exit 1
cp $autopackage $tmpdir
autopackage_file=`basename $2`
chmod +x $tmpdir/$autopackage_file
bash $tmpdir/$autopackage_file -x
rm $tmpdir/$autopackage_file
extracted_dir=$tmpdir/`ls $tmpdir`
function dir_recursive
{
for file in `ls $1`; do
if [ -z $1 ]; then
relative_path=$file
else
relative_path=$1/$file
fi
# if file is directory
if [ -d $relative_path ]; then
dir_recursive $relative_path
else
# If the file used to exist
if [ -a $extracted_dir/$relative_path ]; then
original=`md5sum $extracted_dir/$relative_path | cut -d " " -f1`
new=`md5sum $patch_dir/$relative_path | cut -d " " -f1`
# If we already have the same exact file, then remove it
if [ $original == $new ]; then
rm $patch_dir/$relative_path
fi
fi
fi
done
}
cd $patch_dir
echo "Removing unmodified files..."
dir_recursive ""