Skip to content

Commit

Permalink
Merge pull request #724 from jmrenouard/master
Browse files Browse the repository at this point in the history
Last updates
  • Loading branch information
jmrenouard authored Sep 9, 2023
2 parents b44447e + d0ec7ea commit 5f3775a
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ test_db/**
result*
result_*
sql/*.sql
sql/*.csv
sql/*.csv
cve.csv
11 changes: 0 additions & 11 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ Features list for option: --feature (dev only)
---


* calculations
* compare_tuner_version
* cpu_cores
* cve_recommendations
* grep_file_contents
* log_file_recommendations
* make_recommendations
* mariadb_aria
Expand All @@ -17,7 +13,6 @@ Features list for option: --feature (dev only)
* mariadb_threadpool
* mariadb_tokudb
* mariadb_xtradb
* merge_hash
* mysql_databases
* mysql_indexes
* mysql_innodb
Expand All @@ -29,14 +24,8 @@ Features list for option: --feature (dev only)
* mysql_table_structures
* mysql_tables
* mysql_triggers
* mysql_version_eq
* mysql_version_ge
* mysql_version_le
* mysql_views
* os_setup
* pretty_uptime
* security_recommendations
* system_recommendations
* update_tuner_version
* validate_mysql_version
* validate_tuner_version
66 changes: 66 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
VERSION=$(shell grep '\- Version ' mysqltuner.pl | awk '{ print $$NF}')
UPDATE_SUB_VERSION=$(shell echo $(VERSION) | awk -F. '{ print $$1"."$$2"."$$3+1 }')
UPDATE_MINOR_VERSION=$(shell echo $(VERSION) | awk -F. '{ print $$1"."$$2+1".0" }')
UPDATE_MAJOR_VERSION=$(shell echo $(VERSION) | awk -F. '{ print $$1+1".0.0" }')

all: generate_cve generate_features generate_usage tidy increment_sub_version

help:
@echo "Usage: make <target>"
@echo " help: Show this help"
@echo " generate_usage: Generate USAGE.md"
@echo " generate_cve: Generate vulnerabilities.csv"
@echo " generate_features: Generate FEATURES.md"
@echo " tidy: Tidy mysqltuner.pl"
@echo " installdep_debian: Install dependencies on Debian"
@echo " increment_sub_version: Increment sub version"
@echo " increment_minor_version: Increment minor version"
@echo " increment_major_version: Increment major version"
@echo " push: Push to GitHub"


installdep_debian:
apt install -y cpanminus libpod-markdown-perl libwww-mechanize-gzip-perl perltidy dos2unix
cpanm File::Util

tidy:
dos2unix ./mysqltuner.pl
perltidy -b ./mysqltuner.pl
git add ./mysqltuner.pl
git commit -m "Indenting mysqltuner at $(shell date --iso=seconds)"

generate_usage:
pod2markdown mysqltuner.pl >USAGE.md
git add ./USAGE.md
git commit -m "Generate USAGE.md at $(shell date --iso=seconds)"

generate_cve:
perl ./build/updateCVElist.pl
git add ./vulnerabilities.csv
git commit -m "Generate CVE list at $(shell date --iso=seconds)"

generate_features:
perl ./build/genFeatures.sh
git add ./FEATURES.md
git commit -m "Generate FEATURES.md at $(shell date --iso=seconds)"

increment_sub_version:
@echo "Incrementing sub version from $(VERSION) to $(UPDATE_SUB_VERSION)"
sed -i "s/$(VERSION)/$(UPDATE_SUB_VERSION)/" mysqltuner.pl *.md
git add ./*.md ./mysqltuner.pl
git commit -m "Generate $(UPDATE_SUB_VERSION) sub version at $(shell date --iso=seconds)"

increment_minor_version:
@echo "Incrementing minor version from $(VERSION) to $(UPDATE_MINOR_VERSION)"
sed -i "s/$(VERSION)/$(UPDATE_MINOR_VERSION)/" mysqltuner.pl *.md
git add ./*.md ./mysqltuner.pl
git commit -m "Generate $(UPDATE_SUB_VERSION) minor version at $(shell date --iso=seconds)"

increment_major_version:
@echo "Incrementing major version from $(VERSION) to $(UPDATE_MAJOR_VERSION)"
sed -i "s/$(VERSION)/$(UPDATE_MAJOR_VERSION)/" mysqltuner.pl *.md
git add ./*.md ./mysqltuner.pl
git commit -m "Generate $(UPDATE_SUB_VERSION) major version at $(shell date --iso=seconds)"

push:
git push
2 changes: 1 addition & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NAME

MySQLTuner 2.2.7 - MySQL High Performance Tuning Script
MySQLTuner 2.2.9 - MySQL High Performance Tuning Script

# IMPORTANT USAGE GUIDELINES

Expand Down
8 changes: 4 additions & 4 deletions build/genFeatures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
(
export LANG=C
echo -e "Features list for option: --feature (dev only)\n---\n\n"
grep -E '^sub ' ../mysqltuner.pl | \
grep -E '^sub ' ./mysqltuner.pl | \
perl -pe 's/sub //;s/\s*\{//g' | \
sort -n | \
perl -pe 's/^/* /g' | \
grep -vE '(get_|close_|check_|memerror|human_size|string2file|file2|arr2|dump|which|percentage|trim|is_|hr_|info|print|select|wrap|remove_)'
) > ../FEATURES.md
cat ../FEATURES.md
grep -vE '(get_|close_|check_|memerror|cpu_cores|compare_tuner_version|grep_file_contents|update_tuner_version|mysql_version_|calculations|merge_hash|os_setup|pretty_uptime|update_tuner_version|human_size|string2file|file2|arr2|dump|which|percentage|trim|is_|hr_|info|print|select|wrap|remove_)'
) > ./FEATURES.md
cat ./FEATURES.md
4 changes: 2 additions & 2 deletions build/updateCVElist.pl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sub AUTOLOAD {

my @versions;
my $temp;
unlink '../vulnerabilities.csv' if -f '../vulnerabilities.csv';
unlink './vulnerabilities.csv' if -f './vulnerabilities.csv';
open(CVE, 'cve.csv') or die("Could not open file.");
foreach my $line (<CVE>) {
if ($line =~ /(mysql|mariadb|percona)/i
Expand All @@ -69,7 +69,7 @@ sub AUTOLOAD {
#print $vers."\n".Dumper @nb;
#print "$line";
#exit 0 if ($line =~/before/i) ;
$f->write_file('file' => '../vulnerabilities.csv', 'content' => "$nb[0].$nb[1].$nb[2];$nb[0];$nb[1];$nb[2];$line", 'mode' => 'append');
$f->write_file('file' => './vulnerabilities.csv', 'content' => "$nb[0].$nb[1].$nb[2];$nb[0];$nb[1];$nb[2];$line", 'mode' => 'append');
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions mysqltuner.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
# mysqltuner.pl - Version 2.2.8
# mysqltuner.pl - Version 2.2.9
# High Performance MySQL Tuning Script
# Copyright (C) 2015-2023 Jean-Marie Renouard - [email protected]
# Copyright (C) 2006-2023 Major Hayden - [email protected]
Expand Down Expand Up @@ -57,7 +57,7 @@ package main;
#use Env;

# Set up a few variables for use in the script
my $tunerversion = "2.2.8";
my $tunerversion = "2.2.9";
my ( @adjvars, @generalrec );

# Set defaults
Expand Down Expand Up @@ -7357,7 +7357,7 @@ sub which {
=head1 NAME
MySQLTuner 2.2.8 - MySQL High Performance Tuning Script
MySQLTuner 2.2.9 - MySQL High Performance Tuning Script
=head1 IMPORTANT USAGE GUIDELINES
Expand Down
Loading

0 comments on commit 5f3775a

Please sign in to comment.