IntrotoUbuntuDevelopment

Open Week -- Intro to Ubuntu Development -- Bilal Akhtar -- Wed, Oct 13

   1 [16:01] <ClassBot> Slides for Intro to Ubuntu Development: http://people.ubuntu.com/~nhandler/slides/openweekmaverick/IntroductionToUbuntuDevelopment.pdf
   2 [16:01] <ClassBot> Logs for this session will be available at http://irclogs.ubuntu.com/2010/10/13/%23ubuntu-classroom.html following the conclusion of the session.
   3 [16:02] <nigelb> Hellos folks
   4 [16:02] <bilalakhtar> Hello people and welcome to the third day of the Ubuntu Open week!
   5 [16:02] <nigelb> The next session will be taken by bilal and here he is :)
   6 [16:02] <bilalakhtar> Hello people and welcome to the third day of the Ubuntu Open week!
   7 [16:02] <bilalakhtar> I am Bilal Akhtar, 14 (yes, 10+4) years old, studying at Delhi Public School, Riyadh, Saudi Arabia, though I am Indian by origin
   8 [16:02] <bilalakhtar> sorry for repeating that line, happened by mistake
   9 [16:03] <bilalakhtar> I am an Ubuntu Developer, and hence, I am here to give you an introduction to Ubuntu Development!
  10 [16:03] <bilalakhtar> [SLIDE 1]
  11 [16:03] <bilalakhtar> Before I begin with the session, I want you people to install the following packages, since these will be needed in packaging an application.
  12 [16:03] <bilalakhtar> These packages are: dpkg-dev build-essential dh-make fakeroot devscripts . To install them, type in a terminal:
  13 [16:04] <bilalakhtar> sudo apt-get install dpkg-dev build-essential dh-make fakeroot devscripts
  14 [16:04] <bilalakhtar> [Slide 1]
  15 [16:06] <bilalakhtar> So let's begin!
  16 [16:06] <bilalakhtar> If you want to ask a question, ask it on #ubuntu-classroom-chat with the prefix QUESTION: eg. QUESTION: What does 'foo' mean?
  17 [16:07] <bilalakhtar> Now, create an empty directory in your home directory
  18 [16:07] <bilalakhtar> since I will now tell you how to package a small C application
  19 [16:07] <bilalakhtar> [SLIDE 2]
  20 [16:08] <bilalakhtar> Name the directory hello-packaging
  21 [16:08] <bilalakhtar> and open a terminal and cd into it by typing cd hello-packaging
  22 [16:08] <bilalakhtar> Then, download the source code of the upstream package. What is upstream? Let me explain
  23 [16:09] <bilalakhtar> Upstream refers to the original application. The upstream application is packaged and made into a Debian package, also called a deb
  24 [16:09] <bilalakhtar> Download the upstream source by running this command:
  25 [16:09] <bilalakhtar> wget http://ftp.gnu.org/gnu/hello/hello-2.6.tar.gz
  26 [16:10] <bilalakhtar> then extract the source by running: tar xzf hello-2.6.tar.gz
  27 [16:10] <bilalakhtar> Okay, machinezilla just tols something about a postfix problem he is facing
  28 [16:10] <bilalakhtar> sorry for ignoring it earlier
  29 [16:11] <bilalakhtar> Set it to No configuration
  30 [16:11] <ClassBot> nisshh asked: apparently there are multiple ways to package something, which is confusing for new developers, is there a "recommended" or "simple and easy" way to package the majority of things?
  31 [16:12] <bilalakhtar> Of course there are multiple ways of packagign
  32 [16:12] <bilalakhtar> *packaging
  33 [16:12] <bilalakhtar> Packaging Python/PHP/Perl applications involve different processes
  34 [16:12] <bilalakhtar> The simplest is packaging C/C++ apps
  35 [16:13] <bilalakhtar> there are different ways in that as well
  36 [16:13] <bilalakhtar> but I am telling the latest and best of them
  37 [16:13] <bilalakhtar> which is, of course, *recommended* for new packages
  38 [16:13] <bilalakhtar> Right!
  39 [16:14] <bilalakhtar> Now, you shall have 1 folder and 1 file in your directory
  40 [16:15] <bilalakhtar> Rename the hello-2.6.tar.gz file to hello_2.6.orig.tar.gz
  41 [16:15] <bilalakhtar> and then cd into the hello-2.6 directory
  42 [16:15] <bilalakhtar> okay, now you need to set up your packaging environment
  43 [16:15] <bilalakhtar> for which you need to run the below commands:
  44 [16:16] <bilalakhtar> echo "export DEBEMAIL \"YOUR_EMAIL_ADDRESS@something.com\"" >> ~/.bashrc
  45 [16:17] <bilalakhtar> Replace YOUR_EMAIL_ADDRESS@something.com with your e-mail address
  46 [16:17] <bilalakhtar> Alo run:
  47 [16:17] <bilalakhtar> echo "export DEBFULLNAME \"Your Full Name\"" >> ~/.bashrc
  48 [16:17] <bilalakhtar> Then run :
  49 [16:17] <bilalakhtar> gpg --gen-key
  50 [16:18] <bilalakhtar> Answer the questions, and you shall have a gpg key
  51 [16:19] <bilalakhtar> Now, I assume you are in your hello-packaging/hello-2.6 directory
  52 === abadr_ is now known as abadr
  53 [16:20] <bilalakhtar> Run the below command:
  54 === abadr is now known as badara
  55 [16:20] <bilalakhtar> dh_make -c gpl3 -s
  56 === badara is now known as ABadr
  57 [16:21] <bilalakhtar> -c gpl3 specifies the license
  58 === ABadr is now known as Badr
  59 [16:21] <bilalakhtar> and -s means a single binary package
  60 === Badr is now known as ubuntero
  61 [16:21] <bilalakhtar> Now, your hello-2.6 folder must be having a debian/ subfolder
  62 [16:21] <bilalakhtar> cd into it
  63 [16:21] <bilalakhtar> we need to remove the extra files
  64 [16:21] <bilalakhtar> to do that, run:
  65 === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || UOW Survey: http://is.gd/fZlwL || Event: Ubuntu Open Week - Current Session: Intro to Ubuntu Development - Instructors: bilalakhtar - Slides: http://tinyurl.com/244y3k7
  66 [16:22] <bilalakhtar> [SLIDE 2]
  67 [16:23] <bilalakhtar> Make sure you are in the debian folder, and run:
  68 [16:24] <bilalakhtar> rm *ex *EX README.* info docs
  69 [16:25] <bilalakhtar> Now, open the control file in the debian folder with your favourite text editor
  70 [16:25] <bilalakhtar> Set the Homepage: line to Homepage: http://www.gnu.org/software/hello/
  71 [16:26] <bilalakhtar> This is the link to the main page of the project
  72 [16:26] <bilalakhtar> And, you will need to add a description as well
  73 [16:26] <bilalakhtar> so edit the Description: line and add a short description just after Description:
  74 [16:27] <ClassBot> machinezilla asked: i am stuck at gpg keygen step. i keep getting the following: Not enough random bytes available.  Please do some other work to give
  75 [16:29] <bilalakhtar> You must leave it at the step for some time (upto 5 mins) so that it has enough random bytes
  76 [16:29] <bilalakhtar> So I was at the Description: step
  77 [16:30] <bilalakhtar> Enter a long description BELOW the line, intended with spaces
  78 [16:30] <bilalakhtar> like this:
  79 [16:30] <bilalakhtar>  Hello is a tiny program that prints Hello World!
  80 [16:31] <bilalakhtar>  It follows GNU standards in coding
  81 [16:31] <bilalakhtar>  and can be translated into other languages
  82 [16:31] <bilalakhtar> Make sure each line has a space before it, otherwise the description won't come as intended
  83 [16:32] <bilalakhtar> Now, save and close the control file
  84 [16:32] <bilalakhtar> Ignore the compat file, its usage is beyond the scope of this tutorial
  85 [16:32] <bilalakhtar> Open the copyright file
  86 [16:34] <bilalakhtar> In real packaging, you will have to fill the placeholders in the file with real URLs and real authors
  87 [16:34] <bilalakhtar> that's all about this file
  88 [16:34] <bilalakhtar> now, open control again
  89 [16:34] <bilalakhtar> I missed something in it
  90 [16:35] <bilalakhtar> Change the Section: to Section: misc
  91 [16:36] <bilalakhtar> And remove the #Vcs- fields
  92 [16:36] <bilalakhtar> Save and exit
  93 [16:36] <bilalakhtar> Since this is a simple C application using GNU autotools
  94 [16:36] <bilalakhtar> you don't need to modify the rules file
  95 [16:36] <bilalakhtar> however, if you follow other packaging techniques, you do need to
  96 [16:37] <bilalakhtar> so now for the changelog file
  97 [16:37] <bilalakhtar> The changelog contains a list of all the changes in a package, version-by-version
  98 [16:37] <bilalakhtar> let me give an example
  99 [16:38] <bilalakhtar> http://changelogs.ubuntu.com/changelogs/pool/universe/a/a2ps/a2ps_4.14-1.1/changelog
 100 [16:38] <bilalakhtar> This is a typical changelog
 101 [16:38] <bilalakhtar> Too confusing, eh? But there is a utility to help you deal with debian changelogs
 102 [16:38] <bilalakhtar> which is debchange
 103 [16:39] <bilalakhtar> You already have it installed as part of package devscripts
 104 [16:39] <bilalakhtar> so poke it with:
 105 [16:39] <bilalakhtar> debchange -e
 106 [16:39] <bilalakhtar> If it asks for an editor, select your favourite one
 107 [16:39] <bilalakhtar> Now, let us analyse the changelog
 108 [16:39] <bilalakhtar> The first line is something like this:
 109 [16:39] <bilalakhtar> hello (2.6-1) unstable; urgency=low
 110 [16:39] <bilalakhtar> Change unstable above to maverick
 111 [16:40] <bilalakhtar> 2.6-1 is the version
 112 [16:40] <bilalakhtar> though when packagign for Ubuntu it would be 2.6-0ubuntu1
 113 [16:40] <bilalakhtar> 2.6 is the upstream application number, 0 is the debian version for a package not in Debian, and 1 is Ubuntu revision number
 114 [16:40] <bilalakhtar> Modify the second line like this
 115 [16:41] <bilalakhtar>   * Initial Release
 116 [16:41] <bilalakhtar> that's all
 117 [16:41] <bilalakhtar> Save and close
 118 [16:41] <bilalakhtar> Now, run debuild in the terminal
 119 [16:41] <ClassBot> machinezilla asked: what are the #Vcs fields?
 120 [16:41] <bilalakhtar> They contain the links to the upstream revision control source location
 121 [16:41] <bilalakhtar> What is that?
 122 [16:42] <bilalakhtar> Its a link to the place where the latest source code is located
 123 [16:42] <ClassBot> daker asked: do i have right to package a proprietary software ?
 124 [16:42] <bilalakhtar> Yes you can, but you will need to have access to the source
 125 [16:42] <bilalakhtar> and
 126 [16:42] <bilalakhtar> you will need to mention about the license of the package PROPERLY in debian/copyright
 127 [16:43] <bilalakhtar> Now, as I said, run the command debuild
 128 [16:43] <bilalakhtar> It will build the package
 129 [16:43] <ClassBot> machinezilla asked: so the vcs field is the "Homepage:" field?
 130 [16:43] <bilalakhtar> no
 131 [16:43] <bilalakhtar> Homepage: refers to the home page of the software project
 132 [16:43] <bilalakhtar> which is meant for user
 133 [16:43] <bilalakhtar> *users
 134 [16:44] <bilalakhtar> while Vcs-* fields point directly at the developer source of the package
 135 [16:44] <bilalakhtar> I hope the package is built now
 136 [16:44] <bilalakhtar> and in the hello-packaging folder you should have a deb file
 137 [16:45] <bilalakhtar> Congrats! You just packaged an application!
 138 [16:46] <bilalakhtar> [SLIDE 3]
 139 [16:47] <bilalakhtar> Oops, sorry for not mentioning this earlier
 140 [16:47] <bilalakhtar> but you will need to modify the Maintainer: field in debian/control to: Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
 141 [16:47] <bilalakhtar> Now building should work
 142 [16:48] <bilalakhtar> As the slide shows, Ubuntu is based on Debian http://www.debian.org
 143 [16:49] <bilalakhtar> [SLIDE 4]
 144 [16:49] <bilalakhtar> The slides now tell everything
 145 [16:49] <bilalakhtar> Please ask questions if you have any
 146 [16:50] <bilalakhtar> [SLIDE 5]
 147 [16:51] <bilalakhtar> https://wiki.ubuntu.com/UbuntuDevelopment/Merging outlines the merging process
 148 [16:51] <ClassBot> There are 10 minutes remaining in the current session.
 149 [16:52] <bilalakhtar> [SLIDE 6]
 150 [16:52] <ClassBot> autif asked: If I have a piece of software (say) of source forge or git hub and I want to submit it to debian. Where do I sent it to to be included as a part of the official repository?
 151 [16:53] <bilalakhtar> Wait a minute, I am searching for a link
 152 [16:54] <bilalakhtar> [SLIDE 7]
 153 [16:55] <bilalakhtar> http://wiki.debian.org/HowToPackageForDebian
 154 [16:55] <bilalakhtar> and
 155 [16:55] <ClassBot> There are 5 minutes remaining in the current session.
 156 [16:56] <bilalakhtar> [SLIDE 8]
 157 [16:56] <bilalakhtar> http://mentors.debian.net/cgi-bin/maintainer-intro should help you if you want to get a new package in debian
 158 [16:57] <bilalakhtar> https://wiki.ubuntu.com/ContributingToDebian will also help you
 159 [16:57] <ClassBot> autif asked: What is the level of testing expected before that package is submitted to the official repository - I mean if my fav distro is xubuntu, do I need to test it on ubuntu or latest debian?
 160 [16:57] <bilalakhtar> As I said
 161 [16:57] <bilalakhtar> new packages should come into Debian first
 162 [16:58] <bilalakhtar> so testing with latest Debian is the best
 163 [16:58] <bilalakhtar> Xubuntu uses same repos as Ubuntu
 164 [16:58] <bilalakhtar> [SLIDE 9]
 165 [16:58] <bilalakhtar> And Ubuntu syncs from Debian
 166 [16:58] <bilalakhtar> so getting a package in Debian will mean that it will come everywhere :)
 167 [16:58] <ClassBot> kstailey_ asked: What does it take to get a PPA into Multiverse?
 168 [16:58] <bilalakhtar> What do you actually mean?
 169 [16:59] <bilalakhtar> You mean, a PPA Package?
 170 [16:59] <bilalakhtar> you will need to check it for errors
 171 [16:59] <bilalakhtar> [SLIDE 10]
 172 [16:59] <bilalakhtar> And then apply through the sponsorship process for new packages
 173 [16:59] <bilalakhtar> https://wiki.ubuntu.com/UbuntuDevelopment/NewPackages
 174 [16:59] <bilalakhtar> is the process :)
 175 [17:00] <ClassBot> machinezilla asked: debuild is failing at gpp step. see paste: http://paste.ubuntu.com/512465/
 176 [17:00] <bilalakhtar> Make sure that your DEBEMAIL and DEBFULLNAME variables are set
 177 [17:00] <bilalakhtar> and your GPG key e-mail address matches it
 178 [17:00] <bilalakhtar> okay, almost time up
 179 [17:00] <bilalakhtar> Any more Qs?

MeetingLogs/openweekMaverick/IntrotoUbuntuDevelopment (last edited 2010-10-15 01:38:59 by nigelbabu)