a ÀQYgwã@s˜ddlZddlZddlZddlZddlZddlZddlZddlZddl Zda da da dd„Z dd„Zdd„Zdd „Zd d „Zd d „Zdd„Zdd„ZdS)éNcCs>tj tjjd¡atj td¡at  ¡da tj tdddS)NÚgitzlibosmo-sigtranéT)Úexist_ok) ÚosÚpathÚjoinÚtestenvÚargsÚcacheÚgit_dirÚsccp_dirÚmultiprocessingÚ cpu_countÚjobsÚmakedirs©rrú`/home/osmocom-build/jenkins/workspace/ttcn3-bsc-test-sccplite/_testenv/testenv/podman_install.pyÚinits rcCsD|›d|›dg}| tj¡}||kr@||›d|›dg7}|S)Nz-dbgz-dbgsym)ÚrstripÚstringÚdigits)ÚdepÚretZ dep_nodigitsrrrÚ get_dbg_pkgss  rc Cs0tj tjjdd¡}i}tj dt  |¡›¡|D]Î}tjjd|gt j d}|j   d¡ d¡D] }| d¡rpq`| ¡ d d ¡d }||vrÚt|ƒD]4}t  d d d|›d|g¡}|jd kr”|||<qÊq”||vrÚd||<||r`t |›d|›d||›¡q`q4g} | ¡D]\}} | r| | g7} q| S)NÚpodmanÚ dbg_pkgs_allz$apt-cache pkgnames | grep -- -dbg > z apt-rdepends)Ústdoutzutf-8Ú z ú rrÚgrepú-qú^ú$z -> z : installing )rrrrr r ÚcmdÚrunÚshlexÚquoteÚ subprocessÚPIPErÚdecodeÚsplitÚ startswithrrÚ returncodeÚloggingÚdebugÚitems) ÚpkgsrZdbg_pkgsZpkgZrdepsÚlinerZdbg_pkgrrZdbgrrrÚapt_get_dbg_pkgs)s0   "r2cCsN|sdStt|ƒƒ}|t|ƒ7}t dd |¡›¡tj gd¢|¡dS)NzInstalling packages: z, )zapt-getr Úinstallz-yz--no-install-recommends) ÚlistÚsetr2r-Úinforrr#r$)r0rrrÚ apt_installRs   r7c Cs8tj t¡rt d¡dStj ddt ddddg¡dS)Nzlibosmo-sigtran: already clonedrz-CÚclonez--depthÚ1z*https://gerrit.osmocom.org/libosmo-sigtran) rrÚexistsr r-r.rr#r$r rrrrÚclone_libosmo_sigtran_s  ùÿr;cCs¼tj td¡}tddgƒtj |¡s¤tƒt d¡t j j ddgtdt j j dgtdt j j d d t ›d gtj td ¡dt j j d d t ›d gtj td¡dt j   dd|dg¡dS)Nzexamples/sccp_demo_userzlibosmo-netif-devzlibosmocore-devzBuilding sccp_demo_userZ autoreconfz-fi)Úcwdz ./configureÚmakez-jzlibosmo-sigtran.laÚsrcZsccp_demo_userZexamplesÚlnz-sz/usr/local/bin/sccp_demo_user) rrrr r7r:r;r-r6rr#r$r)Zsccp_demo_user_pathrrrÚfrom_source_sccp_demo_userqs(þÿ    þ  þr@cCsp||d dd¡d}|dkr&tƒSt d|›d¡t d|›d |›¡t d ¡t d ¡t d¡dS) NÚprogramrrrzrun_sccp_demo_user.shzCan't install z! Fix this by either:z* Adding package= to [z] in z/ (if it can be installed from binary packages)z4* Editing from_source() in testenv/podman_install.py)r*r@r-ÚerrorÚsysÚexit)ÚcfgÚcfg_nameÚsectionrArrrÚ from_sourceŽs  rHcCsbg}|D]L}|dvrq||}d|vrH|ddkr4q||d d¡7}qt|||ƒqt|ƒdS)N)ÚDEFAULTÚ testsuiteÚpackageÚnor)r*rHr7)rErFÚpackagesrGÚ section_datarrrrMšs rM)r-r rr%rr'rCÚ testenv.cmdrÚtestenv.podmanr r rrrr2r7r;r@rHrMrrrrÚs&  )