Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
dd3e5e88
Commit
dd3e5e88
authored
Jan 20, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/space/my/mysql-4.1 into mysql.com:/space/my/mysql-5.0
parents
07490d84
f2d79c5e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
169 additions
and
88 deletions
+169
-88
Build-tools/Do-rpm
Build-tools/Do-rpm
+159
-85
support-files/mysql-log-rotate.sh
support-files/mysql-log-rotate.sh
+10
-3
No files found.
Build-tools/Do-rpm
View file @
dd3e5e88
...
@@ -22,7 +22,6 @@ use Getopt::Long;
...
@@ -22,7 +22,6 @@ use Getopt::Long;
Getopt::Long::
Configure
("
bundling
");
Getopt::Long::
Configure
("
bundling
");
use
Sys::
Hostname
;
use
Sys::
Hostname
;
$opt_nobuild
=
undef
;
$opt_cc
=
undef
;
$opt_cc
=
undef
;
$opt_cflags
=
undef
;
$opt_cflags
=
undef
;
$opt_clean
=
undef
;
$opt_clean
=
undef
;
...
@@ -33,6 +32,9 @@ $opt_help= undef;
...
@@ -33,6 +32,9 @@ $opt_help= undef;
$opt_log
=
undef
;
$opt_log
=
undef
;
$opt_mail
=
"";
$opt_mail
=
"";
$opt_verbose
=
undef
;
$opt_verbose
=
undef
;
$opt_susebuild
=
undef
;
$opt_susebuildroot
=
undef
;
$opt_suserpms
=
undef
;
# Set a dummy version until we know the correct one
# Set a dummy version until we know the correct one
$VERSION
=
"
x.y.z
";
$VERSION
=
"
x.y.z
";
...
@@ -49,7 +51,9 @@ GetOptions(
...
@@ -49,7 +51,9 @@ GetOptions(
"
help|h
",
"
help|h
",
"
log|l:s
",
"
log|l:s
",
"
mail|m=s
",
"
mail|m=s
",
"
nobuild
",
"
susebuild|s
",
"
susebuildroot|r=s
",
"
suserpms=s
",
"
verbose|v
",
"
verbose|v
",
)
||
&
print_help
;
)
||
&
print_help
;
...
@@ -57,6 +61,20 @@ GetOptions(
...
@@ -57,6 +61,20 @@ GetOptions(
defined
(
$SPECFILE
=
$ARGV
[
0
])
||
print_help
("
Please provide the spec file name!
");
defined
(
$SPECFILE
=
$ARGV
[
0
])
||
print_help
("
Please provide the spec file name!
");
&
print_help
("
Please define the location of the RPM repository!
")
if
$opt_susebuild
&&
!
(
$opt_suserpms
||
$ENV
{
BUILD_RPMS
});
unless
(
$opt_susebuildroot
)
{
if
(
$ENV
{
BUILD_ROOT
})
{
$opt_susebuildroot
=
$ENV
{
BUILD_ROOT
};
}
else
{
$opt_susebuildroot
=
"
/var/tmp/build-root
";
}
}
# Include helper functions
# Include helper functions
$PWD
=
cwd
();
$PWD
=
cwd
();
$LOGGER
=
"
$PWD
/logger.pm
";
$LOGGER
=
"
$PWD
/logger.pm
";
...
@@ -72,7 +90,7 @@ else
...
@@ -72,7 +90,7 @@ else
$subject
=
"
RPM build for
$SPECFILE
failed
"
if
$opt_mail
;
$subject
=
"
RPM build for
$SPECFILE
failed
"
if
$opt_mail
;
# Open the spec file and extract the version number
# Open the spec file and extract the version number
open
(
SPEC
,
$SPECFILE
)
or
&
abort
("
Unable to open
\"
$ARGV
[0]
\"
: $!
")
;
open
(
SPEC
,
$SPECFILE
)
or
die
"
Unable to open
\"
$ARGV
[0]
\"
: $!
"
;
@spec
=
<
SPEC
>
;
@spec
=
<
SPEC
>
;
close
SPEC
;
close
SPEC
;
...
@@ -94,7 +112,7 @@ $HOST= hostname();
...
@@ -94,7 +112,7 @@ $HOST= hostname();
$HOST
=~
/^([^.-]*)/
;
$HOST
=~
/^([^.-]*)/
;
$HOST
=
$1
;
$HOST
=
$1
;
$LOGFILE
=
"
$PWD
/Logs/Do-rpm-
$HOST
-
$MAJOR
.
$MINOR
.log
";
$LOGFILE
=
"
$PWD
/Logs/Do-rpm-
$HOST
-
$MAJOR
.
$MINOR
.log
";
&
logger
("
Using spec file for version:
$VERSION
");
&
logger
("
Logging to
$LOGFILE
");
#
#
# Override predefined Log file name
# Override predefined Log file name
...
@@ -114,41 +132,91 @@ if (defined $opt_log)
...
@@ -114,41 +132,91 @@ if (defined $opt_log)
}
}
}
}
#
&
logger
("
Using spec file for version:
$VERSION
");
# Newer RPM versions ship with a separate tool "rpmbuild" to build RPMs
#
if
(
$opt_susebuild
)
if
(
-
x
"
/usr/bin/rpmbuild
")
{
{
$RPM
=
"
/usr/bin/rpmbuild
";
&
susebuild
;
$RMSOURCE
=
"
--rmsource --rmspec
";
}
}
else
else
{
{
$RPM
=
"
/bin/rpm
";
&
rpmbuild
;
$RMSOURCE
=
"
--rmspec
";
}
}
if
(
$RPM
)
&
logger
("
SUCCESS: RPM files successfully created.
")
unless
(
$opt_dry_run
);
{
exit
0
;
&
logger
("
Found rpm binary:
$RPM
");
}
#
else
# Build using SUSE's "build" script
#
sub
susebuild
{
{
&
abort
("
Unable to find RPM binary!
");
$BUILD
=
"
/usr/bin/build
";
(
-
x
$BUILD
)
?
&
logger
("
$BUILD
found, proceeding.
")
:
&
abort
("
$BUILD
could not be found!
");
$command
=
"
sudo
$BUILD
--clean
";
$command
.=
"
--root=
$opt_susebuildroot
";
$command
.=
"
--rpms=
$opt_suserpms
"
if
$opt_suserpms
;
$command
.=
"
$SPECFILE
";
&
logger
("
Building RPMs using SUSE build.
");
&
run_command
(
$command
,
"
Error while running the SUSE RPM build!
");
#
# Move the resulting RPMs into the pwd - we can use broad globs here
# as the build root has been cleaned up before so there should not be
# any residuals from previous build runs
#
$command
=
"
cp
";
$command
.=
"
-v
"
if
(
$opt_verbose
);
$command
.=
"
$opt_susebuildroot
/usr/src/packages/SRPMS/MySQL*.src.rpm
$PWD
";
&
logger
("
Copying source RPM to current dir.
");
&
run_command
(
$command
,
"
Error moving source RPM!
");
$command
=
"
cp
";
$command
.=
"
-v
"
if
(
$opt_verbose
);
$command
.=
"
$opt_susebuildroot
/usr/src/packages/RPMS/*/MySQL*.rpm
$PWD
";
&
logger
("
Copying binary RPMs to current dir.
");
&
run_command
(
$command
,
"
Error moving binary RPMs!
");
}
}
#
#
#
determine some RPM settings for this host
#
Build using "plain" RPM
#
#
chomp
(
$RPMARCH
=
`
$RPM
--eval "%{_arch}" 2> /dev/null
`);
sub
rpmbuild
chomp
(
$RPMDIR
=
`
$RPM
--eval "%{_rpmdir}" 2> /dev/null
`);
{
chomp
(
$SOURCEDIR
=
`
$RPM
--eval "%{_sourcedir}" 2> /dev/null
`);
chomp
(
$SPECDIR
=
`
$RPM
--eval "%{_specdir}" 2> /dev/null
`);
#
chomp
(
$SRCRPMDIR
=
`
$RPM
--eval "%{_srcrpmdir}" 2> /dev/null
`);
# Newer RPM versions ship with a separate tool "rpmbuild" to build RPMs
#
if
(
-
x
"
/usr/bin/rpmbuild
")
{
$RPM
=
"
/usr/bin/rpmbuild
";
$RMSOURCE
=
"
--rmsource --rmspec
";
}
else
{
$RPM
=
"
/bin/rpm
";
$RMSOURCE
=
"
--rmspec
";
}
if
(
$RPM
)
{
&
logger
("
Found rpm binary:
$RPM
");
}
else
{
&
abort
("
Unable to find RPM binary!
");
}
$SOURCEFILE
=
glob
"
mysql*-
$VERSION
.tar.gz
";
#
# determine some RPM settings for this host
#
chomp
(
$RPMARCH
=
`
$RPM
--eval "%{_arch}" 2> /dev/null
`);
chomp
(
$RPMDIR
=
`
$RPM
--eval "%{_rpmdir}" 2> /dev/null
`);
chomp
(
$SOURCEDIR
=
`
$RPM
--eval "%{_sourcedir}" 2> /dev/null
`);
chomp
(
$SPECDIR
=
`
$RPM
--eval "%{_specdir}" 2> /dev/null
`);
chomp
(
$SRCRPMDIR
=
`
$RPM
--eval "%{_srcrpmdir}" 2> /dev/null
`);
unless
(
$opt_nobuild
)
{
$SOURCEFILE
=
glob
"
mysql*-
$VERSION
.tar.gz
";
&
logger
("
Starting RPM build of MySQL-
$VERSION
on
$HOST
");
&
logger
("
Starting RPM build of MySQL-
$VERSION
on
$HOST
");
...
@@ -157,9 +225,9 @@ unless($opt_nobuild) {
...
@@ -157,9 +225,9 @@ unless($opt_nobuild) {
&
abort
("
Unable to find
$file
!
")
unless
(
-
f
"
$file
");
&
abort
("
Unable to find
$file
!
")
unless
(
-
f
"
$file
");
}
}
#
#
# Install source and spec file
# Install source and spec file
#
#
&
logger
("
Copying SOURCE and SPEC file to build directories.
");
&
logger
("
Copying SOURCE and SPEC file to build directories.
");
unless
(
$opt_dry_run
)
unless
(
$opt_dry_run
)
{
{
...
@@ -169,10 +237,10 @@ unless($opt_nobuild) {
...
@@ -169,10 +237,10 @@ unless($opt_nobuild) {
or
&
abort
("
Unable to copy
$SPECFILE
to
$SPECDIR
!
");
or
&
abort
("
Unable to copy
$SPECFILE
to
$SPECDIR
!
");
}
}
#
#
# Set environment variables - these are being used in the
# Set environment variables - these are being used in the
# official MySQL RPM spec file
# official MySQL RPM spec file
#
#
&
logger
("
Setting special build environment variables
")
&
logger
("
Setting special build environment variables
")
if
(
$opt_cc
)
or
(
$opt_cflags
)
or
(
$opt_cxxflags
)
or
(
$opt_cxx
);
if
(
$opt_cc
)
or
(
$opt_cflags
)
or
(
$opt_cxxflags
)
or
(
$opt_cxx
);
$ENV
{
MYSQL_BUILD_CC
}
=
$opt_cc
if
(
$opt_cc
);
$ENV
{
MYSQL_BUILD_CC
}
=
$opt_cc
if
(
$opt_cc
);
...
@@ -180,9 +248,9 @@ unless($opt_nobuild) {
...
@@ -180,9 +248,9 @@ unless($opt_nobuild) {
$ENV
{
MYSQL_BUILD_CXXFLAGS
}
=
$opt_cxxflags
if
(
$opt_cxxflags
);
$ENV
{
MYSQL_BUILD_CXXFLAGS
}
=
$opt_cxxflags
if
(
$opt_cxxflags
);
$ENV
{
MYSQL_BUILD_CXX
}
=
$opt_cxx
if
(
$opt_cxx
);
$ENV
{
MYSQL_BUILD_CXX
}
=
$opt_cxx
if
(
$opt_cxx
);
#
#
# Build the RPMs
# Build the RPMs
#
#
$command
=
"
$RPM
";
$command
=
"
$RPM
";
$command
.=
"
-v
"
if
(
$opt_verbose
);
$command
.=
"
-v
"
if
(
$opt_verbose
);
$command
.=
"
-ba
";
$command
.=
"
-ba
";
...
@@ -191,26 +259,22 @@ unless($opt_nobuild) {
...
@@ -191,26 +259,22 @@ unless($opt_nobuild) {
$command
.=
basename
(
$SPECFILE
);
$command
.=
basename
(
$SPECFILE
);
&
logger
("
Building RPM.
");
&
logger
("
Building RPM.
");
&
run_command
(
$command
,
"
Error while building the RPMs!
");
&
run_command
(
$command
,
"
Error while building the RPMs!
");
}
#
# Move the resulting RPMs into the pwd
#
$command
=
"
mv
";
$command
.=
"
-v
"
if
(
$opt_verbose
);
$command
.=
"
$SRCRPMDIR
/MySQL*
$VERSION_SRPM
*.src.rpm
$PWD
";
&
logger
("
Moving source RPM to current dir.
");
&
run_command
(
$command
,
"
Error moving source RPM!
");
$command
=
"
mv
";
$command
.=
"
-v
"
if
(
$opt_verbose
);
# $command.= " $RPMDIR/$RPMARCH/MySQL*$VERSION*.$RPMARCH.rpm $PWD";
$command
.=
"
$RPMDIR
/
$RPMARCH
/MySQL*
$VERSION_SRPM
*.
$RPMARCH
.rpm
$PWD
";
&
logger
("
Moving binary RPMs to current dir.
");
&
run_command
(
$command
,
"
Error moving binary RPMs!
");
&
logger
("
SUCCESS: RPM files successfully created.
")
unless
(
$opt_dry_run
);
#
exit
0
;
# Move the resulting RPMs into the pwd
#
$command
=
"
mv
";
$command
.=
"
-v
"
if
(
$opt_verbose
);
$command
.=
"
$SRCRPMDIR
/MySQL*
$VERSION_SRPM
*.src.rpm
$PWD
";
&
logger
("
Moving source RPM to current dir.
");
&
run_command
(
$command
,
"
Error moving source RPM!
");
$command
=
"
mv
";
$command
.=
"
-v
"
if
(
$opt_verbose
);
$command
.=
"
$RPMDIR
/
$RPMARCH
/MySQL*
$VERSION_SRPM
*.
$RPMARCH
.rpm
$PWD
";
&
logger
("
Moving binary RPMs to current dir.
");
&
run_command
(
$command
,
"
Error moving binary RPMs!
");
}
sub
print_help
sub
print_help
{
{
...
@@ -218,7 +282,7 @@ sub print_help
...
@@ -218,7 +282,7 @@ sub print_help
if
(
$message
ne
"")
if
(
$message
ne
"")
{
{
print
"
\n
";
print
"
\n
";
print
"
ERROR:
$message
\n\n
}
";
print
"
ERROR:
$message
\n\n
";
}
}
print
<<EOF;
print
<<EOF;
...
@@ -241,12 +305,22 @@ Options:
...
@@ -241,12 +305,22 @@ Options:
-t, --dry-run Dry run without executing
-t, --dry-run Dry run without executing
-h, --help Print this help
-h, --help Print this help
-l, --log[=<filename>] Write a log file [to <filename>]
-l, --log[=<filename>] Write a log file [to <filename>]
(default is "$LOGFILE")
-m, --mail=<address> Mail a failure report to the given address
-m, --mail=<address> Mail a failure report to the given address
(and include a log file snippet, if logging
(and include a log file snippet, if logging
is enabled)
is enabled)
Note that the \@-Sign needs to be quoted!
Note that the \@-Sign needs to be quoted!
Example: --mail=user\\\@domain.com
Example: --mail=user\\\@domain.com
-s, --susebuild Use the SUSE "build" script instead of RPM
directly (requires sudo privileges to run the
/usr/bin/build command)
-r, --susebuildroot=<root> Use <root> as the build root directory for the
SUSE "build" (default is /var/tmp/build-root
or defined by the BUILD_ROOT environment
variable)
--suserpms=<path> Path to the SUSE RPM repository to build up
the build root (mandatory option when using
--susebuild and the BUILD_RPMS environment
variable is not set.)
-v, --verbose Verbose execution
-v, --verbose Verbose execution
Example:
Example:
...
...
support-files/mysql-log-rotate.sh
View file @
dd3e5e88
# This logname is set in mysql.server.sh that ends up in /etc/rc.d/init.d/mysql
# This logname can be set in /etc/my.cnf
# by setting the variable "err-log"
# in the [safe_mysqld] section as follows:
#
# [safe_mysqld]
# err-log=@localstatedir@/mysqld.log
#
#
# If the root user has a password you have to create a
# If the root user has a password you have to create a
# /root/.my.cnf configuration file with the following
# /root/.my.cnf configuration file with the following
...
@@ -22,7 +27,9 @@
...
@@ -22,7 +27,9 @@
compress
compress
postrotate
postrotate
# just if mysqld is really running
# just if mysqld is really running
if
test
-n
"
`
ps acx|grep mysqld
`
"
;
then
if
test
-x
@bindir@/mysqladmin
&&
\
@bindir@/mysqladmin ping &>/dev/null
then
@bindir@/mysqladmin flush-logs
@bindir@/mysqladmin flush-logs
fi
fi
endscript
endscript
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment