
    $i                     J    S SK r S SKrS SKrS SKrS SKrS rS rS rS rS r	g)    Nc                     [         R                  R                  U 5      n[        R                  " U S3SS9n[	        U5      S:  d   eU(       a  US   $ S $ )Nz/**/contrib/*.spec.inT)	recursive   r   )libgitget_repo_pathgloblen)project	repo_pathrets      /obs/lib/rpm_spec.pyget_spec_in_pathr      sO    %%g.I
))yk!674
HCs8a<<3q6"d"    c                     [         R                  " U 5      n[        R                  " U S35      n[        U5      S:X  d   e[        R
                  R                  US   5      $ )zGet the name to the .tar.xz file generated by dpkg-buildpackage, that
we also use in the rpm spec file. This requires
lib.debian.move_files_to_output() to run first.z/*.tar.*   r   )r   get_output_pathr	   r
   ospathbasename)r   path_outputr   s      r   get_source_namer      sR     %%g.K
)){m8,
-Cs8q==77CF##r   c           	          [        U 5      nSU 3nU(       a  USU 3-  n[        R                  " SSSSUSU/5        [        R                  " SSSSUSU/5        g)	zAdd a 'Requires: ...' line below the 'Name:' and '%package' lines of
the .spec.in file.
:param pkgname: of the meta-package to depend on (e.g. osmocom-nightly)
:param version: of the meta-pkgname to depend on or None z
Requires: z = sed-ez
/^Name:/a\-iz/^%package/a\N)r   r   run_cmd)r   pkgnameversionr   req_lines        r   
add_dependr!      sh    
 G$DG9%Hc'O# KKmT8T4HI KK.hdKLr   c           	         [        U  S35        [        U 5      n[        U 5      nUR                  SS5      n[        R
                  " SSU S3SU/5        U(       a"  SU 3n[        R
                  " SS	S
S	USU/5        [        R
                  " SSU S3SU/5        Sn[        R
                  " SS	SS	USU/5        [        R
                  " SS[        R                  R                  U 5       S3SU/5        g)z`Update the version and source in the .spec.in file.
:param version: from get-version-gen script z: generating rpm spec file-.r   zs/^Version:.*/Version: /r   zEpoch: r   z/^Version:/a\zs/^Source:.*/Source: zSource1: rpmlintrcz/^Source:/a\zs/^%setup/%setup -n N)	printr   r   replacer   r   r   r   r   )r   r   epochr   source
epoch_linerpmlint_lines          r   generater,   .   s    
WI/
01G$DW%F ooc3'G KK1'!<dDIJug&
UD"2D*d 	
 KK/xq94FG'LKKot\4NO
 KK.rww/?/?/H.IKt r   c                 $   [        U 5      n[        R                  " U 5      n[        R                  R                  U5      S S n[        R                  " X SU 35        [        R                  " [        R                  R                   S3U5        g )Nr%   z/data/rpmlintrc)
r   r   r   r   r   r   shutilcopyconfigpath_top)r   path_spec_inr   	name_specs       r   copy_to_outputr5   L   sp    #G,L%%g.K  .s3I
KKQyk:; KK3::&&'7Er   )
r	   r   r/   r   lib.gitr   r   r!   r,   r5    r   r   <module>r8      s1     	  
 #$M$<Fr   