mò &U²Ic@s™dZdZdkZdkZdkZdkZdkTdklZdk l Z dk l Z dk lZdkTdklZd efd „ƒYZdS( swdistutils.command.bdist_rpm Implements the Distutils 'bdist_rpm' command (create RPM source and binary distributions).s>$Id: bdist_rpm.py 47214 2006-07-03 12:29:51Z martin.v.loewis $N(t*(sCommand(sDEBUG(s get_platform(s write_file(slogt bdist_rpmc*Bs]tZdZdedfdedfdddfd ed fd ed fd edfdedfdedfdedfdedfdedfdedfdedfdedfded fd!ed"fd#ed$fd%ed&fd'ed(fd)ed*fd+ed,fd-ed.fd/ed0fd1ed2fd3d4d5fd6ed7fd8ed9fd:ed;fd<ed=fd>ed?fd@edAfdBedCfdDedEfdFedGfdHedIfdJedKfdLedMfdNedOfdPedQfdRedSfg(Zd3d8d<d1gZhd6d3<d:d8<d>d<") [default: maintainer or author from setup script]s packager=sARPM packager (eg. "Jane Doe ")[default: vendor]s doc-files=s6list of documentation files (space or comma-separated)s changelog=s RPM changelogsicon=sname of icon files provides=s%capabilities provided by this packages requires=s%capabilities required by this packages conflicts=s-capabilities which conflict with this packagesbuild-requires=s+capabilities required to build this packages obsoletes=s*capabilities made obsolete by this packages no-autoreqs+do not automatically calculate dependenciess keep-temptks"don't clean up RPM build directorys no-keep-temps&clean up RPM build directory [default]suse-rpm-opt-flagss8compile with RPM_OPT_FLAGS when building from source RPMsno-rpm-opt-flagss&do not pass any RPM CFLAGS to compilers rpm3-modes"RPM 3 compatibility mode (default)s rpm2-modesRPM 2 compatibility modes prep-script=s3Specify a script for the PREP phase of RPM buildings build-script=s4Specify a script for the BUILD phase of RPM buildings pre-install=s:Specify a script for the pre-INSTALL phase of RPM buildingsinstall-script=s6Specify a script for the INSTALL phase of RPM buildings post-install=s;Specify a script for the post-INSTALL phase of RPM buildingspre-uninstall=s<Specify a script for the pre-UNINSTALL phase of RPM buildingspost-uninstall=s=Specify a script for the post-UNINSTALL phase of RPM buildings clean-script=s4Specify a script for the CLEAN phase of RPM buildingsverify-script=s6Specify a script for the VERIFY phase of the RPM builds force-arch=s0Force an architecture onto the RPM build processcCsZd|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_!d|_"d|_#d|_$d|_%d|_&d|_'dS(Nii((tNonetselft bdist_basetrpm_basetdist_dirtpythont fix_pythont spec_onlyt binary_onlyt source_onlyt use_bzip2tdistribution_nametgrouptreleasetserialtvendortpackagert doc_filest changelogticont prep_scriptt build_scripttinstall_scriptt clean_scriptt verify_scriptt pre_installt post_installt pre_uninstalltpost_uninstalltpreptprovidestrequirest conflictstbuild_requirest obsoletest keep_temptuse_rpm_opt_flagst rpm3_modet no_autoreqt force_arch(R((t8/data/zmath/lib/python2.4/distutils/command/bdist_rpm.pytinitialize_optionsŠsL                                     cCs$|idd ƒ|idjo6|ip td‚ntii|i dƒ|_n|i djo'|i ot i |_ q¤d|_ n|i o td‚ntidjotdti‚n|io|io td ‚n|iiƒp d |_n|idd ƒ|iƒdS(NtbdistRs)you must specify --rpm-base in RPM 2 modetrpmR s8--python and --fix-python are mutually exclusive optionstposixs9don't know how to create RPM distributions on platform %ss6cannot supply both '--source-only' and '--binary-only'iR(s bdist_bases bdist_base(sdist_dirsdist_dir(Rtset_undefined_optionsRRR)tDistutilsOptionErrortostpathtjoinRR R tsyst executabletnametDistutilsPlatformErrorR R t distributionthas_ext_modulesR(tfinalize_package_data(R((R,tfinalize_options¹s&        cCsØ|iddƒ|idd|iiƒ|iiƒfƒ|idƒ|idƒt|iƒtjoLxIdD]=}t i i |ƒo$||ijo|ii |ƒqsqsWn|id d ƒ|id ƒ|id ƒ|id ƒ|i|iƒ|_|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒ|idƒdS(NRsDevelopment/LibrariesRs%s <%s>RRtREADMEs README.txtRt1RRRRRRRRRRRRR R"R#R$R%R&R+(R>s README.txt(Rt ensure_stringR:t get_contacttget_contact_emailtensure_string_listttypeRtListTypetreadmeR3R4texiststappendt_format_changelogRtensure_filename(RRF((R,R<Ûs> #  #                  c Cs÷to9dGHdG|iGHdG|iGHdG|iGHdG|iGHn|io|i} |i | ƒnOh} x;d#D]3}t i i|i|ƒ| |<|i | |ƒqqW| d} t i i| d |iiƒƒ}|it||iƒfd |ƒ|iodSn|id ƒ} |iodg| _n dg| _|id ƒ| iƒd}| d}|i||ƒ|ioAt i i |iƒo|i|i|ƒqÀt!d|i‚nt"i#dƒdg}t i i dƒpt i i dƒo dg}n|i%o|i&dƒn)|i'o|i&dƒn|i&dƒ|i(o*|i)ddt i i*|iƒgƒn|i+p|i&dƒn|i&|ƒ|i,|ƒ|i-p4|i'p^t.i.t i i| d dƒƒ}t0|ƒdjpt1d|‚|i2|d|iƒn|i%p¾t.i.t i i| d d ƒƒ}t.i.t i i| d d!ƒƒ}|o|i5|dƒnt0|ƒdjpt1d"|‚|i2|d|iƒ|o|i2|d|iƒqïqóndS($Nsbefore _get_package_data():svendor =s packager =s doc_files =s changelog =tSOURCEStSPECStBUILDtRPMStSRPMSs%s.specs writing '%s'tsdisttbztartgztarisicon file '%s' does not exists building RPMsR/s/usr/bin/rpmbuilds /bin/rpmbuildtrpmbuilds-bss-bbs-bas--defines _topdir %ss--cleans*.rpmis)unexpected number of SRPM files found: %ss*/*.rpms*/*debuginfo*.rpms(unexpected number of RPM files found: %s(RKRLRMRNRO(6tDEBUGRRRRRR Rtspec_dirtmkpathtrpm_dirRR3R4R5RR:tget_namet spec_pathtexecutet write_filet_make_spec_filetreinitialize_commandRPRtformatst run_commandtget_archive_filestsourcet source_dirt copy_fileRRGtDistutilsFileErrortlogtinfotrpm_cmdR RHR R)textendtabspathR'tspawntdry_runtglobtsrpmstlentAssertionErrort move_filetrpmst debuginfotremove( RRqRgRRaRrRmRbRYRWRURP((R,trun s€                 &     *     "! " !c Csd|iiƒd|iiƒiddƒd|iiddƒdd|iiƒg}|idd d gƒ|i o|i d ƒn|i d ƒ|id |ii ƒd|i ddgƒ|i p%|iiƒp|i dƒq n|i d|i ƒx…dBD]}}t|ti|ƒƒ}t|ƒtjo$|i d|ti|ƒfƒq|dAj o|i d||fƒqqW|iiƒdjo|i d|iiƒƒn|io|i d|iƒn|io!|i dti|iƒƒn|io$|i dtii|iƒƒn|io|i dƒn|idd |ii ƒgƒd!|i!tiit"i#d"ƒf}d#|}|i&od$|}ndCd(d)|fd*d+d,|fdDdEdFdGdHdIg }x|D]‡\}} }t|| ƒ}|p|o[|idd:|gƒ|o,|iti+t,|d;ƒi-ƒd<ƒƒq‡|i |ƒqqW|idd=d>gƒ|i.o!|i d?ti|i.ƒƒn|i/o'|idd@gƒ|i|i/ƒn|S(JsiGenerate the text of an RPM spec file and return it as a list of strings (one per line). s %define name s%define version t-t_s%define release ts Summary: s Name: %{name}sVersion: %{version}sRelease: %{release}s#Source0: %{name}-%{version}.tar.bz2s"Source0: %{name}-%{version}.tar.gzs License: sGroup: s>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootsPrefix: %{_prefix}sBuildArch: noarchs BuildArch: %stVendortPackagertProvidestRequirest Conflictst Obsoletess%s: %stUNKNOWNsUrl: sDistribution: sBuildRequires: sIcon: s AutoReq: 0s %descriptions%s %sis%s buildsenv CFLAGS="$RPM_OPT_FLAGS" R!Rs%setuptbuildRtinstallRs:%s install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILEStcleanRsrm -rf $RPM_BUILD_ROOTt verifyscriptRtpreRtpostRtpreunRtpostunR t%trs s%files -f INSTALLED_FILESs%defattr(-,root,root)s%doc s %changelogN(RxRyRzR{R|R}(spreps prep_scripts%setup(Rs clean_scriptsrm -rf $RPM_BUILD_ROOT(R‚s verify_scriptN(Rƒs pre_installN(R„s post_installN(R…s pre_uninstallN(R†spost_uninstallN(0RR:RXt get_versiontreplaceRtget_descriptiont spec_fileRhRRHt get_licenseRR+R;tfieldtgetattrtstringtlowertvalRDRER5Rtget_urlRR%RR3R4tbasenameR*tget_long_descriptionR R6targvtdef_setup_callt def_buildR(tscript_optionstrpm_opttattrtdefaulttsplittopentreadRR( RR˜RœR’RŒR—RšRŽR™R›((R,R\ksb[  - $   ! $ &  7, ! cCs¿|p|Sng}xtiti|ƒdƒD]p}ti|ƒ}|ddjo|id|gƒq1|ddjo|i|ƒq1|id|ƒq1W|dp |d=n|S(sKFormat the changelog correctly and convert it to a list of strings s iRRwRus N(Rt new_changelogRRtstriptlineRhRH(RRR R¢((R,RIs  ( t__name__t __module__t descriptionRt user_optionstboolean_optionst negative_optR-R=R<RtR\RI(((R,Rsÿçj! / " / a š(t__doc__t __revision__R6R3RRlttypestdistutils.coretCommandtdistutils.debugRTtdistutils.utilt get_platformtdistutils.file_utilR[tdistutils.errorst distutilsReR( RRªRRlR6R[R­R°RTR3Re((R,t?s