Merge lp:~clint-fewbar/ubuntu/maverick/php5/fix-mysql-tests-apparmor into lp:ubuntu/maverick/php5

Proposed by Clint Byrum
Status: Merged
Merge reported by: Mathias Gug
Merged at revision: not available
Proposed branch: lp:~clint-fewbar/ubuntu/maverick/php5/fix-mysql-tests-apparmor
Merge into: lp:ubuntu/maverick/php5
Diff against target: 71 lines (+23/-2)
3 files modified
debian/changelog (+8/-0)
debian/rules (+2/-0)
debian/setup-mysql.sh (+13/-2)
To merge this branch: bzr merge lp:~clint-fewbar/ubuntu/maverick/php5/fix-mysql-tests-apparmor
Reviewer Review Type Date Requested Status
Mathias Gug Pending
Review via email: mp+35562@code.launchpad.net

Description of the change

This copies mysqld into the build dir while running the build tests (and cleans up after itself when done). This is done to avoid the restrictions imposed on /usr/sbin/mysqld by its default apparmor profile.

To post a comment you must log in.
Revision history for this message
Mathias Gug (mathiaz) wrote :

Looks good. Uploaded to maverick.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2010-08-25 14:04:57 +0000
3+++ debian/changelog 2010-09-15 17:54:52 +0000
4@@ -1,3 +1,11 @@
5+php5 (5.3.3-1ubuntu7) maverick; urgency=low
6+
7+ * debian/setup-mysql.sh: Copy mysqld to local dir during build to avoid
8+ apparmor restrictions (LP: #638401)
9+ * debian/rules: stop mysql instance on clean just in case we failed in tests
10+
11+ -- Clint Byrum <clint@ubuntu.com> Wed, 15 Sep 2010 10:48:32 -0700
12+
13 php5 (5.3.3-1ubuntu6) maverick; urgency=low
14
15 * Undo sybase debugging libraries split: keeping a smaller delta with Debian
16
17=== modified file 'debian/rules'
18--- debian/rules 2010-08-25 14:04:57 +0000
19+++ debian/rules 2010-09-15 17:54:52 +0000
20@@ -406,6 +406,8 @@
21 rm -rf fpm-build
22 rm -rf pear-build pear-build-download
23 rm -f debian/copyright
24+ # just in case the build tests failed, kill the running mysqld
25+ $(SHELL) debian/setup-mysql.sh $(MYSQL_PORT) $(MYSQL_DATA_DIR) stop > /dev/null 2>&1 || exit 0
26 rm -rf test-results.txt $(MYSQL_DATA_DIR)
27 dh_clean -Xorig
28
29
30=== modified file 'debian/setup-mysql.sh'
31--- debian/setup-mysql.sh 2010-07-18 15:35:06 +0000
32+++ debian/setup-mysql.sh 2010-09-15 17:54:52 +0000
33@@ -12,25 +12,36 @@
34 datadir=$2
35 action=${3:-start}
36
37+localbase=`dirname $datadir`/mysql_base
38+
39 # Some vars #
40
41 socket=$datadir/mysql.sock
42 # Commands:
43 mysqladmin="mysqladmin -u root -P $port -h localhost --socket=$socket"
44-mysqld="/usr/sbin/mysqld --no-defaults --bind-address=localhost --port=$port --socket=$socket --datadir=$datadir"
45+mysqld="$localbase/bin/mysqld --no-defaults --bind-address=localhost --port=$port --socket=$socket --datadir=$datadir"
46
47 # Main code #
48
49 if [ "$action" = "stop" ]; then
50 $mysqladmin shutdown
51+ rm -rf $localbase
52 exit
53 fi
54
55+# Copy the necessary pieces of mysql to a local dir to avoid apparmor restrictions
56+rm -rf $localbase
57+mkdir -p $localbase/bin
58+mkdir -p $localbase/share
59+cp /usr/sbin/mysqld $localbase/bin
60+cp /usr/bin/my_print_defaults $localbase/bin
61+cp -r /usr/share/mysql $localbase/share
62+
63 rm -rf $datadir
64 mkdir -p $datadir
65 chmod go-rx $datadir
66
67-mysql_install_db --datadir=$datadir --rpm --force >> $datadir/bootstrap.log 2>&1
68+mysql_install_db --basedir=$localbase --datadir=$datadir --rpm --force --tmpdir=/tmp >> $datadir/bootstrap.log 2>&1
69
70 tmpf=$(mktemp)
71 cat > "$tmpf" <<EOF

Subscribers

People subscribed via source and target branches

to all changes: