[pacman-dev] delta support in libalpm

Xavier shiningxc at gmail.com
Thu Feb 26 18:21:54 EST 2009


On Thu, Feb 26, 2009 at 11:34 PM, Aaron Griffin <aaronmgriffin at gmail.com> wrote:
>
> So, ok, from a db-scripts point of view, we're going to have to do the
> following:
>
> when a new package is added:
>   copy old package file from ftp to build dir
>   generate delta from old file -> new file (in staging)

$ oldfile=tzdata-2009a-1-x86_64.pkg.tar.gz
$ newfile=tzdata-2009b-1-x86_64.pkg.tar.gz
$ pkgdelta $oldfile $newfile
==> Generating delta from version 2009a-1 to version 2009b-1
==> Generated delta : 'tzdata-2009a-1_to_2009b-1-x86_64.delta'

>   add new pkg and delta to DB
>   ? add new delta info _somewhere_?

$ repo-add repo.db.tar.gz $newfile $pkgname*.delta

Adding the package will create a tzdata-2009b-1 entry in the database.
Adding the delta will create a tzdata-2009b-1/deltas file, with only
one line containing the information about the
tzdata-2009a-1_to_2009b-1-x86_64.delta (supposing it was the first
delta for tzdata which was added to the database)

>   copy new pkg and delta to ftp
>
> Is this correct? If so, it's not all THAT complex.

Yup it is correct.

> Less so if repo-add
> could simply spit out the deltas on it's own - if it can, we can
> simply add the logic to copy od packages to the build dir before
> calling repo-add, repo-add realizes there's another package there and
> uses it for deltas.
>

Indeed, it should be possible to put that in repo-add, I seriously
considered that option a while ago.
But using pkgdelta and repo-add on delta files should be easy enough,
as you can see above.

> Additionally, we run a cleanup script every few hours to remove old
> and/or unused packages
> this logic would simply need to be changed to scan deltas and leave
> $RETAINED_DELTAS for each package.
>
> I haven't been following the delta stuff too much, can we put the
> deltas in a totally unrelated directory? Is there delta information
> stored in the pacman DB? If so, the cleanup gets far more complicated?

If you can get a list of the delta filenames you want to remove, just
pass them to repo-remove to remove their information from the pacman
DB.
$ repo-remove repo.db.tar.gz *.delta


More information about the pacman-dev mailing list