\bgTdZddlZddlZddlZddlmZddlmZddlm Z ddl m Z m Z m Z mZddlmZdd lmZGd d eZdS) zwdistutils.command.bdist_rpm Implements the Distutils 'bdist_rpm' command (create RPM source and binary distributions).N)log)Command)DEBUG)DistutilsExecErrorDistutilsFileErrorDistutilsOptionErrorDistutilsPlatformError) write_file)get_python_versioncXeZdZdZgdZgdZddddZdZd Zd Z d Z d Z d Z dZ dS) bdist_rpmzcreate an RPM distribution)))z bdist-base=Nz/base directory for creating built distributions)z rpm-base=Nzdbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2))z dist-dir=dzDdirectory to put final RPM files in (and .spec files if --spec-only))zpython=NzMpath to Python interpreter to hard-code in the .spec file [default: "python"])z fix-pythonNzLhard-code the exact path to the current Python interpreter in the .spec file)z spec-onlyNzonly regenerate spec file)z source-onlyNzonly generate source RPM)z binary-onlyNzonly generate binary RPM)z use-bzip2Nz7use bzip2 instead of gzip to create source distribution)zdistribution-name=Nzgname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!))zgroup=Nz9package classification [default: "Development/Libraries"])zrelease=NzRPM release number)zserial=NzRPM serial number)zvendor=NzaRPM "vendor" (eg. "Joe Blow ") [default: maintainer or author from setup script])z packager=NzBRPM packager (eg. "Jane Doe ") [default: vendor])z doc-files=Nz6list of documentation files (space or comma-separated))z changelog=Nz RPM changelog)zicon=Nzname of icon file)z provides=Nz%capabilities provided by this package)z requires=Nz%capabilities required by this package)z conflicts=Nz-capabilities which conflict with this package)zbuild-requires=Nz+capabilities required to build this package)z obsoletes=Nz*capabilities made obsolete by this package) no-autoreqNz+do not automatically calculate dependencies) keep-tempkz"don't clean up RPM build directory) no-keep-tempNz&clean up RPM build directory [default])use-rpm-opt-flagsNz8compile with RPM_OPT_FLAGS when building from source RPM)no-rpm-opt-flagsNz&do not pass any RPM CFLAGS to compiler) rpm3-modeNz"RPM 3 compatibility mode (default)) rpm2-modeNzRPM 2 compatibility mode)z prep-script=Nz3Specify a script for the PREP phase of RPM building)z build-script=Nz4Specify a script for the BUILD phase of RPM building)z pre-install=Nz:Specify a script for the pre-INSTALL phase of RPM building)zinstall-script=Nz6Specify a script for the INSTALL phase of RPM building)z post-install=Nz;Specify a script for the post-INSTALL phase of RPM building)zpre-uninstall=Nzr ospathjoinrrrsys executablenamer r!r" distributionhas_ext_modulesr=finalize_package_datarAs rCfinalize_optionszbdist_rpm.finalize_optionssC ""7,HIII = > X*+VWWWGLL%@@DM ;  (!n ' _ &J  7g  (S"'SS     0 &H   0022 +%*D " ""7,DEEE ""$$$$$rEcd|dd|d|jd|jd|d|dt |jtrGdD]D}tj |r#||jvr|j |E|d d |d |d |d | |j |_ |d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|ddS)Nr%zDevelopment/Librariesr(z <>r)r*)READMEz README.txtr&1r'r$r+r,r-r.r/r0r1r2r3r4r5r7r8r9r:r;r@) ensure_stringrR get_contactget_contact_emailensure_string_list isinstancer*listrLrMexistsappend_format_changelogr+ensure_filename)rBreadmes rCrTzbdist_rpm.finalize_package_datas 7$;<<<   ,,.. Z Z$2C2U2U2W2W Z Z Z    :&&&  ,,, dnd + + 22 2 27>>&))2fDN.J.JN))&111 9c*** 8$$$ ./// ;'''//?? V$$$ ]+++ ^,,, -... ^,,, _--- ]+++ ^,,, _--- -...  +++  +++  ,,,  0111  ,,, <(((((rEcn trctdtd|jtd|jtd|jtd|j|jr|j}||nRi}dD]E}tj |j |||<|||F|d}tj ||j d}|t ||fd |d |jrdS|j jdd}|d }|jr d g|_nd g|_|d ||j _|d}|d}||||jrXtj |jr||j|nt7d|jdt9jddg} |jr| dn2|j r| dn| d| !dd|j"g|j#r<| !ddtj $|j g|j%s| d|j&r| d| |d} | dz} d| zdz} d | d!| d"|d } tj'| } g}d} |(}|sna|)*}tW|d$ksJ||d%||d}x|,}|rt[d&|  |,n#|,wxYw|.| |j/s|j 0rtc}nd'}|j stj |d(|}tj |sJ|2||jtj |j|}|j jd)||f|js|D]}tj |d*|}tj |r|2||jtj |jtj 3|}|j jd)||fdSdSdS)+Nzbefore _get_package_data():zvendor =z packager =z doc_files =z changelog =)SOURCESSPECSBUILDRPMSSRPMSrgz.specz writing ''sdistbztargztarrrfz icon file 'z' does not existz building RPMsrpmbuildz-bsz-bbz-baz--definez __python z_topdir z--cleanz--quietz%{name}-%{version}-%{release}z.src.rpmz%{arch}/z .%{arch}.rpmz rpm -q --qf ' z\n' --specfile 'TrzFailed to execute: anyrjrri)4rprintr(r)r*r+r rmkpathrLrMrNrrRget_nameexecuter _make_spec_file dist_filesreinitialize_commandr#formats run_commandget_archive_files copy_filer,r`rrinfor"rar!extendrr>abspathr<rpopenreadlinestripsplitlencloserspawndry_runrSr move_filebasename)rBspec_dirrpm_dirr spec_pathsaved_dist_filesrlsource source_dirrpm_cmd nvr_stringsrc_rpm non_src_rpmq_cmdout binary_rpms source_rpmlineellstatus pyversionsrpmfilenamerHs rCrunz bdist_rpm.runs)  1 / 0 0 0 *dk * * * , . . . - 0 0 0 - 0 0 0 > (}H KK ! ! ! !GC ( (W\\$-;;  GAJ''''w'HGLLd.?.H.H.J.J+Q+Q+QRR  D$8$8$:$:;=U=U=U=U    >  F ,7:))'22 > &$IEMM$IEM !!!'7$((**1-Y'  vz*** 9 Tw~~di(( Tty*5555()Rty)R)R)RSSS !!!,   " NN5 ! ! ! !   " NN5 ! ! ! ! NN5 ! ! ! $= $=$=>??? > V NNJ(S27??4=3Q3Q(S(ST U U U~ & NN9 % % % : & NN9 % % %y!!! 5 z) :-> TTT;TT TTThuoo KJ (||~~jjll((**3xx1}}}}""3q6***%!$QJ (YY[[F J()Hu)H)HIII J IIKKKKCIIKKKK 7|  0022 ".00 ! # Xw||GG$4jAAw~~d+++++tT]3337<< zBB!,33[)X4VWWW# &  C',,wv<g|]}d|dS) z \)r).0rs rC z-bdist_rpm._make_spec_file..s9! ! ! '+ " " " "! ! ! rEzbrp-python-bytecompile \ z%brp-python-bytecompile %{__python} \ z3# Workaround for https://bugs.python.org/issue14443z%define __os_install_post )z Name: %{name}zVersion: %{version}zRelease: %{release}z-Source0: %{name}-%{unmangled_version}.tar.bz2z,Source0: %{name}-%{unmangled_version}.tar.gzz License: zGroup: z>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootzPrefix: %{_prefix}zBuildArch: noarchz BuildArch: )VendorPackagerProvidesRequires Conflicts Obsoletesz{}: {}rpNz: zUrl: zDistribution: zBuildRequires: zIcon: z AutoReq: 0z %descriptionrz buildzenv CFLAGS="$RPM_OPT_FLAGS" z< install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES)r6r-z&%setup -n %{name}-%{unmangled_version}buildr.installr/)cleanr0zrm -rf $RPM_BUILD_ROOT) verifyscriptr1N)prer2N)postr3N)preunr4N)postunr5N%)rz%files -f INSTALLED_FILESz%defattr(-,root,root)z%doc z %changelog)(rRru get_versionreplacer&get_description subprocess getoutputrN splitlinesrarr# get_licenser%r@rSgetattrlowerr^r_formatget_urlr$r:r,rLrMrr?get_long_descriptionrrOargvr=openreadrr*r+)rB spec_file vendor_hookproblemfixed fixed_hookfieldvaldef_setup_call def_build install_cmdscript_optionsrpm_optattrdefaultfs rCrwzbdist_rpm._make_spec_filesP d/88:: : !2!>!>!@!@!H!Hc!R!R R (4+<+H+H+J+J J !5!5c3!?!? ?  4,<<>>K) L  !*+LMM ii! ! /:/E/E/G/G! ! !   09 ((%88  $ $   R S S S   9JFM N N N        > M   L M M M M   K L L L 4,88::Gi H  " L      >$4466 6  !4555   <4?<< = = = 4 4E$ ..C#t$$ 4   !F!FGGGG  E!2!2S!2!2333   $ $ & & D   Wt'8'@'@'B'BB C C C  ! H   -0FF G G G   P   .$:M1N1NN O O O 9 E   X(8(8(C(CC D D D ? +   \ * * *     2 2 4 4 :    $!KII"'*:*:38A;*G*GII%---  ! C6BI(eee  N ni 0 (+ 6 ? 3 ( * , .  '5 . . "GT7$%%C .g .  'M".c?a!(()=)=>>>???????????????$$W---       > A   Wsxx'?'?? @ @ @ > -         T^ , , ,s>;SS S c`|s|Sg}|dD]t}|}|ddkr|d|g:|ddkr||\|d|zu|ds|d=|S)zBFormat the changelog correctly and convert it to a list of stringsrr*rrr)rrrra)rBr+ new_changelogrs rCrbzbdist_rpm._format_changelogCs   OO%%++D11 2 2D::<rs    #"""""******~~~~~~~~~~rE