xref: /aosp_15_r20/external/spdx-tools/builder/builder2v3/build_relationship.go (revision ba677afa8f67bb56cbc794f4d0e378e0da058e16)
1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2
3package builder2v3
4
5import (
6	"fmt"
7
8	"github.com/spdx/tools-golang/spdx/common"
9	"github.com/spdx/tools-golang/spdx/v2_3"
10)
11
12// BuildRelationshipSection2_3 creates an SPDX Relationship (version 2.3)
13// solely for the document "DESCRIBES" package relationship, returning that
14// relationship or error if any is encountered. Arguments:
15//   - packageName: name of package / directory
16func BuildRelationshipSection2_3(packageName string) (*v2_3.Relationship, error) {
17	rln := &v2_3.Relationship{
18		RefA:         common.MakeDocElementID("", "DOCUMENT"),
19		RefB:         common.MakeDocElementID("", fmt.Sprintf("Package-%s", packageName)),
20		Relationship: "DESCRIBES",
21	}
22
23	return rln, nil
24}
25