diff --git a/.circleci/config.yml b/.circleci/config.yml index 7be07ecc9..8990586c3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,7 +38,7 @@ jobs: command: | sudo apt update -qq sudo apt install -y snapd - sudo snap install --beta review-tools + sudo snap install review-tools sudo /snap/bin/review-tools.snap-review *.snap - run: diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 383fd0aad..b5ca4586c 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -325,18 +325,10 @@ parts: # The collabora appimage requires this - libfontconfig1 - # Download the boost headers for MySQL. Note that the version used may need to - # be updated if the version of MySQL changes. boost: plugin: dump - source: https://github.com/kyrofa/boost_tarball/raw/master/boost_1_59_0.tar.gz - source-checksum: sha1/5123209db194d66d69a9cfa5af8ff473d5941d97 - # When building MySQL, the headers in the source directory 'boost/' are - # required. Previously, using the 'copy' plugin, the whole archive was put - # under 'boost/', making the headers reside in 'boost/boost/'. Due to a bug, - # we now only stage the 'boost/' directory without moving it. - # - # Bug: https://bugs.launchpad.net/snapcraft/+bug/1757093 + source: https://sourceforge.net/projects/boost/files/boost/1.73.0/boost_1_73_0.tar.bz2 + source-checksum: sha1/6d6ed02b29c860fd21b274fc4e1f820855e765e9 stage: - boost/ prime: @@ -344,65 +336,66 @@ parts: mysql: plugin: cmake - source: https://github.com/mysql/mysql-server.git - source-tag: mysql-5.7.34 - source-depth: 1 - override-pull: | - snapcraftctl pull - git apply $SNAPCRAFT_STAGE/mysql-support-compile-time-disabling-of-setpriority.patch - after: [boost, patches] + after: [boost] + + # Get from https://dev.mysql.com/downloads/mysql/ + source: https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.24.tar.gz + source-checksum: md5/e8cb8eafe07e22d5da123ffc5ca79e56 configflags: - - -DWITH_BOOST=$SNAPCRAFT_STAGE - - -DWITH_INNODB_PAGE_CLEANER_PRIORITY=OFF - -DCMAKE_INSTALL_PREFIX=/ - -DBUILD_CONFIG=mysql_release + - -DCMAKE_BUILD_TYPE=Release - -DWITH_UNIT_TESTS=OFF - -DWITH_EMBEDDED_SERVER=OFF - -DWITH_ARCHIVE_STORAGE_ENGINE=OFF + - -DWITH_EXAMPLE_STORAGE_ENGINE=OFF - -DWITH_BLACKHOLE_STORAGE_ENGINE=OFF - -DWITH_FEDERATED_STORAGE_ENGINE=OFF - -DWITH_PARTITION_STORAGE_ENGINE=OFF + - -DWITH_PERFSCHEMA_STORAGE_ENGINE=OFF + - -DWITH_DEBUG=OFF + - -DWITH_INNODB_EXTRA_DEBUG=OFF - -DINSTALL_MYSQLTESTDIR= + - -DDOWNLOAD_BOOST=OFF + - -DWITH_BOOST=$SNAPCRAFT_STAGE + + override-build: | + snapcraftctl build + # MySQL v8 is massive. Strip it. + find "$SNAPCRAFT_PART_INSTALL/bin" -type f -exec sh -c 'grep -IL . "$1" || strip --strip-all "$1"' sh "{}" \; + build-packages: - - wget - - g++ - - cmake - - bison - libncurses5-dev - - libaio-dev - stage-packages: - - libaio1 + - binutils stage: # Remove scripts that we'll be replacing with our own - -support-files/mysql.server - -COPYING - prime: - # Remove scripts that we'll be replacing with our own - - -support-files/mysql.server # Remove unused binaries that waste space + - -bin/comp_err + - -bin/ibd2sdi - -bin/innochecksum - -bin/lz4_decompress + - -bin/myisam_ftdump - -bin/myisam* - - -bin/mysqladmin - - -bin/mysqlbinlog - -bin/mysql_client_test - -bin/mysql_config* + - -bin/mysql_secure_installation + - -bin/mysql_ssl_rsa_setup + - -bin/mysql_tzinfo_to_sql + - -bin/mysql_upgrade + - -bin/mysqladmin + - -bin/mysqlbinlog + - -bin/mysqlcheck - -bin/mysqld_multi - -bin/mysqlimport - - -bin/mysql_install_db - - -bin/mysql_plugin - -bin/mysqlpump - - -bin/mysql_secure_installation + - -bin/mysqlrouter* - -bin/mysqlshow - -bin/mysqlslap - - -bin/mysql_ssl_rsa_setup - - -bin/mysqltest - - -bin/mysql_tzinfo_to_sql + - -bin/mysqltest* - -bin/perror - - -bin/replace - - -bin/resolveip - - -bin/resolve_stack_dump - -bin/zlib_decompress # Copy over our MySQL scripts diff --git a/src/mysql/bin/start_mysql b/src/mysql/bin/start_mysql index 9d887e915..86e0287c5 100755 --- a/src/mysql/bin/start_mysql +++ b/src/mysql/bin/start_mysql @@ -56,7 +56,7 @@ if [ $new_install = true ]; then ALTER USER 'root'@'localhost' IDENTIFIED BY '$root_password'; CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY '$nextcloud_password'; CREATE DATABASE nextcloud; - GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY '$nextcloud_password'; + GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost'; SQL then # Now the root mysql user has a password. Save that as well. @@ -75,20 +75,10 @@ else sed -ri "s|(socket\s*=\s*)/var/snap/.*mysql.sock|\1$MYSQL_SOCKET|" "$MYSQL_ROOT_OPTION_FILE" fi -# Wait here until mysql is running +# Wait here until mysql is running. MySQL 8 runs the upgrade automatically, +# so no need to do that, anymore. wait_for_mysql -f -# Check and upgrade mysql tables if necessary. This will return 0 if the upgrade -# succeeded, in which case we need to restart mysql. -echo "Checking/upgrading mysql tables if necessary..." -if mysql_upgrade --defaults-file="$MYSQL_ROOT_OPTION_FILE"; then - echo "Restarting mysql server after upgrade..." - "$SNAP/support-files/mysql.server" restart - - # Wait for server to come back after upgrade - wait_for_mysql -f -fi - # If this was a new installation, wait until the server is all up and running # before saving off the nextcloud user's password. This way the presence of the # file can be used as a signal that mysql is ready to be used. diff --git a/src/mysql/support-files/mysql.server b/src/mysql/support-files/mysql.server index 8dfea09d6..10f60e972 100755 --- a/src/mysql/support-files/mysql.server +++ b/src/mysql/support-files/mysql.server @@ -115,7 +115,7 @@ other_args="$*" # uncommon, but needed when called from an RPM upgrade action # Upstream mysql stuff, no need to fix this # shellcheck disable=SC2116,SC2039 case "$(echo "testing\c")","$(echo -n testing)" in - *c*,-n*) echo_n="" echo_c="" ;; + *c*,-n*) echo_n="" echo_c="" ;; *c*,*) echo_n=-n echo_c="" ;; *) echo_n="" echo_c='\c' ;; esac @@ -202,7 +202,7 @@ case "$mode" in then # Give extra arguments to mysqld with the my.cnf file. This script # may be overwritten at next upgrade. - "$bindir/mysqld_safe" --defaults-file="$SNAP/my.cnf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" --lc-messages-dir="$SNAP/share" --socket="$MYSQL_SOCKET" "$other_args" >/dev/null 2>&1 & + "$bindir/mysqld_safe" --defaults-file="$SNAP/my.cnf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" --lc-messages-dir="$SNAP/share" --socket="$MYSQL_SOCKET" "$other_args" >/dev/null & wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$? # Make lock for RedHat / SuSE @@ -253,7 +253,7 @@ case "$mode" in 'restart') # Stop the service and regardless of whether it was # running or not, start it again. - if $0 stop "$other_args"; then + if $0 stop "$other_args"; then $0 start "$other_args" else log_failure_msg "Failed to stop running server, so refusing to try to start."