src/util/distro-import/importer.py
changeset 1471 7526bfca96f9
parent 1464 6d5abe98a5b7
child 1516 8c950a3b4171
equal deleted inserted replaced
1470:0775809e07bd 1471:7526bfca96f9
    55 # pkg & path
    55 # pkg & path
    56 
    56 
    57 
    57 
    58 basename_dict = {}   # basenames to action lists
    58 basename_dict = {}   # basenames to action lists
    59 branch_dict = {}     # 
    59 branch_dict = {}     # 
       
    60 cons_dict = {}       # consolidation incorporation dictionaries
    60 create_repo = False  #
    61 create_repo = False  #
    61 curpkg = None        # which IPS package we're currently importing
    62 curpkg = None        # which IPS package we're currently importing
    62 def_branch = ""      # default branch
    63 def_branch = ""      # default branch
    63 def_repo = "http://localhost:10000"
    64 def_repo = "http://localhost:10000"
    64 def_vers = "0.5.11"  # default package version
    65 def_vers = "0.5.11"  # default package version
    96                 self.srcpkgs = []
    97                 self.srcpkgs = []
    97                 self.classification = []
    98                 self.classification = []
    98                 self.desc = ""
    99                 self.desc = ""
    99                 self.summary = ""
   100                 self.summary = ""
   100                 self.version = ""
   101                 self.version = ""
       
   102                 self.consolidation = ""
   101                 self.imppkg = None
   103                 self.imppkg = None
   102                 self.actions = []
   104                 self.actions = []
   103 
   105 
   104                 pkgdict[name] = self
   106                 pkgdict[name] = self
   105 
   107 
  1113                         curpkg.classification.append(
  1115                         curpkg.classification.append(
  1114                             "org.opensolaris.category.2008:%s" % cat_subcat)
  1116                             "org.opensolaris.category.2008:%s" % cat_subcat)
  1115 
  1117 
  1116                 elif token == "description":
  1118                 elif token == "description":
  1117                         curpkg.desc = lexer.get_token()
  1119                         curpkg.desc = lexer.get_token()
       
  1120 
       
  1121                 elif token == "consolidation":
       
  1122 			# Add to consolidation incorporation and
       
  1123 			# include the org.opensolaris.consolidation
       
  1124 			# package property.
       
  1125                         curpkg.consolidation = lexer.get_token()
       
  1126                         if not curpkg.consolidation in cons_dict:
       
  1127                                 cons_dict[curpkg.consolidation] = []
       
  1128                         cons_dict[curpkg.consolidation].append(curpkg.name)
       
  1129 
       
  1130                         action = actions.fromstr("set " \
       
  1131                             "name=org.opensolaris.consolidation value=%s" %
       
  1132                             curpkg.consolidation)
       
  1133                         action.attrs["importer.source"] = token
       
  1134                         curpkg.actions.append(action)
  1118 
  1135 
  1119                 elif token == "summary":
  1136                 elif token == "summary":
  1120                         curpkg.summary = lexer.get_token()
  1137                         curpkg.summary = lexer.get_token()
  1121 
  1138 
  1122                 elif token == "depend":
  1139                 elif token == "depend":
  1330                         sys.exit(1)
  1347                         sys.exit(1)
  1331                 print "external packages checked for conflicts"
  1348                 print "external packages checked for conflicts"
  1332 
  1349 
  1333         print "Third pass: dependency id, resolution and publication", datetime.now()
  1350         print "Third pass: dependency id, resolution and publication", datetime.now()
  1334 
  1351 
       
  1352         # Generate consolidation incorporations
       
  1353         for cons in cons_dict.keys():
       
  1354                 curpkg = start_package("consolidation/%s/%s-incorporation" %
       
  1355                         (cons, cons))
       
  1356                 curpkg.summary = "%s consolidation incorporation" % cons
       
  1357                 curpkg.desc = "This incorporation constrains packages " \
       
  1358                         "from the %s consolidation." % cons
       
  1359 
       
  1360                 for depend in cons_dict[cons]:
       
  1361                         action = actions.fromstr(
       
  1362                             "depend fmri=%s type=incorporate" % depend)
       
  1363                         action.attrs["importer.source"] = "depend"
       
  1364                         curpkg.actions.append(action)
       
  1365                 action = actions.fromstr("set " \
       
  1366                     "name=org.opensolaris.consolidation value=%s" % cons)
       
  1367                 action.attrs["importer.source"] = "add"
       
  1368                 curpkg.actions.append(action)
       
  1369                 end_package(curpkg)
       
  1370                 curpkg = None
       
  1371 
  1335         if just_these_pkgs:
  1372         if just_these_pkgs:
  1336                 newpkgs = set(pkgdict[name]
  1373                 newpkgs = set(pkgdict[name]
  1337                               for name in pkgdict.keys()
  1374                               for name in pkgdict.keys()
  1338                               if name in just_these_pkgs
  1375                               if name in just_these_pkgs
  1339                               )
  1376                               )