Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to create an updated version of the network-manager-openconnect package in Ubuntu. Apparantely I need to get the latest package source:

bzr branch lp:~network-manager/network-manager/openconnect-ubuntu.head

Then what? The package seems to have a way to update itself from the latest upstream code using git. But how do I get it to do that?

share|improve this question

migrated from stackoverflow.com Mar 10 '11 at 19:56

This question came from our site for professional and enthusiast programmers.

    
I thought bzr meant bazaar -- bazaar.canonical.com/en –  Paul Mar 13 '11 at 17:56

2 Answers 2

up vote 5 down vote accepted

Building an updated package from a bzr branch tends to differ a fair amount depending on who maintains the branches or how the package works in general. However, here are a few guidelines for a quick and dirty update of just about any package, to be pushed to a PPA:

Get the branch:

bzr branch lp:~network-manager/network-manager/openconnect-ubuntu.head

Then switch to it, and update changelog:

dch -i

dch -i will simply open a new entry in debian/changelog, increasing the version revision by one. If you want to add a patch, that's perfect, but if you want to update to a newer version of the upstream software, you'll need to update the version number before the dash (-). Say, a version in 1.2-0ubuntu1, if you start dch -i it will change to 1.2-0ubuntu2, which is good for patching but if you need a new version you'd likely want to change that to 1.3-0ubuntu1.

If you need to patch, now is the time to add your changes. In branches that have only a debian/ directory, you can use bzr bd-do (requires the bzr-builddeb package) to switch to a work tree where you can do changes, use quilt or any patch system, then "exit 0" to have your changes copied back.

If you want a new upstream version, once changelog has been changed you'd likely run a command similar to this one:

debian/rules get-orig-source

This will usually download the right tarball from the upstream publisher to get you started. If further changes are necessary, proceed as above for "patching" or changing other files in the debian/ directory, otherwise you're almost done:

bzr bd -S

bzr bd will take care of building. Calling it with no arguments starts to build on your system, while calling it with -S tells it to prepare a source package, which will include a ..._source.changes file which is what you want to upload to your PPA (use dput ppa:<yourname>/<name of your ppa> <changes file> to do that).


For NetworkManager packages, it's a little different. Let's look at openconnect specifically:

bzr branch lp:~network-manager/network-manager/openconnect-ubuntu.head network-manager-openconnect

Make sure you also have all the build dependencies: sudo get-build-deps

With the branch retrieved, this will read the debian/control file and try to download everything you need to build network-manager-openconnect. You might need git too though. Once that is done, run get-orig-source to get just the tarball of the very latest snapshot from git:

debian/rules get-orig-source

You'll see text fly by and a tarball with a long version number appear. That's the latest code you could get for nm-openconnect.

You will then need to update changelog with the version number from the tarball, just keeping the -0ubuntu1 suffix intact.

Or, change debian/changelog with the specific version number you want, then run: debian/rules get-current-source

Since the plugins don't change much, you should be able to just build the package from there, using bzr bd as above. If not, apply any changes necessary as above.

Don't forget to bzr commit after you've made changes.

I first forgot to add, don't hesitate to use the merge proposal system (Propose for merging link your branch's page on LP) when the changes you're making could benefit others. Usually you can just propose for merging against the branch yours is based on (e.g. lp:~network-manager/network-manager/openconnect-ubuntu.head in this case).

share|improve this answer
    
Thanks a ton! That is exactly what I needed! –  James Ward Mar 15 '11 at 4:07
    
Figured I had to forget something: don't be afraid to bring up your changes for merging onto the main packaging branch if it's a packaging fix (this includes patches too), so that everyone can benefit of changes! :) –  Mathieu Trudel-Lapierre Apr 12 '11 at 3:33

Ok updated on how to pull the code from launch pad

bzr branch lp:~network-manager/network-manager/openconnect-ubuntu.head

What this dose is pull the code from the lp (launchpad hosting service). We need to find where the code is sitting.

man bzr
343 #type 343 as the man page comes up.

bzr branch FROM_LOCATION [TO_LOCATION]        
       If  the TO_LOCATION is omitted, the last component of the FROM_LOCATION
       will be used.  In other words, "branch ../foo/bar" will attempt to cre‐
       ate  ./bar.   If the FROM_LOCATION has no / or path separator embedded,
       the TO_LOCATION is derived from the FROM_LOCATION by stripping a  lead‐
       ing   scheme   or  drive  identifier,  if  any.  For  example,  "branch
       lp:foo-bar" will attempt to create ./foo-bar.

Try changing to the directory you want to work in or adding the directory where you and the code to go to.

cd /home/[your user name]/[path to development dir]
or bzr branch lp:~network-manager/network-manager/openconnect-ubuntu.head /home/[your user name]/[path to development dir]
e.g bzr branch lp:~network-manager/network-manager/openconnect-ubuntu.head /home/joe/projects/network-manger/dev

If you have already done this you probably have a directory in your home dir

ls ~
./openconnect-ubuntu.head

There should be a README fiel in that directory to see what should be in there have a look a the project code, here is a link to README.source

README should have instructions on building that individual project.

Other useful bzr tools to install

sudo apt-get install bzr-builddeb bzr-builder bzr-explorer quilt

The bzr-explorere will let yo browse your bzr repositories that you have created on your machine in a gui.

Another note. You may need to pull the entire network-manger source in order to build the one component openconnect There may be many dependencies and between different components.

You need to create a fix for the current opneconnect package then create a patch using what every diff tools you use. And send it to the package maintainer.

Or if you want to use your fix new package locally you want to create a .deb package file.

Creating a package this is quite involved read the following links

share|improve this answer
    
Thanks. But I'm still not sure how to pull down the latest network-manager-openconnect code from git. The files I pulled down with bzr have a script in debian/rules that seems to be able to do the git pull but I don't know how to run the script correctly. –  James Ward Mar 12 '11 at 14:28
    
@james launchpad pulls the upstream source from the git reposity of the nework-manager project that is hosted by the gnome community. So you don't need to use git to pull the repository. read the bzr documentation and do some of the tutorials to get an idea of how bzr works. Other wise check out git over at stackoverflow –  nelaar Mar 14 '11 at 9:31
    
@james simpler might be to just download the .tar.gz file at the bottom of this page or straight using this link –  nelaar Mar 14 '11 at 9:33
    
It seems like bzr has a simple way to branch and then update to the latest original source. –  James Ward Mar 14 '11 at 13:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.