Skip to content

Commit

Permalink
Feature/v10 tweaks (#844)
Browse files Browse the repository at this point in the history
* Use package instead of name for portage

Signed-off-by: Prabhu Subramanian <[email protected]>

* Flatpak wip

Signed-off-by: Prabhu Subramanian <[email protected]>

---------

Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu authored Jan 28, 2024
1 parent 1023769 commit 2c508b7
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 2 deletions.
67 changes: 67 additions & 0 deletions contrib/flatpak/org.cyclonedx.cdxgen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
app-id: org.cyclonedx.cdxgen
branch: stable
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
# Add the Node 16 SDK extension.
sdk-extensions:
- org.freedesktop.Sdk.Extension.node18
command: bin/cdxgen.js
finish-args:
# Network access.
- --share=network
# If you need to access the filesystem, also add:
- --filesystem=home
modules:
# First step is to install Node to /app/node, that way it can be accessible outside of the sdk
# environment. install-sdk.sh is used because install.sh omits npm.
- name: node
buildsystem: simple
build-commands:
- /usr/lib/sdk/node18/install-sdk.sh

# Now is the quickstart module.
- name: cdxgen
buildsystem: simple
build-options:
# Add the node bin directory.
append-path: /usr/lib/sdk/node18/bin
env:
# Set the cache directory, used to find Electron and some other helper
# tools.
# (The directory format is: /run/build/MODULE_NAME/flatpak-node/cache)
XDG_CACHE_HOME: /run/build/cdxgen/flatpak-node/cache
# Set the npm cache directory, used by npm to find its package metadata.
npm_config_cache: /run/build/cdxgen/flatpak-node/npm-cache
# Sets the directory where Node is located so that npm won't download the headers.
npm_config_nodedir: /usr/lib/sdk/node18
build-commands:
# Install the packages from our offline cache.
# --prefix= is the path to our subdirectory (see the cdxgen source below).
# If you were using Yarn here, you'd use the yarn config and yarn --offline commands
# as shown in the webpack-quick-start demo. The need for --prefix= is dependent on how
# this project is run, not on the package manager.
- npm install --prefix=cdxgen --offline

# This quick start is designed for running directly from the source directory, so we
# copy it resulting directory to /app/cdxgen. (This isn't npm-specific.)
- cp -r cdxgen /app
# Install the wrapper script to start it.
- install -Dm 755 start-cdxgen.sh /app/bin/start-cdxgen

# To allow separate locales
- setup-separate-locales ${FLATPAK_DEST}/cdxgen
sources:
- type: git
url: https://github.com/CycloneDX/cdxgen
commit: 10237696b97f550acde30e8c565baf1112b5f700
branch: release/10.x
# Checkout into a subdirectory so we can copy the whole thing to /app.
dest: cdxgen
# Add the flatpak-node-generator generated sources.
- sources.json
# Our runner script.
- type: script
dest-filename: start-cdxgen.sh
commands:
- export PATH=$PATH:/app/node/bin
35 changes: 35 additions & 0 deletions contrib/flatpak/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"type": "script",
"commands": [],
"dest-filename": "patch.sh",
"dest": "flatpak-node"
},
{
"type": "script",
"commands": [
"$FLATPAK_BUILDER_BUILDDIR/flatpak-node/patch.sh"
],
"dest-filename": "patch-all.sh",
"dest": "flatpak-node"
},
{
"type": "script",
"commands": [
"version=$(node --version | sed \"s/^v//\")",
"nodedir=$(dirname \"$(dirname \"$(which node)\")\")",
"mkdir -p \"flatpak-node/cache/node-gyp/$version\"",
"ln -s \"$nodedir/include\" \"flatpak-node/cache/node-gyp/$version/include\"",
"echo 9 > \"flatpak-node/cache/node-gyp/$version/installVersion\""
],
"dest-filename": "setup_sdk_node_headers.sh",
"dest": "flatpak-node"
},
{
"type": "shell",
"commands": [
"FLATPAK_BUILDER_BUILDDIR=$PWD flatpak-node/patch-all.sh",
"bash flatpak-node/setup_sdk_node_headers.sh"
]
}
]
2 changes: 1 addition & 1 deletion data/cbomosdb-queries.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"componentType": "library"
},
"portage_packages": {
"query": "select * from portage_packages where name like '%ssl%' OR name like '%crypto%';",
"query": "select * from portage_packages where package like '%ssl%' OR package like '%crypto%';",
"description": "Retrieves all the installed packages on the target Linux system.",
"purlType": "ebuild",
"componentType": "library"
Expand Down
2 changes: 1 addition & 1 deletion data/cosdb-queries.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"purlType": "deb"
},
"portage_packages": {
"query": "select * from portage_packages where name like '%dev%' OR name like '%header%';",
"query": "select * from portage_packages where package like '%dev%' OR package like '%header%';",
"description": "Retrieves all the installed packages on the target Linux system.",
"purlType": "ebuild"
},
Expand Down

0 comments on commit 2c508b7

Please sign in to comment.