[dak/master] [setup] reduce number of `psql` calls
This makes the setup run through quite a bit faster. This is
interesting for the integration tests.
---
setup/core-init.d/005_components | 10 ++--
setup/core-init.d/010_queues | 21 +++-----
setup/core-init.d/020_sections | 5 +-
setup/core-init.d/025_priorities | 14 +++---
setup/core-init.d/030_corearch | 6 +--
setup/core-init.d/040_keyrings | 7 +--
setup/core-init.d/050_overridetype | 5 +-
setup/core-init.d/070_srcformats | 5 +-
setup/core-init.d/080_metadatakeys | 98 ++++++++++++++++++++------------------
9 files changed, 78 insertions(+), 93 deletions(-)
diff --git a/setup/core-init.d/005_components b/setup/core-init.d/005_components
index d45ef86..77caaa6 100755
--- a/setup/core-init.d/005_components
+++ b/setup/core-init.d/005_components
@@ -6,10 +6,6 @@ set -u
echo "Creating components"
psql -c "INSERT INTO component (name, description, meets_dfsg)
- VALUES ('main', 'Main', TRUE)" >/dev/null
-
-psql -c "INSERT INTO component (name, description, meets_dfsg)
- VALUES ('contrib', 'Contrib', TRUE)" >/dev/null
-
-psql -c "INSERT INTO component (name, description, meets_dfsg)
- VALUES ('non-free', 'Software that fails to meet the DFSG', FALSE)" >/dev/null
+ VALUES ('main', 'Main', TRUE),
+ ('contrib', 'Contrib', TRUE),
+ ('non-free', 'Software that fails to meet the DFSG', FALSE)" >/dev/null
diff --git a/setup/core-init.d/010_queues b/setup/core-init.d/010_queues
index c00e13b..ae7c847 100755
--- a/setup/core-init.d/010_queues
+++ b/setup/core-init.d/010_queues
@@ -10,19 +10,10 @@ QUEUEBASE="${DAKBASE}/queue"
psql -c "INSERT INTO policy_queue (queue_name, path, perms, change_perms,
generate_metadata, stay_of_execution, send_to_build_queues)
VALUES ('unchecked', '${QUEUEBASE}/unchecked', '0660', '0660',
- FALSE, 86400, FALSE)" >/dev/null
-
-psql -c "INSERT INTO policy_queue (queue_name, path, perms, change_perms,
- generate_metadata, stay_of_execution, send_to_build_queues)
- VALUES ('new', '${QUEUEBASE}/new', '0660', '0660',
- FALSE, 86400, FALSE)" >/dev/null
-
-psql -c "INSERT INTO policy_queue (queue_name, path, perms, change_perms,
- generate_metadata, stay_of_execution, send_to_build_queues)
- VALUES ('newstage', '${QUEUEBASE}/newstage', '0660', '0660',
- FALSE, 86400, FALSE)" >/dev/null
-
-psql -c "INSERT INTO policy_queue (queue_name, path, perms, change_perms,
- generate_metadata, stay_of_execution, send_to_build_queues)
- VALUES ('byhand', '${QUEUEBASE}/byhand', '0660', '0660',
+ FALSE, 86400, FALSE),
+ ('new', '${QUEUEBASE}/new', '0660', '0660',
+ FALSE, 86400, FALSE),
+ ('newstage', '${QUEUEBASE}/newstage', '0660', '0660',
+ FALSE, 86400, FALSE),
+ ('byhand', '${QUEUEBASE}/byhand', '0660', '0660',
FALSE, 86400, FALSE)" >/dev/null
diff --git a/setup/core-init.d/020_sections b/setup/core-init.d/020_sections
index 0c77e47..c9df928 100755
--- a/setup/core-init.d/020_sections
+++ b/setup/core-init.d/020_sections
@@ -64,8 +64,11 @@ x11
xfce
zope"
+values=""
for prefix in "" "contrib/" "non-free/"; do
for section in ${SECTIONS}; do
- psql -c "INSERT INTO section (section) VALUES ('$prefix$section')" >/dev/null
+ values="${values:+${values},} ('${prefix}${section}')"
done
done
+
+psql -c "INSERT INTO section (section) VALUES ${values}" >/dev/null
diff --git a/setup/core-init.d/025_priorities b/setup/core-init.d/025_priorities
index d49bb17..7d71a89 100755
--- a/setup/core-init.d/025_priorities
+++ b/setup/core-init.d/025_priorities
@@ -5,10 +5,10 @@ echo "Creating default priorities"
set -e
set -u
-psql -c "INSERT INTO priority (priority, level) VALUES ('required', 1)" >/dev/null
-psql -c "INSERT INTO priority (priority, level) VALUES ('important', 2)" >/dev/null
-psql -c "INSERT INTO priority (priority, level) VALUES ('standard', 3)" >/dev/null
-psql -c "INSERT INTO priority (priority, level) VALUES ('optional', 4)" >/dev/null
-psql -c "INSERT INTO priority (priority, level) VALUES ('extra', 5)" >/dev/null
-psql -c "INSERT INTO priority (priority, level) VALUES ('source', 0)" >/dev/null
-
+psql -c "INSERT INTO priority (priority, level)
+ VALUES ('required', 1),
+ ('important', 2),
+ ('standard', 3),
+ ('optional', 4),
+ ('extra', 5),
+ ('source', 0)" >/dev/null
diff --git a/setup/core-init.d/030_corearch b/setup/core-init.d/030_corearch
index 6f19e10..71fffc1 100755
--- a/setup/core-init.d/030_corearch
+++ b/setup/core-init.d/030_corearch
@@ -6,8 +6,6 @@ set -u
echo "Setting up source and all architectures"
psql -c "INSERT INTO architecture (arch_string, description)
- VALUES ('source', 'Source')" >/dev/null
-
-psql -c "INSERT INTO architecture (arch_string, description)
- VALUES ('all', 'Architecture Independent')" >/dev/null
+ VALUES ('source', 'Source'),
+ ('all', 'Architecture Independent')" >/dev/null
diff --git a/setup/core-init.d/040_keyrings b/setup/core-init.d/040_keyrings
index 77065ef..7f1befa 100755
--- a/setup/core-init.d/040_keyrings
+++ b/setup/core-init.d/040_keyrings
@@ -5,11 +5,8 @@ set -u
echo "Setting up default keyrings"
-psql -c "INSERT INTO binary_acl (access_level) VALUES ('full')" >/dev/null
-psql -c "INSERT INTO binary_acl (access_level) VALUES ('map')" >/dev/null
-
-psql -c "INSERT INTO source_acl (access_level) VALUES ('full')" >/dev/null
-psql -c "INSERT INTO source_acl (access_level) VALUES ('dm')" >/dev/null
+psql -c "INSERT INTO binary_acl (access_level) VALUES ('full'), ('map')" >/dev/null
+psql -c "INSERT INTO source_acl (access_level) VALUES ('full'), ('dm')" >/dev/null
psql -c "INSERT INTO keyrings (name, default_source_acl_id, default_binary_acl_id)
VALUES ('${DAKBASE}/keyrings/upload-keyring.gpg',
diff --git a/setup/core-init.d/050_overridetype b/setup/core-init.d/050_overridetype
index fc8ad16..e0b128c 100755
--- a/setup/core-init.d/050_overridetype
+++ b/setup/core-init.d/050_overridetype
@@ -5,7 +5,4 @@ set -u
echo "Creating override types"
-psql -c "INSERT INTO override_type (type) VALUES ('deb')" >/dev/null
-psql -c "INSERT INTO override_type (type) VALUES ('udeb')" >/dev/null
-psql -c "INSERT INTO override_type (type) VALUES ('dsc')" >/dev/null
-
+psql -c "INSERT INTO override_type (type) VALUES ('deb'), ('udeb'), ('dsc')" >/dev/null
diff --git a/setup/core-init.d/070_srcformats b/setup/core-init.d/070_srcformats
index 59c4394..940396a 100755
--- a/setup/core-init.d/070_srcformats
+++ b/setup/core-init.d/070_srcformats
@@ -5,6 +5,5 @@ set -u
echo "Setting up source formats"
-psql -c "INSERT INTO src_format (format_name) VALUES ('1.0')" >/dev/null
-psql -c "INSERT INTO src_format (format_name) VALUES ('3.0 (quilt)')" >/dev/null
-psql -c "INSERT INTO src_format (format_name) VALUES ('3.0 (native)')" >/dev/null
+psql -c "INSERT INTO src_format (format_name)
+ VALUES ('1.0'), ('3.0 (quilt)'), ('3.0 (native)')" >/dev/null
diff --git a/setup/core-init.d/080_metadatakeys b/setup/core-init.d/080_metadatakeys
index 482b12e..41c033b 100755
--- a/setup/core-init.d/080_metadatakeys
+++ b/setup/core-init.d/080_metadatakeys
@@ -5,50 +5,54 @@ set -u
echo "Setting up metadata key ordering"
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Package', -2600)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Source', -2500)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Binary', -2400)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Version', -2300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Essential', -2250)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Installed-Size', -2200)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Maintainer', -2100)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Uploaders', -2090)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Original-Maintainer', -2080)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Build-Depends', -2000)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Build-Depends-Indep', -1990)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Build-Conflicts', -1980)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Build-Conflicts-Indep', -1970)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Architecture', -1800)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Standards-Version', -1700)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Format', -1600)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Files', -1500)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Dm-Upload-Allowed', -1400)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Browse', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Hg', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Darcs', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Svn', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Git', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Browser', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Arch', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Bzr', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Mtn', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Cvs', -1300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Checksums-Sha256', -1200)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Checksums-Sha1', -1200)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Replaces', -1100)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Provides', -1000)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Depends', -900)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Pre-Depends', -850)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Recommends', -800)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Suggests', -700)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Enhances', -650)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Conflicts', -600)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Breaks', -500)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Description', -400)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Origin', -300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Bugs', -200)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Multi-Arch', -150)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Homepage', -100)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Tag', 300)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Package-Type', 400)" >/dev/null
-psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Installer-Menu-Item', 500)" >/dev/null
+values="
+ ('Package', -2600),
+ ('Source', -2500),
+ ('Binary', -2400),
+ ('Version', -2300),
+ ('Essential', -2250),
+ ('Installed-Size', -2200),
+ ('Maintainer', -2100),
+ ('Uploaders', -2090),
+ ('Original-Maintainer', -2080),
+ ('Build-Depends', -2000),
+ ('Build-Depends-Indep', -1990),
+ ('Build-Conflicts', -1980),
+ ('Build-Conflicts-Indep', -1970),
+ ('Architecture', -1800),
+ ('Standards-Version', -1700),
+ ('Format', -1600),
+ ('Files', -1500),
+ ('Dm-Upload-Allowed', -1400),
+ ('Vcs-Browse', -1300),
+ ('Vcs-Hg', -1300),
+ ('Vcs-Darcs', -1300),
+ ('Vcs-Svn', -1300),
+ ('Vcs-Git', -1300),
+ ('Vcs-Browser', -1300),
+ ('Vcs-Arch', -1300),
+ ('Vcs-Bzr', -1300),
+ ('Vcs-Mtn', -1300),
+ ('Vcs-Cvs', -1300),
+ ('Checksums-Sha256', -1200),
+ ('Checksums-Sha1', -1200),
+ ('Replaces', -1100),
+ ('Provides', -1000),
+ ('Depends', -900),
+ ('Pre-Depends', -850),
+ ('Recommends', -800),
+ ('Suggests', -700),
+ ('Enhances', -650),
+ ('Conflicts', -600),
+ ('Breaks', -500),
+ ('Description', -400),
+ ('Origin', -300),
+ ('Bugs', -200),
+ ('Multi-Arch', -150),
+ ('Homepage', -100),
+ ('Tag', 300),
+ ('Package-Type', 400),
+ ('Installer-Menu-Item', 500)
+"
+
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ${values}" >/dev/null
--
2.1.4
Reply to: