launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07772
[Merge] lp:~wgrant/launchpad/newsampledata-sanity into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/newsampledata-sanity into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/newsampledata-sanity/+merge/105437
This branch makes sampledata regeneration a little easier, by changing "make newsampledata" to write to current(-dev).sql directly, rather than newsampledata(-dev).sql and relying on devs to move and diff manually.
bin/lint.sh relied on the different filenames for its sampledata outdatedness detection, so I removed it. lint is rarely run in DB branches these days, and outdated sampledata hurts nobody.
--
https://code.launchpad.net/~wgrant/launchpad/newsampledata-sanity/+merge/105437
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/newsampledata-sanity into lp:launchpad.
=== modified file 'buildout-templates/bin/lint.sh.in'
--- buildout-templates/bin/lint.sh.in 2011-03-23 16:28:51 +0000
+++ buildout-templates/bin/lint.sh.in 2012-05-11 05:28:19 +0000
@@ -36,76 +36,6 @@
done
fi
-
-# Are there patches to the schema or changes to current.sql?
-sample_dir="database/sampledata"
-current_sql="$sample_dir/current.sql"
-current_dev_sql="$sample_dir/current-dev.sql"
-lintdata_sql="$sample_dir/lintdata.sql"
-lintdata_dev_sql="$sample_dir/lintdata-dev.sql"
-database_changes=$(echo $files | sed '/database.*\(patch-\|current\)/!d')
-if [ -n "$database_changes" ]; then
- make -C database/schema lintdata > /dev/null
- sql_diff=$(diff -q "$current_sql" "$lintdata_sql")
- if [ -z "$sql_diff" ]; then
- rm $lintdata_sql
- fi
- sql_dev_diff=$(diff -q "$current_dev_sql" "$lintdata_dev_sql")
- if [ -z "$sql_dev_diff" ]; then
- rm $lintdata_dev_sql
- fi
-else
- sql_diff=""
- sql_dev_diff=""
-fi
-
-karma_bombs=`sed '/INTO karma /!d; /2000-/d; /2001-/d' $current_sql`
-
-echo_sampledata_changes () {
- echo " $2 differs from $1."
- echo " Patches to the schema, or manual edits to $1"
- echo " do not match the dump of the $3 database."
- echo " If $2 is correct, copy it to"
- echo " $1."
- echo " Otherwise update $1 and run:"
- echo " make schema"
- echo " make newsampledata"
- echo " cd $sample_dir"
- echo " cp $4 $1"
- echo " Run make schema again to update the test/dev database."
-}
-
-if [ -n "$sql_diff" -o -n "$sql_dev_diff" -o -n "$karma_bombs" ]; then
- echo ""
- echo ""
- echo "== Schema =="
- echo ""
-fi
-
-#
-if [ -n "$sql_diff" -o -n "$karma_bombs" ]; then
- echo "$current_sql"
-fi
-if [ -n "$sql_diff" ]; then
- echo_sampledata_changes \
- "$current_sql" "$lintdata_sql" "launchpad_ftest_template"\
- "newsampledata.sql"
-fi
-if [ -n "$karma_bombs" ]; then
- echo " Karma time bombs were added to sampledata."
- echo " The Karma table has dates after 2002-01-01; either revise"
- echo " them or remove rows if they are unneeded."
-fi
-
-if [ -n "$sql_dev_diff" ]; then
- echo ""
- echo "$current_sql"
- echo_sampledata_changes \
- "$current_dev_sql" "$lintdata_dev_sql" "launchpad_dev_template"\
- "newsampledata-dev.sql"
-fi
-
-
# Sample data contains auto generated files with long lines.
pocketlint_files=`echo "$files" | env -i grep -v ".sql$"`
if [ -z "$pocketlint_files" ]; then
=== modified file 'database/sampledata/README'
--- database/sampledata/README 2009-08-04 11:02:12 +0000
+++ database/sampledata/README 2012-05-11 05:28:19 +0000
@@ -57,34 +57,20 @@
make harness LPCONFIG=test-playground
- 4. Make a fresh snapshot of the sample data to newsampledata.sql:
+ 4. Update the snapshot of the sample data in current(-dev).sql:
make newsampledata
5. Inspect the new sample data:
- cd ../sampledata
- diff current-dev.sql newsampledata-dev.sql
-
- If your changes are to the sampledata used for tests, the files
- above will be named current.sql and newsampledata.sql instead.
-
- 6. If it passes your sanity checks, just copy it over the existing one:
-
- cp newsampledata-dev.sql current-dev.sql
-
- Or
-
- cp newsampledata.sql current.sql
-
- if your changes are to the sample data used for tests.
-
- 7. Ensure the tests still pass:
+ bzr diff ../sampledata
+
+ 6. Ensure the tests still pass:
cd ../..
make check # Yeah, yeah, we all know our machines can stand that.
- 8. Commit your changes and submit for review:
+ 7. Commit your changes and submit for review:
bzr commit -m 'Added frotz to sampledata..."
bzr push
=== modified file 'database/schema/Makefile'
--- database/schema/Makefile 2012-02-14 20:24:06 +0000
+++ database/schema/Makefile 2012-05-11 05:28:19 +0000
@@ -11,10 +11,6 @@
SAMPLEDATA=../sampledata/current.sql
SAMPLEDATA_DEV=../sampledata/current-dev.sql
-# The database dump to create
-NEWSAMPLEDATA=../sampledata/newsampledata.sql
-NEWSAMPLEDATA_DEV=../sampledata/newsampledata-dev.sql
-
# The database dump to create for lint reports
LINTDATA=../sampledata/lintdata.sql
LINTDATA_DEV=../sampledata/lintdata-dev.sql
@@ -178,10 +174,10 @@
${PYTHON} diagram.py
newsampledata_test:
- $(call build_new_sampledata,${TEST_PLAYGROUND_DBNAME},${NEWSAMPLEDATA})
+ $(call build_new_sampledata,${TEST_PLAYGROUND_DBNAME},${SAMPLEDATA})
newsampledata_dev:
- $(call build_new_sampledata,${DBNAME_DEV},${NEWSAMPLEDATA_DEV})
+ $(call build_new_sampledata,${DBNAME_DEV},${SAMPLEDATA_DEV})
newsampledata: newsampledata_dev newsampledata_test
Follow ups