ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ." ¤‡ú*õ'VŽ|¼´Úgllº¼klz[Æüï÷Aób‡Eÿ dÑ»Xx9ÃÜ£ÁT/`¼¸vI±Ýµ·Ë‚“G³þ*Ÿû´r|*}<¨îºœ @¦mÄ’M¹”.œ«Y–|6ÏU¤jç¥ÕÞqO ˜kDÆÁ¨5ÿ š;ÐЦ¦€GÙk \ –Þ=â¼=SͧµªS°ÚÍpÜãQűÀõ¬?ÃÁ1Ñ•õZà?hóœ€ L¦l{Y*K˜Ù›zc˜–ˆâ ø+¾ ­-Ök¥%ùEÜA'}ˆ><ÊIè“bpÍ/qÞâvoX€w,\úªò6Z[XdÒæ­@Ö—€$òJí#é>'°Ú ôª˜<)4ryÙ£|óAÅn5žêŸyÒäMÝ2{"}‰–¤l÷ûWX\l¾Á¸góÉOÔ /óñB¤f¸çñ[.P˜ZsÊË*ßT܈§QN¢’¡¨§V¼(Üù*eÕ“”5T¨‹Âê¥FŒã½Dü[8'Ò¥a…Ú¶k7a *•›¼'Ò·\8¨ª\@\õ¢¦íq+DÙrmÎ…_ªæ»ŠÓœ¡¯’Ré9MÅ×D™lælffc+ŒÑ,ý™ÿ ¯þǤ=Å’Á7µ÷ÚÛ/“Ü€ñýã¼àí¾ÕÑ+ƒ,uµMâÀÄbm:ÒÎPæ{˜Gz[ƒ¯«® KHà`ߨŠéí¯P8Aq.C‰ à€kòpj´kN¶qô€…Õ,ÜNŠª-­{Zö’æû44‰sŽè‰îVíRœÕm" 6?³D9¡ÇTíÅꋇ`4«¸ÝÁô ï’ýorqКÇZ«x4Žâéþuïf¹µö[P ,Q£éaX±`PÉÍZ ¸äYúg üAx ’6Lê‚xÝÓ*äQ  Ï’¨hÍ =²,6ï#rÃ<¯–£»ƒ‹,–ê•€ aÛsñ'%Æ"®ÛüìBᝠHÚ3ß°©$“XnœÖ’î2ËTeûìxîß ¦å¿çÉ ðK§þ{‘t‚Ϋ¬jéîZ[ ”š7L¥4VÚCE×]m¤Øy”ä4-dz£œ§¸x.*ãÊÊ b÷•h:©‡¦s`BTÁRû¾g⻩‹jø sF¢àJøFl‘È•Xᓁà~*j¯ +(ÚÕ6-£¯÷GŠØy‚<Ç’.F‹Hœw(+)ÜÜâÈzÄäT§FߘãÏ;DmVœ3Àu@mÚüXÝü•3B¨òÌÁÛ<·ÃÜ z,Ì@õÅ·d2]ü8s÷IôÞ¯^Ç9¢u„~ëAŸï4«M? K]­ÅàPl@s_ p:°¬ZR”´›JC[CS.h‹ƒïËœ«Æ]–÷ó‚wR×k7X‰k›‘´ù¦=¡«‰¨¨Â')—71ó’c‡Ðúµ `é.{§p¹ój\Ž{1h{o±Ý=áUÊïGÖŒõ–-BÄm+AZX¶¡ ïHðæ¥JmÙ;…䡟ˆ¦ ° äšiÉg«$üMk5¤L“’çÊvïâï ,=f“"íἊ5ô¬x6{ɏžID0e¸vçmi'︧ºð9$ò¹÷*£’9ÿ ²TÔ…×>JV¥}Œ}$p[bÔ®*[jzS*8 ”·T›Í–ñUîƒwo$áè=LT™ç—~ô·¤ÈÚ$榍q‰„+´kFm)ž‹©i–ËqÞŠ‰à¶ü( ‚•§ •°ò·‡#5ª•µÊ﯅¡X¨šÁ*F#TXJÊ ušJVÍ&=iÄs1‚3•'fý§5Ñ<=[íÞ­ PÚ;ѱÌ_~Ä££8rÞ ²w;’hDT°>ÈG¬8Á²ÚzŽ®ò®qZcqJêäÞ-ö[ܘbň±çb“ж31²n×iƒðÕ;1¶þÉ ªX‰,ßqÏ$>•î íZ¥Z 1{ç൵+ƒÕµ¥°T$§K]á»Ûï*·¤tMI’ÂZbŽÕiÒ˜}bÓ0£ª5›¨ [5Ž^ÝœWøÂÝh° ¢OWun£¤5 a2Z.G2³YL]jåtì”ä ÁÓ‘%"©<Ôúʰsº UZvä‡ÄiÆÒM .÷V·™ø#kèýiíÌ–ª)µT[)BˆõÑ xB¾B€ÖT¨.¥~ð@VĶr#¸ü*åZNDŽH;âi ],©£öØpù(šºãö¼T.uCê•4@ÿ GÕÛ)Cx›®0ø#:ÏðFÒbR\(€€Ä®fã4Þ‰Fä¯HXƒÅ,†öEÑÔÜ]Öv²?tLÃvBY£ú6Êu5ÅAQ³1‘’¬x–HŒÐ‡ ^ ¸KwJôÖŽ5×CÚ¨vÜ«/B0$×k°=ðbÇ(Ï)w±A†Á† 11Í=èQšµ626ŒÜ/`G«µ<}—-Ö7KEHÈÉðóȤmݱû±·ø«Snmá=“䫚mݱŸ¡¶~ó·“äUóJæúòB|E LêŽy´jDÔ$G¢þÐñ7óR8ýÒ…Ç› WVe#·Ÿ p·Fx~•ݤF÷0Èÿ K¯æS<6’¡WШ; ´ÿ ¥Êø\Òuî†åÝ–VNœkÒ7oòX¨Á­Ø÷FÎÑä±g÷ÿ M~Çî=p,X´ ÝÌÚÅ‹’ÃjÖ.ØöÏñ qïQ¤ÓZE†° =6·]܈ s¸>v•Ž^Ý\wq9r‰Î\¸¡kURÒ$­*‹Nq?Þª*!sŠÆ:TU_u±T+øX¡ ®¹¡,ÄâÃBTsÜ$Ø›4m椴zÜK]’’›Pƒ @€#â˜`é¹=I‡fiV•Ôî“nRm+µFPOhÍ0B£ €+¬5c v•:P'ÒyÎ ‰V~‚Ó†ÖuókDoh$å\*ö%Ю=£«…aȼ½÷Û.-½VŒŠ¼'lyî±1¬3ó#ÞE¿ÔS¤gV£m›=§\û"—WU¤ÚǼÿ ÂnÁGŒÃ ‚õN D³õNÚíŒÕ;HôyÄÈ©P¹Ä{:?R‘Ô¨âF÷ø£bÅó® JS|‚R÷ivýáâ€Æé¡è³´IئÑT!§˜•ت‚¬â@q€wnïCWÄ@JU€ê¯m6]Ï:£âx'+ÒðXvÓ¦Úm=–´7œ $ì“B£~p%ÕŸUþ« N@¼üï~w˜ñø5®—'Ôe»¤5ã//€ž~‰Tþ›Å7•#¤× Íö pÄ$ùeåì*«ÓŠEØWEÈsßg ¦ûvžSsLpºÊW–âµEWöˬH; ™!CYõZ ÃÄf æ#1W. \uWâ\,\Çf j’<qTbên›Î[vxx£ë 'ö¨1›˜ÀM¼Pÿ H)ƒêêŒA7s,|F“ 꺸k³9Ìö*ç®;Ö!Ö$Eiž•¹ÒÚ†ýóéÝû¾ÕS®ó$’NÝäŸz¤5r¦ãÄÃD÷Üø!°ø‡Ô&@m™Ì^Ãä­d q5Lnÿ N;.6½·N|#ä"1Nƒx“ã<3('&ñßt  ~ªu”1Tb㫨9ê–›–bìd$ߣ=#ÕãÒmU¯eí$EFù5ýYô櫨æì™Ç—±ssM]·á¿0ÕåJRÓªîiƒ+O58ÖñªŠÒx" \µâá¨i’¤i —Ö ” M+M¤ë9‚‰A¦°Qõ¾ßøK~¼Ã‘g…Ö´~÷Ï[3GUœÒ½#…kàÔ®Ò”‰³·dWV‰IP‰Ú8u¹”E ÖqLj¾êÕCBš{A^Âß;–¨`¯¬ìö ˼ ×tìø.tƐm*n¨y4o&Àx¥n¦×î‡aupáÛj8¿m›è¶ã!o½;ß0y^ý×^EÑ¿ÒjzŒ­)vÚÑnÄL …^ªô× ‡—‚3k Îý­hï]içå–îÏ*÷ñþ»Ô CÒjøjÍznˆ´ ¹#b'Fô‹ ‰v¥'’à'T´ƒHýÍ%M‰ ƒ&ÆÇŒï1 ‘ –Þ ‰i¬s žR-Ÿ kЬá¬7:þ 0ŒÅÒÕ/aÙ¬ÃÝ#Úøœ ©aiVc‰. ¹¦ãµ” ›Yg¦›ÆÎýº°f³7ƒhá·¸­}&D9¡ÂsÉÙÞèŠõØàC™¨ñbFC|´Ü(ŸƒÚÒ-%»'a Ì¿)ËÇn¿úÿ ÞŽX…4ÊÅH^ôΑí@ù¹Eh¶“L8Çjù ¼ÎåVªóR©Ï5uà V4lZß®=€xÖŸ–ÑÈ ÷”¨°¾__yM1tÉ?uÆþIkÄgæ@þ[¢†°XÃJ£j·:nkÅ¢u ‘}âGzö­/IµèЬ¼48q¦F°ŽR¼=ûì{´¯RýicS ÕÛ íNtÍÙï£,w4rêì®»~x(©Uñ§#Ñ&œÕ¤>ÎåÍÓ9’Ö{9eV­[Öjâ²ãu]˜å2›qÑšÕJç0€sÄ|Êëè0튔bÁ>“{×_F`Ø©ºê:µä,v¤ðfc1±"«ÔÍän1#=· Âøv~H½ÐßA¾¿Ü€Óš]Õ; I¾÷ç‚Qi†î¹9ywÔKG˜áñ zQY—§ÃÕZ07§X‚ Áh;ÁM)iÌCH-¯T‘ë|A0{Ò½LÚ–TâÖkÜ’dÀ“rmm»”جPF³ÖcbE§T€ÒxKºû’Ó®7±²(\4ŽÃ¸Uu@j™yĵ;³µ!Á¢b.W¤=mõ´êµK k ¸K^ÜÛ#p*Ü14qkZç5ïë †°5Ï%ÍÛ<Õ¤×Ô¥ê†C Õ´¼ú$ƒÖ“”]Ù¬qÞÚ[4©ý!ûÏ—Áb쳐XµA¬â~`›Çr¸8ìùÝ䫦<>ä÷«?xs´ÇÑ /á;¹øüÊÈÙà{"@Žïzâ¬[âß‚ U_<ÇŸ½4èN˜ú61®qŠu ¦þF£»äJ_ˆÙÎ~ ÞAã–݄ϗrŠD;xTž‘ô`É«…suãO`?³à™ô Lý#Íc5öoæØ‚y´´÷«ZR§<&JÇ+éâô´€i!Àˆ0æAoàðLèÖ-2ŸõW.’t^–(KÁmHµV@xÜÇy®Ñø­â^:Ú3w· 7½¹°ñ¸â¹®:',«Mœ—n­Á+Ãbš LÈ‘ÄnRÓÅœ%¦²‰¨ùQ:¤f‚ "PÕtô¸…cæl…&˜Ú˜Ôkv‹ž+vŠ,=¢v­6—Xy*¥t£«<™:“aîϲ=¦6rO]XI¿Œ÷¤zÚ­›¶ 6÷”w\d ü~v®ˆÌk«^m<ÿ ¢‰Õ\)ùºŽ;… lîÙÅEŠ®cѾ@vnMÏ,¼“ñ•ŽBxðÃzãÇç%3ˆ"}Ù•Åî> BÉú;Ò]V+P˜F_´ßé> Øše|ï‡ÄOmFæÇ ãqÞ$/xÐx­z`ï9"œÜij‚!7.\Td…9M‡•iŽ‹¾‘50ÞŽn¥ß4ÉôO ¹*í^QêËÜÇÌ8=ާs‰'ÂëÙ«á%Pú[O †ÅP¯Vsް.‰,kc¶ ¬A9n˜XÎ-ÞšN["¹QÕ‰ƒMýÁߺXJæÍaLj¾×Ãmã¾ãÚ uñÒþåQô¦¥ /ÄUx:‚ÍÜ’ Đ©ØÝ3V¨‰ÕnÐ6ó*óúK­«…c ¯U òhsý­jóÔj#,ímŒRµ«lbïUTŒÑ8†Ä0œÏr`ð¡¬É Ї ë"À² ™ 6¥ f¶ ¢ÚoܱԷ-<Àî)†a¶ž'Ú»¨TXqØæ¶÷YÄHy˜9ÈIW­YÀuMFë ºÏ’AqÌ4·/Ú †ô'i$øä­=Ä Ý|öK×40è|È6p‘0§)o¥ctî§H+CA-“ xØ|ÐXАç l8íºð3Ø:³¤¬KX¯UÿÙ # DistUpgradeView.py # # Copyright (c) 2004,2005 Canonical # # Author: Michael Vogt # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA from .DistUpgradeGettext import gettext as _ from .DistUpgradeGettext import ngettext from .telemetry import get as get_telemetry import apt from enum import Enum import errno import os import apt_pkg import locale import logging import signal import select from .DistUpgradeApport import apport_pkgfailure try: locale.setlocale(locale.LC_ALL, "") (code, ENCODING) = locale.getdefaultlocale() except: logging.exception("getting the encoding failed") ENCODING = "utf-8" #pyflakes # if there is no encoding, setup UTF-8 if not ENCODING: ENCODING = "utf-8" os.putenv("LC_CTYPE", "C.UTF-8") try: locale.setlocale(locale.LC_CTYPE, "C.UTF-8") except locale.error: pass # log locale information logging.info("locale: '%s' '%s'" % locale.getlocale()) def FuzzyTimeToStr(sec): " return the time a bit fuzzy (no seconds if time > 60 secs " #print("FuzzyTimeToStr: ", sec) sec = int(sec) days = sec//(60*60*24) hours = sec//(60*60) % 24 minutes = (sec//60) % 60 seconds = sec % 60 # 0 seonds remaining looks wrong and its "fuzzy" anyway if seconds == 0: seconds = 1 # string map to make the re-ordering possible map = { "str_days" : "", "str_hours" : "", "str_minutes" : "", "str_seconds" : "" } # get the fragments, this is not ideal i18n wise, but its # difficult to do it differently if days > 0: map["str_days"] = ngettext("%li day","%li days", days) % days if hours > 0: map["str_hours"] = ngettext("%li hour","%li hours", hours) % hours if minutes > 0: map["str_minutes"] = ngettext("%li minute","%li minutes", minutes) % minutes map["str_seconds"] = ngettext("%li second","%li seconds", seconds) % seconds # now assemble the string if days > 0: # Don't print str_hours if it's an empty string, see LP: #288912 if map["str_hours"] == '': return map["str_days"] # TRANSLATORS: you can alter the ordering of the remaining time # information here if you shuffle %(str_days)s %(str_hours)s %(str_minutes)s # around. Make sure to keep all '$(str_*)s' in the translated string # and do NOT change anything appart from the ordering. # # %(str_hours)s will be either "1 hour" or "2 hours" depending on the # plural form # # Note: most western languages will not need to change this return _("%(str_days)s %(str_hours)s") % map # display no minutes for time > 3h, see LP: #144455 elif hours > 3: return map["str_hours"] # when we are near the end, become more precise again elif hours > 0: # Don't print str_minutes if it's an empty string, see LP: #288912 if map["str_minutes"] == '': return map["str_hours"] # TRANSLATORS: you can alter the ordering of the remaining time # information here if you shuffle %(str_hours)s %(str_minutes)s # around. Make sure to keep all '$(str_*)s' in the translated string # and do NOT change anything appart from the ordering. # # %(str_hours)s will be either "1 hour" or "2 hours" depending on the # plural form # # Note: most western languages will not need to change this return _("%(str_hours)s %(str_minutes)s") % map elif minutes > 0: return map["str_minutes"] return map["str_seconds"] class AcquireProgress(apt.progress.base.AcquireProgress): def __init__(self): super(AcquireProgress, self).__init__() self.est_speed = 0.0 def start(self): super(AcquireProgress, self).start() self.est_speed = 0.0 self.eta = 0.0 self.percent = 0.0 self.release_file_download_error = False def update_status(self, uri, descr, shortDescr, status): super(AcquireProgress, self).update_status(uri, descr, shortDescr, status) # FIXME: workaround issue in libapt/python-apt that does not # raise a exception if *all* files fails to download if status == apt_pkg.STAT_FAILED: logging.warning("update_status: dlFailed on '%s' " % uri) if uri.endswith("Release.gpg") or uri.endswith("Release"): # only care about failures from network, not gpg, bzip, those # are different issues for net in ["http","ftp","mirror"]: if uri.startswith(net): self.release_file_download_error = True break # required, otherwise the lucid version of python-apt gets really # unhappy, its expecting this function for apt.progress.base.AcquireProgress def pulse_items(self, arg): return True def pulse(self, owner=None): super(AcquireProgress, self).pulse(owner) self.percent = (((self.current_bytes + self.current_items) * 100.0) / float(self.total_bytes + self.total_items)) if self.current_cps > self.est_speed: self.est_speed = (self.est_speed+self.current_cps)/2.0 if self.current_cps > 0: self.eta = ((self.total_bytes - self.current_bytes) / float(self.current_cps)) return True def isDownloadSpeedEstimated(self): return (self.est_speed != 0) def estimatedDownloadTime(self, required_download): """ get the estimated download time """ if self.est_speed == 0: timeModem = required_download/(56*1024/8) # 56 kbit timeDSL = required_download/(1024*1024/8) # 1Mbit = 1024 kbit s= _("This download will take about %s with a 1Mbit DSL connection " "and about %s with a 56k modem.") % (FuzzyTimeToStr(timeDSL), FuzzyTimeToStr(timeModem)) return s # if we have a estimated speed, use it s = _("This download will take about %s with your connection. ") % FuzzyTimeToStr(required_download/self.est_speed) return s class InstallProgress(apt.progress.base.InstallProgress): """ Base class for InstallProgress that supports some fancy stuff like apport integration """ def __init__(self): apt.progress.base.InstallProgress.__init__(self) self.master_fd = None def wait_child(self): """Wait for child progress to exit. The return values is the full status returned from os.waitpid() (not only the return code). """ while True: try: select.select([self.statusfd], [], [], self.select_timeout) except select.error as e: if e.args[0] != errno.EINTR: raise self.update_interface() try: (pid, res) = os.waitpid(self.child_pid, os.WNOHANG) if pid == self.child_pid: break except OSError as e: if e.errno != errno.EINTR: raise if e.errno == errno.ECHILD: break return res def run(self, pm): pid = self.fork() if pid == 0: # child, ignore sigpipe, there are broken scripts out there # like etckeeper (LP: #283642) signal.signal(signal.SIGPIPE,signal.SIG_IGN) try: res = pm.do_install(self.writefd) except Exception as e: print("Exception during pm.DoInstall(): ", e) logging.exception("Exception during pm.DoInstall()") with open("/var/run/ubuntu-release-upgrader-apt-exception","w") as f: f.write(str(e)) os._exit(pm.RESULT_FAILED) os._exit(res) self.child_pid = pid res = os.WEXITSTATUS(self.wait_child()) return res def error(self, pkg, errormsg): " install error from a package " apt.progress.base.InstallProgress.error(self, pkg, errormsg) logging.error("got an error from dpkg for pkg: '%s': '%s'" % (pkg, errormsg)) if "/" in pkg: pkg = os.path.basename(pkg) if "_" in pkg: pkg = pkg.split("_")[0] # now run apport apport_pkgfailure(pkg, errormsg) class DumbTerminal(object): def call(self, cmd, hidden=False): " expects a command in the subprocess style (as a list) " import subprocess subprocess.call(cmd) class DummyHtmlView(object): def open(self, url): pass def show(self): pass def hide(self): pass class Step(Enum): PREPARE = 1 MODIFY_SOURCES = 2 FETCH = 3 INSTALL = 4 CLEANUP = 5 REBOOT = 6 N = 7 # Declare these translatable strings from the .ui files here so that # xgettext picks them up. ( _("Preparing to upgrade"), _("Getting new software channels"), _("Getting new packages"), _("Installing the upgrades"), _("Cleaning up"), ) class DistUpgradeView(object): " abstraction for the upgrade view " def __init__(self): self.needs_screen = False pass def getOpCacheProgress(self): " return a OpProgress() subclass for the given graphic" return apt.progress.base.OpProgress() def getAcquireProgress(self): " return an acquire progress object " return AcquireProgress() def getInstallProgress(self, cache=None): " return a install progress object " return InstallProgress() def getTerminal(self): return DumbTerminal() def getHtmlView(self): return DummyHtmlView() def updateStatus(self, msg): """ update the current status of the distUpgrade based on the current view """ pass def abort(self): """ provide a visual feedback that the upgrade was aborted """ pass def setStep(self, step): """ we have 6 steps current for a upgrade: 1. Analyzing the system 2. Updating repository information 3. fetch packages 3. Performing the upgrade 4. Post upgrade stuff 5. Complete """ get_telemetry().add_stage(step.name) pass def hideStep(self, step): " hide a certain step from the GUI " pass def showStep(self, step): " show a certain step from the GUI " pass def confirmChanges(self, summary, changes, demotions, downloadSize, actions=None, removal_bold=True): """ display the list of changed packages (apt.Package) and return if the user confirms them """ self.confirmChangesMessage = "" self.demotions = demotions self.toInstall = [] self.toReinstall = [] self.toUpgrade = [] self.toRemove = [] self.toRemoveAuto = [] self.toDowngrade = [] for pkg in changes: if pkg.marked_install: self.toInstall.append(pkg) elif pkg.marked_upgrade: self.toUpgrade.append(pkg) elif pkg.marked_reinstall: self.toReinstall.append(pkg) elif pkg.marked_delete: if pkg._pcache._depcache.is_auto_installed(pkg._pkg): self.toRemoveAuto.append(pkg) else: self.toRemove.append(pkg) elif pkg.marked_downgrade: self.toDowngrade.append(pkg) # do not bother the user with a different treeview self.toInstall = self.toInstall + self.toReinstall # sort it self.toInstall.sort() self.toUpgrade.sort() self.toRemove.sort() self.toRemoveAuto.sort() self.toDowngrade.sort() # now build the message (the same for all frontends) msg = "\n" pkgs_remove = len(self.toRemove) + len(self.toRemoveAuto) pkgs_inst = len(self.toInstall) + len(self.toReinstall) pkgs_upgrade = len(self.toUpgrade) # FIXME: show detailed packages if len(self.demotions) > 0: msg += ngettext( "%(amount)d installed package is no longer supported by Canonical. " "You can still get support from the community.", "%(amount)d installed packages are no longer supported by " "Canonical. You can still get support from the community.", len(self.demotions)) % { 'amount' : len(self.demotions) } msg += "\n\n" if pkgs_remove > 0: # FIXME: make those two separate lines to make it clear # that the "%" applies to the result of ngettext msg += ngettext("%d package is going to be removed.", "%d packages are going to be removed.", pkgs_remove) % pkgs_remove msg += " " if pkgs_inst > 0: msg += ngettext("%d new package is going to be " "installed.", "%d new packages are going to be " "installed.",pkgs_inst) % pkgs_inst msg += " " if pkgs_upgrade > 0: msg += ngettext("%d package is going to be upgraded.", "%d packages are going to be upgraded.", pkgs_upgrade) % pkgs_upgrade msg +=" " if downloadSize > 0: downloadSizeStr = apt_pkg.size_to_str(downloadSize) if isinstance(downloadSizeStr, bytes): downloadSizeStr = downloadSizeStr.decode(ENCODING) msg += _("\n\nYou have to download a total of %s. ") % ( downloadSizeStr) msg += self.getAcquireProgress().estimatedDownloadTime(downloadSize) if ((pkgs_upgrade + pkgs_inst) > 0) and ((pkgs_upgrade + pkgs_inst + pkgs_remove) > 100): if self.getAcquireProgress().isDownloadSpeedEstimated(): msg += "\n\n%s" % _( "Installing the upgrade " "can take several hours. Once the download " "has finished, the process cannot be canceled.") else: msg += "\n\n%s" % _( "Fetching and installing the upgrade " "can take several hours. Once the download " "has finished, the process cannot be canceled.") else: if pkgs_remove > 100: msg += "\n\n%s" % _( "Removing the packages " "can take several hours. ") # Show an error if no actions are planned if (pkgs_upgrade + pkgs_inst + pkgs_remove) < 1: # FIXME: this should go into DistUpgradeController summary = _("The software on this computer is up to date.") msg = _("There are no upgrades available for your system. " "The upgrade will now be canceled.") self.error(summary, msg) return False # set the message self.confirmChangesMessage = msg return True def askYesNoQuestion(self, summary, msg, default='No'): " ask a Yes/No question and return True on 'Yes' " pass def askCancelContinueQuestion(self, summary, msg, default='Cancel'): " ask a Cancel/Continue question and return True on 'Continue'" pass def confirmRestart(self): " generic ask about the restart, can be overridden " summary = _("Reboot required") msg = _("The upgrade is finished and " "a reboot is required. " "Do you want to do this " "now?") return self.askYesNoQuestion(summary, msg) def error(self, summary, msg, extended_msg=None): " display a error " pass def information(self, summary, msg, extended_msg=None): " display a information msg" pass def processEvents(self): """ process gui events (to keep the gui alive during a long computation """ pass def pulseProgress(self, finished=False): """ do a progress pulse (e.g. bounce a bar back and forth, show a spinner) """ pass def showDemotions(self, summary, msg, demotions): """ show demoted packages to the user, default implementation is to just show a information dialog """ self.information(summary, msg, "\n".join(demotions)) if __name__ == "__main__": fp = AcquireProgress() fp.pulse()