434
435 pkgpaths = {}
436
437 def pkg_path(pkgname):
438 name = os.path.basename(pkgname)
439 if pkgname in pkgpaths:
440 return pkgpaths[name]
441 if "/" in pkgname:
442 pkgpaths[name] = os.path.realpath(pkgname)
443 return pkgname
444 else:
445 for each_path in wos_path:
446 if os.path.exists(each_path + "/" + pkgname):
447 pkgpaths[name] = each_path + "/" + pkgname
448 return pkgpaths[name]
449
450 raise RuntimeError("package %s not found" % pkgname)
451
452
453 def start_package(pkgname):
454 return package(pkgname)
455
456 def end_package(pkg):
457 pkg_branch = get_branch(pkg.name)
458 if not pkg.version:
459 pkg.version = "%s-%s" % (def_vers, pkg_branch)
460 elif "-" not in pkg.version:
461 pkg.version += "-%s" % pkg_branch
462
463 print "Package '%s'" % pkg.name
464 print " Version:", pkg.version
465 print " Description:", pkg.desc
466 print " Summary:", pkg.summary
467 print " Classification: ", ",".join(pkg.classification)
468
469 def publish_pkg(pkg):
470
471 new_pkg_name = "%s@%s" % (pkg.name, pkg.version)
472 t = trans.Transaction(def_repo, create_repo=create_repo,
473 pkg_name=new_pkg_name, noexecute=nopublish)
474
475 print " open %s" % new_pkg_name
476 transaction_id = t.open()
477
478 # Publish non-file objects first: they're easy.
479 for f in pkg.files:
480 if f.type in "dx":
481 action = actions.directory.DirectoryAction(
482 None, mode = f.mode, owner = f.owner,
993 # note that we ignore these if specifically included.
994 #
995 elided_files = {}
996 #
997 # if user uses -j, just_these_pkgs becomes list of pkgs to process
998 # allowing other arguments to be read in as files...
999 #
1000 just_these_pkgs = []
1001 #
1002 # strings to rip out of summaries (case insensitve)
1003 #
1004 summary_detritus = [", (usr)", ", (root)", " (usr)", " (root)",
1005 " (/usr)", " - / filesystem", ",root(/)"]
1006 #
1007 # list of global includes to add to every package
1008 #
1009 global_includes = []
1010 # list of macro substitutions
1011 macro_definitions = {}
1012
1013 try:
1014 _opts, _args = getopt.getopt(sys.argv[1:], "B:D:I:G:NT:b:dj:m:ns:v:w:p:")
1015 except getopt.GetoptError, _e:
1016 print "unknown option", _e.opt
1017 sys.exit(1)
1018
1019 g_proto_area = os.environ.get("ROOT", "")
1020
1021 for opt, arg in _opts:
1022 if opt == "-b":
1023 def_branch = arg.rstrip("abcdefghijklmnopqrstuvwxyz")
1024 elif opt == "-d":
1025 show_debug = True
1026 elif opt == "-j": # means we're using the new argument form...
1027 just_these_pkgs.append(arg)
1028 elif opt == "-m":
1029 _a = arg.split("=", 1)
1030 macro_definitions.update([("$(%s)" % _a[0], _a[1])])
1031 elif opt == "-n":
1032 nopublish = True
1033 elif opt == "-p":
1034 if not os.path.exists(arg):
1035 raise RuntimeError("Invalid prototype area specified.")
1036 # Clean up relative ../../, etc. out of path to proto
1037 g_proto_area = os.path.realpath(arg)
1038 elif opt == "-s":
1039 def_repo = arg
1040 if def_repo.startswith("file://"):
1041 # When publishing to file:// repositories, automatically
1042 # create the target repository if needed.
1043 create_repo = True
1044 elif opt == "-v":
1045 def_vers = arg
1046 elif opt == "-w":
1047 wos_path.append(arg)
1048 elif opt == "-D":
1049 elided_files[arg] = True
1050 elif opt == "-I":
|
434
435 pkgpaths = {}
436
437 def pkg_path(pkgname):
438 name = os.path.basename(pkgname)
439 if pkgname in pkgpaths:
440 return pkgpaths[name]
441 if "/" in pkgname:
442 pkgpaths[name] = os.path.realpath(pkgname)
443 return pkgname
444 else:
445 for each_path in wos_path:
446 if os.path.exists(each_path + "/" + pkgname):
447 pkgpaths[name] = each_path + "/" + pkgname
448 return pkgpaths[name]
449
450 raise RuntimeError("package %s not found" % pkgname)
451
452
453 def start_package(pkgname):
454 set_macro("PKGNAME", urllib.quote(pkgname, ""))
455 return package(pkgname)
456
457 def end_package(pkg):
458 pkg_branch = get_branch(pkg.name)
459 if not pkg.version:
460 pkg.version = "%s-%s" % (def_vers, pkg_branch)
461 elif "-" not in pkg.version:
462 pkg.version += "-%s" % pkg_branch
463
464 clear_macro("PKGNAME")
465 print "Package '%s'" % pkg.name
466 print " Version:", pkg.version
467 print " Description:", pkg.desc
468 print " Summary:", pkg.summary
469 print " Classification: ", ",".join(pkg.classification)
470
471 def publish_pkg(pkg):
472
473 new_pkg_name = "%s@%s" % (pkg.name, pkg.version)
474 t = trans.Transaction(def_repo, create_repo=create_repo,
475 pkg_name=new_pkg_name, noexecute=nopublish)
476
477 print " open %s" % new_pkg_name
478 transaction_id = t.open()
479
480 # Publish non-file objects first: they're easy.
481 for f in pkg.files:
482 if f.type in "dx":
483 action = actions.directory.DirectoryAction(
484 None, mode = f.mode, owner = f.owner,
995 # note that we ignore these if specifically included.
996 #
997 elided_files = {}
998 #
999 # if user uses -j, just_these_pkgs becomes list of pkgs to process
1000 # allowing other arguments to be read in as files...
1001 #
1002 just_these_pkgs = []
1003 #
1004 # strings to rip out of summaries (case insensitve)
1005 #
1006 summary_detritus = [", (usr)", ", (root)", " (usr)", " (root)",
1007 " (/usr)", " - / filesystem", ",root(/)"]
1008 #
1009 # list of global includes to add to every package
1010 #
1011 global_includes = []
1012 # list of macro substitutions
1013 macro_definitions = {}
1014
1015 def set_macro(key, value):
1016 macro_definitions.update([("$(%s)" % key, value)])
1017
1018 def clear_macro(key):
1019 del macro_definitions["$(%s)" % key]
1020
1021 try:
1022 _opts, _args = getopt.getopt(sys.argv[1:], "B:D:I:G:NT:b:dj:m:ns:v:w:p:")
1023 except getopt.GetoptError, _e:
1024 print "unknown option", _e.opt
1025 sys.exit(1)
1026
1027 g_proto_area = os.environ.get("ROOT", "")
1028
1029 for opt, arg in _opts:
1030 if opt == "-b":
1031 def_branch = arg.rstrip("abcdefghijklmnopqrstuvwxyz")
1032 elif opt == "-d":
1033 show_debug = True
1034 elif opt == "-j": # means we're using the new argument form...
1035 just_these_pkgs.append(arg)
1036 elif opt == "-m":
1037 _a = arg.split("=", 1)
1038 set_macro(_a[0], _a[1])
1039 elif opt == "-n":
1040 nopublish = True
1041 elif opt == "-p":
1042 if not os.path.exists(arg):
1043 raise RuntimeError("Invalid prototype area specified.")
1044 # Clean up relative ../../, etc. out of path to proto
1045 g_proto_area = os.path.realpath(arg)
1046 elif opt == "-s":
1047 def_repo = arg
1048 if def_repo.startswith("file://"):
1049 # When publishing to file:// repositories, automatically
1050 # create the target repository if needed.
1051 create_repo = True
1052 elif opt == "-v":
1053 def_vers = arg
1054 elif opt == "-w":
1055 wos_path.append(arg)
1056 elif opt == "-D":
1057 elided_files[arg] = True
1058 elif opt == "-I":
|