Next Previous Contents

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:

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 <packages@mickiesoft.com>

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:

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:

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:

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/Apegkatastash

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:

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 :

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

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):

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 xrhsimopoihsete 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.

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.

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 :

Yparxoyn arketes parallages sto -b switch. Aytes einai oi akoloy8es :

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.


Next Previous Contents