How do I update Ubuntu packages from source?
Solution 1:
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).
Solution 2:
Ok updated on how to pull the code from launch pad
-
https://help.launchpad.net/
- Really good place to start
- https://help.launchpad.net/Code/FindingAndDownloading
- http://doc.bazaar.canonical.com/latest/en/mini-tutorial/index.html
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.
-
http://packages.ubuntu.com/en/karmic/network-manager-openconnect
- this has links to different resource regrading your package look at submit a bug report and ask a question. Ask a question would probably get you the help you look from the people who work with the package.
- this is where I would start. Ask question here to find out what you need to do.
- How patches work
- The Ten Minute Guide to diff and patch
- a longer more detailed tutorial
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
- Howto make debian standard debs from scratch
-
Debian New Maintainers' Guide
- This is probably the first thing you need to read.
- ubuntu packaging guide
- Some thing I used checkinstall
- I had some fixes for small little vpn connector that I used at univercity that only about 4 other people really wanted. I used checkinstall to make a package for us.