[pacman-dev] [PATCH 3/5] repo-add : rework of delta support

Allan McRae allan at archlinux.org
Wed Feb 25 22:11:22 EST 2009


Xavier Chantry wrote:
> Use the correct database format
>
> Instead of getting all the info from the filename, which was a bit ugly, use
> xdelta3 to get the source and destination files
>
> Instead of looking for .delta files in the current directory when adding a
> package, which was not very flexible, allow .delta files to be added with
> repo-add just like package files. delta files can also be removed with
> repo-remove. This is simply done by looking for a .delta extension in the
> arguments, and calling the appropriate db_write_delta or db_remove_delta
> functions.
>
> Example usage:
> repo-add repo/test.db.tar.gz repo/libx11-1.1.99.2-2-x86_64.pkg.tar.gz
> repo-add repo/test.db.tar.gz repo/libx11-1.1.5-2_to_1.1.99.2-2-x86_64.delta
> repo-remove repo/test.db.tar.gz libx11-1.1.5-2_to_1.1.99.2-2-x86_64.delta
>
> Note that db_write_entry had to be modified so that the deltas file is not
> lost on a package upgrade (remove + add). FS#13414 should be fixed in the
> same time, by printing a different message when the same package is added.
>
> Normal output:
> ==> Adding package 'repo/libx11-1.1.99.2-2-x86_64.pkg.tar.gz'
>   -> Removing version 'libx11-1.1.5-2'...
> Warning:
> ==> Adding package 'repo/libx11-1.1.99.2-2-x86_64.pkg.tar.gz'
> ==> WARNING: An entry for 'libx11-1.1.99.2-2' already exists, overwriting...
>
> Signed-off-by: Xavier Chantry <shiningxc at gmail.com>
> ---
>  scripts/repo-add.sh.in |  203 ++++++++++++++++++++++++++++--------------------
>  1 files changed, 120 insertions(+), 83 deletions(-)
>
> diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
> index c6d25aa..95b7959 100644
> --- a/scripts/repo-add.sh.in
> +++ b/scripts/repo-add.sh.in
> @@ -57,8 +57,8 @@ error() {
>  # print usage instructions
>  usage() {
>  	printf "repo-add, repo-remove (pacman) %s\n\n" "$myver"
> -	printf "$(gettext "Usage: repo-add [-q] <path-to-db> <package> ...\n")"
> -	printf "$(gettext "Usage: repo-remove [-q] <path-to-db> <packagename> ...\n\n")"
> +	printf "$(gettext "Usage: repo-add [-q] <path-to-db> <package|delta> ...\n")"
> +	printf "$(gettext "Usage: repo-remove [-q] <path-to-db> <packagename|delta> ...\n\n")"
>  	printf "$(gettext "\
>  repo-add will update a package database by reading a package file.\n\
>  Multiple packages to add can be specified on the command line.\n\n")"
> @@ -93,36 +93,84 @@ write_list_entry() {
>  	fi
>  }
>  
> -# write a delta entry to the pacman database
> -#   arg1 - path to delta
> +# Get the package name from the delta filename
> +getpkgname() {
> +	local tmp
> +
> +	tmp=${1##*/}
> +	echo ${tmp%-*-*_to*}
> +}
>   

Rename this to getdeltapkgname to clarify it is only used for deltas?  
Self document function names make my head hurt less.

Otherwise, a quick read of the other changes made sense to me, but I 
will need to do this in more detail. 

One comment that is moderately related to this.  Should there be a 
mechanism to inspect the deltas are remove the ones that are no longer 
necessary?  I.e. deltas with a broken chain, deltas who chain download 
will be bigger than the package.  Should that be a job of repo-add when 
adding a new delta or a separate script?

Allan





More information about the pacman-dev mailing list