== Dev Week -- How to update a package to the latest upstream version in the repositories -- coolbhavi -- Wed, Feb 1st, 2012 == {{{#!irc [16:00] Logs for this session will be available at http://irclogs.ubuntu.com/2012/02/01/%23ubuntu-classroom.html following the conclusion of the session. [16:00] thanks dpm :) [16:00] Hi all I am Bhavani Shankar a 24 year old ubuntu developer from India and I am going to take you through the process of upgrading packages in the ubuntu archive [16:01] Before we start a bit of dev environment preparation; Make sure you have packaging-dev package installed if you are running on oneiric :) or please go through the session logs of dholbach's session yesterday :) [16:01] So lets start :) [16:01] Upgrading a package generally means upgrading a package to the latest upstream version in the ubuntu archive [16:02] normally, we would get the update from debian in the form of a merge or a sync, but there are cases when we don't, like for example if debian is in a freeze, or the package is orphaned, or its a native ubuntu maintained package [16:02] or we simply need it urgently (in case of a RC bugfix, for instance), and then pass the result back to debian [16:03] So assuming there are no doubts lets move on :) [16:03] so, we now know we have a new upstream version, first thing to do is to get it [16:03] We can either download it using wget or uupdate [16:04] Or if we have a watch file under debian directory in the current package, we can use that giving the command "uscan" at the source tree root [16:04] (More on debian/watch here http://wiki.debian.org/debian/watch) [16:04] uscan --verbose would say a bit more about what we are trying to do (in fact uscan calls upon uupdate :) more on uupdate: please see man uupdate) [16:05] finally, there could be a get-orig-source target in debian/rules that we can use [16:05] by executing "make -f debian/rules get-orig-source" in the source tree [16:06] A check here: be careful to read the previous entries of debian/changelog as the previous packager could have mentioned something he did with the previous version of the upstream tarball (like for instance repacking the tarball) which comes in detail later in the session [16:07] ok, now that we have an upstream tarball, we need to rename it in accordance to our policy foo-1.1.tar.gz will become foo_1.1.orig.tar.gz [16:07] In the simplest case is if there are no changes to packaging and no changes outside of debian [16:08] Just untar your tarball, copy the old debian dir to the new source tree, Add a changelog entry and Build the package :) [16:08] I wish all the updates were so simple :) [16:09] (Previously prior to dpkg-source version 3.0 if the the previous packager made inline changes instead of using a patch system, (you could check this by checking the old diff.gz), Just making changes inside the debian directory would'nt be enough, you needed to run the patch the present version of the package manually and there you would experience some pain in some changes being obsolete and couldnt apply anymore or you would run uup [16:09] date ../foo_2.orig.tar.gz in the old version src tree to automate the whole manual process.) [16:10] But now thanks to dpkg-source version 3.0 which generates a debian-changes-* file while building if there are any changes outside the debian directory and wrt policy 3.9.2 throws out a lintian warning too :) [16:10] ( More about dpkg-source version 3.0 here: http://wiki.debian.org/Projects/DebSrc3.0) [16:11] A more complex scenario of updating a package would involve the following checks normally: [16:11] Checking licenses of all the files in the tarball (licensecheck -r --copyright command) [16:11] Checking if all the patches in the previous version are perfectly applicable or obsolete [16:12] Checking if there are new dependencies required for the new version of the package (this is usually reported in upstream ChnageLog, but sometimes you only discover it by looking at upstream autoconf files (or Makefile)) [16:12] Checking if the package installs files in a different manner for instance, any change in file locations (We may need to change our packaging then) [16:13] Checking if the package has a man page, desktop file, icons et al and we may want to install those or for ex. there is a .desktop file already existing we may want to validate the same. (desktop-file-validate) [16:13] sometimes upstream changes few things which need you to change compilation flags [16:14] if upstream is a library particular care has to be taken [16:14] checking if API/ABI change is reflected in SONAME/version (More on SONAME here: http://en.wikipedia.org/wiki/Soname) [16:15] (check-symbols command can help you in that) [16:15] you may need a library transition, which involves perhpas rebuilding many packages already in the archive [16:16] Perhaps at this point its better to go through a simple example for us to get started hands on :) [16:16] I hope I am not speeding up the session [16:17] Okay lets get started with our hands on :) [16:18] The package I am using as an example is my own debian package mobile-broadband-provider-info (Which I havent updated in quite sometime due to my schedule of things lately) [16:19] Type in a terminal mkdir m-b-p-i && cd m-b-p-i && dget -x https://launchpad.net/ubuntu/+archive/primary/+files/mobile-broadband-provider-info_20111113-1ubuntu1.dsc [16:19] Which will download the latest available version in ubuntu i.e 20111113-1ubuntu1 (Note: I'm not using apt-get source mobile-broadband provider info as it will download the respective SRU versions for oneiric,natty,maverick or lucid) [16:20] I ll wait for sometime now for those who are downloading the package [16:21] QUESTION: I'm getting an error Validation FAILED!! [16:22] obounaim, please do gpg --recv-keys [16:22] and retry dget -x https://launchpad.net/ubuntu/+archive/primary/+files/mobile-broadband-provider-info_20111113-1ubuntu1.dsc [16:23] or simple one pull-lp-source mobile-broadband-provider-info [16:25] so assuming everything is fine lets move on [16:26] now if you do a cd mobile-broadband-provider-info-20111113/ and look in you will find a debian directory and most of our work is concentrated in around the debian directory normally [16:27] now if you look inside the debian directory you will see a changelog control mobile-broadband-provider-info.docs copyright rules watch files and a source directory [16:28] QUESTION: bzr branch lp:ubuntu/mobile-broadband-provider-info will work? [16:29] yes it will but m not explaining distributed devel method herr :) [16:30] its a more conventional explanation here for a start off :) [16:31] obounaim, QUESTION: i don't have the mobile-broadband-provider-info-20111113/ directory ? [16:31] Please make sure you extracted the source properly [16:34] ok so now moving on, inside the source directory you will find a file called format which contains something as "3.0 (quilt)" which specifies that this is a dpkg-source version 3.0 package [16:34] Now if you look at the watch file it states that its a dummy watch file (which I created to satisfy lintian as the package is maintained and updates are pushed into git and no orig tarball is available for same for a dynamic update (once in 1 month, 2 months)) [16:35] Now since the debian/watch file is unavailable if you take a look at debian/rules file you can see that we have defined a get-orig-source target. [16:37] Now to parse through the get-orig-source rule you saw in debian/rules, you need to install automake and git-core packages as specified in the debian/rules file [16:39] assuming there are no doubts at this point, lets move on [16:41] So, running make -f debian/rules get-orig-source inside mobile-broadband-provider-info-20111113/ directory will download the latest version of the changes in git-head and converts the same to a tarball mobile-broadband-provider-info-20120201 and untars it creating a directory mobile-broadband-provider-info-20120201 going by the sequence of commands under get-orig-source in debian/rules [16:42] Now since there are no changes or patches outside the debian directory copy the debian directory from mobile-broadband-provider-info-20111113/ to mobile-broadband-provider-info-20120201/ [16:43] Once done navigate to the debian directory in the new source tree and type dch -i and give a version as 20120201-0ubuntu1 (-0ubuntu1 since this version is not present yet in debian but in ubuntu) targetted to precise since that is the devel version presently [16:46] (Looks something like mobile-broadband-provider-info (20120201-0ubuntu1) precise; urgency=low) [16:46] And update the changelog as * Merging upstream version 20120201 from git and make a list of upstream changes mapping the LP bugs closed in the changelog (Changelog writing will be taken up as a seperate topic by myself tomorrow where I'm going to explain changelog writing specifics) [16:48] QUESTION: I heard about fakeroot. What's difference between fakeroot debian/rules ~ and make -f debian/rules ~ ? [16:50] There are 10 minutes remaining in the current session. [16:50] jincreator1, make -f uses make command on debian/rules as a file (see man make) and fakeroot runs the same command in a env faking root previlages for execution [16:50] as per my understandingf [16:51] Once done, Save the file and then type debuild -S -sa (Which builds the package along with the new tarball included) [16:51] Some steps to gain additional points :) [16:52] After that a dsc and a changes file will be generated. Use pbuilder to test build the generated dsc file in a pristine environment (A session is coming up on the same tomorrow by tumbleweed) [16:53] And then do a diff between the old source tree and the new source tree for example bhavani@bhavani-desktop:~/m-b-p-i_1$ diff -Nurb mobile-broadband-provider-info-20111113 mobile-broadband-provider-info-20120201 > m-b-p-i.diff and attach the diff and the new source tarball to the new upstream request bug in LP. (my preferred way as a sponsor!) [16:54] Once done, Please subscribe the ubuntu-sponsors team to evaluate the same :) [16:55] Once evaluated the package will be uploaded and a new upstream version lands in ubuntu archives [16:55] There are 5 minutes remaining in the current session. [16:55] Any more questions? [16:56] Thanks all of you for turning up :) Please feel free to hang out at #ubuntu-motu or #ubuntu-devel for any questions. [16:57] You can also catch me up on bhavi@ubuntu.com or facebook.com/bshankar [16:57] Thanks all again! Thats it from my side :) See you tomorrow! }}}