<s> """<STR_LIT>""" <EOL> import tarfile <EOL> from Bcfg2 . Server . Plugins . Packages . Collection import Collection <EOL> from Bcfg2 . Server . Plugins . Packages . Source import Source <EOL> class PacCollection ( Collection ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , metadata , sources , cachepath , basepath , debug = False ) : <EOL> Collection . __init__ ( self , metadata , sources , cachepath , basepath , <EOL> debug = debug ) <EOL> __init__ . __doc__ = Collection . __init__ . __doc__ . split ( "<STR_LIT>" ) [ <NUM_LIT:0> ] <EOL> class PacSource ( Source ) : <EOL> """<STR_LIT>""" <EOL> ptype = '<STR_LIT>' <EOL> @ property <EOL> def urls ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . rawurl : <EOL> rv = [ ] <EOL> for part in self . components : <EOL> for arch in self . arches : <EOL> rv . append ( "<STR_LIT>" % <EOL> ( self . url , part , arch , part ) ) <EOL> return rv <EOL> else : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> def read_files ( self ) : <EOL> bdeps = dict ( ) <EOL> bprov = dict ( ) <EOL> depfnames = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> if self . recommended : <EOL> depfnames . append ( '<STR_LIT>' ) <EOL> for fname in self . files : <EOL> if not self . rawurl : <EOL> barch = [ x for x in fname . split ( '<STR_LIT:@>' ) if x in self . arches ] [ <NUM_LIT:0> ] <EOL> else : <EOL> barch = self . arches [ <NUM_LIT:0> ] <EOL> if barch not in bdeps : <EOL> bdeps [ barch ] = dict ( ) <EOL> bprov [ barch ] = dict ( ) <EOL> try : <EOL> self . debug_log ( "<STR_LIT>" % fname ) <EOL> tar = tarfile . open ( fname , "<STR_LIT:r>" ) <EOL> except ( IOError , tarfile . TarError ) : <EOL> self . logger . error ( "<STR_LIT>" % fname ) <EOL> raise <EOL> for tarinfo in tar : <EOL> if tarinfo . isdir ( ) : <EOL> self . pkgnames . add ( tarinfo . name . rsplit ( "<STR_LIT:->" , <NUM_LIT:2> ) [ <NUM_LIT:0> ] ) <EOL> self . debug_log ( "<STR_LIT>" % <EOL> tarinfo . name . rsplit ( "<STR_LIT:->" , <NUM_LIT:2> ) [ <NUM_LIT:0> ] ) <EOL> tar . close ( ) <EOL> self . process_files ( bdeps , bprov ) <EOL> read_files . __doc__ = Source . read_files . __doc__ </s>
