userland-incorporator revision 2213
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# CDDL HEADER START
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# The contents of this file are subject to the terms of the
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# Common Development and Distribution License (the "License").
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# You may not use this file except in compliance with the License.
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# See the License for the specific language governing permissions
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# and limitations under the License.
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# When distributing Covered Code, include this CDDL HEADER in each
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# If applicable, add the following below this CDDL HEADER, with the
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# fields enclosed by brackets "[]" replaced with your own identifying
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# information: Portions Copyright [yyyy] [name of copyright owner]
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# CDDL HEADER END
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# incorporator - an utility to incorporate packages in a repo
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass #printf "/usr/bin/pkg list -ng $repository @fmris\n";
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass open($fp, "-|", "/usr/bin/pkgrepo", "list", "-H", "-s", $repository,
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass # publisher package [r|o] version,5.12-branch:timestamp
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass # publisher package [r|o] version-branch:timestamp
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass if ((/^(\S+)\s+(\S+)\s+\S?\s+([\d.]+),[\d.]+-([\d.]+):.+$/) ||
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass (/^(\S+)\s+(\S+)\s+\S?\s+([\d.]+)-([\d.]+):.+$/)) {
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass #printf "returning %s\n", $_->{name} for (@packages);
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass my $facet = "facet.version-lock.$package->{name}";
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass printf "depend fmri=%s@%s-%s %s=true type=incorporate\n",
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass $package->{name}, $package->{version}, $package->{branch},
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glassmy ($repository, $fmri, $summary, $description, $consolidation) = ();
ffa35f3c26be15ca573281e930814a837f2ef719Dav GlassGetOptions("R|repository=s" => \$repository, "v|version=s" => \$version,
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass "s|summary=s" => \$summary, "d|description=s" => \$description,
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass# print the incorporation
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glassprintf "set name=pkg.summary value='%s'\n", $summary;
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glassprintf "set name=pkg.description value='%s'\n", $description;
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glassprintf "set name=org.opensolaris.consolidation value=%s\n",
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glassprintf "set name=pkg.depend.install-hold value=core-os.%s\n",
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glassprintf "set name=info.classification value='org.opensolaris.category.2008:Meta Packages/Incorporations'\n";
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass@packages = enumerate_packages($repository, $consolidation, @fmris);
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass printf "depend fmri=pkg:/%s@%s-%s %s=true type=incorporate\n",
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass $_->{name}, $_->{version}, $_->{branch},
ffa35f3c26be15ca573281e930814a837f2ef719Dav Glass $seen->{$_->{name}} = 1;