[ckan-changes] commit/ckan-debs-public: jame... at okfn.org: Removing old files

Bitbucket commits-noreply at bitbucket.org
Wed Jun 15 11:08:34 UTC 2011


1 new changeset in ckan-debs-public:

http://bitbucket.org/okfn/ckan-debs-public/changeset/f1e70f8adde9/
changeset:   f1e70f8adde9
user:        jame... at okfn.org
date:        2011-06-15 13:08:27
summary:     Removing old files
affected #:  14 files (997 bytes)

--- a/ckan-common/DEBIAN/control.template	Wed Jun 15 11:56:41 2011 +0100
+++ b/ckan-common/DEBIAN/control.template	Wed Jun 15 12:08:27 2011 +0100
@@ -1,10 +1,9 @@
+# This get's set by the build script
+# Version: XXX
 Package: ckan-common
-Version: 1.3.4~01
-Architecture: amd64
+Architecture: all
 Maintainer: James Gardner <james.gardner at okfn.org>
 Installed-Size: 0
-Depends: python-ckan
-Recommends: postgresql, curl
 Section: main/web
 Priority: extra
 Homepage: http://ckan.org


--- a/ckan-common/usr/lib/ckan/common.sh	Wed Jun 15 11:56:41 2011 +0100
+++ b/ckan-common/usr/lib/ckan/common.sh	Wed Jun 15 12:08:27 2011 +0100
@@ -35,20 +35,16 @@
 ckan_ensure_users_and_groups () {
     local INSTANCE
     INSTANCE=$1
-    local user group ckan_users
-    user="ckan${INSTANCE}"
-    group="ckan"
-    ckan_users="ckan www-data okfn"
-    COMMAND_OUTPUT=`cat /etc/group | grep "ckan"`
-    if ! [[ "$COMMAND_OUTPUT" =~ ckan ]] ; then
-        sudo groupadd --system        ${group}
+    COMMAND_OUTPUT=`cat /etc/group | grep "ckan${INSTANCE}:"`
+    if ! [[ "$COMMAND_OUTPUT" =~ "ckan${INSTANCE}:" ]] ; then
+        echo "Crating the 'ckan${INSTANCE}' group ..." 
+        sudo groupadd --system "ckan${INSTANCE}"
     fi
-    for u in ${ckan_users} ; do
-      grep -q "^${u}:"  /etc/passwd && sudo usermod -a -G ${group} ${u}
-    done
-    COMMAND_OUTPUT=`cat /etc/passwd | grep "ckan"`
-    if ! [[ "$COMMAND_OUTPUT" =~ ckan ]] ; then
-        sudo useradd  --system  --gid ${group}  --home /var/lib/ckan/${INSTANCE} -M  --shell /usr/sbin/nologin  ${user}
+    COMMAND_OUTPUT=`cat /etc/passwd | grep "ckan${INSTANCE}:"`
+    if ! [[ "$COMMAND_OUTPUT" =~ "ckan${INSTANCE}:" ]] ; then
+        echo "Crating the 'ckan${INSTANCE}' user ..." 
+        sudo useradd  --system  --gid "ckan${INSTANCE}" --home /var/lib/ckan/${INSTANCE} -M  --shell /usr/sbin/nologin ckan${INSTANCE}
+        sudo usermod -a -G www-data ckan${INSTANCE}
     fi
 }
 
@@ -63,9 +59,9 @@
         mkdir -p -m 0755 /etc/ckan/${INSTANCE}
         mkdir -p -m 2750 /var/lib/ckan/${INSTANCE}{,/static}
         mkdir -p -m 2770 /var/{backup,log}/ckan/${INSTANCE} /var/lib/ckan/${INSTANCE}/{data,sstore,static/dump}
-        chgrp ckan /var/lib/ckan/
-        chgrp ckan /var/backup/ckan/
-        chgrp ckan /var/log/ckan/
+        chgrp ckan${INSTANCE} /var/lib/ckan/${INSTANCE}
+        chgrp ckan${INSTANCE} /var/backup/ckan/${INSTANCE}
+        chgrp ckan${INSTANCE} /var/log/ckan/${INSTANCE}
     fi
 }
 


--- a/ckan-dgu/DEBIAN/control	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-Package: ckan-dgu
-Version: 0.2~16
-Architecture: all
-Maintainer: James Gardner <james.gardner at okfn.org>
-Installed-Size: 0
-Depends: 
-     
-     apache2, libapache2-mod-wsgi, rabbitmq-server, postgresql-8.4-postgis, 
-     ckan-common, python-ckan-conflict
-     # Python deps (with their exact version) PRESENT
-     python-dateutil, python-carrot etc
-     # Python deps (with their exact version) MISSING
-     python-ckanext-spatial_0.1~06+lucid-1_amd64.deb
-     python-ckanext-stats_0.1~06+lucid-1_amd64.deb
-     python-ckanext-csw_0.3~12+lucid-1_amd64.deb
-     python-swiss_0.3~01-1_amd64.deb
-     python-ckanext-dgu_0.2~12+lucid-1_amd64.deb
-     python-ckanext-inspire_0.1~04+lucid-1_amd64.deb
-     python-pyutilib.component.core_4.1-1_amd64.deb
-     python-ckanext-dgutheme_0.1~01+lucid-1_amd64.deb
-     python-vdm_0.9-1_amd64.deb
-     python-ckanext-qa_0.1~19-1_amd64.deb
-     python-licenses_0.6-1_amd64.deb
-     python-ckanext-importlib_0.1~01-1_amd64.deb
-     python-apachemiddleware_0.1.0-1_amd64.deb
-     python-solrpy_0.9.3-1_amd64.deb
-     python-ckan_1.3.4~02-1_amd64.deb
-     python-markupsafe_0.9.2-1_amd64.deb
-     python-ckanext-harvest_0.1~16+lucid-1_amd64.deb
-     python-formalchemy_1.3.6-1_amd64.deb
-     python-owslib_0.3.2beta~04-1_amd64.deb
-     python-ckanclient_0.6-1_amd64.deb
-
-
-Depends: python-ckan (== 1.4~03+1029381023810+lucid), apache2, libapache2-mod-wsgi, python-apachemiddleware, python-ckanext-dgu, python-ckanext-harvest, python-ckanext-csw, python-swiss, python-dateutil, rabbitmq-server, postgresql-8.4-postgis, python-carrot, python-ckanext-spatial, python-ckanext-inspire, python-ckanext-qa, python-ckanext-
-Section: main/web
-Priority: extra
-Homepage: http://ckan.org
-Description: ckan-dgu
- Extensions for CKAN to run the data.gov.uk site
-
-
-
-ckan-common_1.3.4~03_amd64.deb
-ckan-dgu_0.2~15_amd64.deb
-
-python-ckan-deps_1.3.4-1_amd64.deb


--- a/ckan-dgu/DEBIAN/postinst	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-#!/bin/bash
-. /usr/lib/ckan/common.sh
-
-# The above command means import the bash functions from there so we can 
-# use them here
-
-# Things that could be done in a future version of this script
-# * Have a separate config for drupal password and Apache names
-# * Have dgu users, groups and directories, rather than CKAN ones so that 
-#   potentially lots of different INSTANCEs can be installed on the same
-#   machine
-
-# Exit immediately if there is ever a command that returns a non-zero value
-# and don't process any more commands, most likley leaving CKAN in maintenance
-# mode
-set -e 
-
-# Check we are root, something has gone very wrong if we are not!
-if [[ $EUID -ne 0 ]]; then
-   echo "This script must be run as root"
-   exit 1
-fi
-
-INSTANCE="dgu"
-
-# Disable any existing crontabs during the upgrade, we don't want
-# scripts running when things are still changing
-echo "Disabling the crontab for the ckan${INSTANCE} user ..."
-PACKAGED_CRONJOB="/tmp/${INSTANCE}-cronjob"
-cat <<EOF > ${PACKAGED_CRONJOB}
-# m  h dom mon dow  command
-EOF
-crontab -u ckan${INSTANCE} ${PACKAGED_CRONJOB}
-
-# Try to put CKAN into maintenance mode, if it is installed
-if ! [ -f /etc/apache2/sites-available/${INSTANCE}.maint ] ; then
-    # We have a maintence mode available
-    echo "Putting CKAN into maintenance mode ..."
-    ckan_maintenance_on ${INSTANCE}
-fi
-
-echo "Ensuring users and groups are set up correctly ..."
-ckan_ensure_users_and_groups ${INSTANCE}
-
-echo "Ensuring directories exist for ${INSTANCE} CKAN INSTANCE ..."
-# Ensure the standard directories exist
-ckan_make_ckan_directories ${INSTANCE}
-# Then create the extra ones DGU need and set permissions
-sudo chmod a+x /var/lib/ckan/${INSTANCE}/
-sudo mkdir -p -m 0700 /var/lib/ckan/${INSTANCE}/pid
-sudo chmod a+x /var/lib/ckan/${INSTANCE}/pid
-sudo mkdir -p -m 0700 /var/lib/ckan/${INSTANCE}/qa/download
-sudo chmod a+x /var/lib/ckan/${INSTANCE}/qa/download
-sudo chown -R ckan${INSTANCE}:ckan${INSTANCE} /var/lib/ckan/${INSTANCE}/qa/download
-
-echo "Setting log file permissions so that both Apache and cron jobs can log to the same place ..."
-ckan_set_log_file_permissions ${INSTANCE}
-
-echo "Ensuring who.ini file exists for data.gov.uk CKAN INSTANCE ..."
-ckan_create_who_ini ${INSTANCE}
-
-echo "Ensuring ${INSTANCE}.py file exists for data.gov.uk CKAN INSTANCE ..."
-ckan_create_wsgi_handler ${INSTANCE}
-
-echo "Ensuring the ${INSTANCE} database exists ..."
-ckan_ensure_db_exists ${INSTANCE}
-
-echo "Ensuring ${INSTANCE}.ini file exists for data.gov.uk CKAN INSTANCE ..."
-if ! [ -f /etc/ckan/${INSTANCE}/${INSTANCE}.ini ] ; then
-    # Create a password
-    password=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c10`
-    # Replace any existing user with a new one with this password
-    echo "Setting the password of the ${INSTANCE} user in PostgreSQL"
-    ckan_add_or_replace_database_user ${INSTANCE} ${password}
-    # Create the config file
-    echo "Creating a data.gov.uk config for CKAN with the same password as the DGU user"
-    # We use the actual password in PostgreSQL in case any non-sense has gone on
-    ckan_create_config_file ${INSTANCE} ${password}
-    # Now that the file exists, make some customisations
-    cat <<EOF >> /etc/ckan/${INSTANCE}/${INSTANCE}.ini
-ckan.qa_downloads = /var/lib/ckan/${INSTANCE}/qa/download
-dgu.xmlrpc_username = CKAN_API
-#------------------------------------- XXX setup Drupal here -------------
-# dgu.xmlrpc_password = XXX 
-# dgu.xmlrpc_domain = dev.dataco.coi.gov.uk
-#------------------------------------- XXX setup Drupal here -------------
-ckan.default_roles.Package = {"visitor": ["reader"], "logged_in": ["reader"]}
-ckan.default_roles.Group = {"visitor": ["reader"], "logged_in": ["reader"]}
-ckan.default_roles.System = {"visitor": ["reader"], "logged_in": ["reader"]}
-ckan.default_roles.AuthorizationGroup = {"visitor": ["reader"], "logged_in": ["reader"]}
-licenses_group_url = http://licenses.opendefinition.org/2.0/ukgov
-EOF
-    sed \
-        -e "s,^\(ckan.dump_dir\)[ =].*,\1 = /var/lib/ckan/dgu/static/dump," \
-        -e "s,^\(ckan.site_title\)[ =].*,\1 = data.gov.uk," \
-        -e "s,^\(ckan.site_url\)[ =].*,\1 = http://dgu-uat.okfn.org," \
-        -e "s,^\(package_form\)[ =].*,\1 = package_gov3," \
-        -e "s,^\(email_to\)[ =].*,\1 = ckan-sysadmin at okfn.org," \
-        -e "s,^\(error_email_from\)[ =].*,\1 = ckan-sysadmin at okfn.org," \
-        -i /etc/ckan/${INSTANCE}/${INSTANCE}.ini
-     echo "CAUTION: Make sure you edit '/etc/ckan/${INSTANCE}/${INSTANCE}.ini' to set the Drupal password."
-fi
-
-# Install the harvesting init scripts
-if ! [ -f /etc/rc2.d/S25${INSTANCE}_harvest_gather ] ; then
-    echo "Creating the harvester gather consumers ..."
-    sudo touch /var/lib/ckan/${INSTANCE}/pid/gather.pid
-    sudo chown ckan${INSTANCE}:ckan${INSTANCE} /var/lib/ckan/${INSTANCE}/pid/gather.pid
-    sudo update-rc.d -f ${INSTANCE}_harvest_gather defaults 25 &> /dev/null
-    sudo /etc/init.d/${INSTANCE}_harvest_gather start &> /dev/null
-fi
-if ! [ -f /etc/rc2.d/S25${INSTANCE}_harvest_fetch ] ; then
-    echo "Creating the harvester fetch consumers ..."
-    sudo touch /var/lib/ckan/${INSTANCE}/pid/fetch.pid
-    sudo chown ckan${INSTANCE}:ckan${INSTANCE} /var/lib/ckan/${INSTANCE}/pid/fetch.pid
-    sudo update-rc.d -f ${INSTANCE}_harvest_fetch defaults 25 &> /dev/null
-    sudo /etc/init.d/${INSTANCE}_harvest_fetch start &> /dev/null
-fi
-
-# Install the harvesting extension tables if they aren't there already
-COMMAND_OUTPUT=`sudo -u postgres psql -d ${INSTANCE} -c "SELECT 'True' AS harvest_source_exists from pg_tables where schemaname='public' and tablename='harvest_source';" 2> /dev/null`
-if [[ "$COMMAND_OUTPUT" =~ True ]] ; then
-    echo "Harvester tables present"
-else
-    echo "Setting up the harvester tables ..."
-    paster --plugin=ckanext-harvest harvester initdb --config=/etc/ckan/${INSTANCE}/${INSTANCE}.ini &> /dev/null
-fi
-
-# Install the geospatial search tables if they aren't there already
-COMMAND_OUTPUT=`sudo -u postgres psql -d ${INSTANCE} -c "SELECT count(*) from pg_proc where proname = 'postgis_full_version'" 2> /dev/null`
-if [[  "$COMMAND_OUTPUT" =~ 0 ]] ; then
-    echo "Adding the plpgsql langauge to the ${INSTANCE} database ..."
-    sudo -u postgres createlang plpgsql ${INSTANCE} &> /dev/null
-    echo "Installing PostGIS extensions ..."
-    sudo -u postgres psql -d ${INSTANCE} -f /usr/share/postgresql/8.4/contrib/postgis.sql &> /dev/null
-    sudo -u postgres psql -d ${INSTANCE} -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql &> /dev/null
-    echo "Setting PostGIS permissions for CKAN and initialising tables ..."
-    sudo -u postgres psql -d ${INSTANCE} -c "ALTER TABLE geometry_columns OWNER TO ${INSTANCE}" &> /dev/null
-    sudo -u postgres psql -d ${INSTANCE} -c "ALTER TABLE spatial_ref_sys OWNER TO ${INSTANCE}" &> /dev/null
-    sudo paster --plugin=ckanext-spatial spatial initdb --config=/etc/ckan/${INSTANCE}/${INSTANCE}.ini &> /dev/null
-fi
-
-# Set any plugins needed
-echo "Ensuring the latest plugins are configured ..."
-sed -e "s,^\(ckan.plugins\)[ =].*,\1 = dgu_form_api cswserver harvest gemini_harvester gemini_doc_harvester gemini_waf_harvester inspire_api wms_preview spatial_query dgu_theme_embedded qa dgu_auth_api," \
-    -i /etc/ckan/${INSTANCE}/${INSTANCE}.ini
-
-# Overwrite the existing Apache config
-if [ -f /etc/apache2/sites-enabled/default ] ; then
-    echo "Disabling the default Apache site ..."
-    a2dissite default
-fi
-
-echo "Overwriting the existing Apache config ..."
-ckan_overwrite_apache_config ${INSTANCE} catalog.data.gov.uk dgu-live.okfn.org
-
-# Make sure mod_rewrite is enabled
-if ! [ -f /etc/apache2/mods-enabled/rewrite.load ] ; then
-    echo "Enabling Apache mod_rewite ..."
-    a2enmod rewrite
-fi
-
-
-# Standard paster db upgrade
-echo "Performing any database upgrades ..."
-paster --plugin=ckan db upgrade --config=/etc/ckan/${INSTANCE}/${INSTANCE}.ini &> /dev/null
-
-# Make sure our INSTANCE is enabled
-echo "Bringing the ${INSTANCE} INSTANCE out of maintenance mode ..."
-ckan_maintenance_off ${INSTANCE}
-
-# Restart Apache so it is aware of any changes
-echo "Restarting apache ..."
-/etc/init.d/apache2 restart 
-#&> /dev/null
-
-# Install the new crontab
-echo "Enabling crontab for the ckan${INSTANCE} user ..."
-PACKAGED_CRONJOB="/tmp/${INSTANCE}-cronjob"
-cat <<EOF > ${PACKAGED_CRONJOB}
-# WARNING:  Do not edit these cron tabs, they will be overwritten any time 
-#           the ckan INSTANCE package is upgraded
-# QUESTION: Should email reports be sent to root?
-# Gov Daily
-# 31               23  *   *   *   python /usr/lib/pymodules/python2.6/ckanext/dgu/bin/gov_daily.py /etc/ckan/dgu/dgu.ini
-# Try to start the harvester consumers in case they have stopped
-*/10              *  *   *   *   /etc/init.d/dgu_harvest_gather start
-*/10              *  *   *   *   /etc/init.d/dgu_harvest_fetch start
-# Then run the harvester 1 minute after any fetch or gather restart
-# 1,11,21,31,41,51  *  *   *   *   paster --plugin=ckanext-harvest harvester run --config=/etc/ckan/dgu/dgu.ini
-# Update the package 5 star scores once a month
-# 0                 0  1   *   *   paster --plugin=ckanext-qa package-scores update --config=/etc/ckan/dgu/dgu.ini
-EOF
-crontab -u ckan${INSTANCE} ${PACKAGED_CRONJOB}
-


--- a/ckan-dgu/DEBIAN/prerm	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-#!/bin/sh
-set -e
-


--- a/ckan-dgu/etc/init.d/dgu_harvest_fetch	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-DAEMON=/usr/bin/python
-ARGS="/usr/bin/paster --plugin=ckanext-harvest harvester fetch_consumer --config=/etc/ckan/dgu/dgu.ini"
-PIDFILE=/var/lib/ckan/dgu/pid/fetch.pid
-
-function start {
-    /sbin/start-stop-daemon --start --pidfile $PIDFILE \
-        --user ckan --group ckan \
-        -b --make-pidfile \
-        --chuid ckan \
-        --exec $DAEMON -- $ARGS
-}  
-function stop {
-    /sbin/start-stop-daemon --stop --pidfile $PIDFILE --verbose
-}
-
-case "$1" in
-  start)
-    echo "Starting server ..."
-    start
-    ;;
-  stop)
-    echo "Stopping server ..."
-    stop
-    ;;
-  restart)
-    echo "Restarting server ..."
-    stop
-    start
-  *)
-    echo "Usage: $0 {start|stop|restart}"
-    exit 1
-    ;;
-esac
-
-exit 0
-


--- a/ckan-dgu/etc/init.d/dgu_harvest_gather	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-DAEMON=/usr/bin/python
-ARGS="/usr/bin/paster --plugin=ckanext-harvest harvester gather_consumer --config=/etc/ckan/dgu/dgu.ini"
-PIDFILE=/var/lib/ckan/dgu/pid/gather.pid
-
-function start {
-    /sbin/start-stop-daemon --start --pidfile $PIDFILE \
-        --user ckan --group ckan \
-        -b --make-pidfile \
-        --chuid ckan \
-        --exec $DAEMON -- $ARGS
-}  
-function stop {
-    /sbin/start-stop-daemon --stop --pidfile $PIDFILE --verbose
-}
-
-case "$1" in
-  start)
-    echo "Starting server ..."
-    start
-    ;;
-  stop)
-    echo "Stopping server ..."
-    stop
-    ;;
-  restart)
-    echo "Restarting server ..."
-    stop
-    start
-  *)
-    echo "Usage: $0 {start|stop|restart}"
-    exit 1
-    ;;
-esac
-
-exit 0
-


--- a/ckan/DEBIAN/control	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-Package: ckan
-Version: 1.4
-Architecture: amd64
-Maintainer: James Gardner <james.gardner at okfn.org>
-Installed-Size: 0
-Depends: python-ckan, ckan-common
-Recommends: postgresql, curl
-Section: main/web
-Priority: extra
-Homepage: http://ckan.org
-Description: ckan
- The Data Hub


--- a/ckan/DEBIAN/postinst	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-#!/bin/bash
-. /usr/lib/ckan/common.sh
-
-# The above command means import the bash functions from there so we can 
-# use them here
-
-# Exit immediately if there is ever a command that returns a non-zero value
-# and don't process any more commands
-set -e 
-
-# Check we are root, something has gone very wrong if we are not!
-if [[ $EUID -ne 0 ]]; then
-   echo "This script must be run as root"
-   exit 1
-fi
-
-# Try to put CKAN into maintenance mode, if it is installed
-if ! [ -f /etc/apache2/sites-available/${instance}.maint ] ; then
-    # We have a maintence mode available
-    echo "Putting CKAN into maintenance mode ..."
-    ckan-instance-maintenance ${instance} on
-fi
-
-echo "Ensuring users and groups are set up correctly ..."
-ensure_users_and_groups
-
-echo "Ensuring directories exist for data.gov.uk CKAN instance ..."
-# Ensure the standard directories exist
-make_ckan_directories dgu
-# Then create the extra ones DGU need and set permissions
-sudo chmod a+x /var/lib/ckan/dgu/
-sudo mkdir -p -m 0700 /var/lib/ckan/dgu/pid
-sudo chmod a+x /var/lib/ckan/dgu/pid
-sudo mkdir -p -m 0700 /var/lib/ckan/dgu/qa/download
-sudo chmod a+x /var/lib/ckan/dgu/pid/download
-
-echo "Setting log file permissions so that both Apache and cron jobs can log to the same place..."
-sudo touch /var/log/ckan/dgu/dgu.log
-sudo touch /var/log/ckan/dgu/dgu[1-9].log
-sudo chmod g+w /var/log/ckan/dgu/dgu.log
-sudo chmod g+w /var/log/ckan/dgu/dgu[1-9].log
-sudo chown www-data:ckan /var/log/ckan/dgu/dgu.log
-sudo chown www-data:ckan /var/log/ckan/dgu/dgu[1-9].log
-
-echo "Ensuring who.ini file exists for data.gov.uk CKAN instance ..."
-create_who_ini dgu
-
-echo "Ensuring dgu.py file exists for data.gov.uk CKAN instance ..."
-create_wsgi_handler dgu
-
-echo "Ensuring the dgu database exists ..."
-ensure_db_exists dgu
-
-echo "Ensuring dgu.ini file exists for data.gov.uk CKAN instance ..."
-if ! [ -f /etc/ckan/dgu/dgu.ini ] ; then
-    # Create a password
-    password=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c10`
-    # Replace any existing dgu user with a new one with this password
-    echo "Setting the password of the dgu user in PostgreSQL"
-    add_or_replace_database_user dgu $password
-    # Create the config file
-    echo "Creating a data.gov.uk config for CKAN with the same password as the DGU user"
-    # We use the actual password in PostgreSQL in case any non-sense has gone on
-    create_config_file dgu $password
-    # Now that the file exists, make some customisations
-    cat <<EOF >> /etc/ckan/dgu/dgu.ini
-ckan.qa_downloads = /var/lib/ckan/dgu/qa/download
-dgu.xmlrpc_username = CKAN_API
-#------------------------------------- XXX setup Drupal here -------------
-# dgu.xmlrpc_password = XXX 
-# dgu.xmlrpc_domain = dev.dataco.coi.gov.uk
-#------------------------------------- XXX setup Drupal here -------------
-ckan.default_roles.Package = {"visitor": ["reader"], "logged_in": ["reader"]}
-ckan.default_roles.Group = {"visitor": ["reader"], "logged_in": ["reader"]}
-ckan.default_roles.System = {"visitor": ["reader"], "logged_in": ["reader"]}
-ckan.default_roles.AuthorizationGroup = {"visitor": ["reader"], "logged_in": ["reader"]}
-licenses_group_url = http://licenses.opendefinition.org/2.0/ukgov
-EOF
-    sed \
-        -e "s,^\(ckan.dump_dir\)[ =].*,\1 = /var/lib/ckan/dgu/static/dump," \
-        -e "s,^\(ckan.site_title\)[ =].*,\1 = data.gov.uk," \
-        -e "s,^\(ckan.site_url\)[ =].*,\1 = http://dgu-uat.okfn.org," \
-        -e "s,^\(package_form\)[ =].*,\1 = package_gov3," \
-        -e "s,^\(email_to\)[ =].*,\1 = ckan-sysadmin at okfn.org," \
-        -e "s,^\(error_email_from\)[ =].*,\1 = ckan-sysadmin at okfn.org," \
-        -i /etc/ckan/dgu/dgu.ini
-     echo "CAUTION: Make sure you edit '/etc/ckan/dgu/dgu.ini' to set the Drupal password."
-fi
-
-# Install the harvesting init scripts
-if ! [ -f /etc/rc2.d/S25dgu_harvest_gather ] ; then
-    echo "Creating the harvester gather consumers ..."
-    sudo touch /var/lib/ckan/dgu/pid/gather.pid
-    sudo chown ckan:ckan /var/lib/ckan/dgu/pid/gather.pid
-    sudo update-rc.d -f dgu_harvest_gather defaults 25 &> /dev/null
-    sudo /etc/init.d/dgu_harvest_gather start &> /dev/null
-fi
-if ! [ -f /etc/rc2.d/S25dgu_harvest_fetch ] ; then
-    echo "Creating the harvester fetch consumers ..."
-    sudo touch /var/lib/ckan/dgu/pid/fetch.pid
-    sudo chown ckan:ckan /var/lib/ckan/dgu/pid/fetch.pid
-    sudo update-rc.d -f dgu_harvest_fetch defaults 25 &> /dev/null
-    sudo /etc/init.d/dgu_harvest_fetch start &> /dev/null
-fi
-
-# Install the harvesting extension tables if they aren't there already
-COMMAND_OUTPUT=`sudo -u postgres psql -d dgu -c "SELECT 'True' AS harvest_source_exists from pg_tables where schemaname='public' and tablename='harvest_source';" 2> /dev/null`
-if [[ "$COMMAND_OUTPUT" =~ True ]] ; then
-    echo "Harvester tables present"
-else
-    echo "Setting up the harvester tables ..."
-    paster --plugin=ckanext-harvest harvester initdb --config=/etc/ckan/dgu/dgu.ini &> /dev/null
-fi
-
-# Install the geospatial search tables if they aren't there already
-COMMAND_OUTPUT=`sudo -u postgres psql -d dgu -c "SELECT count(*) from pg_proc where proname = 'postgis_full_version'" 2> /dev/null`
-if [[  "$COMMAND_OUTPUT" =~ 0 ]] ; then
-    echo "Adding the plpgsql langauge to the dgu database ..."
-    sudo -u postgres createlang plpgsql dgu &> /dev/null
-    echo "Installing PostGIS extensions ..."
-    sudo -u postgres psql -d dgu -f /usr/share/postgresql/8.4/contrib/postgis.sql &> /dev/null
-    sudo -u postgres psql -d dgu -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql &> /dev/null
-    echo "Setting PostGIS permissions for CKAN and initialising tables ..."
-    sudo -u postgres psql -d dgu -c "ALTER TABLE geometry_columns OWNER TO dgu" &> /dev/null
-    sudo -u postgres psql -d dgu -c "ALTER TABLE spatial_ref_sys OWNER TO dgu" &> /dev/null
-    sudo paster --plugin=ckanext-spatial spatial initdb --config=/etc/ckan/dgu/dgu.ini &> /dev/null
-fi
-
-# Set any plugins needed
-echo "Ensuring the latest plugins are configured ..."
-sed -e "s,^\(ckan.plugins\)[ =].*,\1 = dgu_form_api cswserver harvest gemini_harvester gemini_doc_harvester gemini_waf_harvester inspire_api wms_preview spatial_query dgu_theme_embedded qa dgu_auth_api," \
-    -i /etc/ckan/dgu/dgu.ini
-
-# Overwrite the existing Apache config
-if [ -f /etc/apache2/sites-enabled/default ] ; then
-    echo "Disabling the default Apache site ..."
-    a2dissite default
-fi
-
-echo "Overwriting the existing Apache config ..."
-overwrite_apache_config dgu catalog.data.gov.uk dgu-live.okfn.org
-
-# Make sure mod_rewrite is enabled
-if ! [ -f /etc/apache2/mods-enabled/rewrite ] ; then
-    echo "Enabling Apache mod_rewite ..."
-    a2enmod rewrite
-fi
-
-
-# Standard paster db upgrade
-echo "Performing any database upgrades ..."
-paster --plugin=ckan db upgrade --config=/etc/ckan/dgu/dgu.ini &> /dev/null
-
-# Make sure our instance is enabled
-echo "Bringing the dgu instance out of maintenance mode ..."
-ckan-instance-maintenance ${instance} off
-
-# Restart Apache so it is aware of any changes
-echo "Restarting apache ..."
-/etc/init.d/apache2 restart &> /dev/null
-
-# Install the new crontab
-echo "Enabling crontab for the ckan user ..."
-PACKAGED_CRONJOB="/tmp/${instance}-cronjob"
-cat <<EOF > ${PACKAGED_CRONJOB}
-# WARNING:  Do not edit these cron tabs, they will be overwritten any time 
-#           the ckan-dgu package is upgraded
-# QUESTION: Should email reports be sent to root?
-# Gov Daily
-# 31               23  *   *   *   python /usr/lib/pymodules/python2.6/ckanext/dgu/bin/gov-daily.py /etc/ckan/dgu/dgu.ini
-# Try to start the harvester consumers in case they have stopped
-*/10              *  *   *   *   /etc/init.d/dgu_harvest_gather start
-*/10              *  *   *   *   /etc/init.d/dgu_harvest_fetch start
-# Then run the harvester 1 minute after any fetch or gather restart
-# 1,11,21,31,41,51  *  *   *   *   paster --plugin=ckanext-harvest harvester run --config=/etc/ckan/dgu/dgu.ini
-# Update the package 5 star scores once a month
-# 0                 0  1   *   *   paster --plugin=ckanext-qa update-scores update --config=/etc/ckan/dgu/dgu.ini
-EOF
-crontab -u ckan ${PACKAGED_CRONJOB}
-echo "done."
-


--- a/ckan/DEBIAN/prerm	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-#!/bin/sh
-set -e
-


--- a/ckan/usr/bin/ckan-create-instance	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-#!/bin/bash
-
-# This could becaome part of a ckan-install-instance script shipped with the ckan package.
-# That script could then be called by the ckan-dgu postinstall
-
-set -e
-
-if [ "X$1" = "X" ] || [ "X$2" = "X" ] || [ "X$3" = "X" ]; then
-    echo "ERROR: call this script with instance name and (apache) servername, e.g." 
-    echo "       $0  dgu   dgu-dev.okfn.org www.ckan.net"
-    exit 1
-fi
-
-instance=$1
-ServerName=$2
-ServerAlias=$3
-password=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c10`
-wsgi_path="`python -c 'import ckan; print ckan.__path__[0]'`/wsgi.py"
-
-mkdir -p -m 0755 /etc/ckan/${instance}
-mkdir -p -m 2750 /var/lib/ckan/${instance}{,/static}
-mkdir -p -m 2770 /var/{backup,log}/ckan/${instance} /var/lib/ckan/${instance}/{data,sstore,static/dump}
-
-cp -n /usr/share/pyshared/ckan/config/who.ini /etc/ckan/${instance}/who.ini
-sed -e "s,%(here)s,/var/lib/ckan/${instance}," \
-    -i /etc/ckan/${instance}/who.ini
-
-echo "Creating a ${instance} config for CKAN..."
-paster make-config ckan /etc/ckan/${instance}/${instance}.ini
-sed -e "s,^\(email_to\)[ =].*,\1 = root," \
-    -e "s,^\(error_email_from\)[ =].*,\1 = ckan-${instance}@`hostname`," \
-    -e "s,^\(cache_dir\)[ =].*,\1 = /var/lib/ckan/${instance}/data," \
-    -e "s,^\(who.config_file\)[ =].*,\1 = /etc/ckan/${instance}/who.ini," \
-    -e "s,%(here)s,/var/lib/ckan/${instance}," \
-    -e "s,^\(sqlalchemy.url\)[ =].*,\1 = postgresql://${instance}:${password}@localhost/${instance}," \
-    -i /etc/ckan/${instance}/${instance}.ini
-echo "done."
-
-echo "Setting up a postgres database and user..."
-su postgres -c "psql -c \"CREATE USER \"${instance}\" WITH PASSWORD '${password}'\""
-echo "The password chosen is ${password}, it has been added to your ${instance}.ini file automatically"
-echo "Creating the database..."
-su postgres -c "createdb -O ${instance} ${instance}"
-echo "done."
-echo "Installing the CKAN tables..."
-paster --plugin=ckan db upgrade --config=/etc/ckan/${instance}/${instance}.ini
-echo "done."
-echo "Found Apache script in ${wsgi_path}, creating symlink from /etc/ckan/${instance}/${instance}.py"
-ln -s ${wsgi_path} /etc/ckan/${instance}/${instance}.py
-cat <<EOF > /etc/apache2/sites-available/${instance}.common
-
-    # WARNING: Do not manually edit this file, it is desgined to be 
-    #          overwritten at any time by the postinst script of 
-    #          dependent packages
-
-    # These are common settings used for both the normal and maintence modes
-
-    DocumentRoot /var/lib/ckan/${instance}/static
-    ServerName ${ServerName}
-    ServerAlias ${ServerAlias}
-
-    <Directory />
-        deny from all
-    </Directory>
-
-    <Directory /etc/ckan/${instance}/>
-        allow from all
-    </Directory>
-
-    <Directory /var/lib/ckan/${instance}/static>
-        allow from all
-    </Directory>
-
-    Alias /dump /var/lib/ckan/${instance}/static/dump
-
-    # Disable the mod_python handler for static files
-    <Location /dump>
-        SetHandler None
-        Options +Indexes
-    </Location>
-
-    # this is our app
-    WSGIScriptAlias / /etc/ckan/${instance}/${instance}.py
-
-    # pass authorization info on (needed for rest api)
-    WSGIPassAuthorization On
-
-    ErrorLog /var/log/apache2/${instance}.error.log
-    CustomLog /var/log/apache2/${instance}.custom.log combined
-EOF
-cat <<EOF > /etc/apache2/sites-available/${instance} 
-<VirtualHost *:80>
-    # WARNING: Do not manually edit this file, it is desgined to be 
-    #          overwritten at any time by the postinst script of 
-    #          dependent packages
-    Include /etc/apache2/sites-available/${instance}.common
-</VirtualHost>
-EOF
-cat <<EOF > /etc/apache2/sites-available/${instance}.maint
-<VirtualHost *:80>
-    # WARNING: Do not manually edit this file, it is desgined to be 
-    #          overwritten at any time by the postinst script of 
-    #          dependent packages
-    Include /etc/apache2/sites-available/${instance}.common
-
-    # Maintenance mode
-    RewriteEngine On
-    RewriteRule ^(.*)/new /return_503 [PT,L]
-    RewriteRule ^(.*)/create /return_503 [PT,L]      
-    RewriteRule ^(.*)/authz /return_503 [PT,L]
-    RewriteRule ^(.*)/edit /return_503 [PT,L]
-    RewriteCond %{REQUEST_METHOD} !^GET$ [NC]
-    RewriteRule (.*) /return_503 [PT,L]
-</VirtualHost>
-EOF
-echo "done."
-echo "Enabling Apache mod_rewite"
-a2enmod rewrite
-/etc/init.d/apache2 reload
-echo "done."
-echo "Please disable the default site by running 'sudo a2dissite default; sudo a2ensite ${instance};  sudo /etc/init.d/apache2 reload' before the CKAN site will be present"


--- a/ckan/usr/bin/ckan-instance-maintenance	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#!/bin/bash
-. /usr/lib/ckan/common.sh
-
-set -e
-
-# Un-comment for debugging
-
-# Check we are root
-if [[ $EUID -ne 0 ]]; then
-   echo "This script must be run as root"
-   exit 1
-fi
-
-error() { 
-    echo -e "${@}" 1>&2
-    exit 1
-}
-
-usage() {
-    error "ERROR: call this script with instance name and \"on\" or \"off\", e.g.\n       $0  dgu   on"
-}
-
-[ "X$1" = "X" ] || [ "X$2" = "X" ] && usage
-instance=$1
-command=$2
-
-for conf in /etc/apache2/sites-available/${instance}{,.maint} ; do
-    [ -f ${conf} ] || error "ERROR: ${conf} not found"
-done
-
-case $command in
-    on)
-        echo "Putting CKAN site \"${instance}\" into maintenance mode ..."
-        maintenance_on $instance
-        echo "done."
-        ;;
-    
-    off)
-        echo "Disabling maintenance mode for CKAN site \"${instance}\" ..."
-        maintenance_off $instance
-        echo "done."
-        ;;
-    *)
-        usage
-        ;;
-esac
-
-exit 0


--- a/deb.py	Wed Jun 15 11:56:41 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-#!/usr/bin/env python
-
-"""\
-Convert a Python package installed into a virtualenv into a Debian package automatically
-
-Usage:
-
-::
-
-    python deb.py /path/to/dir ckan 1.3~01+lucid http://ckan.org python-routes python-vdm python-pylons python-genshi python-sqlalchemy python-repoze.who python-repoze.who-plugins python-pyutilib.component.core python-migrate python-formalchemy python-sphinx
-
-For this to work you need a modern Ubuntu with these packages installed:
-
-::
-
-    sudo apt-get install -y python wget dh-make devscripts build-essential fakeroot cdbs
-
-There's a dependency on postfix. Choose internet site and the default hostname unless you know better.
-
-Once you have packages you'll want to put them in a repo. You can do that as described here:
-
-http://joseph.ruscio.org/blog/2010/08/19/setting-up-an-apt-repository/
-
-Then add them like this:
-
-::
-
-    cd /var/packages/debian/
-    sudo reprepro includedeb lucid ~/*.deb
-
-Todo
-
-* Make this convert all files in a virtualenv recursively
-* Automatically extract the dependencies using buildkit
-* Save the changelogs somewhere and put them back once they are updated
-
-
-"""
-
-import os 
-import sys
-from subprocess import Popen, check_call, CalledProcessError
-
-class DebBuilder(object):
-    def __init__(self, **env):
-        '''
-        @params
-        package_path - full path to the package to be packaged up (contains setup.py)
-        package - name of package
-        version - version number e.g. 0.1~04+lucid
-        homepage - homepage (goes into control file)
-        deps - names of debian packages that this one depends on
-        base - debian diretory in output directory
-        here - output directory
-        print_prefix - Prefix for print statements
-        '''
-        for param in ['package_path', 'package', 'version', 'here', 'base',
-                       'homepage', 'deps']:
-            assert param in env, 'Need to specify param %r' % param
-        if env['deps']:
-            assert isinstance(env['deps'], (list, tuple))
-        if not env.has_key('print_prefix'):
-            env['print_prefix'] = '\n #'
-        self.env = env
-        
-    def run(self, cmd, cwd=None):
-        '''Runs a command, substituting env variables.
-        Non-zero returncode raises CalledProcessError
-        '''
-        print '%s Deb: %s' % (self.env['print_prefix'], cmd % self.env)
-        if cwd:
-            print 'With cwd: %s' % cwd % self.env
-        process = check_call(cmd % self.env,
-                             shell=True,
-                             cwd=(cwd % self.env) if cwd else None)
-    
-    def create_debian(self):
-        '''
-        Takes some source code and puts it into a debian directory suitable
-        for packaging up. Caller must ensure CWD is one up from the package
-        source
-
-        Takes:
-          (package_path)/setup.py
-
-        Creates:
-          (here)/(package)-(version).tar.gz
-          (here)/python-(package)-(version)/debian/*
-
-        environment params:
-        package_path - full path to the package (contains setup.py)
-        package - name of package to be packaged up
-        version - version number e.g. 0.1~04+lucid
-        here - output directory
-
-        '''
-        assert os.path.exists(self.env['package_path'])
-        assert os.path.exists(os.path.join(self.env['package_path'], 'setup.py')), 'Could not find %r' % os.path.join(self.env['package_path'], 'setup.py')
-        self.env['package_parent_path'], self.env['original_package_folder'] = os.path.split(os.path.normpath(self.env['package_path']))
-        assert not os.path.exists("%(package_parent_path)s/%(package)s-%(version)s" % self.env), 'Folder in the way: %r' % '%(package_parent_path)s/%(package)s-%(version)s' % self.env
-        self.run('mv "%(original_package_folder)s" "%(package)s-%(version)s"', '%(package_parent_path)s')
-        try:
-            self.run('tar -cvzf "%(here)s/%(package)s-%(version)s.tar.gz" "%(package)s-%(version)s"', '%(package_parent_path)s')
-        finally:
-            self.run('mv "%(package)s-%(version)s" "%(original_package_folder)s"', '%(package_parent_path)s')
-#        self.run('mv "%(package)s-%(version)s.tar.gz" "%(here)s"')
-        self.run('tar -xf "%(package_parent_path)s/%(package)s-%(version)s.tar.gz" -C %(here)s')
-        self.run('mv "%(package)s-%(version)s" "python-%(package)s-%(version)s"', '%(here)s')
-        self.run("""export EDITOR="vi"
-                    export DEBFULLNAME="James Gardner"
-                    export DEBEMAIL="james.gardner at okfn.org"
-                    cd %(here)s/python-%(package)s-%(version)s
-                    dh_make -s -b -f "../%(package)s-%(version)s.tar.gz"
-                    """)
-        self.run('rm %(base)s/*ex')
-        self.run('rm %(base)s/*EX')
-        self.run('rm %(base)s/README.Debian')
-        self.run('rm %(base)s/README.source')
-
-##        process = check_call("""
-##            export EDITOR="vi"
-##            export DEBFULLNAME="James Gardner"
-##            export DEBEMAIL="james.gardner at okfn.org"
-##            mv "%(package)s" "%(package)s-%(version)s"
-##            tar -cvzf "%(package)s-%(version)s.tar.gz" "%(package)s-%(version)s"
-##            mv "%(package)s-%(version)s" "%(package)s"
-##            mv "%(package)s-%(version)s.tar.gz" "%(here)s"
-##            cd "%(here)s"
-##            tar -xf "%(package)s-%(version)s.tar.gz"
-##            mv "%(package)s-%(version)s" "python-%(package)s-%(version)s"
-##            cd "python-%(package)s-%(version)s"
-##            echo "\n" | dh_make  -s -b -f "../%(package)s-%(version)s.tar.gz"
-##            cd debian
-##            rm *ex *EX
-##            rm README.Debian
-##            rm README.source
-##            """%dict(
-##                package=package, 
-##                version=version, 
-##                here=here,
-##            ),
-##            shell=True,
-##        )
-##        process.communicate()
-##        return process.wait()
-
-    def update_rules(self):
-        fp = open(os.path.join(self.env['base'], 'rules'), 'wb')
-        control = fp.write("""\
-    #!/usr/bin/make -f
-
-    DEB_PYTHON_SYSTEM=pysupport
-
-    include /usr/share/cdbs/1/rules/debhelper.mk
-    include /usr/share/cdbs/1/class/python-distutils.mk""")
-        fp.close()
-
-    def update_change_log(self):
-        self.run("""
-            export DEBFULLNAME="James Gardner"
-            export DEBEMAIL="james.gardner at okfn.org"
-            dch -e
-            """, 
-                 cwd=self.env['base'],
-                )
-
-    def build(self):
-        self.run("""
-            export DEBFULLNAME="James Gardner"
-            export DEBEMAIL="james.gardner at okfn.org"
-            debuild -us -uc
-            """,
-                 cwd=self.env['base'],
-                 )
-
-    def cleanup(self):
-        self.run('rm -rf "%(here)s/python-%(package)s-%(version)s"')
-        self.run('rm -rf "%(here)s/python-%(package)s-%(version)s.tag.gz"')
-        self.run('mv "%(here)s/python-%(package)s-%(version)s.orig.tag.gz" "%(here)s/python-%(package)s-%(version)s.tag.gz"')
-
-    def update_control(self):
-        control_filepath = os.path.join(self.env['base'], 'control')
-        fp = open(control_filepath, 'r')
-        control = fp.read().split('\n')
-        fp.close()
-        control[1] = 'Section: main/web'
-        control[6] = 'Homepage: %(homepage)s' % self.env
-        control[4] = 'Build-Depends: cdbs (>= 0.4.49), debhelper (>= 7), python (>= 2.5), python-support'
-        control.insert(5, 'XS-Python-Version: >= 2.5')
-        control[11] = 'Depends: ${misc:Depends}, ${python:Depends}'
-        deps_str = ', '.join(self.env['deps'] or '')
-        control.insert(12, 'Recommends: %s' % deps_str)
-        control[13] = 'Description: %s'%(self.env['package'][:60])
-        control = control[:14]
-        fp = open(control_filepath, 'wb')
-        control = fp.write('\n'.join(control))
-        fp.close()
-
-    def handle_one(self):
-        '''
-        Takes some source code and puts it into a debian directory suitable
-        for packaging up.
-
-        @return success boolean
-
-        '''
-        try:
-            self.create_debian()
-            self.update_control()
-            self.update_rules()
-            self.update_change_log()
-            self.build()
-            self.cleanup()
-        except CalledProcessError, e:
-            print 'Command failed'
-            return False
-
-if __name__ == '__main__':
-    db = DebBuilder(
-                    package_path=os.getcwd(),
-                    package=sys.argv[2],
-                    version=sys.argv[3],
-                    homepage=sys.argv[4],
-                    deps=sys.argv[5:],
-                    base=os.path.join(os.getcwd(), 'python-%s-%s' % (sys.argv[2], sys.argv[3]), 'debian'),
-                    here=os.getcwd(),
-                    )
-    os.chdir(sys.argv[1])
-    if not db.handle_one():
-        sys.exit(1)
-

Repository URL: https://bitbucket.org/okfn/ckan-debs-public/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list