Skip to content

Commit fb4ea3f

Browse files
committed
Reorder features based on Makefile
1 parent ee64f17 commit fb4ea3f

3 files changed

Lines changed: 66 additions & 6 deletions

File tree

Makefile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
VERSION=$(shell grep '\- Version ' mysqltuner.pl | awk '{ print $$NF}')
2+
UPDATE_SUB_VERSION=$(shell echo $(VERSION) | awk -F. '{ print $$1"."$$2"."$$3+1 }')
3+
UPDATE_MINOR_VERSION=$(shell echo $(VERSION) | awk -F. '{ print $$1"."$$2+1".0" }')
4+
UPDATE_MAJOR_VERSION=$(shell echo $(VERSION) | awk -F. '{ print $$1+1".0.0" }')
5+
6+
all: generate_cve generate_features generate_usage tidy increment_sub_version
7+
8+
help:
9+
@echo "Usage: make <target>"
10+
@echo " help: Show this help"
11+
@echo " generate_usage: Generate USAGE.md"
12+
@echo " generate_cve: Generate vulnerabilities.csv"
13+
@echo " generate_features: Generate FEATURES.md"
14+
@echo " tidy: Tidy mysqltuner.pl"
15+
@echo " installdep_debian: Install dependencies on Debian"
16+
@echo " increment_sub_version: Increment sub version"
17+
@echo " increment_minor_version: Increment minor version"
18+
@echo " increment_major_version: Increment major version"
19+
@echo " push: Push to GitHub"
20+
21+
22+
installdep_debian:
23+
apt install -y cpanminus libpod-markdown-perl libwww-mechanize-gzip-perl perltidy dos2unix
24+
cpanm File::Util
25+
26+
tidy:
27+
dos2unix ./mysqltuner.pl
28+
perltidy -b ./mysqltuner.pl
29+
# git add ./mysqltuner.pl
30+
# git commit -m "Indenting mysqltuner at $(shell date --iso=seconds)"
31+
32+
generate_usage:
33+
pod2markdown mysqltuner.pl >USAGE.md
34+
# git add ./USAGE.md
35+
# git commit -m "Generate USAGE.md at $(shell date --iso=seconds)"
36+
37+
generate_cve:
38+
perl ./build/updateCVElist.pl
39+
# git add ./vulnerabilities.csv
40+
# git commit -m "Generate CVE list at $(shell date --iso=seconds)"
41+
42+
generate_features:
43+
perl ./build/genFeatures.sh
44+
# git add ./FEATURES.md
45+
# git commit -m "Generate FEATURES.md at $(shell date --iso=seconds)"
46+
47+
increment_sub_version:
48+
@echo "Incrementing sub version from $(VERSION) to $(UPDATE_SUB_VERSION)"
49+
sed -i "s/$(VERSION)/$(UPDATE_SUB_VERSION)/" mysqltuner.pl *.md
50+
51+
increment_minor_version:
52+
@echo "Incrementing minor version from $(VERSION) to $(UPDATE_MINOR_VERSION)"
53+
sed -i "s/$(VERSION)/$(UPDATE_MINOR_VERSION)/" mysqltuner.pl *.md
54+
55+
increment_major_version:
56+
@echo "Incrementing major version from $(VERSION) to $(UPDATE_MAJOR_VERSION)"
57+
sed -i "s/$(VERSION)/$(UPDATE_MAJOR_VERSION)/" mysqltuner.pl *.md
58+
59+
push:
60+
git push

build/genFeatures.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
(
55
export LANG=C
66
echo -e "Features list for option: --feature (dev only)\n---\n\n"
7-
grep -E '^sub ' ../mysqltuner.pl | \
7+
grep -E '^sub ' ./mysqltuner.pl | \
88
perl -pe 's/sub //;s/\s*\{//g' | \
99
sort -n | \
1010
perl -pe 's/^/* /g' | \
11-
grep -vE '(get_|close_|check_|memerror|human_size|string2file|file2|arr2|dump|which|percentage|trim|is_|hr_|info|print|select|wrap|remove_)'
12-
) > ../FEATURES.md
13-
cat ../FEATURES.md
11+
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_)'
12+
) > ./FEATURES.md
13+
cat ./FEATURES.md

build/updateCVElist.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ sub AUTOLOAD {
4949

5050
my @versions;
5151
my $temp;
52-
unlink '../vulnerabilities.csv' if -f '../vulnerabilities.csv';
52+
unlink './vulnerabilities.csv' if -f './vulnerabilities.csv';
5353
open(CVE, 'cve.csv') or die("Could not open file.");
5454
foreach my $line (<CVE>) {
5555
if ($line =~ /(mysql|mariadb|percona)/i
@@ -69,7 +69,7 @@ sub AUTOLOAD {
6969
#print $vers."\n".Dumper @nb;
7070
#print "$line";
7171
#exit 0 if ($line =~/before/i) ;
72-
$f->write_file('file' => '../vulnerabilities.csv', 'content' => "$nb[0].$nb[1].$nb[2];$nb[0];$nb[1];$nb[2];$line", 'mode' => 'append');
72+
$f->write_file('file' => './vulnerabilities.csv', 'content' => "$nb[0].$nb[1].$nb[2];$nb[0];$nb[1];$nb[2];$line", 'mode' => 'append');
7373
}
7474
}
7575
}

0 commit comments

Comments
 (0)