Ellhniko RPM HOWTO Donnie Barnes, djb@redhat.com 8 Aprilioy 1997, ekdosh v2.07 ____________________________________________________________ Table of Contents 1. Eisagwgh 2. Episkophsh 3. Genikes Plhrofories 3.1 Apoktwntas to RPM 3.2 Apaithseis toy RPM 4. Xrhsimopoiwntas to RPM 5. Kai ti mporw na kanw 6. Xtizontas RPMs 6.1 To arxeio rpmrc 6.2 To arxeio prodiagrafwn (Spec File) 6.3 H epikefalida 6.4 Prep 6.5 Xtisimo (Build) 6.6 Egkatastash 6.7 Proairetika skriptakia prin kai meta thn Egkatastash/Apegkatastash 6.8 Arxeia 6.9 Xtizontas to 6.9.1 O dendroeidhs katalogos toy phgaioy kwdika 6.9.2 Elegxos sto xtisimo 6.9.3 Dhmioyrgwntas th lista arxeiwn 6.9.4 Xtizontas to Paketo me RPM 6.10 Elegjte to 6.11 Ti na kanete me ta nea sas RPMs 6.12 Kai twra; 7. Xtizontas RPM gia polles arxitektonikes 7.1 Ena aplo arxeio prodiagrafwn (spec File) 7.2 Optflags 7.3 Macros 7.4 Afairwntas arxitektonikes apo Paketa 7.5 Teleiwnontas 8. Pneymatika Dikaiwmata 9. Peri ths Ellhnikhs Metafrashs ______________________________________________________________________ 1. Eisagwgh To RPM einai einai akrwnumio toy Red Hat Package Manager. Parolo poy periexei to Red Hat sto onoma toy, h pro8esh einai na apotelesei ena anoikto susthma paketarismatos, dia8esimo pros xrhsh apo ka8enan. Epitrepei stoys xrhstes na pairnoyn ton phgaio kwdika enos neoy logismikou kai na ton paketaroyn se phgaia kai ektelesimh morfh, wste na mporoun na egka8istantai kai na parakoloy8ountai eukola ta ektelesima paketa, kai o phgaios kwdikas na mporei na xtizetai me aplo tropo. Diathrei epishs mia bash dedomenwn olwn twn paketwn kai twn arxeiwn toys, poy mporei na xrhsimopoih8ei gia thn epalh8eysh ths uparjhs kai akeraiothtas twn paketwn ka8ws kai gia thn apanthsh se erwthseis sxetika me arxeia h paketa. H etaireia Red Hat Software en8arrunei alloys promh8eytes dianomwn na dia8esoyn xrono sto na katanohsoyn to RPM kai na to xrhsimopoihsoyn gia tis dikes toys dianomes. To RPM einai polu eyelikto kai euxrhsto, parolo poy parexei thn bash gia ena polu eyru susthma. Einai epishs teleiws anoikto kai plhrws dia8esimo, kai 8a ektimousame opoiesdhpote anafores sfalmatwn kai dior8wseis. Ekxwreitai h adeia dwrean xrhshs kai dianomhs toy RPM katw apo toys oroys ths GPL. Mia plhresterh tekmhriwsh gia to RPM einai dia8esimh sto biblio toy Ed Bailey, Maximum RPM. To biblio einai dia8esimo gia na to katebasete h na to agorasete sth dieu8ynsh www.redhat.com . 2. Episkophsh Prwta ap'ola, epitrecte moy na perigracw ta basika ths filosofias poy krubetai pisw apo to RPM. Enas sxediastikos stoxos htan na epitrecei thn xrhsh ``prwtarxikou (basikou)'' kwdika. Me to RPP (o prohgoumenos mas diaxeirisths paketwn, apo ton opoion de xrhsimopoih8hke tipota sth dhmioyrgia toy RPM), ta paketa phgaioy kwdika htan ``peiragmenoi'' arxikoi phgaioi kwdikes poy meta xtisame. 8ewrhtika, kapoios 8a mporouse na egkatasthsei ena phgaio RPP kai meta na kaneimake xwris problhmata. Alla o phgaios kwdikas den htan o arxikos prwtotypos, kai den yphrxe kamia anafora sto poies allages xreiasthke na kanoyme gia na ta kataferoyme na xtizetai epityxws. 8a eprepe na katebasete ton arxiko prwtotypo kwdika jexwrista. Me to ROM, exete ton arxiko kwdika mazi me ena mpalwma (patch) to opoio xrhsimopoihsame gia na kanoyme th metaglwttish. Ayto to 8ewroume san ena megalo pleonekthma. Giati; Gia pollous logoys. Prwta - prwta, an bgei mia nea ekdosh kapoioy programmatos, de xreiazetai na arxisete anagkastika apo thn arxh gia na to metaglwttisete sto RHL. Mporeite na koitajete sto mpalwma (patch) gia to ti isws xreiastei na kanete. Me ayton ton tropo, oles oi proka8orismenes ry8miseis ths metaglwttishs einai eukola katanohtes. To RPM sxediasthke gia na prosferei isxyres dynatothtes erwthshs. Mporeite na cajete mesa se oloklhrh th bash sas gia paketa h gia oloklhra arxeia. Mporeite epishs na breite eukola se poio paketo anhkei ena sygkekrimeno arxeio kai apo poio prohl8e. Ta idia ta RPM arxeia einai sympiesmena arxeia, alla mporeite na kanete eukola kai suntoma mia erwthsh se jexwrista paketa xarh se mia epikefalida dyadikhs morfhs, poy exei proste8ei sto paketo kai periexei otidhpote xreiazetai na gnwrizete. Ayto syntelei se grhgorh erwthsh. Allo ena isxyro xarakthristiko einai h ikanothta na epalh8eusete paketa. An anhsyxeite oti sbhsate ena shmantiko arxeio gia kapoio paketo, apla epalh8euste to. 8a enhmerw8eite gia tyxon anwmalies. Se ayth thn periptwsh, mporeite na epanegkatasthsete to paketo an einai aparaithto. O,ti arxeia ry8misewn eixate 8a parameinoyn akeraia. 8a 8elame na eyxaristhsoyme ta paidia ths dianomhs BOGUS mia kai polles apo tis idees toys xrhsimopoih8hkan sto RPM. An kai to RPM grafthke apokleistika apo th Red Hat Software, h leitoyrgia toy einai basismenh ston kwdika poy grafthke gia th dianomh BOGUS (PM kai PMS). 3. Genikes Plhrofories 3.1. Apoktwntas to RPM O kaluteros tropos na apokthsete to RPM einai na sthsete to Red Hat Linux. An de 8elete na to kanete ayto, mporeite kai pali na parete kai na xrhsimopoihsete to RPM. 8a to breite sto ftp.redhat.com . 3.2. Apaithseis toy RPM H kuria apaithsh gia na trejete to RPM einai na exete to cpio 2.4.2 h megalutero. An kai to susthma proorizetai gia xrhsh me Linux, mporei na metafer8ei kai se alla systhmata Unix. Sygkekrimena, exei metaglwttistei gia SunOS, Solaris, AIX, Irix, AmigaOS kai alla. Sas proeidopoioume oti ta dyadika-ektelesima paketa poy dhmioyrgeite se ena susthma Unix de 8a einai symbata se allo susthma. Aytes einai oi elaxistes apaithseis gia na egkatasthsete RPMs. Gia na xtisete RPMs apo ton kwdika, xreiazeste oti 8a 8elate kanonika gia na xtisete ena paketo, opws ta gcc, make, klp. 4. Xrhsimopoiwntas to RPM Sthn aplousterh morfh toy, to RPM xrhsimopoieitai gia na egkatasthste paketa: rpm -i foobar-1.0-1.i386.rpm H epomenh aploustath entolh apegka8ista ena paketo: rpm -e foobar Mia apo tis pio sun8etes alla kai polu xrhsimes entoles sas epitrepei na egkatasthsete paketa mesw FTP. An eiste syndedemenoi sto diktyo kai 8elete na egkatasthsete ena neo paketo, to mono poy xreiazetai einai na prosdiorisete to arxeio dinontas to katallhlo URL, opws : rpm -i ftp://ftp.pht.com/pub/linux/redhat/rh-2.0-beta/RPMS/foobar-1.0-1.i386.rpm Parakalw shmeiwste oti to RPM 8a kanei thn erwthsh kai/h 8a egkatasthsei to paketo mesw FTP. Enw aytes einai aples entoles, to rpm mporei na xrhsimopoih8ei me pollous tropoys opws 8a deite apo to munhma Usage : RPM version 2.3.9 Copyright (C) 1997 - Red Hat Software This may be freely redistributed under the terms of the GNU Public License usage: rpm {--help} rpm {--version} rpm {--initdb} [--dbpath ] rpm {--install -i} [-v] [--hash -h] [--percent] [--force] [--test] [--replacepkgs] [--replacefiles] [--root ] [--excludedocs] [--includedocs] [--noscripts] [--rcfile ] [--ignorearch] [--dbpath ] [--prefix ] [--ignoreos] [--nodeps] [--ftpproxy ] [--ftpport ] file1.rpm ... fileN.rpm rpm {--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test] [--oldpackage] [--root ] [--noscripts] [--excludedocs] [--includedocs] [--rcfile ] [--ignorearch] [--dbpath ] [--prefix ] [--ftpproxy ] [--ftpport ] [--ignoreos] [--nodeps] file1.rpm ... fileN.rpm rpm {--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R] [--scripts] [--root ] [--rcfile ] [--whatprovides] [--whatrequires] [--requires] [--ftpuseport] [--ftpproxy ] [--ftpport ] [--provides] [--dump] [--dbpath ] [targets] rpm {--verify -V -y} [-afpg] [--root ] [--rcfile ] [--dbpath ] [--nodeps] [--nofiles] [--noscripts] [--nomd5] [targets] rpm {--setperms} [-afpg] [target] rpm {--setugids} [-afpg] [target] rpm {--erase -e} [--root ] [--noscripts] [--rcfile ] [--dbpath ] [--nodeps] [--allmatches] package1 ... packageN rpm {-b|t}[plciba] [-v] [--short-circuit] [--clean] [--rcfile ] [--sign] [--test] [--timecheck ] specfile rpm {--rebuild} [--rcfile ] [-v] source1.rpm ... sourceN.rpm rpm {--recompile} [--rcfile ] [-v] source1.rpm ... sourceN.rpm rpm {--resign} [--rcfile ] package1 package2 ... packageN rpm {--addsign} [--rcfile ] package1 package2 ... packageN rpm {--checksig -K} [--nopgp] [--nomd5] [--rcfile ] package1 ... packageN rpm {--rebuilddb} [--rcfile ] [--dbpath ] rpm {--querytags} Mporeite na breite perissoteres leptomereies gia tis epiloges toy RPM sth selida boh8eias (man page). 5. Kai ti mporw na kanw pragmatika me to RPM; To RPM einai polu xrhsimo ergaleio, kai opws 8a deite, exei polles epiloges. O kaluteros tropos gia na bgalete mia akrh me aytes einai na deite merika paradeigmata. Deijame parapanw thn epilogh egkatastashs/apegkatastashs kai twra akoloy8oun merika akomh paradeigmata : · As poume oti diagracate merika arxeia kata la8os, alla den eiste sigoyroi gia to poia sbhsate. An 8elete na epalh8eusete to susthma sas kai na deite ti leipei, 8a gracete : rpm -Va · As poume oti synantate kapoio arxeio poy den anagnwrizete. Gia na breite se poio paketo anhkei, 8a gracete : rpm -qf /usr/X11R6/bin/xjewel To apotelesma 8a einai: xjewel-1.6-1 · Briskete ena neo RPM me to onoma koules, alla den jerete ti einai ayto. Gia na deite kapoies plhrofories sxetika me to paketo, 8a gracete : rpm -qpi koules-1.2-2.i386.rpm To apotelesma 8a einai: Name : koules Distribution: Red Hat Linux Colgate Version : 1.2 Vendor: Red Hat Software Release : 2 Build Date: Mon Sep 02 11:59:12 1996 Install date: (none) Build Host: porky.redhat.com Group : Games Source RPM: koules-1.2-2.src.rpm Size : 614939 Summary : SVGAlib action game with multiplayer, network, and sound support Description : This arcade-style game is novel in conception and excellent in execution. No shooting, no blood, no guts, no gore. The play is simple, but you still must develop skill to play. This version uses SVGAlib to run on a graphics console. · Twra 8elete na deite poia arxeia egka8ista to RPM koules. 8a gracete: rpm -qpl koules-1.2-2.i386.rpm To apotelesma einai: /usr/doc/koules /usr/doc/koules/ANNOUNCE /usr/doc/koules/BUGS /usr/doc/koules/COMPILE.OS2 /usr/doc/koules/COPYING /usr/doc/koules/Card /usr/doc/koules/ChangeLog /usr/doc/koules/INSTALLATION /usr/doc/koules/Icon.xpm /usr/doc/koules/Icon2.xpm /usr/doc/koules/Koules.FAQ /usr/doc/koules/Koules.xpm /usr/doc/koules/README /usr/doc/koules/TODO /usr/games/koules /usr/games/koules.svga /usr/games/koules.tcl /usr/man/man6/koules.svga.6 Ayta htan merika paradeigmata. Mporeite na epinohsete pio dhmioyrgikes xrhseis toy RPM otan ejoikeiw8eite me ayto. 6. Xtizontas RPMs Einai arketa eukolo na xtisete RPMs, eidikotera an mporeite na kataferete na xtisete apo mono toy to logismiko poy sas endiaferei na paketarete. H basikh diadikasia gia na xtisete ena RPM einai h akoloy8h: · Elegjte oti to /etc/rpmrc exei egkatasta8ei sto susthma sas. · Kante ton phgaio kwdika gia ton opoio 8a xtiste to RPM na pernaei apo metaglwttish sto susthma sas. · Ftiajte ena mpalwma (patch) gia ka8e allagh poy xreiasthkate na kanete wste na metaglwttistei swsta · Ftiajte ena arxeio prodiagrafwn (spec file) gia to paketo. · Bebaiw8eite pws ola einai einai sth swsth toys 8esh. · Xtiste to paketo xrhsimopoiwntas to RPM. Ypo fysiologikes syn8hkes, to RPM dhmioyrgei toso to paketo toy ektelesimoy oso kai toy phgaioy kwdika. 6.1. To arxeio rpmrc Gia thn wra, h monh ru8mish toy RPM diati8etai mesw toy arxeioy /etc/rpmrc. Akoloy8ei ena paradeigma: require_vendor: 1 distribution: I roll my own! require_distribution: 1 topdir: /usr/src/me vendor: Mickiesoft packager: Mickeysoft Packaging Account optflags: i386 -O2 -m486 -fno-strength-reduce optflags: alpha -O2 optflags: sparc -O2 signature: pgp pgp_name: Mickeysoft Packaging Account pgp_path: /home/packages/.pgp tmppath: /usr/tmp H grammh require_vendor kanei to RPM na zhta na brei mia grammh pwlhth (vendor). Ayth mporei na proel8ei apo to arxeio /etc/rpmrc h apo thn epikefalida toy idioy toy arxeioy prodiagrafwn (spec file). Gia na to apenergopoihsete, allajte ton ari8mo se 0. To idio isxuei gia tis grammes require_distribution kai require_group. H epomenh grammh einai sxetikh me th dianomh distribution. Mporeite na th dhlwsete edw h argotera sthn epikefalida toy arxeioy prodiagrafwn (spec file). Otan xtizete to paketo gia kapoia sygkekrimenh dianomh, einai kalh idea na bebaiw8eite oti ayth h grammh einai swsth, akomh ki an den apaiteitai. H grammh vendor doyleuei antistoixa, alla mporei na grafei otidhpote (p.x. Joe's Software and Rock Music Emporium). To RPM exei yposthrijh gia na xtisete paketa se pollaples arxitektonikes. To arxeio rpmrc mporei na krata mia metablhth ``optflags'' gia na xtisete pragmata poy apaitoun sygkekrimena flags analoga me thn arxitektonikh kata to xtisimo toys. Deite ta parakatw tmhmata gia to pws na xrhsimopoihsete ayth th metablhth. Yparxoyn kai alla polla epipleon macros poy mporeite na xrhsimopoihsete gia na deite ta tags kai ta dia8esima flags. rpm --showrc 6.2. To arxeio prodiagrafwn (Spec File) 8a jekinhsoyme me syzhthsh gia to arxeio prodiagrafwn. Ta arxeia prodiagrafwn apaitountai gia na xtisete ena paketo. To arxeio prodiagrafwn einai mia perigrafh toy logismikou mazi me entoles kai odhgies gia to pws 8a sth8oun kai mia lista gia ola ta ektelesima poy egkatasta8hkan. Kalo einai na onomasete to arxeio prodiagrafwn sumfwna me typikes symbaseis. 8a prepei na einai to paketo onoma-paula-ari8mos ekdoshs (version number)-paula- ari8mos seiras (release number)-teleia-spec. Akoloy8ei ena mikro paradeigma arxeioy prodiagrafwn (vim-3.0-1.spec): Summary: ejects ejectable media and controls auto ejection Name: eject Version: 1.4 Release: 3 Copyright: GPL Group: Utilities/System Source: sunsite.unc.edu:/pub/Linux/utils/disk-management/eject-1.4.tar.gz Patch: eject-1.4-make.patch Patch1: eject-1.4-jaz.patch %description Ayto to programma epitrepei sto xrhsth na bgazei (eject) ta mesa poy yposthrizoyn aytomath ejagwgh opws CD-ROMs,Jaz kai Zip drives, kai odhgous disketas se mhxanes SPARC. %prep %setup %patch -p1 %patch1 -p1 %build make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" %install install -s -m 755 -o 0 -g 0 eject /usr/bin/eject install -m 644 -o 0 -g 0 eject.1 /usr/man/man1 %files %doc README COPYING ChangeLog /usr/bin/eject /usr/man/man1/eject.1 6.3. H epikefalida H epikefalida exei merika sta8era pedia poy prepei na symplhrw8oun. Dinontai epishs kai merikes ypodeijeis. Ta pedia prepei na symplhrw8oun opws fainetai parakatw: · Summary: Einai h perigrafh toy paketoy se mia grammh. · Name: Einai to onoma toy rpm arxeioy poy skopeuete na xrhsimopoihsete. · Version: Einai h ekdosh (version) toy rpm arxeioy poy skopeuete na xrhsimopoihsete. · Release: Einai h seira (release) toy paketoy gia thn parapanw ekdosh (p.x. an ftiajoyme ena paketo kai to broume ligo problhmatiko kai prepei na to janaftiajoyme, to epomeno paketo 8a einai seira 2). · Icon: Einai to onoma toy arxeioy toy eikonidioy poy 8a xrhsimopoih8ei me alla ergaleia egkatastashs ychlou epipedoy (opws to ``glint'' ths Red Hat). Prepei na einai gif kai na brisketai ston katalogo SOURCES. · Source: Ayth h grammh deixnei sthn topo8esia HOME toy arxikou arxeioy phgaioy kwdika. Xrhsimopoieitai sthn periptwsh poy 8elete na parete ton kwdika jana h na elegjete gia newteres ekdoseis. Shmeiwsh: To onoma arxeioy PREPEI na tairiazei me to onoma toy arxeioy poy exete sto susthma sas (p.x. mhn katebasete to phgaio arxeio kai allajete meta to onoma toy). Mporeite epishs na ka8orisete perissotera toy enos arxeia phgaioy kwdika xrhsimopoiwntas grammes opws : Source0: blah-0.tar.gz Source1: blah-1.tar.gz Source2: fooblah.tar.gz Ayta ta arxeia phgainoyn ston katalogo SOURCES . (H domh toy katalogoy 8a syzhth8ei argotera se epomeno tmhma, "O dendroeidhs katalogos toy phgaioy kwdika"). · Patch: Einai to meros poy 8a breite to mpalwma (patch) an xreiastei na to katebasete jana. Shmeiwsh: To onoma arxeioy edw prepei na tairiazei me ayto poy xrhsimopoieite otan ftiaxnete to diko SAS patch. Mporei epishs na 8elete na shmeiwsete oti mporei na exete pollapla patch arxeia oso mporei na exete pollapla phgaia arxeia. 8a exete kati san to parakatw: Patch0: blah-0.patch Patch1: blah-1.patch Patch2: fooblah.patch Ayta ta arxeia 8a pane ston katalogo SOURCES . · Copyright: Ayth h grammh anaferei gia ta dikaiwmata toy paketoy. 8a prepei na xrhsimopoieite kati san GPL, BSD, MIT, public domain, distributable, h commercial. · BuildRoot: Ayth h grammh sas epitrepei na ka8orisete enan katalogo san ``root'' gia na xtisete kai na egkatasthsete ena paketo. Mporeite na to xrhsimopoihsete gia na testarete to paketo sas prin na to egkatasthsete sto mhxanhma sas. · Group: Ayth h grammh xrhsimopoieitai gia na pei se programmata egkatastashs ychlou epipedoy (opws to ``glint'' ths RedHat) pou na balei ayto to programma sth domh ths ierarxias. To dendro toy gkroyp moiazei ws ejhs : Applications Communications Editors Emacs Engineering Spreadsheets Databases Graphics Networking Mail Math News Publishing TeX Base Kernel Utilities Archiving Console File System Terminal Text Daemons Documentation X11 XFree86 Servers Applications Graphics Networking Games Strategy Video Amusements Utilities Libraries Window Managers Libraries Networking Admin Daemons News Utilities Development Debuggers Libraries Libc Languages Fortran Tcl Building Version Control Tools Shells Games · %description Den einai pragmatika ena tmhma ths epikefalidas, alla 8a prepei na perigrafei me to ypoloipo ths epikefalidas. Xreiazeste ena tag perigrafhs ana paketo kai/h ypopaketo. Ayto einai ena pedio pollaplwn-grammwn poy prepei na xrhsimopoih8ei gia na dwsei mia katanohth perigrafh toy paketoy. 6.4. Prep Ayto einai to deutero tmhma sto arxeio prodiagrafwn. Xrhsimopoieitai gia na etoimasete ton kwdika gia xtisimo. Edw prepei na kanete otidhpote xreiastei gia na kanete patch toys kwdikes kai na toys egkatasthsete opws prepei gia na gracete make. Shmeiwste to ejhs: Ka8e ena apo ayta ta tmhmata einai pragmatika xwros gia na ektelesete skriptakia floiou (shell scripts). Mporeite apla na ftiajete ena sh script kai na to balete meta to %prep tag gia na jepaketarete kai na kanete patch ton kwdika sas. Parolayta, exoyme ftiajei macros gia na boh8hsoyme s'ayto. To prwto ap'ayta ta macros einai to %setup macro. Sthn aplousterh toy morfh (xwris epiloges apo th grammh entolwn), apla jepaketarei ton kwdika kai mpainei ston katalogo me ton kwdika. Pairnei epishs tis parakatw epiloges: · -n name 8etei to onoma toy katalogoy poy 8a xrhsimopoih8ei gia to xtisimo sto onoma poy akoloy8ei name. To proka8orismeno onoma einai $ONOMA-$EKDOSH. Alles dynatothtes perilambanoyn to $ONOMA, ${ONOMA}${EKDOSH}, h oti xrhsimopoiei to kurio tar arxeio. (Shmeiwste parakalw oti oi metablhtes ``$'' den einai pragmatikes metablhtes poy diati8entai mesa sto arxeio prodiagrafwn. Xrhsimopoiountai edw anti gia ena onoma-paradeigma. Eseis prepei na xrhsimopoihsete to pragmatiko onoma kai thn ekdosh sto paketo sas, oxi mia metablhth). · -c 8a dhmioyrghsei kai 8a mpei ston onomazomeno katalogo prin na kanei untar. · -b # 8a kanei untar ton Kwdika# prin na mpei ston katalogo (kai de bgazei nohma me thn epilogh -c gi'ayto mhn to kanete). Ayto einai xrhsimo otan exete pollapla arxeia me kwdika. · -a # 8a kanei untar ton Kwdika# afou mpei ston katalogo. · -T Ayth h epilogh agnoei thn proka8orismenh epilogh poy kanei untar ton Kwdika kai apaitei thn epilogh -b 0 h -a 0 gia na kanete untar to kurio arxeio kwdika. 8a to xreiasteite ayto otan yparxoyn deytereuoyses phges. · -D MH diagrafete ton katalogo prin na jepaketarete. Ayto einai xrhsimo mono opoy exete perissotera toy enos macro egkatastashs. 8a prepei na xrhsimopoieitai mono se macros egkatastashs meta to prwto (alla pote sto prwto). To epomeno apo ta dia8esima macros einai to %patch macro. Ayto to macro boh8a sthn aytomatopoihsh ths diadikasias ths efarmoghs mpalwmatwn (patches) stoys kwdikes. Pairnei polles epiloges, oi opoies fainontai parakatw: · # 8a efarmosei to Patch# · -p # ka8orizei ton ari8mo twn diadoxikwn ypokatalogwn poy 8a agnohsei h entolh patch(1). · -P H proka8orismenh energeia einai h efarmogh toy Patch (h Patch0). Ayth h epilogh klhronomei thn proka8orismenh energeia kai 8a apaithsei ena 0 gia na kanei untar to kurio arxeio phgaioy kwdika. Ayth h epilogh einai xrhsimh se ena deutero (h metepeita) %patch macro to opoio apaitouse ena diaforetiko ari8mo apo to prwto macro. · Mporeite epishs na gracete %patch# anti gia thn pragmatikh entolh : %patch # -P Ayta prepei na einai ola ta macros poy xreiazeste. Afou ta exete ayta swsta, mporeite na kanete opoiadhpote egkatastash 8elete me sh skriptakia. Otidhpote symperilabete mexri to %build macro (to opoio 8a syzhth8ei sto epomeno tmhma), ekteleitai mesw sh. Koitajte to parapanw paradeigma gia toys tupoys twn pragmatwn poy mporei na 8elete na kanete. 6.5. Xtisimo (Build) Den yparxoyn alh8eia macros se ayto to tmhma. 8a prepei apla na balete tis entoles poy 8a xreiastei na xrhsimopoihsete gia na xtisete to logismiko afou exete jepaketarei ton kwdika, ton exete kanei patch kai exete mpei ston katalogo. Ayto einai apla ena akomh sunolo entolwn poy perniountai sto sh, etsi wste oles oi nomimes entoles sh mporoun na mpoyn edw (symperilambanomenwn twn sxoliwn). O trexwn katalogos poy doyleuete ginetai reset se ka8e ena apo ayta ta tmhmata sto pio chlo epipedo toy katalogoy poy periexei ton kwdika , na to exete ypoch sas. Mporeite na mpeite stoys ypokatalogoys me cd an xreiastei. 6.6. Egkatastash Oute kai edw yparxoyn, pragmatika, macros. 8elete basika na balete oti entoles xreiazontai gia thn egkatastash. An exete sth dia8esh sas to make install sto paketo poy xtizete, balte to ekei. An oxi, mporeite eite na kanete patch to makefile wste na gracete make install kai sth synexeia na zhthsete na ginei edw to make install , h mporeite na ta egkatasthsete edw me to xeri xrhsimopoiwntas sh entoles. Mporeite na 8ewrhsete ton trexwn katalogo san to pio chlo epipedo toy katalogoy me ton kwdika. 6.7. Proairetika skriptakia prin kai meta thn Egkatastash/Apegkatas- tash Mporeite na pros8esete skriptakia poy na trexoyn prin kai meta thn egkatastash/ apegkatastash twn ektelesimwn paketwn. O kurios logos gi'ayto einai na kanete pragmata opws na trejete to ldconfig afou egkatasthsete h afairesete paketa poy periexoyn diamoirazomenes biblio8hkes. Ta macros gia ka8e ena apo ta skriptakia einai ta parakatw: · %pre einai to macro poy ektelei skriptakia prin thn egkatastash. · %post einai to macro poy ektelei skriptakia meta thn egkatastash. · %preun einai to macro poy ektelei skriptakia prin thn apegkatastash. · %postun einai to macro poy ektelei skriptakia meta thn apegkatastash. Ta periexomena aytwn twn tmhmatwn mporei na einai opoioydhpote tupoy sh script, an kai de xreiazeste to #!/bin/sh. 6.8. Arxeia Ayto einai to tmhma opoy prepei na dwsete th lista twn arxeiwn gia to ektelesimo paketo. To RPM den exei tropo na gnwrizei ti ektelesima egkatasta8hkan san apotelesma toy make install. DEN YPARXEI tropos na to kanete ayto. Merikoi proteinoyn na ektelesete th find prin kai meta thn egkatastash toy paketoy. Se ena polyxrhstiko susthma, ayto einai aparadekto ka8ws einai dynato na dhmioyrgh8oun alla arxeia kata th diadikasia xtisimatos enos paketoy, ta opoia den exoyn apolutws kamia sxesh me to idio to paketo. Yparxoyn merika dia8esima macros poy kanoyn tetoies eidikes leitoyrgies. Ayta einai ta parakatw : · %doc xrhsimopoieitai gia na markarei mesa sto paketo phgaioy kwdika thn tekmhriwsh poy 8elete na egkatasta8ei me mia egkatastash binary. Ta keimena 8a egkatasta8oun sto /usr/doc/$NAME-$VERSION-$RELEASE. Mporeite na exete me ayto to macro lista pollaplwn keimenwn sth grammh entolwn, h na parete th lista ka8enos jexwrista xrhsimopoiwntas ena macro gia ka8ena ap'ayta. · %config xrhsimopoieitai gia na markarei ta arxeia ry8misewn se ena paketo. Ayto perilambanei arxeia opws ta sendmail.cf, passwd, klp. An argotera apegkatasthsete ena paketo poy periexei arxeia ry8misewn, opoia arxeia den allajan 8a sbhstoun kai opoia exoyn ypostei allages 8a metonomastoun sto palio onoma me katalhjh .rpmsave sto onoma toy arxeioy. Mporeite, epishs, na parete th lista pollaplwn arxeiwn me ayto to macro. · %dir markarei ena mono katalogo se mia lista arxeiwn poy 8a symperilhf8ei san na anhkei sto paketo. Einai proka8orismeno, oti an deite th lista enos katalogoy XWRIS kapoio %dir macro, OLA se ayton ton katalogo symperilambanontai sth lista arxeiwn kai egka8istwntai san tmhma toy paketoy. · %files -f 8a sas epitrecei na emfanisete lista twn arxeiwn sas se kapoio ay8aireto arxeio mesa ston katalogo toy phgaioy kwdika opoy ginetai to xtisimo. Ayto einai kalo se periptwseis opoy exete ena paketo poy mporei na xtisei th dikh toy lista arxeiwn. Tote apla enswmatwnete edw ayth th lista arxeiwn kai de xreiazetai na emfanisete eidikh lista arxeiwn. H megaluterh pagida sth lista arxeiwn einai h emfanish katalogwn. An emfanisete to /usr/bin kata la8os, to ektelesimo paketo sas 8a periexei ka8e arxeio sto /usr/bin sto susthma sas. 6.9. Xtizontas to 6.9.1. O dendroeidhs katalogos toy phgaioy kwdika To prwto poy xreiazeste einai ena kala ry8mismeno dendro gia xtisimo (build tree). Ayto ry8mizetai xrhsimopoiwntas to arxeio /etc/rpmrc. Oi perissoteroi 8a xrhsimopoihsoyn apla to /usr/src. Mporei na xreiastei na dhmioyrghsete toys parakatw katalogoys gia na ftiajete ena dendro gia xtisimo (build tree): · BUILD einai o katalogos opoy ginetai to xtisimo apo to RPM. De xreiazetai na testarete to xtisimo kapoy sygkekrimena, alla edw 8a kanei to RPM 8a kanei to xtisimo toy. · SOURCES einai o katalogos opoy 8a prepei na balete ta arxika tar arxeia phgaioy kwdika kai ta patches. Edw einai poy exei proka8oristei na cajei to RPM. · SPECS einai o katalogos opoy prepei na pane ola ta arxeia prodiagrafwn (spec). · RPMS einai ekei opoy 8a balei to RPM ola ta ektelesima RPMs meta to xtisimo. · SRPMS einai ekei poy 8a mpoyn ola ta RPMs phgaioy kwdika. 6.9.2. Elegxos sto xtisimo To prwto pragma poy pi8ana na 8elete na kanete einai na parete ton kwdika kai na xtisete to paketo xwris na xrhsimopoihsete ka8oloy to RPM. Gia na to kanete ayto, jepaketarete ton phgaio kwdika, kai allajte to onoma toy katalogoy se $NAME.orig. 3epaketarete ton kwdika jana. Xrhsimopoihste ton kwdika gia na xtisete to paketo. Phgainete ston katalogo me ton kwdika kai akoloy8hste tis odhgies gia to xtisimo. An prepei na allajete pragmata, 8a xreiasteite ena mpalwma (patch). Molis to xtisete, ka8ariste ton katalogo me ton phgaio kwdika. Sigoyreyteite oti diagracate ola ta arxeia poy dhmioyrgh8hkan apo to script configure. Sth synexeia, bgeite apo ton katalogo me ton phgaio kwdika ston pio panw grafontas cd . Kante kati san to parakatw: diff -uNr dirname.orig dirname > ../SOURCES/dirname-linux.patch Ayto 8a sas dhmioyrghsei ena patch to opoio mporeite na xrhsimopoih- sete sto arxeio prodiagrafwn sas (spec file). Shmeiwste oti to ``linux'' poy blepete sto onoma toy patch einai apla anagnwristiko. Mporeite na xrhsimopoihsete kati pio epejhghmatiko opws ``config'' h ``bugs'' wste na ejhghsete giati xreiasthke na ftiajete ayto to patch. Einai epishs kalh idea na koitajete to patch arxeio poy ftiaxnete prin na to xrhsimopoihsete wste na sigoyreyteite oti den symperilambanontai kata la8os tyxon ektelesima. 6.9.3. Dhmioyrgwntas th lista arxeiwn Twra poy exete ton kwdika gia to xtisimo toy paketoy kai jerete pws 8a to kanete, xtiste to kai egkatasthste to. Koitajte thn ejodo ths diadikasias egkatastashs kai xtiste th lista arxeiwn sas apo ayth poy 8a xrhsimopoihsete sto arxeio prodiagrafwn. Synh8ws, xtizoyme to arxeio prodiagrafwn parallhla me ola ayta ta bhmata. Mporeite na dhmioyrghsete to arxiko kai na symplhrwsete ta eukola tmhmata, kai sth synexeia na symplhrwnete kai ta ypoloipa bhmata ka8ws proxwrate. 6.9.4. Xtizontas to Paketo me RPM Apo th stigmh poy exete ena arxeio prodiagrafwn (spec file), eiste etoimoi na dokimasete na xtisete to paketo sas. O pio xrhsimos tropos na to kanete einai me mia entolh san thn akoloy8h : rpm -ba foobar-1.0.spec Yparxoyn epishs kai alles xrhsimes epiloges me to switch -b : · p shmainei na trejei apla to tmhma prep toy specfile. · l einai enas elegxos listas poy kanei merikous elegxoys sta %arxeia. · c kanei oti leei to tmhma prep kai metaglwttizei. Ayto einai xrhsimo otan den eiste sigoyroi gia to an o kwdikas sas 8a ginei build. Fainetai axrhsto epeidh mporei na 8elete na synexisete na paizete me ton idio ton kwdika mexri na xtistei kai meta na xrhsimopoihsete to RPM, alla otan ejoikeiw8eite me th xrhsh toy RPM, 8a breite stigmes poy 8a 8elhsete na to xrhsimopoihsete. · i kanei oti leei to tmhma prep, metaglwttizei kai egka8ista. · b kanei oti leei to tmhma prep, metaglwttizei, egka8ista kai xtizei mono to ektelesimo paketo. · a ta xtizei ola (kai ta ektelesima kai ta phgaioy kwdika paketa). Yparxoyn arketes parallages sto -b switch. Aytes einai oi akoloy8es : · --short-circuit 8a metabei katey8eian se ena sygkekrimeno shmeio (mporei na xrhsimopoih8ei mono me ta c kai i). · --clean apomakrunei to dendro xtisimatos (build tree) otan teleiwsei. · --keep-temps 8a krathsei ola ta temp arxeia kai ta scripts poy ftiaxthkan sto /tmp. Mporeite na deite poia arxeia dhmioyrgh8hkan ston katalogo /tmp xrhsimopoiwntas thn epilogh -v . · --test den ektelei pragmatika ta bhmata, mono elegxei an mporoun na ginoyn. 6.10. Elegjte to Afou ftiajate ena ektelesimo kai ena me ton phgaio kwdika rpm gia to paketo sas, xreiazetai na to elegjete. O eykoloteros kai kaluteros tropos einai na xrhsimopoihsete ena teleiws diaforetiko mhxanhma gia na to dokimasete. Sto katw-katw, exete kanei tosa make install sto mhxanhma sas, poy 8a prepei na egkatasta8ei kala. Mporeite na elegjete to paketo grafontas rpm -u packagename, alla ayto mporei na sas ejapathsei epeidh sto xtisimo toy paketoy, kanate make install. An afhsete kati ejw apo th lista arxeiwn sas, de 8a apegkatasta8oun. 8a egkatasthsete jana to ektelesimo paketo (binary package) kai to susthma sas 8a leitoyrgei kai pali, alla to rpm den einai entajei. Sigoyreyteite kai exete ypoch sas oti mporei eseis na grafete rpm -ba package, polloi omws egka8istoun to paketo sas kanontas rpm -i package. Sigoyreyteite oti den kanete tipota sta tmhmata build h install poy 8a xreiastei na ginei otan ta ektelesima paketa egka8istantai mona toys. 6.11. Ti na kanete me ta nea sas RPMs Molis ftiajete to diko sas neo RPM gia kati (ypo8etoyme oti einai kati poy den yparxei se RPM), mporeite na prosferete th doyleia sas kai se alloys (epishs ypo8etoyme oti ftiajate RPM enos programmatos poy dianeimetai eleu8era). Gia na to kanete ayto, 8a 8elhsete na to anebasete sto ftp.redhat.com . 6.12. Kai twra; Diabaste parakalw ta parapanw tmhmata sxetika me ton Elegxo kai toy ti na kanete me ta nea RPMs. 8eloyme osa RPMs einai dynato na exoyme, kai 8eloyme malista na einai kai kala RPMs. Parakalw dwste arketo xrono sto testarisma twn paketwn RPMs kai kante ton kopo na ta balete sto internet gia to kalo olwn mas. Epishs, parakalw sigoyreyteite oti kanete upload eleu8era dia8esimo logismiko. Emporiko kai shareware logismiko de 8a prepei na ginetai upload ektos ki an exoyn anaferetai rhta oti epitrepetai sthn adeia pneymatikhs idiokthsias. Ayto perilambanei to logismiko Netscape, ssh, pgp, klp. 7. Xtizontas RPM gia polles arxitektonikes To RPM mporei na xrhsimopoih8ei gia na xtisete paketa gia Intel i386, Digital Alpha poy trexoyn Linux kai se Sparc. Exei anafer8ei oti doyleuei epishs kai se sta8mous ergasias SGI kai HP. Yparxoyn diafora xarakthristika poy kanoyn to xtisimo twn paketwn eukolo se oles tis platformes. To prwto einai h ntirektiba ``optflags'' sto /etc/rpmrc. Mporei na xrhsimopoih8ei gia na 8esete flags poy xrhsimopoiountai otan xtizete logismiko, se times poy ejartwntai apo thn arxitektonikh toy systhmatos. Allo ena xarakthristiko einai ta ``arch'' macros sto arxeio prodiagrafwn (spec file). Mporoun na xrhsimopoih8oun gia na kanete diafora pragmata analoga me thn arxitektonikh toy systhmatos sthn opoia to xtizete. Allo ena xarakthristiko einai h ntirektiba ``Exclude'' sthn epikefalida (header). 7.1. Ena aplo arxeio prodiagrafwn (spec File) To parakatw einai tmhma toy arxeioy prodiagrafwn (spec file) gia to paketo ``fileutils''. Einai ry8mismeno gia na xtizetai kai se Alpha kai se Intel. Summary: GNU File Utilities Name: fileutils Version: 3.16 Release: 1 Copyright: GPL Group: Utilities/File Source0: prep.ai.mit.edu:/pub/gnu/fileutils-3.16.tar.gz Source1: DIR_COLORS Patch: fileutils-3.16-mktime.patch %description These are the GNU file management utilities. It includes programs to copy, move, list, etc, files. The ls program in this package now incorporates color ls! %prep %setup %ifarch alpha %patch -p1 autoconf %endif %build configure --prefix=/usr --exec-prefix=/ make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS=-s %install rm -f /usr/info/fileutils* make install gzip -9nf /usr/info/fileutils* . . . 7.2. Optflags Se ayto to paradeigma, mporeite na deite pws xrhsimopoieitai h ntirektiba ``optflags'' apo to /etc/rpmrc. Analoga me to panw se poia arxitektonikh 8a xtisete, dinete thn katallhlh timh sto RPM_OPT_FLAGS. Prepei na kanete patch to Makefile etsi wste to paketo sas na xrhsimopoiei ayth th metablhth anti twn kanonikwn ntirektibwn poy 8a mporousate na xrhsimopoihsete (opws -m486 kai -O2). Mporeite na parete mia kalh idea gia to ti xreiazetai na kanete egka8istwntas to phgaio kwdika toy paketoy kai aposympieste ton kwdika kai ejetaste to Makefile. Koitajte tote to patch gia to Makefile kai deite ti allages prepei na kanete. 7.3. Macros To %ifarch macro einai polu shmantiko se ola ayta. Tis perissoteres fores 8a xreiastei na efarmosete ena-duo patch eidika gia mia sygkekrimenh arxitektonikh. Se ayth thn periptwsh, to RPM 8a sas epitrecei na efarmosete ayto to patch se mia arxitektonikh mono. Sto parapanw paradeigma, to fileutils exei ena patch gia mhxanes 64 bit. Profanws, ayto 8a prepei na efarmostei mono se Alpha gia thn wra. Etsi, pros8etoyme ena %ifarch macro gurw apo to 64 bit patch opws parakatw: %ifarch axp %patch1 -p1 %endif Ayto ejasfalizei oti to patch de 8a efarmostei se opoiadhpote arxitek- tonikh ektos apo alpha. 7.4. Afairwntas arxitektonikes apo Paketa Gia na mporeite na synthreite paketa RPMs phgaioy kwdika se enan katalogo gia oles tis platformes, exoyme ylopoihsei thn ikanothta na "afaireite" paketa wste na mh xtistoun se sygkekrimenes arxitektonikes. Ayto ginetai wste na mporeite na kanete akomh pragmata opws rpm --rebuild /usr/src/SRPMS/*.rpm kai na xtisete ta swsta paketa. An den exete metaferei mia efarmogh se mia sygkekrimenh platforma, to mono poy prepei na kanete einai na pros8esete mia grammh san ayth : ExcludeArch: axp sthn epikefalida toy arxeioy prodiagrafwn toy paketoy me ton kwdika. Sth synexeia, janaxtiste to paketo sthn platforma gia thn opoia proorizetai. 8a exete tote ena paketo phgaioy kwdika poy paizei se Intel kai mporei eukola na metafer8ei se Alpha. 7.5. Teleiwnontas Synh8ws, einai eykolotero na xrhsimopoihsete RPM gia na ftiajete paketa gia pollaples -arxitektonikes apo to na parete to ka8e paketo jexwrista kai na to xtisete sta duo merh. Ka8ws polla apo ta megala paketa xtizontai, ayto ginetai eykolotero, parolayta. Opws panta, o kaluteros tropos gia na anazhthsete boh8eia otan kollhsete xtizontas ena RPM einai na deite ton kwdika enos paromoioy paketoy. 8. Pneymatika Dikaiwmata Ta pneymatika dikaiwmata aytou toy keimenoy kai twn periexomenwn toy prostateuontai. Epitrepetai h epanadianomh aytou toy keimenoy efoson to periexomeno toy paramenei analloiwto. Me alla logia, to mono poy mporeite na kanete einai na allajete th morfh toy keimenoy, na to typwsete jana h na to dianeimete. 9. Peri ths Ellhnikhs Metafrashs Gia sxolia, parathrhseis, dior8wseis, enhmerwseis peri ths Ellhnikhs metafrashs aytou toy HOWTO, steilte email sthn Boula Sanida : voulariba@hellug.gr