From Fedora Project Wiki

Revision as of 13:48, 5 April 2009 by Mspevack (talk | contribs) (New page: === IRC Log === {| |- id="t13:30" | colspan="2" | * spevack hands the microphone to cwickert for RPM Packaging --
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


* spevack hands the microphone to cwickert for RPM Packaging -- 13:30
cwickert ok, here we go... 13:30
... leave!#fedora-classroom -> jcapel() 13:30
Padhu1 ொம 13:30
Padhu1 ok 13:30
cwickert My name is Christoph Wickert and I'm your teacher for todays IRC classroom lesson on building RPM packages 13:30
mahesh hello to cwickert 13:30
cwickert hi mahesh 13:30
... join!#fedora-classroom -> zeroC(n=zeroc@unaffiliated/danielf) 13:30
cwickert We are not going into details, instead I want all of you to have your first RPM after this class 13:30
dash123 cwickert: goodevening teacher :) 13:30
... join!#fedora-classroom -> verdurin( 13:30
Padhu1 hi tutor 13:31
cwickert first, we need to have a couple of tools installed 13:31
cwickert please do a 13:31
cwickert yum groupinstall development-tools 13:31
cwickert if you don't have them installed already 13:31
mahesh done 13:31
dash123 done 13:31
cassmodiah done 13:31
cwickert cassmodiah: :) 13:31
cwickert cassmodiah already is a package maintainer, so he has all the necessary stuff installed 13:32
cassmodiah  :-) correct! 13:32
ahmed-araby  :) 13:32
cwickert and especially for RPM building we need some more tools 13:32
cwickert yum install rpmbuild rpmdevtools 13:32
cwickert rpmbuild is the command to build the package 13:33
cwickert rpmdevtools is a collection of handy utils 13:33
ahmed-araby is rpmbuild rpmdevtools as I think I've problem is rpmfusion ? 13:33
cwickert so while some are still installing stuff, let's talk about the basics 13:33
ahmed-araby *is enough ? 13:33
cwickert ahmed-araby: what exactly is your prob? 13:34
... join!#fedora-classroom -> sattam1(n=sattam@unaffiliated/thtoh) 13:34
ahmed-araby [Errno -1] Metadata file does not match checksum 13:34
cwickert ahmed-araby: you can ether do "yum clean all" or disable the rpmfusion repo for now 13:34
dash123 cwickert: i did that yesterday it said ther ain't such thing as rpmbuild,? 13:35
ahmed-araby I've already rpmdevtools & rpmbuild installed already 13:35
cwickert ahmed-araby: fine 13:35
... signoff!#fedora-classroom -> sattam(Nick collision from services.) 13:35
... nick!sattam1 -> sattam 13:35
cwickert dash123: where id it say that? in yum or from the command line? 13:35
cwickert s/id/did 13:36
dash123 result of yum search 13:36
cwickert dash123: sorry, it's rpm-build 13:36
cwickert ok everybody, my bad 13:37
cwickert yum install rpm-build 13:37
dash123 worries 13:37
cwickert me is ashamed ;) 13:37
cwickert pk, let's go on 13:37
mahesh nothing... go ahead 13:37
cwickert any idea why we are building packages after all? 13:37
cwickert or what RPM actually means? 13:38
dash123 redhat package manager 13:38
mahesh RPM Package Manager 13:38
cwickert mharris: right 13:38
Padhu1 custom applications. am i right? 13:38
cwickert It used to stand for "Red Hat Package Manager", but got renamed since many other distributions are using RPM too 13:38
ahmed-araby for building Binary Packages from SOurce code 13:38
lwh to automatically install a bunch of stuff and possibly run things to set it up ? 13:38
ahmed-araby ready to use 13:38
... join!#fedora-classroom -> UsamaAkkad(n=Usama@unaffiliated/uaa) 13:38
cwickert ahmed-araby: exactly, ready to use packages 13:38
cwickert no need to compile them, but install them with a couple of mouseclicks 13:39
cwickert RPM has a database that keeps track of all files installed, so you can uninstall them later without orphaned files 13:39
cwickert The database is located in /var/lib/rpm/*db.* 13:39
cwickert RPM will also take care of providing all the dependencies of a package, verify it's integrity and so on 13:39
* ahmed-araby rises his hand 13:39
cwickert ahmed-araby: yes? 13:40
ahmed-araby why sqlite with in specific ? 13:40
ahmed-araby It's using sqlite right ? 13:40
... join!#fedora-classroom -> sadfag( 13:40
Padhu1 very lite DB and easy to use 13:40
cwickert ahmed-araby: yes, the database is using sqlite 13:40
cwickert the database lists all files installed, e.g you can run "rpm -ql foo" and it will show you all files inside foo 13:41
cwickert so everybody has the tools installed now? 13:41
dash123 yes 13:41
openpercept yes 13:41
l0nwlf yes 13:41
cwickert ok 13:41
cassmodiah yes 13:41
ahmed-araby yes 13:42
cwickert one important thing is 13:42
cwickert NEVER build packages as root! 13:42
cwickert If a package has a stupid Makefile, you might accidentally overwrite files of your system. 13:42
mahesh yes 13:42
cwickert so we need to setup a rpm build tree for your user 13:42
cwickert we use rpmdev-setuptree from the rpmdevtools package to do that 13:43
cwickert just run rpmdev-setuptree 13:43
cassmodiah  ? 13:43
cwickert it will create a folder rpmbuild inside your homedir 13:43
cwickert cassmodiah: yes please 13:43
cassmodiah cwickert do you think it's important to set up an extra user just for packaging? the fedora wiki doesn't give a hit, and the packagers are not agreed 13:43
cwickert cassmodiah: no, it's only usefull for fully automated packageing 13:43
cwickert but you won't need it 13:44
cassmodiah k, thx 13:44
... signoff!#fedora-classroom -> rjones("Leaving") 13:44
cwickert note to the rest of the class: by fedorawiki cassmodiah means, not the wiki at 13:44
cwickert now let's look inside the rpmnbuild folder 13:44
lwh that command doesn't exist , will this work on f9 ? 13:45
mahesh i was wondering about that, now clear 13:45
cwickert there are five subdirs inside 13:45
cwickert BUILD is where the builds are happening. Every package will create a subfolder <name>-<version> there 13:45
cwickert RPM is where the binary packages will be placed when they are ready 13:45
cwickert SOURCES is where we need to place the sources of which we build the packages! 13:45
mahesh ok 13:45
cwickert SPECS is for spec files 13:45
cwickert so what are spec files? any idea? 13:45
cassmodiah  ! 13:46
dash123 specifications 13:46
dash123  ? 13:46
cassmodiah build reciepts :-) 13:46
mahesh SPECS are like the makefiles's it provides info to the package manager right? 13:46
cwickert cassmodiah: you be quiet please ;) you know all that stuff already 13:46
cwickert mharris: well said! 13:47
cwickert sorry, I meant mahesh 13:47
mahesh ok 13:47
cwickert so the spec has a set of instructions _how_ to build the package 13:47
cwickert so building RPMs means writing a spec first of all 13:47
cwickert ok, we continue with the folders first 13:48
cwickert SRPMS is for source RPMS. 13:48
cwickert any questions so far? 13:48
dash123 cwickert: i previously tried to get to the source code of some linuxdcpp.srpm and did these steps, shud i delete these and start afresh?? 'cause all my subdirs are filled with dcpp files 13:48
cwickert dash123: no problem 13:49
mahesh is the SRPMS built automatically or is it another process? 13:49
sattam whats the diffrent between SRPMS and source ? 13:50
cwickert mahesh: depends on how you call rpmbuild 13:50
mahesh i mean foo.src.rpm 13:50
mahesh ok 13:50
cwickert sattam: good question 13:50
cwickert the SRPM or source RPM contains the source tarball 13:50
cwickert as well as the spec 13:50
cwickert and patches, if there are any 13:50
cwickert so you can use the srpm to build binary rpms of it for different releases 13:51
cwickert sattam: got it? 13:51
sattam cwickert: yes , very clear 13:51
cwickert ok 13:51
mahesh so rpms are built from srpms? 13:51
cwickert mahesh: yes, you can do this 13:52
mahesh fine 13:52
cwickert but you can also do this in a single run of rpmbuild 13:52
cwickert depends how you call it 13:52
cwickert we'll come to that later 13:52
mahesh ok 13:52
cwickert first we need a spec 13:52
cwickert and of course we need a program to package 13:53
... join!#fedora-classroom -> megenius_( 13:53
cwickert I have chosen gigolo from 13:53
cwickert it's already in Fedora, but nevermind 13:53
... join!#fedora-classroom -> sattam1(n=sattam@unaffiliated/thtoh) 13:53
mahesh ok 13:53
cwickert so everybody please go to 13:53
dash123 ok..which one to download? 13:54
cwickert and download the latest release 0.3.1 to your ~/rpmbuild/SOURCES folder 13:54
l0nwlf 0.3.1 ?? 13:54
... join!#fedora-classroom -> Fzza3a(i=29dd1066@gateway/web/ajax/ 13:54
... leave!#fedora-classroom -> Fzza3a() 13:54
cwickert l0nwlf: yes: 13:54
cwickert or as direct link 13:55
dash123 cwickert: do we also need the gpg signature?? 13:55
cwickert nope 13:55
dash123 ok 13:55
cwickert we trust ourselves and upstream 13:55
cwickert  :) 13:55
... signoff!#fedora-classroom -> sattam(Read error: 54 (Connection reset by peer)) 13:55
dash123 done 13:55
UsamaAkkad  :) 13:55
cwickert ok, now we go to rpmbuild/SPECS 13:55
sattam1 13:55
cwickert and run the command "rpmdev-newrpmspec gigolo" 13:55
cwickert sattam1: exactly 13:56
cwickert the command will create an empty specfile from a template 13:56
cwickert use an editor to edit it 13:56
mahesh ok 13:56
cwickert everybody has the spec file opened? 13:56
dash123 bash: rpmdev-newrpmspec: command not found 13:57
verdurin it's rpmdev-newspec 13:57
openpercept is it rpmdev-newspec or rpmdev-newrpmspec 13:57
openpercept  ? 13:57
cwickert verdurin: right 13:57
cwickert got renamed recently 13:57
cwickert I'm still used to the old name 13:57
cwickert rpmdev-newspec is the new name 13:57
... signoff!#fedora-classroom -> marflow_afk(Read error: 110 (Connection timed out)) 13:57
cwickert so it's rpmdev-newspec gigolo 13:57
dash123 done 13:58
openpercept yeah done 13:58
cwickert ok, now let's take a look at that file 13:58
cwickert we go through the tags one by one 13:58
cwickert Name: this one is pretty trivial, it's "gigolo". Please use the notation of the source tarball 13:58
cwickert Version: 0.3.1 in our case 13:59
cwickert Release: leave it as is 13:59
* l0nwlf have a doubt ? 13:59
cwickert the version is from upstream while Release is from Fedora 13:59
cwickert so 1 is the first Fedora package 13:59
cwickert l0nwlf: question=? 14:00
l0nwlf Version is 'blank' not '0.3.1' in gigolo.spec 14:00
cwickert l0nwlf: yes, you need to enter 0.3.1 there as I said 14:00
cwickert Release is already filled and remains as is 14:00
l0nwlf oh , we need to _edit_ it 14:00
cwickert l0nwlf: yes 14:01
cwickert  %{?dist} will be expanded to "fc10" or "fc11" 14:01
dash123 cwickert: can you tell us about how we decide version numbers?? 14:01
cwickert dash123: use the one from upstream 14:01
cwickert look at the tarball 14:01
dash123 ok 14:01
cwickert and for release you usually start with 1 14:02
... join!#fedora-classroom -> edouardp_( 14:02
cwickert but threre are exceptions 14:02
cwickert for snapshots and betas etc 14:02
cwickert but we are not going to cover that since it is outlined in the wiki 14:02
cwickert next is the Group tag 14:02
cwickert oh no, I forgot Summary 14:03
cwickert Summary should be short and precise. Only keywords, now whole sentences, because this is what you see in PackageKit. 14:03
cwickert We can take this from the homepage 14:03
... signoff!#fedora-classroom -> nethad("Konversation terminated!") 14:03
... leave!#fedora-classroom -> lwh() 14:03
... join!#fedora-classroom -> nethad(n=thomas@ 14:03
cwickert for example "GIO/GVFS management application" 14:03
cwickert now we come to Group 14:04
Padhu1 cwickert: some RPMs needed GPL Keys when try to install it. Is it possible to build like these? then How 14:04
cwickert Padhu1: later... 14:04
cwickert you mean gpg keys, right? 14:04
Padhu1 yes 14:05
cwickert signing is a different process after the build 14:05
cwickert lets continue with the spec 14:05
Padhu1 ok 14:05
cwickert please take a look at /usr/share/doc/rpm-4.6.0/GROUPS 14:05
mahesh explain about the gpg keys before the end of this session 14:05
cwickert mharris: will do 14:05
... signoff!#fedora-classroom -> ahmed-araby(Read error: 110 (Connection timed out)) 14:05
cwickert I think "User Interface/Desktops" fits best for our package 14:05
cwickert but you can choose anything you want from the list 14:06
cwickert License: inside the source tarball you will find a copy of the GPL named COPYING. It's version 2 of the license 14:06
cwickert so we use "GPLv2" for now, but we'll come back to that later 14:06
cwickert URL: The homepage of the program: 14:07
cwickert Source0: is the dowload link 14:07
cwickert so for us it's 14:07
cwickert sorry 14:07
cwickert 14:07
cwickert needs to be the link to the file itself 14:08
cwickert Now comment out BuildRequires and Requires, we don't care about that right now but shoot into the dark instead :) 14:08
cwickert  %description: we can take that from the homepage too 14:09
cwickert for example: Gigolo is a frontend to easily manage connections to remote filesystems using GIO/GVfs. It allows you to quickly connect/mount a remote filesystem and manage bookmarks of such. 14:09
cwickert You see: complete sentences with dots at the end. 14:09
... signoff!#fedora-classroom -> edouardp(Read error: 110 (Connection timed out)) 14:09
cwickert Any questions so far? 14:09
mahesh nope, its clear 14:09
cwickert has everybody filled all tags now? 14:10
dash123 what haapens if i choose some random group tag? 14:10
dash123 do i "have" to choose from th e/GROUPS? 14:10
cwickert dash123: yes 14:10
cwickert well, you can uses something different 14:10
cwickert I don't think rpmbuild will complain 14:11
cwickert but we in Fedora will :) 14:11
cwickert so stick with the list please 14:11
UsamaAkkad  :D 14:11
dash123 ok 14:11
cwickert the group tag is not important any longer, as it is not used by packagekit 14:11
cwickert ok, now we can start our first build 14:12
nethad cwickert: i have a question, do i need to put " " around the strings, e.g. Licence: "GPLv2" or is it: Licence: GPLv2  ? 14:12
... nick!megenius_ -> meGenius 14:12
cwickert or at leastr an attempt to do so 14:12
cwickert nethad: no "" 14:12
cwickert just GPLv2 14:12
nethad ok 14:12
l0nwlf i have a doubt ? 14:12
cwickert l0nwlf: yes please 14:12
l0nwlf  %prep , %setup ?? 14:12
cwickert ok, then I'll explain it 14:13
l0nwlf we'll leave it as it is 14:13
cwickert for now we can use what's in there 14:13
cwickert  %prep ist for preparing 14:13
sattam1 cwickert: why you skip " BuildRoot " ? 14:13
cwickert sattam1: my bad 14:13
cwickert BuildRoot remains as is 14:14
cwickert it's the location where we are building the package 14:14
cwickert a temporary folder 14:14
cwickert ok sattam1? 14:14
sattam1 clear 14:14
cwickert ok, so %prep is for preparing 14:15
cwickert this means extractiong the source and applying patches if there are any 14:15
cwickert after that the actual build starts in %build 14:15
cwickert ok, just realized that I choose a bad example :( 14:16
cwickert because gigolgo uses war for building and not autotools 14:16
cwickert usually yu run ./configure && make 14:16
cwickert and make install 14:16
mahesh yes 14:17
cwickert so ./configure and make are the stuff in the %build section 14:17
cwickert after that the files are installed to a temporary location 14:17
cwickert during %install 14:17
cwickert waf bedomes more and more popular 14:18
cwickert so in our example we use waf instead of autotools for building 14:18
... signoff!#fedora-classroom -> nethad("Konversation terminated!") 14:18
dash123 cwickert: how did you get to know gigolo uses war/waf??experience? 14:18
cwickert so please remove %configure 14:19
cwickert make %{?_smp_mflags} 14:19
cwickert dash123: see the readme inside the tarball 14:19
dash123 ok 14:19
cwickert it contains instructions for building the package 14:19
cwickert the statement we use for building is at 14:19
l0nwlf we remove only these two i suppose 14:19
cwickert use this to replace the two lines 14:20
cwickert l0nwlf: right 14:20
... join!#fedora-classroom -> nethad(n=thomas@ 14:20
cwickert actually this is only the configure 14:20
cwickert for building we need "./waf build" 14:20
cwickert so ./waf build replaces make %{?_smp_mflags} 14:21
cwickert so everybody has his %build section ready now? 14:21
dash123 yes 14:21
cwickert ok, then we start 14:21
cwickert rpmbuild -ba gigolo.spec 14:22
cwickert -ba means build all, binaries and source rpm 14:22
cwickert -bs means build source 14:22
cwickert and --bb build binary 14:22
UsamaAkkad build source mean srpm ? 14:23
cwickert UsamaAkkad: exactly 14:23
... signoff!#fedora-classroom -> linuxguru("Leaving") 14:23
cwickert so are you already running the rpmbuild? 14:23
cwickert anybody? 14:23
cwickert it will most likely stop with an error 14:23
dash123 yes i got errors 14:23
cwickert ok, dash123, tell me 14:24
nethad cwickert: yes, errors 14:24
l0nwlf error: line 8: Unknown tag: Version 2, June 1991 14:24
l0nwlf I copied all licence : and it's second line of licennse tag 14:24
dash123 14:24
nethad my one seems to be about the waf command 14:24
cwickert l0nwlf: no, just insert GPL there 14:24
cwickert dash123: there seems to be a letter missing 14:25
sattam1 error: line 15: Too many names: %description Gigolo is a frontend to easily manage connections 14:25
cwickert needs to be "export" 14:25
dash123 and my spec file is this: 14:26
l0nwlf error: line 19: Too many names: %description my first RPM 14:26
l0nwlf  %description is causing errors 14:27
cwickert l0nwlf needs a new line after description 14:27
cwickert all: I have posted what the head of the spec should look like at 14:27
cwickert it also contains some more things we'll come to later 14:27
... signoff!#fedora-classroom -> nethad(Remote closed the connection) 14:28
cwickert for those who have problems, I suggest to use the paste I provided 14:28
l0nwlf 14:28
... signoff!#fedora-classroom -> GeroldKa(Read error: 113 (No route to host)) 14:28
cwickert l0nwlf: there is a typo 14:28
cwickert all: xport needs to be export, the e is missing 14:29
cwickert my bad, I missed that during copying 14:29
cwickert here is the correct version: 14:29
cwickert so, anybody running rpmbuild right now? 14:30
cwickert or where are the problems? 14:30
dash123 ah working now its checking for gcc, etc..ops error again 14:30
cwickert dash123: this was expected :) 14:30
cwickert these are missing build reuirements 14:31
l0nwlf what about %install , %clean , %files 14:31
cwickert dash123: can you please post the errors? 14:31
cwickert l0nwlf: later... 14:31
dash123 yes 14:31
openpercept  :wq 14:31
openpercept oops 14:31
dash123 14:31
l0nwlf 14:32
cwickert dash123: looks good so far, this is because we have not yet tweaked the %install section 14:32
cwickert l0nwlf: same for you 14:32
cwickert so basically the buold itself has worked for all of you 14:33
cwickert fine 14:33
cwickert not to %install 14:33
... signoff!#fedora-classroom -> icarus-c("Leaving") 14:33
cwickert the first line remains as is 14:33
cwickert rm -rf $RPM_BUILD_ROOT 14:33
cwickert is for cleaning up old stuff if there is any from a previpus build that failed 14:34
cwickert now instead of "make install DESTDIR=$RPM_BUILD_ROOT" we use waf again 14:34
cwickert so it becomes 14:34
cwickert DESTDIR=$RPM_BUILD_ROOT ./waf install 14:34
cwickert when you have changed that, you can re-run rpmbuild 14:34
... join!#fedora-classroom -> megenius_( 14:35
dash123 cwickert: i do realise i didn't include ./waf build -v in %build will that cause problems later? 14:35
cwickert dash123: yes , then you did not build anything 14:35
cwickert because this is the counterpart to "make" 14:35
dash123 oh...ok sry 14:36
cwickert np 14:36
cwickert let's get back to for a moment 14:36
@spevack cwickert: about 5 minutes left, FUI 14:36
@spevack er, FYI 14:36
cwickert spevack: thanks 14:36
cwickert everybody: you see these "checking for ..." messages, right= 14:37
cwickert  ? 14:37
dash123 i got a bunch more errors after the correction: 14:37
cwickert this is where we get the buildquirements from 14:37
dash123 color coded in red 14:37
cwickert anybody successfully did the build? 14:37
cwickert until  %install? 14:37
dash123 not me 14:37
dash123 let me copy your spec and try 14:38
cwickert dash123: please do 14:38
l0nwlf 14:38
l0nwlf here are my errors 14:38
cwickert l0nwlf: great 14:38
cwickert these were expected, because the %files section is empty 14:39
... join!#fedora-classroom -> raina(n=raina@pdpc/supporter/active/raina) 14:39
l0nwlf  %clean, %files, %changelogs -> the three things still UNtouched 14:40
cwickert I have updated the spec at 14:40
cwickert  %clean remains as is 14:40
cwickert and for %changelog you write something like 14:40
cwickert * Sun Apr 05 2009 Foo bari <> - 0.3.1-1 14:41
cwickert - Initial attempt 14:41
cwickert let's have a look a the files section 14:41
cwickert /usr/bin/gigolo is unpackaged 14:42
cwickert this means it was build but not included in the rpm 14:42
cwickert so we add %{_bindir}/gigolo to the files section 14:42
... join!#fedora-classroom -> pabloa( 14:43
cwickert do not hardcode /usr/bin, but use %{_bindir} instead 14:43
cwickert for a complete list of macros see 14:43
... join!#fedora-classroom -> megenius__( 14:43
dash123 ok 14:44
cwickert so basically everthing that rpm complained about as unpacked needs to be inserted in the %files section 14:44
cwickert and that's basically it 14:44
l0nwlf 14:44
... join!#fedora-classroom -> jyoti(n=Jyoti@ 14:44
cwickert l0nwlf: fine 14:44
cwickert this is where we use %find_lang 14:45
cwickert it will automatically search for locales and include them 14:45
cwickert this is decribed in the wiki 14:45
cwickert 14:45
cwickert so now all errors should be fixed 14:46
cwickert and if somebody still has problems, contact me in private 14:46
cwickert because now the next class is about to start 14:46
dash123 ok... 14:46
cwickert I will be around in the chan for answers 14:46
@spevack ok cwickert, thanks so much for teaching this class. 14:46
* cassmodiah applauds cwickert 14:47
cwickert but these are al minor problems, I hope you understoood what it's about 14:47
@spevack we'll take a short break, and nirik will start on his Networking class at :52 14:47
grndplane Yes thanks for taking the time :-) 14:47
cwickert feel free to contact me 14:47
G__81 very good session cwickert :) 14:47
dash123 thanks cwickert 14:47
* dash123 bows down 14:47
* nirik waits in the wings ready to start in a bit. 14:47
cwickert thanks everybody for your time and intereest :) 14:47
openpercept thanks cwickert 14:47
Padhu1 Thanks 14:47

Generated by 2.7 by Marius Gedminas - find it at!