[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg-source's future and relation with VCS



Russ Allbery <rra@debian.org> writes:

> It's certainly trivial to convert a package that uses quilt to the Git
> format.  You just import the upstream tarball on an upstream branch, clone
> it to master, create a feature branch for every patch, merge them all into
> master in the order specified by the series file, create a debian branch,
> add the debian directory on that branch, and merge that branch into
> master).  In fact, it's basically this script:
>
>     git init
>     git checkout -b upstream
>     dpkg-source -x ../<dsc> .
>     rm -rf debian
>     git add .
>     git commit
>     git checkout master
>     git merge upstream
>     git checkout -b debian
>     dpkg-source -x ../<dsc> .
>     mv debian/patches ../patches
>     git add debian
>     git commit
>     git checkout master
>     for patch in `cat ../patches/series` ; do
>         git checkout -b "feature/$patch"
>         patch -p1 < ../patches/"$patch"
>         git commit
>         git checkout master
>         git merge "feature/$patch"
>     done
>     git checkout master
>     git merge feature/`tail -1 ../patches/series`
>     git merge debian

Uh, sorry, ignore the last two lines above git merge debian.

As recompense, unless I'm missing something, the trivial quilt
implementation of the v3 source format would look basically like this:

sub prep_tar {
    system('quilt', 'pop', '-a');
}

sub post_unpack_tar {
    chdir($srcdir)
        or main::syserr(sprintf(_g("unable to chdir to `%s'"), $srcdir));
    system('quilt', 'push', '-a');
}

As with the initial cut at the bzr plugin, though, there are details to be
worked out, particularly around what to do with uncommitted changes.
You'd probably also want to plug pristine-tar into this picture and save
off the delta (and similarly would want to do that with the Git format) so
that you can regenerate the pristine tarball for checksum comparison with
upstream and diffing against the tree to ensure that you haven't missed
any changes.

There are details to work out, but it looks pretty straightforward to me.
The hardest part is to make uncommitted changes sane for non-quilt users.
I'd be tempted to just recursively quilt add every file in the tree to a
new empty patch after unpacking the source tree, since then you can easily
quilt refresh that top patch and save it off before running quilt pop.
That does double the size of the checked-out tree, though....

I'm going to bed now.  :)

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: