[13:54] <c2tarun> anyone here?? how much time is left in today's class
[13:54] <c2tarun> ??
[13:55] <bilalakhtar> c2tarun: 5 mins
[13:55] <c2tarun> thanks
[13:56] <skfin> :)
[14:01] <bilalakhtar> Hello people, and welcome to the Packaging tutorial session!
[14:01] <ClassBot> Logs for this session will be available at http://irclogs.ubuntu.com/2010/11/23/%23ubuntu-classroom.html following the conclusion of the session.
[14:02] <bilalakhtar> Before we move ahead, I would like to tell you people how to ask questions and the like
[14:02] <bilalakhtar> The session will go on here
[14:02] <bilalakhtar> this channel is moderated
[14:03] <bilalakhtar> you will have to ask the questions in #ubuntu-classroom-chat , prefixed with QUESTION: , like this:
[14:03] <bilalakhtar> QUESTION: What does a deb file do?
[14:03] <bilalakhtar> New, let's begin!
[14:03] <bilalakhtar> *now
[14:03] <bilalakhtar> I would like everyone to install these packages:
[14:03] <bilalakhtar> build-essential dpkg-dev fakeroot devscripts autotools-dev debhelper dh-make
[14:04] <bilalakhtar> To install them, run this in a terminal:
[14:04] <bilalakhtar> sudo apt-get install build-essential dpkg-dev fakeroot devscripts autotools-dev debhelper dh-make
[14:04] <bilalakhtar> (let it install in the background)
[14:05] <bilalakhtar> Now, make an empty directory called ubuntu-packaging
[14:07] <bilalakhtar> and cd into it from a terminal
[14:07] <bilalakhtar> Then, download the source code of a very simple programme which we would package (in this case, GNU hello) Download it my typing this in a terminal:
[14:07] <bilalakhtar> wget http://ftp.gnu.org/gnu/hello/hello-2.6.tar.gz
[14:07] <bilalakhtar> Then, rename it by typing this:
[14:08] <bilalakhtar> mv hello-2.6.tar.gz hello_2.6.orig.tar.gz
[14:08] <bilalakhtar> Then, extract the archive:
[14:08] <bilalakhtar> tar xzf hello_2.6.orig.tar.gz
[14:09] <bilalakhtar> Now, you will have a directory hello-2.6, cd into it
[14:09] <bilalakhtar> If you don't have a GPG key already, run this command:
[14:09] <bilalakhtar> gpg --gen-key
[14:09] <bilalakhtar> and follow the steps
[14:11] <bilalakhtar> Now, set your full name and e-mail env variables in your system for use by the packaging tools, like this:
[14:12] <bilalakhtar> echo "export DEBFULLNAME=\"YOUR FULL NAME HERE\"" >> ~/.bashrc
[14:12] <bilalakhtar> echo "export DEBEMAIL=\"youremail@something.com\"" >> ~/.bashrc
[14:13] <bilalakhtar> After that, run these commands to set the vars in the current session as well:
[14:13] <bilalakhtar> export DEBFULLNAME="YOUR FULL NAME HERE"
[14:13] <bilalakhtar> export DEBEMAIL="youremail@something.com"
[14:13] <bilalakhtar> I hope you replaced YOUR FULL NAME HERE and youremail@something.com with your name and e-mail address
[14:14] <bilalakhtar> now, let us move ahead with the packaging!
[14:14] <bilalakhtar> I hope you are in the hello-2.6 folder
[14:14] <bilalakhtar> then run this command:
[14:14] <bilalakhtar> dh_make -c gpl3 -s
[14:15] <bilalakhtar> Hit enter if every information is correct
[14:15] <bilalakhtar> If not, then say 'NO' in #ubuntu-classroom-chat
[14:16] <bilalakhtar> I assume it worked for everyone
[14:16] <bilalakhtar> now, cd into the newly-created debian subdirectory in the hello-2.6 folder
[14:16] <bilalakhtar> Then run these commands to clear the unnecessary files in the folder
[14:17] <bilalakhtar> rm *ex *EX
[14:17] <bilalakhtar> rm docs info README.*
[14:18] <bilalakhtar> Now, let us analyse the files remaining in the directory
[14:18] <bilalakhtar> Ignore the compat file and the source folder, they are parts of the source which are never touched
[14:19] <bilalakhtar> (not never, but not touched usually)
[14:19] <bilalakhtar> Open the control file in your favourite text editor
[14:19] <bilalakhtar> Set the Section: field from unknown to misc
[14:19] <bilalakhtar> Delete the two #Vcs-* lines
[14:20] <ClassBot> c2tarun asked: what is misc?
[14:20] <bilalakhtar> misc -> Miscellaneous
[14:21] <bilalakhtar> There are many debian sections that can be written there
[14:21] <bilalakhtar> examples are video, net, etc
[14:22] <bilalakhtar> let me give you a list
[14:22] <bilalakhtar> The possible sections are:
[14:22] <bilalakhtar> admin, cli-mono, comm, database, devel, debug, doc, editors, electronics, embedded, fonts, games, gnome, graphics, gnu-r, gnustep, hamradio, haskell, httpd, interpreters, java, kde, kernel, libs, libdevel, lisp, localization, mail, math, misc, net, news, ocaml, oldlibs, otherosfs, perl, php, python, ruby, science, shells, sound, tex, text, utils, vcs, video, web, x11, xfce, zope.
[14:23] <bilalakhtar> FYI: perl, php, python, lisp sections are for language modules, not apps made in that language
[14:23] <bilalakhtar> okay, so let us move ahead
[14:23] <bilalakhtar> In the Homepage: field replace <insert the upstream URL, if relevant>
[14:23] <bilalakhtar> with http://www.gnu.org/software/hello/
[14:24] <bilalakhtar> Now, the package description
[14:24] <bilalakhtar> Replace <insert up to 60 chars description>
[14:24] <bilalakhtar> with a short description of the package
[14:25] <bilalakhtar> In this case: Hello program that prints out Hello World!
[14:25] <bilalakhtar> Replace the <insert long description, indented with spaces> thing with this:
[14:26] <bilalakhtar>  GNU Hello prints out Hello World! and is translateable.
[14:26] <bilalakhtar>  It is a good example of how an application should be made and
[14:26] <bilalakhtar>  follow the GNU coding standards
[14:27] <bilalakhtar> IMPORTANT: There should be a space before every line in the long description
[14:28] <bilalakhtar> Correction: Please change the short description to: Program that prints out Hello World!
[14:28] <bilalakhtar> According to Debian policy we should not have the package name at the beginning of the short description
[14:28] <bilalakhtar> Now, open the copyright file
[14:29] <bilalakhtar> Replace the placeholders there with the appropriate information
[14:30] <bilalakhtar> (this file is very important in actual packaging, but in a tutorial it makes little sense to add info there)
[14:30] <bilalakhtar> Now, the rules file
[14:31] <bilalakhtar> Since our package is a pure C program that uses autotools, we don't need to edit the rules file
[14:31] <bilalakhtar> but in the case of python apps/modules, perl scripts, or anything that doesn't use makefiles and autotools, you will need to edit the rules file as well
[14:32] <bilalakhtar> let me give you link to documentation on that
[14:33] <bilalakhtar> https://wiki.ubuntu.com/PackagingGuide/Basic has good info
[14:33] <ClassBot> tarora asked: how to find package dependencies?
[14:33] <bilalakhtar> Since our package uses autotools, the packaging tools will automatically provide a list of package dependencies when we build the package
[14:34] <bilalakhtar> But in other cases, like python modules and other non-autotools packages
[14:35] <bilalakhtar> you will need to replace the ${shlibs:Depends} in the Depends: field of the control file with a comma-separated list of dependencies
[14:35] <bilalakhtar> but always leave ${misc:Depends} there
[14:36] <ClassBot> ongolaBoy asked: where do we find a complete reference of debian section ?
[14:36] <bilalakhtar> The most comprehensive information you would find would be the Debian policy manual http://www.debian.org/doc/debian-policy/
[14:37] <bilalakhtar> It is the base of all other documentation
[14:37] <bilalakhtar> However, if you want tutorial-style docs, you would like https://wiki.ubuntu.com/PackagingGuide
[14:37] <ClassBot> c2tarun asked: what is the function of rules file??
[14:38] <bilalakhtar> The rules file is like a makefile
[14:38] <bilalakhtar> it contains information for the packaging tools to build the package
[14:38] <ClassBot> c2tarun asked: what are  ${shlibs:Depends}, ${misc:Depends}
[14:39] <bilalakhtar> The former gets replaced automatically by a list of package dependencies that are unique to the package
[14:39] <bilalakhtar> If the package would be a rhythmbox plugin (for example), this would be replaced by rhythmbox, and other deps
[14:40] <bilalakhtar> in this case, it would be replaced by libc6 and other basic things, since this is a very basic package
[14:40] <bilalakhtar> ${misc:Depends} gets replaced by a list of dependencies common to every package
[14:41] <bilalakhtar> like: glibc, linux, and things without which the system would be unusable
[14:41] <ClassBot> boulabiar asked: is there any GUI for all of this?
[14:41] <bilalakhtar> not at the moment :)
[14:41] <bilalakhtar> If you want to develop stuff, and want to get your feet wet in packaging, you have to sacrifice the luxury of a GUI
[14:42] <ClassBot> c2tarun asked: when will this replacement occur??
[14:42] <bilalakhtar> When we build the package
[14:42] <bilalakhtar> (which is the next step
[14:42] <bilalakhtar> )
[14:42] <bilalakhtar> Now, let us build the package, to do that, type this:
[14:42] <bilalakhtar> debuild
[14:42] <bilalakhtar> That would do it all
[14:43] <bilalakhtar> Some stuff will be printed on the screen
[14:44] <bilalakhtar> When it asks you for the gpg passwords, enter the password of your gpg key
[14:44] <bilalakhtar> Once that is done, you shall have a deb file in the ubuntu-packaging directory
[14:45] <bilalakhtar> Okay, I forgot to mention about the changelog file
[14:46] <bilalakhtar> The package should build properly nevertheless
[14:46] <bilalakhtar> The very first line of the file should be like this:
[14:46] <bilalakhtar> hello (2.6-1) unstable; urgency=low
[14:46] <bilalakhtar> hello -> package name
[14:46] <bilalakhtar> 2.6-1 -> package version number
[14:47] <bilalakhtar> If you are packaging a new package for Ubuntu it would rather be 2.6-0ubuntu1
[14:47] <bilalakhtar> 0 is the debian revision, 0ubuntu1 means this package isn't in Debian yet
[14:47] <bilalakhtar> 2.6 is upstream version number
[14:48] <bilalakhtar> The second line onwards contains the changes made:
[14:48] <bilalakhtar> and the rest is not important for discussion ATM
[14:48] <bilalakhtar> Did the package build well?
[14:49] <ClassBot> c2tarun asked: what about the Makefile?? dont we have to create it??
[14:49] <bilalakhtar> the configure script creates it when we run debuild
[14:49] <ClassBot> c2tarun asked: can u explain what exactly debuild did??
[14:49] <bilalakhtar> Debuild did nothing but executed the debian/rules file with a different set of arguments
[14:50] <bilalakhtar> which built the package
[14:50] <bilalakhtar> man debuild will tell you what it did
[14:50] <bilalakhtar> It basically runs dpkg-buildpackage, then lintian, then debsign
[14:51] <bilalakhtar> dpkg-buildpackage does the main work
[14:51] <bilalakhtar> man dpkg-buildpackage will tell you about it
[14:51] <ClassBot> There are 10 minutes remaining in the current session.
[14:51] <ClassBot> c2tarun asked: where is the configure script??
[14:51] <bilalakhtar> In the hello-2.6 directory
[14:51] <bilalakhtar> it is supplied by upstream
[14:52] <bilalakhtar> Questions, please!
[14:52] <bilalakhtar> Okay, about PPAs
[14:52] <bilalakhtar> debuild must have created many files apart from a deb
[14:53] <bilalakhtar> If you want to upload the package to a PPA
[14:53] <bilalakhtar> make sure that you replace 'unstable' in the changelog file with 'maverick' or 'lucid' or the version of ubuntu you want to upload for
[14:54] <bilalakhtar> By version I mean codename of the release (hardy, jaunty, intrepid, etc) not numbers (8.04, 9.04, etc)
[14:54] <bilalakhtar> then run debuild -S
[14:54] <bilalakhtar> then install package dput
[14:55] <bilalakhtar> https://help.launchpad.net/Packaging/PPA/Uploading will help you then
[14:55] <ClassBot> c2tarun asked: i can see four configure files here? which one is the one guiding for Makefile
[14:55] <bilalakhtar> The one that is named 'configure'
[14:55] <bilalakhtar> that one
[14:55] <bilalakhtar> not configure.ac or something
[14:56] <ClassBot> There are 5 minutes remaining in the current session.
[14:56] <ClassBot> c2tarun asked: there is a file name configure.ac . can u please explain that file??
[14:56] <bilalakhtar> Beyond scope, but I will explain briefly
[14:56] <bilalakhtar> Developers use it to create 'configure' using autoconf
[14:57] <bilalakhtar> it is a helper file in reality
[14:57] <bilalakhtar> but of no use to the user or packager
[14:57] <bilalakhtar> < maxpaguro> where to learn more about correct libs and howto correct handle?
[14:57] <bilalakhtar> YOu mean correct dependencies?
[14:58] <bilalakhtar> they are usually listed in the README file in the upstream tarball
[14:58] <bilalakhtar> 2 minutes remaining, might answer 2 more Qs
[14:58] <bilalakhtar> quick!
[14:59] <ClassBot> maxpaguro asked: dependencies and libraries if updating a package
[14:59] <bilalakhtar> If you are updating a package
[14:59] <bilalakhtar> usually the deps remain the same
[15:00] <bilalakhtar> In autotools packages the deps are taken care of automatically
[15:00] <bilalakhtar> but in non-autotools packages, check the upstream changelog (not debian/changelog)
[15:00] <bilalakhtar> Almost time up!
[15:00] <bilalakhtar> Thanks for everyone who attended
[15:01] <ClassBot> Logs for this session will be available at http://irclogs.ubuntu.com/2010/11/23/%23ubuntu-classroom.html
[15:01]  * bilalakhtar waits for the bot to call off
[15:02] <c2tarun> today was my first class. it was good :) where can i get logs of previous classes
[15:02] <leoquant>  http://irclogs.ubuntu.com/2010/11/23/%23ubuntu-classroom.html
[15:03] <c2tarun> leoquant: at ur link i saw the log of todays class...  what about previous classes??
[17:45] <c2tarun> what is the timing of next class??
[17:47] <coolbhavi> c2tarun, please see the topic :)
[17:49] <c2tarun> how can i convert the given time according to indian time?
[17:51] <m4n1sh> c2tarun: +5:30
[18:05] <c2tarun> can i get the log files of previous classes
[18:09] <pleia2> c2tarun: they are all linked on the wiki page in the topic
[22:36] <airborn> ale chuj jestes
[22:36] <airborn> ups
[22:36] <airborn> sorry
[22:36] <airborn> :(