Wiedi in Wonderland

Parallel git and cvs workflow

Wed 08 July 2015

This describes a workflow for using git to develop on pkgsrc. As pkgsrc upstream uses cvs you'll need two parallel copies of the tree: one using git and one using cvs. To get changes from git into cvs it uses git-cvsexportcommit. Git has many benefits like local commits, easy branching, atomic commits across multiple files, etc. I also like to prepare my commit messages and review them before setting them in stone in the eternal history.

Environment

To setup a basic working environment I use configuration like follows.

Add to ~/.bash_profile:

export CVSEDITOR=$EDITOR
export CVSROOT=$LOGNAME@cvs.NetBSD.org:/cvsroot
export CVS_RSH=ssh

Add to ~/.cvsrc

# recommended CVS configuration file from the pkgsrc guide
cvs -q -z2
checkout -P
update -dP
diff -upN
rdiff -u
release -d

CVS

get your cvs tree:

mkdir ~/cvs ~/tmp
cd ~/cvs
cvs checkout pkgsrc

GIT

checkout Jörgs git conversion:

cd ~/tmp
git clone https://github.com/jsonn/pkgsrc.git

bootstrap

the git tree will be your working tree:

cd ~/tmp/pkgsrc/bootstrap
./bootstrap --unprivileged

add to ~/.bash_profile

export PATH="~/pkg/bin:~/pkg/sbin:$PATH"

create your change

as an example let's do a simple update of nano:

cd ~/tmp/pkgsrc/editors/nano

make changes and test them:

$EDITOR Makefile
bmake package
...

stage your changes and commit:

git add Makefile distinfo PLIST
git commit

you now get to review your change as one entitiy, including the commit message:

git show -1
commit 3b861ca6563af68aa3c175ebae151d3870c9b5d2
Author: Sebastian Wiedenroth <wiedi@frubar.net>
Date:   Wed Jul 8 22:59:39 2015 +0200

    Update nano to 2.4.2

    2015.07.05 - GNU nano 2.4.1 "Portorož" is released.  This release
            includes several fixes, including the ability to resize
            when in modes other than the main editing window,
            proper displaying of invalid UTF-8 bytes, new syntax
            definitions for Elisp, Guile, and PostgreSQL, and
            better display of shortcuts in the help menu and file
            browser.  Thanks for your patience and using nano!

diff --git a/editors/nano/Makefile b/editors/nano/Makefile
index 62fb2c1..c2a4b12 100644
--- a/editors/nano/Makefile
+++ b/editors/nano/Makefile
@@ -1,10 +1,10 @@
 # $NetBSD: Makefile,v 1.46 2015/06/05 01:32:38 wiedi Exp $

-DISTNAME=  nano-2.4.1
+DISTNAME=  nano-2.4.2
 CATEGORIES=    editors
 MASTER_SITES=  http://www.nano-editor.org/dist/v2.4/

-MAINTAINER=    pkgsrc-users@NetBSD.org
+MAINTAINER=    wiedi@frubar.net
 HOMEPAGE=  http://www.nano-editor.org/
 COMMENT=   Small and friendly text editor (a free replacement for Pico)
 LICENSE=       gnu-gpl-v3
diff --git a/editors/nano/PLIST b/editors/nano/PLIST
index 7d4f944..1ecfdd4 100644
--- a/editors/nano/PLIST
+++ b/editors/nano/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.18 2015/06/05 01:32:38 wiedi Exp $
+@comment $NetBSD$
 bin/nano
 bin/rnano
 info/nano.info
@@ -50,10 +50,12 @@ share/nano/cmake.nanorc
 share/nano/css.nanorc
 share/nano/debian.nanorc
 share/nano/default.nanorc
+share/nano/elisp.nanorc
 share/nano/fortran.nanorc
 share/nano/gentoo.nanorc
 share/nano/go.nanorc
 share/nano/groff.nanorc
+share/nano/guile.nanorc
 share/nano/html.nanorc
 share/nano/java.nanorc
 share/nano/javascript.nanorc
@@ -70,6 +72,7 @@ share/nano/patch.nanorc
 share/nano/perl.nanorc
 share/nano/php.nanorc
 share/nano/po.nanorc
+share/nano/postgresql.nanorc
 share/nano/pov.nanorc
 share/nano/python.nanorc
 share/nano/ruby.nanorc
diff --git a/editors/nano/distinfo b/editors/nano/distinfo
index 6b372a5..3420686 100644
--- a/editors/nano/distinfo
+++ b/editors/nano/distinfo
@@ -1,6 +1,6 @@
 $NetBSD: distinfo,v 1.20 2015/06/05 01:32:38 wiedi Exp $

-SHA1 (nano-2.4.1.tar.gz) = 422958cb700cc8cedc9a6b5ec00bf968c0fa875e
-RMD160 (nano-2.4.1.tar.gz) = 84bd54e50b5e8c6457d983dc7ef730b5a0303bf8
-Size (nano-2.4.1.tar.gz) = 1890805 bytes
+SHA1 (nano-2.4.2.tar.gz) = bcf2bb3fcc04874cb38c52cfd8feebce61dd5e0a
+RMD160 (nano-2.4.2.tar.gz) = 6a3d0569740c223230af6ae88f8ef0797402c4c2
+Size (nano-2.4.2.tar.gz) = 1898633 bytes
 SHA1 (patch-configure) = 3a63b02a39000d5a15087739648b82e999d14f56

You can take this diff and apply it to different systems for testing. This is very easy with git.

Once you are happy you can commit to CVS.

commiting

cd ~/tmp/pkgsrc/
git cvsexportcommit -w ~/cvs/pkgsrc/ -pcv 3b861ca6563af68aa3c175ebae151d3870c9b5d2

This will commit (-c) if the change with the id 3b861ca6563af68aa3c175ebae151d3870c9b5d2 applies cleanly (-p for paranoid).

Keepking CHANGES and TODO up to date:

~/cvs/pkgsrc/editors/nano
bmake changes-entry
cd ../../doc
cvs diff
cvs commit CHANGES-2015

The reason to not prepare this in the git commit is that the CHANGES file is updated very frequently and will conflict with the strict settings used with cvsexportcommit.

keeping both trees updated

before starting a new change update your git tree:

git pull

As you now have git you can also rebase easily onto more recent changes from upstream.

Before commiting update your cvs tree:

cvs update -d