Dev Week -- How to update a package to the latest upstream version in the repositories -- coolbhavi -- Wed, Feb 1st, 2012
1 [16:00] <ClassBot> Logs for this session will be available at http://irclogs.ubuntu.com/2012/02/01/%23ubuntu-classroom.html following the conclusion of the session. 2 [16:00] <coolbhavi> thanks dpm :) 3 [16:00] <coolbhavi> 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 4 [16:01] <coolbhavi> 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 :) 5 [16:01] <coolbhavi> So lets start :) 6 [16:01] <coolbhavi> Upgrading a package generally means upgrading a package to the latest upstream version in the ubuntu archive 7 [16:02] <coolbhavi> 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 8 [16:02] <coolbhavi> or we simply need it urgently (in case of a RC bugfix, for instance), and then pass the result back to debian 9 [16:03] <coolbhavi> So assuming there are no doubts lets move on :) 10 [16:03] <coolbhavi> so, we now know we have a new upstream version, first thing to do is to get it 11 [16:03] <coolbhavi> We can either download it using wget or uupdate <path to orig tarball> 12 [16:04] <coolbhavi> 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 13 [16:04] <coolbhavi> (More on debian/watch here http://wiki.debian.org/debian/watch) 14 [16:04] <coolbhavi> 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) 15 [16:05] <coolbhavi> finally, there could be a get-orig-source target in debian/rules that we can use 16 [16:05] <coolbhavi> by executing "make -f debian/rules get-orig-source" in the source tree 17 [16:06] <coolbhavi> 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 18 [16:07] <coolbhavi> 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 19 [16:07] <coolbhavi> In the simplest case is if there are no changes to packaging and no changes outside of debian 20 [16:08] <coolbhavi> Just untar your tarball, copy the old debian dir to the new source tree, Add a changelog entry and Build the package :) 21 [16:08] <coolbhavi> I wish all the updates were so simple :) 22 [16:09] <coolbhavi> (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 23 [16:09] <coolbhavi> date ../foo_2.orig.tar.gz in the old version src tree to automate the whole manual process.) 24 [16:10] <coolbhavi> 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 :) 25 [16:10] <coolbhavi> ( More about dpkg-source version 3.0 here: http://wiki.debian.org/Projects/DebSrc3.0) 26 [16:11] <coolbhavi> A more complex scenario of updating a package would involve the following checks normally: 27 [16:11] <coolbhavi> Checking licenses of all the files in the tarball (licensecheck -r --copyright command) 28 [16:11] <coolbhavi> Checking if all the patches in the previous version are perfectly applicable or obsolete 29 [16:12] <coolbhavi> 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)) 30 [16:12] <coolbhavi> 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) 31 [16:13] <coolbhavi> 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) 32 [16:13] <coolbhavi> sometimes upstream changes few things which need you to change compilation flags 33 [16:14] <coolbhavi> if upstream is a library particular care has to be taken 34 [16:14] <coolbhavi> checking if API/ABI change is reflected in SONAME/version (More on SONAME here: http://en.wikipedia.org/wiki/Soname) 35 [16:15] <coolbhavi> (check-symbols command can help you in that) 36 [16:15] <coolbhavi> you may need a library transition, which involves perhpas rebuilding many packages already in the archive 37 [16:16] <coolbhavi> Perhaps at this point its better to go through a simple example for us to get started hands on :) 38 [16:16] <coolbhavi> I hope I am not speeding up the session 39 [16:17] <coolbhavi> Okay lets get started with our hands on :) 40 [16:18] <coolbhavi> 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) 41 [16:19] <coolbhavi> 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 42 [16:19] <coolbhavi> 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) 43 [16:20] <coolbhavi> I ll wait for sometime now for those who are downloading the package 44 [16:21] <coolbhavi> <obounaim> QUESTION: I'm getting an error Validation FAILED!! 45 [16:22] <coolbhavi> obounaim, please do gpg --recv-keys <the key ID due to which package is failing to validate> 46 [16:22] <coolbhavi> and retry dget -x https://launchpad.net/ubuntu/+archive/primary/+files/mobile-broadband-provider-info_20111113-1ubuntu1.dsc 47 [16:23] <coolbhavi> or simple one pull-lp-source mobile-broadband-provider-info 48 [16:25] <coolbhavi> so assuming everything is fine lets move on 49 [16:26] <coolbhavi> 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 50 [16:27] <coolbhavi> 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 51 [16:28] <coolbhavi> <chilicui1> QUESTION: bzr branch lp:ubuntu/mobile-broadband-provider-info will work? 52 [16:29] <coolbhavi> yes it will but m not explaining distributed devel method herr :) 53 [16:30] <coolbhavi> its a more conventional explanation here for a start off :) 54 [16:31] <coolbhavi> obounaim, QUESTION: i don't have the mobile-broadband-provider-info-20111113/ directory ? 55 [16:31] <coolbhavi> Please make sure you extracted the source properly 56 [16:34] <coolbhavi> 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 57 [16:34] <coolbhavi> 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)) 58 [16:35] <coolbhavi> 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. 59 [16:37] <coolbhavi> 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 60 [16:39] <coolbhavi> assuming there are no doubts at this point, lets move on 61 [16:41] <coolbhavi> 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 62 [16:42] <coolbhavi> 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/ 63 [16:43] <coolbhavi> 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 64 [16:46] <coolbhavi> (Looks something like mobile-broadband-provider-info (20120201-0ubuntu1) precise; urgency=low) 65 [16:46] <coolbhavi> 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) 66 [16:48] <coolbhavi> <jincreator1> QUESTION: I heard about fakeroot. What's difference between fakeroot debian/rules ~ and make -f debian/rules ~ ? 67 [16:50] <ClassBot> There are 10 minutes remaining in the current session. 68 [16:50] <coolbhavi> 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 69 [16:50] <coolbhavi> as per my understandingf 70 [16:51] <coolbhavi> Once done, Save the file and then type debuild -S -sa (Which builds the package along with the new tarball included) 71 [16:51] <coolbhavi> Some steps to gain additional points :) 72 [16:52] <coolbhavi> 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) 73 [16:53] <coolbhavi> 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!) 74 [16:54] <coolbhavi> Once done, Please subscribe the ubuntu-sponsors team to evaluate the same :) 75 [16:55] <coolbhavi> Once evaluated the package will be uploaded and a new upstream version lands in ubuntu archives 76 [16:55] <ClassBot> There are 5 minutes remaining in the current session. 77 [16:55] <coolbhavi> Any more questions? 78 [16:56] <coolbhavi> Thanks all of you for turning up :) Please feel free to hang out at #ubuntu-motu or #ubuntu-devel for any questions. 79 [16:57] <coolbhavi> You can also catch me up on firstname.lastname@example.org or facebook.com/bshankar 80 [16:57] <coolbhavi> Thanks all again! Thats it from my side :) See you tomorrow!