<s> from debile . slave . wrappers . piuparts import parse_piuparts <EOL> from schroot . chroot import SchrootCommandError <EOL> from schroot import schroot <EOL> try : <EOL> import configparser <EOL> except ImportError : <EOL> import ConfigParser as configparser <EOL> import os <EOL> import re <EOL> LINE_INFO = re . compile ( <EOL> r"<STR_LIT>" ) <EOL> def piuparts ( chroot , target , analysis ) : <EOL> cfg = configparser . ConfigParser ( ) <EOL> if cfg . read ( "<STR_LIT>" % ( chroot ) ) == [ ] : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> block = cfg [ chroot ] <EOL> if "<STR_LIT:file>" not in block : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> location = block [ '<STR_LIT:file>' ] <EOL> copy_location = os . path . join ( "<STR_LIT>" , os . path . basename ( location ) ) <EOL> with schroot ( chroot ) as chroot : <EOL> chroot . copy ( location , copy_location ) <EOL> chroot . copy ( target , "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> chroot . run ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , user = '<STR_LIT:root>' ) <EOL> print ( "<STR_LIT>" ) <EOL> failed = False <EOL> try : <EOL> print ( "<STR_LIT>" ) <EOL> out , err , _ = chroot . run ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , copy_location , <EOL> '<STR_LIT>' % target , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , user = '<STR_LIT:root>' ) <EOL> except SchrootCommandError as e : <EOL> out , err = e . out , e . err <EOL> failed = True <EOL> for x in parse_piuparts ( out . splitlines ( ) , target ) : <EOL> analysis . results . append ( x ) <EOL> return ( analysis , out + err , failed , None , None ) <EOL> def version ( ) : <EOL> return ( '<STR_LIT>' , '<STR_LIT>' ) </s>
