Skip to content

Commit 1cfd3e9

Browse files
authored
Implement Author field and Supplier field (#102)
* Implement Author field and Supplier field Signed-off-by: Robert Smigielski <[email protected]> * fixup! Implement Author field and Supplier field Github actions show macos-13 is no longer supported Signed-off-by: Robert Smigielski <[email protected]> * fixup! Implement Author field and Supplier field Github actions deal with gettext on macOS and Poetry support for code coverage Signed-off-by: Robert Smigielski <[email protected]> * fixup! Implement Author field and Supplier field Github actions deal with gettext on macOS and Poetry support for code coverage Signed-off-by: Robert Smigielski <[email protected]> * fixup! Implement Author field and Supplier field Github actions deal with gettext on macOS and Poetry support for code coverage Signed-off-by: Robert Smigielski <[email protected]> --------- Signed-off-by: Robert Smigielski <[email protected]>
1 parent 92ce020 commit 1cfd3e9

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

.github/workflows/python.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
- name: Checkout
5050
# see https://github.com/actions/checkout
5151
uses: actions/checkout@v6
52+
- name: Install gettext (macOS)
53+
if: runner.os == 'macOS'
54+
run: brew install gettext
5255
- name: Setup Python Environment
5356
# see https://github.com/actions/setup-python
5457
uses: actions/setup-python@v6
@@ -108,12 +111,21 @@ jobs:
108111
- name: Checkout
109112
# see https://github.com/actions/checkout
110113
uses: actions/checkout@v6
114+
- name: Install gettext (macOS)
115+
if: runner.os == 'macOS'
116+
run: brew install gettext
111117
- name: Setup Python Environment
112118
# see https://github.com/actions/setup-python
113119
uses: actions/setup-python@v6
114120
with:
115121
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
116122
architecture: 'x64'
123+
- name: Upgrade pip
124+
run: pip install --upgrade pip
125+
- name: Install Poetry
126+
run: curl -sSL https://install.python-poetry.org | python3 -
127+
- name: Add Poetry to PATH
128+
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
117129
- name: Install self
118130
run: pip install .
119131
- name: run command
@@ -128,7 +140,7 @@ jobs:
128140
matrix:
129141
os:
130142
- ubuntu-latest
131-
- macos-13 # macos-latest might be incompatible to py38 - see https://github.com/CycloneDX/cyclonedx-python-lib/pull/599#issuecomment-2077462142
143+
- macos-15
132144
- windows-latest
133145
python-version:
134146
- "3.13" # highest supported
@@ -143,6 +155,13 @@ jobs:
143155
uses: actions/checkout@v6
144156
- name: Create reports directory
145157
run: mkdir ${{ env.REPORTS_DIR }}
158+
- name: Setup Homebrew
159+
run: |
160+
brew update
161+
brew install gettext
162+
- name: Install Python Dependencies
163+
run: |
164+
pip install poetry==2.1.1
146165
- name: Setup Python Environment
147166
# see https://github.com/actions/setup-python
148167
uses: actions/setup-python@v6
@@ -182,6 +201,10 @@ jobs:
182201
runs-on: ubuntu-latest
183202
timeout-minutes: 5
184203
steps:
204+
- name: Install Poetry
205+
run: curl -sSL https://install.python-poetry.org | python3 -
206+
- name: Add Poetry to PATH
207+
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
185208
- name: fetch test artifacts
186209
# see https://github.com/actions/download-artifact
187210
uses: actions/download-artifact@v6

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ options:
6767
-n PRODUCT_NAME name of the product
6868
-v PRODUCT_VERSION product version string
6969
-m MANUFACTURER_NAME name of product manufacturer
70+
-s SUPPLIER_NAME name of SBOM Supplier
71+
-a AUTHOR_NAME name of SBOM Author
7072
-c CPE_INPUT_FILE cpe file from make show-info
7173
```
7274

cyclonedx_buildroot/_internal/cli.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from cyclonedx.exception.factory import InvalidLicenseExpressionException
3030
from cyclonedx.schema import SchemaVersion, OutputFormat
3131
from cyclonedx.output import make_outputter
32-
from cyclonedx.model.contact import OrganizationalEntity
32+
from cyclonedx.model.contact import OrganizationalEntity, OrganizationalContact
3333

3434

3535
if TYPE_CHECKING:
@@ -160,6 +160,12 @@ def run(*, argv: Optional[Sequence[str]] = None, **kwargs: Any) -> Union[int, No
160160
parser.add_argument('-c', action='store', dest='cpe_input_file', default='unknown',
161161
help='cpe file from make show-info')
162162

163+
parser.add_argument('-s', action='store', dest='supplier_name', default='unknown',
164+
help='name of SBOM supplier')
165+
166+
parser.add_argument('-a', action='store', dest='author_name', default='unknown',
167+
help='name of SBOM author')
168+
163169
args = parser.parse_args(argv)
164170

165171
print('Buildroot manifest input file: ' + args.input_file)
@@ -168,11 +174,16 @@ def run(*, argv: Optional[Sequence[str]] = None, **kwargs: Any) -> Union[int, No
168174
print('SBOM Product Version: ' + args.product_version)
169175
print('SBOM Product Manufacturer: ' + args.manufacturer_name)
170176
print('Buildroot cpe input file: ' + args.cpe_input_file)
177+
print('SBOM author: ' + args.author_name)
178+
print('SBOM supplier: ' + args.supplier_name)
179+
171180

172181
br_bom = Bom()
173182
br_bom.metadata = BomMetaData(
174183
manufacturer=OrganizationalEntity(name=args.manufacturer_name),
175-
component=Component(name=args.product_name, version=args.product_version)
184+
component=Component(name=args.product_name, version=args.product_version),
185+
supplier=OrganizationalEntity(name=args.supplier_name),
186+
authors=[OrganizationalContact(name=args.author_name)]
176187
)
177188

178189
br_bom = create_buildroot_sbom(str(args.input_file).strip(" "), str(args.cpe_input_file).strip(" "), br_bom)

0 commit comments

Comments
 (0)