How to convert a Debian package from CVS to svn
This page describes the steps necessary to convert a Debian package that has its Debian sources managed in CVS to a svn repository. It has been created accompanying the migration of the nagios-plugins package from an Alioth CVS repository to an Alioth/SVN repository.
debian/-only package layout
Usually, in CVS, you have both the upstream sources and the Debian changes in the same CVS repository. This imposes extra work in case of Upstream updates and is confusing to beginners.
You can, of course, maintain your package the same way in svn. But svn-buildpackage can do better: It can merge upstream sources at build time, so that you only need to maintain the debian/ subdirectory under your version control. This makes the repository much smaller and is a great help in development. Of course, if you want to patch upstream, you need to use dpatch or a similiar system to apply patches located inside debian/ to the upstream sources at build time.
- cvs2svn needs access to the raw repository directories. If your source CVS and the target svn are not on the same box, either move the CVS repository to the target host (for example via a tarball), or create a local svn repository on the source host and move it to the target later via dump/restore.
- create svn repository, or have it created by site administration
assign the paths to the repositories to CVS_REPOS_PATH and SVN_REPOS_PATH.
CVS_REPOS_PATH needs to point at the module you intend to migrate and might be a "deep link"
SVN_REPOS_PATH needs to point at the root directory of the svn repository
cvs2svn --existing-svnrepos --dry-run -s $SVN_REPOS_PATH $CVS_REPOS_PATH/nagios-plugins
for the brave: remove --dry-run
don't try the --tags, --branches, --trunk options, they do not work.
if you previously used cvs-buildpackage to manage your cvs repository, you might need to pass --force-branch=source-dist
- this is going to take a while
- Commit information to CVS that the module has migrated to svn so that people stop working with the CVS version to avoid waste of work.
- The following steps do not need to be done on the server hosting the svn repository
Assign the path to your repository to $URL (svn+ssh://svn.debian.org/svn/pkg-nagios)
- Assign the "module name" inside the repository to $MODULE
try svn ls $URL . You should see (besides other possible repository contents) three directories, branches, tags and trunk.
- move them to their final place:
svn mkdir $URL/$MODULE
- for dir in trunk branches tags; do svn mv $URL/$dir $URL/$MODULE/$dir; done
- verify what you've done
svn ls $URL
svn ls $URL/$MODULE
- optionally: fix debian_version_tags
for dir in $(svn ls $URL/$MODULE/tags | grep ^debian_version'); do newdir=$(echo $dir | sed 's/^debian_version_\(.*\)/\1/;s/_/./g'); echo svn mv $URL/$MODULE/tags/$dir $URL/$MODULE/tags/$newdir; done
for the brave: remove the echo
look at the mess you've made: svn ls $URL/$MODULE/tags
check out the trunk: svn co $URL/$MODULE/trunk
export the trunk to a different directory: svn export $URL/$MODULE/trunk export
- check whether the exported trunk still builds and verify that the result is similiar to what you have built from CVS
- make sure that the upstream tarball is available to that build so that a debian .diff.gz is generated
You're done. Continue only if you intend to convert your package to a debian/-only setup
- inspect the just generated .diff.gz and check whether there are changes outside of debian/
- If so, convert them into patches to be applied at build time and addd the patches to debian/
- the export and the just built packages are not needed any more and can be removed
- Remove sources from repository tags and branches
svn rm $URL/$MODULE/branches/source-dist
for dir in $(svn ls $URL/$MODULE/tags | grep '^upstream_version'); do echo svn rm $URL/$MODULE/tags/$dir; done
- for the brave: remove the echo
- Change to the checked out version
- Remove everything but debian/:
/bin/ls | grep -v '^debian/\?$' | xargs echo svn rm
- for the brave: remove the echo
- Tell svn-buildpackage to merge with upstream sources
svn propset mergeWithUpstream 1 debian
svn update - I don't know why this is needed, but without this, the commit fails
- try building: svn-buildpackage