a „µ@gµã@s¼ddlZddlZddlZddlZddlZddlZddlZddlZddl Zda da da da dadadd„Zdd„Zdd„Zdd „Zd d „Zd d „Zdd„Zdd„Zdd„Zdd„Zdd„ZdS)éNcCshtj tjjd¡atj td¡atj td¡atj td¡a tj td¡a t   ¡da tjtdddS) NÚgitz osmocom-bbzsrc/host/trxconzsrc/host/virt_phyzlibosmo-sigtranéT)Úexist_ok)ÚosÚpathÚjoinÚtestenvÚargsÚcacheÚgit_dirÚbb_dirÚ trxcon_dirÚ virtphy_dirÚsccp_dirÚmultiprocessingÚ cpu_countÚjobsÚmakedirs©rrú\/home/osmocom-build/jenkins/workspace/ttcn3-cbc-test-asan/_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_pkgs's  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_pkgr"rZdbgrrrÚapt_get_dbg_pkgs2s0   "r5cCsN|sdStt|ƒƒ}|t|ƒ7}t dd |¡›¡tj gd¢|¡dS)NzInstalling packages: z, )zapt-getr#Úinstallz-yz--no-install-recommends) ÚlistÚsetr5r0Úinforrr&r')r3rrrÚ apt_install[s   r:c Cs8tj t¡rt d¡dStj ddt ddddg¡dS)Nzosmocom-bb: already clonedrú-CÚcloneú--depthÚ1z%https://gerrit.osmocom.org/osmocom-bb) rrÚexistsr r0r1rr&r'r rrrrÚclone_osmocom_bbhs  ùÿr@c Cs8tj t¡rt d¡dStj ddt ddddg¡dS)Nzlibosmo-sigtran: already clonedrr;r<r=r>z*https://gerrit.osmocom.org/libosmo-sigtran) rrr?rr0r1rr&r'r rrrrÚclone_libosmo_sigtranzs  ùÿrAcCsŠtj td¡}tj |¡srtƒtdgƒt d¡t j j ddgtdt j j dgtdt j j dd t ›gtdt j   d d |d g¡dS) Nz src/trxconúlibosmocore-devzBuilding trxconÚ autoreconfú-fi©Úcwdú ./configureÚmakeú-jÚlnú-sz/usr/local/bin/trxcon) rrrr r?r@r:r0r9rr&r'r)Ztrxcon_in_srcdirrrrÚfrom_source_trxconŒs   rLcCsŠtj td¡}tj |¡srtƒtdgƒt d¡t j j ddgtdt j j dgtdt j j dd t ›gtdt j   d d |d g¡dS) Nz src/virtphyrBzBuilding virtphyrCrDrErGrHrIrJrKz/usr/local/bin/virtphy) rrrrr?r@r:r0r9rr&r'r)Zvirtphy_in_srcdirrrrÚfrom_source_virtphyšs   rMcCs¼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-devrBzBuilding sccp_demo_userrCrDrErGrHrIzlibosmo-sigtran.laÚsrcZsccp_demo_userZexamplesrJrKz/usr/local/bin/sccp_demo_user) rrrrr:r?rAr0r9rr&r'r)Zsccp_demo_user_pathrrrÚfrom_source_sccp_demo_user¨s(þÿ    þ  þrOcCsš||d dd¡d}|dkr&tƒS|dkr4tƒS|dkrBtƒS|dkrPtƒSt d |›d ¡t d |›d |›¡t d ¡t d¡t d¡dS)NÚprogramr!rrZtrxconZvirtphyzrun_fake_trx.shzrun_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-rLrMr@rOr0ÚerrorÚsysÚexit)ÚcfgÚcfg_nameÚsectionrPrrrÚ from_sourceÅs  rWcCsbg}|D]L}|dvrq||}d|vrH|ddkr4q||d d¡7}qt|||ƒqt|ƒdS)N)ÚDEFAULTÚ testsuiteÚpackageÚnor!)r-rWr:)rTrUÚpackagesrVÚ section_datarrrr\×s r\)r0rrr(rr*rRÚ testenv.cmdrÚtestenv.podmanr r r rrrrrr5r:r@rArLrMrOrWr\rrrrÚs2 )