Skip to content

Commit

Permalink
Merge pull request #891 from matty0ung/usability
Browse files Browse the repository at this point in the history
Tidy up code that loads translations
  • Loading branch information
matty0ung authored Nov 23, 2024
2 parents 20622a2 + 9a8b190 commit 5f508c4
Show file tree
Hide file tree
Showing 9 changed files with 394 additions and 167 deletions.
4 changes: 3 additions & 1 deletion CHANGES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ Bug fixes and minor enhancements.
* Drop down menu for Style and Equipment are so narrow, cannot see contents [879](https://github.com/Brewtarget/brewtarget/issues/879)
* OG doesn't immediately change when adding malt to a recipe [880](https://github.com/Brewtarget/brewtarget/issues/880)
* IBU doesn't update when adding hops [881](https://github.com/Brewtarget/brewtarget/issues/881)
* Errors when loading translations [889](https://github.com/Brewtarget/brewtarget/pull/889)
* Debian package depencies [890](https://github.com/Brewtarget/brewtarget/issues/890)

### Release Timestamp
Tue, 19 Nov 2024 04:00:11 +0100
Fri, 22 Nov 2024 04:00:11 +0100

## v4.0.10
Bug fixes and minor enhancements.
Expand Down
40 changes: 23 additions & 17 deletions packaging/linux/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,31 @@ Architecture: amd64
#
# Note that some libraries have a "t64" version which is used instead of the "base" one (eg libqt6network6t64 instead
# of libqt6network6). This is to do with upgrades to 64-bit time (to fix the "year 2038 problem") -- per
# https://wiki.debian.org/ReleaseGoals/64bit-time.
# https://wiki.debian.org/ReleaseGoals/64bit-time. For the moment, we specify both the "t64" and "non-t64" versions
# to allow things to work on Ubuntu (mostly already migrated to t64) and Debian Stable (mostly not yet migrated to
# t64).
#
# Note too that qt6-translations-l10n is not required in terms of providing any functions that we call, but it does
# ensure the Qt framework's own translation files are installed.
#
Depends: \
libc6 (>= 2.35 ), \
libc6-dev (>= 2.35 ), \
libc6-i386 (>= 2.35 ), \
lib32gcc-s1 (>= 12.3.0), \
lib32stdc++6 (>= 12.3.0), \
libgcc-s1 (>= 12.3.0), \
libstdc++6 (>= 12.3.0), \
libqt6core6t64 (>= 6.2.4 ), \
libqt6gui6t64 (>= 6.2.4 ), \
libqt6multimedia6 (>= 6.2.4 ), \
libqt6network6t64 (>= 6.2.4 ), \
libqt6printsupport6t64 (>= 6.2.4 ), \
libqt6sql6t64 (>= 6.2.4 ), \
libqt6widgets6t64 (>= 6.2.4 ), \
libxalan-c112t64 (>= 1.12 ), \
libxerces-c3.2t64 (>= 3.2.3 )
libc6 (>= 2.35 ), \
libc6-dev (>= 2.35 ), \
libc6-i386 (>= 2.35 ), \
lib32gcc-s1 (>= 12.3.0), \
lib32stdc++6 (>= 12.3.0), \
libgcc-s1 (>= 12.3.0), \
libstdc++6 (>= 12.3.0), \
libqt6core6 | libqt6core6t64 (>= 6.2.4 ), \
libqt6gui6 | libqt6gui6t64 (>= 6.2.4 ), \
libqt6multimedia6 (>= 6.2.4 ), \
libqt6network6 | libqt6network6t64 (>= 6.2.4 ), \
libqt6printsupport6 | libqt6printsupport6t64 (>= 6.2.4 ), \
libqt6sql6 | libqt6sql6t64 (>= 6.2.4 ), \
libqt6widgets6 | libqt6widgets6t64 (>= 6.2.4 ), \
libxalan-c112 | libxalan-c112t64 (>= 1.12 ), \
libxerces-c3.2 | libxerces-c3.2t64 (>= 3.2.3 ), \
qt6-translations-l10n (>= 6.2.4 )
#
# Installed-Size (Optional) : an estimate of the total amount of disk space required to install the named package
# The disk space is given as the integer value of the estimated installed size in bytes, divided by 1024 and rounded
Expand Down
31 changes: 16 additions & 15 deletions packaging/linux/rpm.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,22 @@ BuildArch : x86_64
# continuations are OK here!
#
Requires : \
glibc >= 2.35 , \
glibc-32bit >= 2.35 , \
libgcc_s1-32bit >= 12.3.0, \
libstdc++6-32bit >= 12.3.0, \
libgcc_s1 >= 12.3.0, \
libstdc++6 >= 12.3.0, \
libQt6Core6 >= 6.2.4 , \
libQt6Gui6 >= 6.2.4 , \
libQt6Multimedia6 >= 6.2.4 , \
libQt6Network6 >= 6.2.4 , \
libQt6PrintSupport6 >= 6.2.4 , \
libQt6Sql6 >= 6.2.4 , \
libQt6Widgets6 >= 6.2.4 , \
libxalan-c112 >= 1.12 , \
libxerces-c-3_2 >= 3.2.3
glibc >= 2.35 , \
glibc-32bit >= 2.35 , \
libgcc_s1-32bit >= 12.3.0, \
libstdc++6-32bit >= 12.3.0, \
libgcc_s1 >= 12.3.0, \
libstdc++6 >= 12.3.0, \
libQt6Core6 >= 6.2.4 , \
libQt6Gui6 >= 6.2.4 , \
libQt6Multimedia6 >= 6.2.4 , \
libQt6Network6 >= 6.2.4 , \
libQt6PrintSupport6 >= 6.2.4 , \
libQt6Sql6 >= 6.2.4 , \
libQt6Widgets6 >= 6.2.4 , \
libxalan-c112 >= 1.12 , \
libxerces-c-3_2 >= 3.2.3 , \
qt6-translations-l10n >= 6.2.4

# Description is done in a different way, perhaps because it's a multi-line field
%description
Expand Down
115 changes: 69 additions & 46 deletions scripts/buildTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ def installDependencies():
# NOTE: For the moment at least, we are assuming you are on Ubuntu or another Debian-based Linux. For other
# flavours of the OS you need to install libraries and frameworks manually.
#
distroName = str(
btUtils.abortOnRunFail(subprocess.run(['lsb_release', '-is'], encoding = "utf-8", capture_output = True)).stdout
).rstrip()
distroRelease = str(
btUtils.abortOnRunFail(subprocess.run(['lsb_release', '-rs'], encoding = "utf-8", capture_output = True)).stdout
).rstrip()
log.debug('Linux distro: ' + distroName + ', release: ' + distroRelease)

#
# For almost everything apart form Boost (see below) we can rely on the distro packages. A few notes:
Expand All @@ -439,42 +446,66 @@ def installDependencies():
# - We need python-dev to build parts of Boost -- though it may be we could do without this as we only use a
# few parts of Boost and most Boost libraries are header-only, so do not require compilation.
# - To keep us on our toes, some of the package name formats change between Qt5 and Qt6. Eg qtmultimedia5-dev
# becomes qt6-multimedia-dev. Also libqt5multimedia5-plugins has no direct successor in Qt6.
# becomes qt6-multimedia-dev, qtbase5-dev becomes qt6-base-dev. Also libqt5multimedia5-plugins has no
# direct successor in Qt6.
# - The package called 'libqt6svg6-dev' in Ubuntu 22.04, is renamed to 'qt6-svg-dev' from Ubuntu 24.04.
#
# I have struggled to find how to install a Qt6 version of lupdate. Compilation on Ubuntu 24.04 seems to work
# fine with the 5.15.13 version of lupdate, so we'll make sure that's installed. Various other comments below
# about lupdate are (so far unsuccessful) attempts to get a Qt6 version of lupdate installed.
#
log.info('Ensuring libraries and frameworks are installed')
btUtils.abortOnRunFail(subprocess.run(['sudo', 'apt-get', 'update']))

qt6svgDevPackage = 'qt6-svg-dev'
if ('Ubuntu' == distroName and Decimal(distroRelease) < Decimal('24.04')):
qt6svgDevPackage = 'libqt6svg6-dev'

btUtils.abortOnRunFail(
subprocess.run(
['sudo', 'apt', 'install', '-y', 'build-essential',
'cmake',
'coreutils',
'debhelper',
'git',
'libqt6sql6-psql',
'libqt6sql6-sqlite',
'libqt6svg6-dev',
'libssl-dev', # For OpenSSL headers
'libxalan-c-dev',
'libxerces-c-dev',
'lintian',
'meson',
'ninja-build',
'pandoc',
'python3',
'python3-dev',
'qmake6', # Possibly needed for Qt6 lupdate
'qtbase5-dev',
'qt6-l10n-tools', # Needed for Qt6 lupdate?
'qt6-multimedia-dev',
'qt6-tools-dev',
'qttools5-dev-tools', # For Qt5 version of lupdate, per comment above
'qt6-tools-dev-tools',
'rpm',
'rpmlint']
['sudo', 'apt', 'install', '-y',

'build-essential',
'cmake',
'coreutils',
'debhelper',
'git',
#
# On Ubuntu 22.04, installing the packages for the Qt GUI module, does not automatically install all its
# dependencies. At compile-time we get an error "Qt6Gui could not be found because dependency
# WrapOpenGL could not be found". Various different posts suggest what packages are needed to satisfy
# this dependency. With a bit of trial-and-error, we have the following.
#
'libgl1',
'libglx-dev',
'libgl1-mesa-dev',
#
'libqt6gui6', # Qt GUI module -- needed for QColor (per https://doc.qt.io/qt-6.2/qtgui-module.html)
'libqt6sql6-psql',
'libqt6sql6-sqlite',
'libqt6svg6',
'libqt6svgwidgets6',
'libssl-dev', # For OpenSSL headers
'libxalan-c-dev',
'libxerces-c-dev',
'lintian',
'meson',
'ninja-build',
'pandoc',
'python3',
'python3-dev',
'qmake6', # Possibly needed for Qt6 lupdate
'qt6-base-dev',
'qt6-l10n-tools', # Needed for Qt6 lupdate?
'qt6-multimedia-dev',
'qt6-tools-dev',
'qt6-translations-l10n', # Puts all the *.qm files in /usr/share/qt6/translations
qt6svgDevPackage,
'qttools5-dev-tools', # For Qt5 version of lupdate, per comment above
'qt6-tools-dev-tools',
'rpm',
'rpmlint'
]
)
)

Expand Down Expand Up @@ -715,24 +746,15 @@ def installDependencies():
# to run `sudo qtchooser -install qt6 $(which qmake6)`, so that's what we do here after sorting out the Meson
# install.
#
distroName = str(
btUtils.abortOnRunFail(subprocess.run(['lsb_release', '-is'], encoding = "utf-8", capture_output = True)).stdout
).rstrip()
log.debug('Linux distro: ' + distroName)
if ('Ubuntu' == distroName):
ubuntuRelease = str(
btUtils.abortOnRunFail(subprocess.run(['lsb_release', '-rs'], encoding = "utf-8", capture_output = True)).stdout
).rstrip()
log.debug('Ubuntu release: ' + ubuntuRelease)
if (Decimal(ubuntuRelease) < Decimal('24.04')):
log.info('Installing newer version of Meson the hard way')
btUtils.abortOnRunFail(subprocess.run(['sudo', 'apt', 'remove', '-y', 'meson']))
btUtils.abortOnRunFail(subprocess.run(['sudo', 'pip3', 'install', 'meson']))
#
# Now fix lupdate
#
fullPath_qmake6 = shutil.which('qmake6')
btUtils.abortOnRunFail(subprocess.run(['sudo', 'qtchooser', '-install', 'qt6', fullPath_qmake6]))
if ('Ubuntu' == distroName and Decimal(distroRelease) < Decimal('24.04')):
log.info('Installing newer version of Meson the hard way')
btUtils.abortOnRunFail(subprocess.run(['sudo', 'apt', 'remove', '-y', 'meson']))
btUtils.abortOnRunFail(subprocess.run(['sudo', 'pip3', 'install', 'meson']))
#
# Now fix lupdate
#
fullPath_qmake6 = shutil.which('qmake6')
btUtils.abortOnRunFail(subprocess.run(['sudo', 'qtchooser', '-install', 'qt6', fullPath_qmake6]))

#-----------------------------------------------------------------------------------------------------------------
#--------------------------------------------- Windows Dependencies ----------------------------------------------
Expand Down Expand Up @@ -1149,7 +1171,8 @@ def installDependencies():
'pandoc',
# 'xercesc3',
# 'xalanc',
'qt6'
'qt6',
'qt6-qttranslations'
]
for packageToInstall in installListPort:
log.debug('Installing ' + packageToInstall + ' via MacPorts')
Expand Down
Loading

0 comments on commit 5f508c4

Please sign in to comment.