Perl Policy - ArchWiki - Arch Linux

文章推薦指數: 80 %
投票人數:10人

0 perl packaging conventions included: The current Arch Linux default perl installation installs site and vendor packages into the same ... HomePackagesForumsWikiBugsSecurityAURDownload Jumptocontent Namespaces PageDiscussion English expanded collapsed Views ReadViewsourceViewhistory More expanded collapsed Navigation MainpageTableofcontentsGettinginvolvedWikinewsRandompage Interaction HelpContributingRecentchangesRecenttalksNewpagesStatisticsRequests Tools WhatlinkshereRelatedchangesSpecialpagesPrintableversionPermanentlinkPageinformation Thispagecoversthepolicyforhowperlitselfisconfiguredandpackaged.ForPerlmodulepackagingguidelines,seePerlpackageguidelines. Contents 1Introduction 1.15.10caveats 1.2Reasoning 1.3Pitfalls 2Perlversions 3Modulepaths 4Documents 5Binariesandscripts 6Core 6.1Coredirectories 6.2Coreperlpackages 7Site 7.1Sitedirectories 7.2Siteinstallation 8Vendor 8.1Packagenaming 8.2Vendordirectories 8.3Vendorinstallation 8.4SamplevendorPKGBUILD 8.5Dependencies 8.5.1Binarymodules 8.5.2Architecture-independentmodules 9Perl6 Introduction Thispolicydocumentwasproposed,accepted,andimplementedinversion5.10.0oftheperlpackage.Itisthestandardregardingtotheperlpackage,relatedPerlpackages,andcreatingPerlmodulepackages(bothinbinaryformandintheformofPKGBUILDs).PortionsarederivedfromtheDebianPerlPolicydocumentandfromvariousportionsofthePerlmanpages. 5.10caveats NOTTRUE:ThedirectoriesforscriptsdonotconformtotheFilesystemHierarchyStandard(FHS). Note:TheFHSdescribeswhatdirectoriesmustbein/usr/binanddoesnotprohibitaddingotherdirectories. Reasoning Apparentproblemswithpre-5.10.0perlpackagingconventionsincluded: ThecurrentArchLinuxdefaultperlinstallationinstallssiteandvendorpackagesintothesamedirectorytree,whichfrequentlycausesconflictsiftheenduserinstallsandupgradesArchLinuxperl(vendor)packagesontopofsitepackages. ThecurrentArchLinuxdefaultperlinstallationinstallsupdatestocoremodulesintotheperlcoredirectories,creatingfileconflicts.ExamplesincludemodulessuchasData::Dumperandversion. Asymlink-farmiscreatedin/usr/lib/perl5/and/usr/lib/perl5/site_perlwhichisun-necessaryandconfusing. Anumberofstandardmodulesseemtobemissing,orwereneglectedtobeaddedasprovidesintheperlpackageitself,causingconfusionandredundantentriesinAURandCommunityasuserstryandfixtheapparentproblemofmissingmodules,whichareprovidedbyperl.Thisisprobablyamatterofeducation. Currentperl-modulePKGBUILD'scouldbesimplifiedandstandardizedquiteabit. Thispolicywouldeliminatealltheseproblems. Pitfalls Current(apparent)downsidestoadoptingapolicysuchasthisone: AnupdateofeveryperlmodulePKGBUILDsothatitinstallsintothecorrect(vendor)directorytree.Itremainssomewhatbackwards-compatiblewiththeoldstructure,inthatoldPKGBUILD'swouldtechnicallywork. Introduceschangesintotheperlpackage,whichlivesinthecorerepository,andproposesanewperl-modulespackage,whichwouldliveintheextrarepository. Non-perlpackageswhichcompilestaticcopiesoftheperlinterpreterwillnotoperatecorrectlyuntilrecompiledonanArchLinuxPCwhichadherestothisdocument.Examplesofsuchpackagesincludevim,subversion,andirssi.Manysuchexamplesexist. Perlversions Atanygiventime,thepackageperlshouldrepresentthecurrentstableupstreamversionofPerlrevision5.(seePerl6). Onlyonepackagemaycontainthe/usr/bin/perlbinaryandthatpackagemusteitherbeperloradependencyofthatpackage.InordertoprovideaminimalinstallationofPerlforusebyapplicationswithoutrequiringthewholeofPerltobeinstalled,theperlpackagecontainsthebinaryandabasicsetofmodules.Theperlpackageshoulddeclareprovidestatementsforeverymoduleprovidedbythebaseperlpackage. Modulepaths Perlsearchesthreedifferentlocationsformodules,referredtointhisdocumentascoreinwhichmodulesdistributedwithPerlareinstalled,vendorforpackagedmodules,andsiteformodulesinstalledbythelocaladministrator. Themodulesearchpath(@INC)intheArchLinuxpackageshasbeenorderedtoincludetheselocationsinthefollowingorder: site ModulesinstalledbythelocaladministratorforthecurrentversionofPerl.Typically,thesemodulesareinstalledusingthecpanorcpanptool,oraredownloadedinsourceformandinstalledviamake. /usr/lib/perl5/site_perl/version /usr/share/perl5/site_perl/version vendor Packagedmodules,installedviathepacmantoolfromthecore,extra,orcommunityrepositories,orbuiltintoproperArchLinuxpackagesfromABS/AURPKGBUILDs. /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl core ModulesincludedinthecorePerldistribution. /usr/lib/perl5/core_perl /usr/share/perl5/core_perl obsolete Obsoleteisthepathnametomodulesinstalledpriortotheestablishmentofthisdocument.Thesepathshavebeenremovedfrom@INCinperl5.12.2. /usr/lib/perl5/site_perl/current/arch /usr/lib/perl5/site_perl/current /usr/lib/perl5/current Ineachofthedirectorypairsabove,thelibcomponentisforbinary,architecturedependent(XS)modules,andshareforarchitecture-independent(pure-perl)modules.Undernocircumstancesshouldcurrentbeusedasareplacementforversion.CoreandVendormodulesshouldbematchedtothecurrentinstallationofperl. Documents ThePODfilesandmanualpagesandHTMLdocumentationwhichdonotrefertoprogramsmaybestrippedfromthepackage,whichisnormalformostArchLinuxpackagesingeneral.Thisisoptional. ManualpagesdistributedwithPerlpackagesmustbeinstalledintothestandarddirectories: Programs Manualpagesforprogramsandscriptsareinstalledinto/usr/man/man1withtheextension.1perl. Modules Manualpagesformodulesareinstalledinto/usr/man/man3withtheextension.3perl. Binariesandscripts Inordertopreventfilecollisions,itisimportanttokeepbinariesgeneratedbycore,vendor,andsiteinstallsseparate.ItisalsoimportantthatthedefaultPATHenvironmentvariablesetineachusersprofiletosearchforbinariesinthesameorderasperl'[email protected],binariesshouldbeinstalledintothefollowingdirectories: Core Binariesandscriptsforallcorepackagesshouldbeinstalledinto/usr/bin/core_perl. Vendor Binariesandscriptsforallvendorpackagesshouldbeinstalledinto/usr/bin/vendor_perl. Site Binariesandscriptsforallsiteshoulddefaulttobeinstalledinto/usr/bin/site_perl. Theperlpackageshouldincludeamechanismtoadjustend-usersPATHentriesaccordinglysothatperlbinariesaresearchedforinthefollowingorder:site,vendor,core. Core CoremodulesarePerlmodules"typically"includedinthecorePerldistribution. Coredirectories ModulesincludedinthecorePerldistributionshouldbeinstalledinto/usr/lib/perl5and/usr/share/perl5. Onlymodulescontainedintheperlpackageshouldbeinstalledintothisdirectorytree. Noversionsubdirectoryexistsinthesepathsasthedependenciesforpackagedmodulesshouldensurethatallworkwiththecurrentperlpackage. Coreperlpackages Theperlpackageshouldcontainthe/usr/bin/perlbinary,andaminimalsetofmodulesneededinorderforsimpleperlscriptstorunandforabasesystemtooperate.Itshouldbemaintainedinthecorerepository. Thefollowingisalistofafewmodules(forexample),whichareprovidedintheperlpackage.(SeethePKGBUILDfortheofficiallist). 'perl-checktree''perl-collate''perl-config''perl-cwd''perl-dynaloader''perl-english''perl-env''perl-exporter''perl-fnctl''perl-filehandle''perl-find''perl-finddepth''perl-getopt''perl-makemaker''perl-socket''perl-sys-syslog''perl-db-file''perl-storable''perl-data-dumper''perl-digest-md5'. EverymodulesuppliedintheperlpackageshallbeaddedintotheprovidesarrayinthePKGBUILD.ModulesinthisarrayshouldNOTappearintheperlpackagesconflictsorreplacesarrays.Endusersshouldbeabletoinstallnewerversionsofcoremodules,eitherinvendororsitedirectorieswithoutfilecollisions. Site SitemodulesareperlmodulesinstalledbythelocaladministratorforthecurrentversionofPerl.Typically,thesemodulesareinstalledusingthecpantool,oraredownloadedinsourceformandinstalledviamake(orMakeMaker). Sitedirectories ThePerlpackagesmustprovideamechanismforthelocaladministratortoinstallmodulesunder/usr/lib/perl5/site_perlbutmustnotcreateorremovethosedirectories. ModulesshouldbeinstalledtothedirectoriesdescribedaboveinModulePathsite,programsto/usr/bin/site_perlandmanualpagesunder/usr/man. Siteinstallation Thefollowingcommandsshouldbesufficientinthemajorityofcasesforthelocaladministratortoinstallmodulesandmustcreatedirectoriesasrequired: perlMakefile.PL makeinstall or cpanFoo::Bar Vendor Vendormodulesarepackagedmodules,installedviathepacmantool,ormoduleswhichhavebeenbuiltintoproperArchLinuxpackagesfromaPKGBUILDandmakepkg. Packagenaming Perlmodulepackagesshouldbenamedfortheprimarymoduleprovided.ThenamingconventionformoduleFoo::Barisperl-foo-bar.Packageswhichincludemultiplemodulesmayadditionallyincludeprovidesforthosemodulesusingthesameconvention. Vendordirectories TheinstallationdirectoryforArchLinuxmodulesmustbedifferentfromthatforsitemodules.Someguidelinesinclude: ThecurrentPerlpackagingusesthevendordirectoriesforthispurpose,whichareatpresentasdescribedinaboveasvendor. Noversionsubdirectoryexistsonthesedirectoriesasthedependenciesforpackagedmodulesshouldensurethatallworkwiththecurrentperlpackage. ThePerldistributionincludesmanymodulesavailableseparatelyfromCPAN,whichmayhaveanewerversion.Theintentofthe@INCordering(describedabove)istoallowsuchmodulestobepackagedtovendorwhichtakeprecedenceovertheversionincore.Apackagedmodulewhichshadowsacoremoduleinthiswaymustbeanewerversion. Modulepackagesmustinstallmanualpagesintothestandarddirectoriesusingtheextensions.1pand.3pmtoensurethatnoconflictariseswhereapackagedmoduleduplicatesacoremodule. .packlist(usedformoduleuninstalls)andperllocal.pod(usedtorecordlocal/siteinstallations)filesshouldnotbeinstalled,andshouldberemovedfromthepackageiffound. Emptydirectoriesshouldbepruned. Vendorinstallation AmoduleshouldusethefollowinglinesinthePKGBUILDbuildtarget. perlMakefile.PLINSTALLDIRS=vendor andthisonetoinstalltheresultsintothetemporarytree... makeinstallDESTDIR="${pkgdir}"install Adependsonperl(>=5.10.0)isrequiredinorderensurethatthemoduleiscorrectlyinstalledintothenew@INCpath. SamplevendorPKGBUILD #$Id$ #Contributor:BarryUser #Maintainer:HarryHacker pkgname=perl-html-template _realname=HTML-Template pkgver=2.9 pkgrel=2 pkgdesc="Perl/CPANModuleHTML::Template :asimpleHTMLtemplatingsystem" arch=('any') url="https://search.cpan.org/dist/${_realname}/" license=('GPL''Artistic') depends=('perl>=5.10.0') source=("https://www.cpan.org/authors/id/S/SA/SAMTREGAR/${_realname}-${pkgver}.tar.gz") md5sums=("cbf88a486b36284be55765ac7357c187") options=('!emptydirs') build(){ cd"${_realname}-${pkgver}" #Settingtheseenvvariablesoverwritesanycommand-lineoptionswedon'twant... exportPERL_MM_USE_DEFAULT=1PERL_AUTOINSTALL=--skipdeps\ PERL_MM_OPT="INSTALLDIRS=vendorDESTDIR='$pkgdir'"\ PERL_MB_OPT="--installdirsvendor--destdir'$pkgdir'"\ PERL5LIB=""PERL_LOCAL_LIB_ROOT=""\ MODULEBUILDRC=/dev/null #IfusingMakefile.PL {/usr/bin/perlMakefile.PL&& make&& maketest&& makeinstall;}||return1 #IfusingBuild.PL {/usr/bin/perlBuild.PL&& ./Build&& ./Buildtest&& ./Buildinstall;}||return1 #removeperllocal.podand.packlist find"$pkgdir"\(-name.packlist-o-nameperllocal.pod\)-delete } Dependencies Binarymodules Binarymodulesmustspecifyadependencyoneitherperlwithaminimumversionoftheperlpackageusedtobuildthemodule,andmustadditionallydependontheexpansionofperlapi-$Config{version}usingtheConfigmodule. Architecture-independentmodules Architecture-independentmoduleswhichrequirecoremodulesfromtheperlpackagemustspecifyadependencyonthatpackage. Moduleswhichcontainexplicitrequireversionoruseversionstatementsmustspecifyadependencyonperlwiththeminimumrequiredversion,ormoresimplythecurrentversion. Intheabsenceofanexplicitrequirement,architecture-independentmodulesmustdependonaminimumperlversionof5.10.0duetothechangesin@INCintroducedbythatversion. Perl6 Thereiscurrentlyworkinprogressonthenextmajorrevision,althoughthespecificationshaveyettobefinalised. ItisanticipatedthatwhenPerl6isreleaseditwillinitiallybepackagedasperl6,installthebinaryas/usr/bin/perl6,andusedifferentdirectoriesforpackagedmodulestoperl: /usr/lib/perl6 /usr/share/perl6 ThiswillallowPerl5and6packagesandmodules(whichshouldbepackagedasperl6-foo-bar),tocoexistforaslongasrequired. AtsomestageinthefuturewhenPerl6issufficientlymature,thepackagenamingmaybereversedsuchthattheperlpackagecontainsPerl6andthecurrentpackagebecomesperl5. Retrievedfrom"https://wiki.archlinux.org/index.php?title=Perl_Policy&oldid=659556" Category:Packagedevelopment



請為這篇文章評分?