Skip to content

Commit

Permalink
#4050 merge fixes from master
Browse files Browse the repository at this point in the history
* match v5.x setup.py flags
* no manifests in this branch
* add numeric version no (easier than reverse computing it)
  • Loading branch information
totaam committed Nov 23, 2024
1 parent ef6e0f2 commit 5cb8451
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 19 deletions.
3 changes: 3 additions & 0 deletions fs/bin/set_source_version
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

NEWV=$1
AUTHOR=$2
NEWVINFO=`python3 -c "print(tuple(int(v) for v in \"$NEWV\".split('.')))"`

if [ -z "${NEWV}" ]; then
echo "usage: $0 NEW_VERSION"
exit 1
Expand All @@ -13,6 +15,7 @@ fi

for f in "fs/lib/cups/backend/xpraforwarder" "xpra/__init__.py"; do
sed -i'' "s/__version__ = .*/__version__ = \"$NEWV\"/" $f
sed -i'' "s/__version_info__ = .*/__version_info__ = $NEWVINFO/" $f
done

for k in "AppVersion" "VersionInfoVersion"; do
Expand Down
20 changes: 1 addition & 19 deletions packaging/MSWindows/BUILD.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,14 @@ def get_build_args(args) -> list[str]:
for option in (
"shadow", "server", "proxy", "rfb",
"dbus",
"encoders", "avif", "gstreamer_video",
"avif", "gstreamer_video",
"nvfbc", "cuda_kernels",
"csc_cython",
"webcam",
"win32_tools",
"docs",
"qt6_client",
"websockets_browser_cookie",
):
xpra_args.append(f"--without-{option}")
xpra_args.append("--with-Os")
else:
xpra_args.append("--with-qt6_client")
if not args.cuda:
xpra_args.append("--without-nvidia")
# we can't do 'docs' this way :(
Expand Down Expand Up @@ -770,18 +765,6 @@ def setup_share(light: bool) -> None:
rm_empty_dir(f"{DIST}/share/icons")


def add_manifests() -> None:
step("Adding EXE manifests")
EXES = [
"Bug_Report", "Xpra-Launcher", "Xpra", "Xpra_cmd",
# these are only included in full builds:
"GTK_info", "NativeGUI_info", "Screenshot", "Xpra-Shadow",
]
for exe in EXES:
if os.path.exists(f"{DIST}/{exe}.exe"):
copyfile("packaging/MSWindows/exe.manifest", f"{DIST}/{exe}.exe.manifest")


def gen_caches() -> None:
step("Generating gdk pixbuf loaders cache")
cmd = ["gdk-pixbuf-query-loaders.exe", "lib/gdk-pixbuf-2.0/2.10.0/loaders/*"]
Expand Down Expand Up @@ -1308,7 +1291,6 @@ def build(args) -> None:
add_numpy(args.numpy)

setup_share(args.light)
add_manifests()
gen_caches()

if args.docs:
Expand Down
124 changes: 124 additions & 0 deletions packaging/MSWindows/cyclonedx_sbom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of Xpra.
# Copyright (C) 2024 Antoine Martin <antoine@xpra.org>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import sys
from xpra.build_info import packages

from packageurl.contrib import url2purl

from cyclonedx.builder.this import this_component as cdx_lib_component
from cyclonedx.factory.license import LicenseFactory
from cyclonedx.model.bom import Bom
from cyclonedx.model.component import Component, ComponentType
from cyclonedx.output.json import JsonV1Dot5


lc_factory = LicenseFactory()

bom = Bom()
bom.metadata.tools.components.add(cdx_lib_component())
bom.metadata.tools.components.add(Component(
name='my-own-SBOM-generator',
type=ComponentType.APPLICATION,
))

bom.metadata.component = root_component = Component(
name='Xpra',
type=ComponentType.APPLICATION,
licenses=[lc_factory.make_from_string('GPL2+')],
bom_ref='Xpra',
)

# cache components so we can more easily add dependencies later:
components = {}
# resolve full mingw64 prefixed package names to short version:
names = {}
dependencies = {}
for package_name, info in packages.items():
license_names = []
licenses = [
lc_factory.make_from_string(license_name)
for license_name in [info.get("Licenses", "")]
]
component = Component(
type=ComponentType.LIBRARY,
name=package_name,
version=info.get("Version", ""),
licenses=licenses,
purl=url2purl.get_purl(info.get("URL", "")),
)
bom.components.add(component)
components[package_name] = component
names[info.get("Name", package_name)] = package_name
provides = info.get("Provides", ())
for provided in provides:
if provided not in names:
names[provided] = package_name
if not info.get("Required By"):
bom.register_dependency(root_component, [component])
deps = info.get("Depends On")
if deps:
dependencies[package_name] = deps


# now resolve the intra component dependencies:
for package_name, deps in dependencies.items():
component = components[package_name]
dep_components = []
for dep in deps:
dep_package_name = names.get(dep, dep)
dep_component = components.get(dep_package_name)
if dep_component:
dep_components.append(dep_component)
else:
if package_name.find("gst") >= 0:
continue
if any(dep.endswith(f"-{suffix}") for suffix in (
# only needed at build time:
"cc", "python-build", "python-installer", "python-packaging",
# gtk dependencies we don't need:
"gtk-update-icon-cache", "shared-mime-info", "json-glib",
"adwaita-icon-theme",
# python dependencies we don't want:
"tcl", "tk", "headers", "tzdata",
# python works fine without `mpdec` so perhaps the current builds of Python
# do not yet use the unbundled mpdec library and the MSYS2 package dependencies are therefore wrong?
# in any case, it will become a hard dependency in python 3.13: /mingw64/bin/libmpdec-4.dll
# at which point this workaround can be removed:
"mpdecimal",
# webp tools can use this, but we don't ship them:
"giflib",
# cairo, why?
"lzo2",
# could this be due to outdated dependencies?
# paramiko and pyu2f work just fine without it:
"python-six",
# libcurl may use them, instead we only rely on the OS:
"ca-certificates",
# we skip the gnome bits of glib-networking:
"gsettings-desktop-schemas",
# libproxy wants this package, but we don't:
"duktape",
# ncurses works just fine without it:
"libsystre",
# sqlite tools use this, but we don't ship them:
"readline",
)
):
continue
sys.stderr.write(f"Warning: {dep!r} not found, dependency of {package_name}\n")
if dep_components:
bom.register_dependency(component, dep_components)

json = JsonV1Dot5(bom).output_as_string(indent=2)

if len(sys.argv) > 1:
filename = sys.argv[1]
with open(filename, "w") as f:
f.write(json)
else:
print(json)
1 change: 1 addition & 0 deletions xpra/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
# later version. See the file COPYING for details.

__version__ = "5.0.11"
__version_info__ = (5, 0, 11)

0 comments on commit 5cb8451

Please sign in to comment.