5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
22 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
25 # incorporator - an utility to incorporate packages in a repo
30 sub enumerate_packages
{
31 local ($repository, $publisher, @fmris) = @_;
34 #printf "/usr/bin/pkg list -ng $repository @fmris\n";
35 open($fp, "-|", "/usr/bin/pkgrepo", "list", "-H", "-s", $repository,
36 "-p", $publisher, @fmris) ||
40 # lines should be in the form:
41 # publisher package [r|o] version,branch:timestamp
42 if (/^(\S+)\s+(\S+)\s+\S?\s+([\d.]+),[\d.]+-([\d.]+):.+$/) {
45 $package->{publisher
} = $1;
46 $package->{name
} = $2;
47 $package->{version
} = $3;
48 $package->{branch
} = $4;
50 push(@packages, $package);
52 printf STDERR
"SKIP: %s", $_;
56 #printf "returning %s\n", $_->{name} for (@packages);
61 sub print_incorporate
{
62 local (%package) = @_;
63 my $facet = "facet.version-lock.$package->{name}";
65 printf "depend fmri=%s@%s-%s %s=true type=incorporate\n",
66 $package->{name
}, $package->{version
}, $package->{branch
},
70 my ($repository, $fmri, $summary, $description, $consolidation) = ();
72 $consolidation = 'userland';
74 GetOptions
("R|repository=s" => \
$repository, "v|version=s" => \
$version,
75 "s|summary=s" => \
$summary, "d|description=s" => \
$description,
76 "p|package=s" => \
$fmri, "f|fmri=s" => \
@fmris,
77 "c|consolidation=s" => \
$consolidation);
80 # print the incorporation
82 printf "set name=pkg.fmri value=%s\n", $fmri;
83 printf "set name=pkg.summary value='%s'\n", $summary;
84 printf "set name=pkg.description value='%s'\n", $description;
85 printf "set name=org.opensolaris.consolidation value=%s\n",
87 printf "set name=pkg.depend.install-hold value=core-os.%s\n",
89 printf "set name=info.classification value='org.opensolaris.category.2008:Meta Packages/Incorporations'\n";
91 @packages = enumerate_packages
($repository, $consolidation, @fmris);
93 printf "depend fmri=pkg:/%s@%s-%s %s=true type=incorporate\n",
94 %$_->{name
}, %$_->{version
}, %$_->{branch
},
95 "facet.version-lock.".%$_->{name
};