From: Yaroslav Halchenko <debian@onerussian.com> Date: Thu, 7 Aug 2014 17:24:31 +0000 (-0400) Subject: RF: absorb neurodebian-repository into neurodebian package (and rename debconf variab... X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=54fc89546f03aa5efc1afcd27b4d1c0b23817a5f;p=neurodebian.git RF: absorb neurodebian-repository into neurodebian package (and rename debconf variables as well) --- diff --git a/debian/TODO b/debian/TODO index 33dfa55..0e69205 100644 --- a/debian/TODO +++ b/debian/TODO @@ -19,13 +19,13 @@ set -ex apt_file=/etc/apt/sources.list.d/local.list # clean up from a previous test -dpkg --purge neurodebian-repository neurodebian-keyring || : -echo PURGE | debconf-communicate neurodebian-repository || : +dpkg --purge neurodebian neurodebian-keyring || : +echo PURGE | debconf-communicate neurodebian || : rm -rf /tmp/apt $apt_file; mkdir -p /tmp/apt; cd /tmp/apt; rm -f neurodebian-*deb; apt-get update -y; apt-get install -y wget; -wget http://www.onerussian.com/tmp/neurodebian-repository_0.33~a1_all.deb; +wget http://www.onerussian.com/tmp/neurodebian_0.33~a1_all.deb; wget http://www.onerussian.com/tmp/neurodebian-keyring_0.33~a1_all.deb; # generate APT repo @@ -33,7 +33,7 @@ apt-get install -y dpkg-dev ; dpkg-scanpackages . /dev/null > Packages # Add it to the list of available echo "deb file:///tmp/apt ./" >| $apt_file; apt-get update # Install the beast -apt-get install -y --allow-unauthenticated neurodebian-repository +apt-get install -y --allow-unauthenticated neurodebian # Verify that it has correct entries release=$(grep -v '^[\s#]*$' /etc/apt/sources.list | head -1 | awk '{print $3;}') @@ -41,7 +41,7 @@ grep -E "^deb\s+http.* $release main\s*\$" /etc/apt/sources.list.d/neurodebian.s grep -E '^deb\s+http.* data main\s*$' /etc/apt/sources.list.d/neurodebian.sources.list # May be even retrospect stored debconf configuration apt-get install debconf-utils -debconf-get-selections | grep neurodebian-repository/release.*select.*auto +debconf-get-selections | grep neurodebian/release.*select.*auto # And apt-get must be working apt-get update # Make sure it is active diff --git a/debian/changelog b/debian/changelog index 6f7f9ee..319f133 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ neurodebian (0.33~a1) unstable; urgency=medium * New "upstream" release * New features: - - neurodebian and neurodebian-repository packages to provide 1-click + - neurodebian and neurodebian packages to provide 1-click NeuroDebian deployment on Debian/Ubuntu boxesw -- Yaroslav Halchenko <debian@onerussian.com> Mon, 28 Jul 2014 20:03:12 -0400 diff --git a/debian/control b/debian/control index 74bbc2b..3783534 100644 --- a/debian/control +++ b/debian/control @@ -12,31 +12,16 @@ XS-DM-Upload-Allowed: yes Package: neurodebian Architecture: all -Depends: ${misc:Depends}, neurodebian-repository -Recommends: neurodebian-desktop, neurodebian-popularity-contest +Pre-depends: python-minimal, wget +Depends: neurodebian-keyring, ${misc:Depends} +Recommends: netselect +Suggests: neurodebian-desktop, neurodebian-popularity-contest Description: turnkey platform for the neuroscience The NeuroDebian project integrates and maintain a variety of neuroscience-oriented (such as AFNI, FSL, PsychoPy, etc.) and many generic computational (such as condor, pandas, etc.) software projects within Debian. . - This meta-package depends on packages needed for a typical - NeuroDebian deployment, e.g. enabling the complementary NeuroDebian - repository of package backports and perspective packages not yet - available from stock Debian/Ubuntu. - - -Package: neurodebian-repository -Architecture: all -Pre-depends: python-minimal, wget -Depends: neurodebian-keyring, ${misc:Depends} -Recommends: netselect -Description: NeuroDebian APT repository installer - Besides making (neuro)scientific software available on stock Debian - systems, neuro.debian.net (and mirrors around the globe) provides - a repository with backport builds of the NeuroDebian-maintained - packages for all supported Debian and Ubuntu releases. - . This package enables NeuroDebian repository on top of the stock Debian or Ubuntu system. diff --git a/debian/neurodebian-repository.config b/debian/neurodebian-repository.config deleted file mode 100755 index 4d9ee97..0000000 --- a/debian/neurodebian-repository.config +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -set -e - -. /usr/share/debconf/confmodule - -db_capb backup # allow to go back, for that we implement that STATE loop - -debug() -{ - [ "${DEBCONF_DEBUG:-}" != "developer" ] || echo -e "D: $*" >&2 -} - -db_settitle neurodebian-repository/title - -if [ "$1" = "configure" ]; then - # Must have been called in preinst state, so no nd-configurerepo - # tool is yet installed, thus delay asking questions to - # whenever will be called in postinst state - which nd-configurerepo 1>/dev/null 2>&1 || exit 0 -fi - -# Create temporary directory which will be reused -export ND_AE_TEMPDIR=$(mktemp -d) -trap "rm -rf \"$ND_AE_TEMPDIR\"" TERM INT EXIT - -neurodebian_releases="auto" - -# This implements a simple state machine so the back button can be handled. -# taken from debconf demo example -STATE=1 -while [ "$STATE" != 0 -a "$STATE" != 8 ]; do - case $STATE in - 1) - export neurodebian_releases="$(ND_IFS=', ' nd-configurerepo --print-releases)" - debug "releases: $neurodebian_releases" - db_subst neurodebian-repository/release releases "$neurodebian_releases" - db_input medium neurodebian-repository/release || true - ;; - 2) - export neurodebian_mirrors="$(ND_IFS=', ' nd-configurerepo --print-mirrors)" - debug "mirrors: $neurodebian_mirrors" - db_subst neurodebian-repository/mirror mirrors "$neurodebian_mirrors" - db_input medium neurodebian-repository/mirror || true - mirror_selection_ret="$RET" - debug "mirror select return: <$mirror_selection_ret>" - ;; - 3) db_input medium neurodebian-repository/flavor || true ;; - 4) db_input medium neurodebian-repository/components || true ;; - 5) db_input low neurodebian-repository/overwrite || true ;; - 6) db_input low neurodebian-repository/suffix || true ;; - 7) db_input medium neurodebian-repository/run-update-note || true ;; - esac - - if db_go; then -# Ubuntus managed to remove netselect "to accompany apt-netselect" -# https://bugs.launchpad.net/ubuntu/+source/netselect/+bug/337377 -# So for now remove this mandatory demanding of netselect for "best", and -# rely on logic in nd-configurerepo to select default mirror (currently origin) -# as the 'best' -# -# case $STATE in -# 2) -# db_metaget neurodebian-repository/mirror value -# selected_mirror="$RET" -# # TODOs: -# # - handle custom -# # - separate out alias from url -# debug "selected mirror: $selected_mirror" -# if [ "$selected_mirror" = "best" ] && ! which netselect &>/dev/null; then -# if [ "$mirror_selection_ret" = "30 question skipped" ]; then -# # if the question was not even shown, we would -# # not get a chance to specify mirror, thus -# # better just fail altogether and demand intervention -# db_input high neurodebian-repository/netselect-cannot-be-used -# exit 1 -# else -# db_input high neurodebian-repository/netselect-not-found -# continue; -# fi -# fi -# esac - STATE=$(($STATE + 1)) - else - STATE=$(($STATE - 1)) - fi -done - -db_stop - diff --git a/debian/neurodebian-repository.install b/debian/neurodebian-repository.install deleted file mode 100644 index 93aa380..0000000 --- a/debian/neurodebian-repository.install +++ /dev/null @@ -1 +0,0 @@ -tools/nd-configurerepo usr/bin diff --git a/debian/neurodebian-repository.postinst b/debian/neurodebian-repository.postinst deleted file mode 100755 index dcae7cc..0000000 --- a/debian/neurodebian-repository.postinst +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -set -e - -. /usr/share/debconf/confmodule - - -case "$1" in - configure) - # obtain all the options and call nd-configurerepo - opts="--do-not-update" - db_get neurodebian-repository/release; [ "$RET" = "auto" ] || opts+=" -r '$RET'" - db_get neurodebian-repository/mirror; nd_mirror="${RET##* }" # get just a url if it came together with alias - db_get neurodebian-repository/flavor; nd_flavor="$RET" - db_get neurodebian-repository/components; nd_components="${RET// /}" - - db_get neurodebian-repository/overwrite; [ "$RET" = "true" ] && opts+=" --overwrite" || : - db_get neurodebian-repository/suffix; [ "$RET" = "" ] || opts+=" --suffix='$RET'" || : - - eval nd-configurerepo -m "$nd_mirror" -c "$nd_components" $opts - ;; - abort-upgrade|abort-remove|abort-deconfigure) - # nothing to do - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -#DEBHELPER# diff --git a/debian/neurodebian-repository.postrm b/debian/neurodebian-repository.postrm deleted file mode 100755 index 902c3f4..0000000 --- a/debian/neurodebian-repository.postrm +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -e - -case "$1" in - purge) - rm -f /etc/apt/sources.list.d/neurodebian.sources*.list - ;; - - remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/neurodebian-repository.templates b/debian/neurodebian-repository.templates deleted file mode 100644 index d2896c8..0000000 --- a/debian/neurodebian-repository.templates +++ /dev/null @@ -1,105 +0,0 @@ -Template: neurodebian-repository/title -Type: title -Description: NeuroDebian APT repository installer - - -Template: neurodebian-repository/release -Type: select -Choices: auto, ${releases} -Default: auto -Description: Release name of the base system - Specify for which Debian or Ubuntu release (e.g. wheezy or trusty). - . - If 'auto', Debian or Ubuntu release name will be deduced from - apt-cache policy. - - -Template: neurodebian-repository/mirror -Type: select -Choices: origin, best, custom, ${mirrors} -Default: best -Description: NeuroDebian mirror to use: - NeuroDebian project has a number of community-maintainer mirrors - around the globe. - . - If you do not know which mirror URL to choose, select among - . - - origin: original NeuroDebian repository - - best: will try to use netselect to select "closest" mirror. - Depending on the configuration of the firewall, and actual mirror - setup, might fail to select actually closest one. If netselect - is not available, default mirror (possibly 'origin') will be used. - - -Template: neurodebian-repository/flavor -Type: select -Choices: auto, libre, full -Default: auto -Description: NeuroDebian flavor to use: - NeuroDebian project adheres to Debian Free Software Guidelines and - has three areas of the archive in all suites/releases: - . - libre - only the DFSG-compliant materials - full - all three areas (main, contrib, non-free) - auto - determine which flavor to choose based on current output of - apt-cache policy ('full' -- if non-free (Debian) or multiverse - (Ubuntu) areas are enabled) - -Template: neurodebian-repository/components -Type: multiselect -Choices: software, data, devel -Default: software, data -Description: Select NeuroDebian repository components to enable - NeuroDebian repository provides - . - software - Packages containing software packages, often backports of stable - software releases for previous Debian/Ubuntu releases - devel - Additional "bleeding edge" software packages, which might not be a - good fit for being enabled by default. (Similar to Debian - experimental) - data - Packages containing data (e.g. atlases, sample datasets), often - required by software packages. Should generally be enabled. - - -Template: neurodebian-repository/overwrite -Type: boolean -Default: true -Description: Should existing NeuroDebian APT file be overridden? - If not allowed, configuration would fail if there is - an existing apt configuration file for the NeuroDebian. - -Template: neurodebian-repository/suffix -Type: string -Default: -Description: Additional suffix to use in the NeuroDebian APT file name - For instance if you would like to enable additional repository - (e.g. NeuroDebian devel) or release, without interfering with the - main/default configuration file. - -Template: neurodebian-repository/run-update-note -Type: note -Description: Upon completion of installation invoke update in your APT frontend. - For the installed NeuroDebian APT configuration to take an effect, - list of packages needs to be updated. This needs to be done - "manually" (e.g. apt-get update) upon completion of installation of - the neurodebian-repository package. - -Template: neurodebian-repository/netselect-not-found -Type: error -Description: netselect tool was not found - Please install netselect tool first (apt-get install netselect) or - choose a specific mirror. - -Template: neurodebian-repository/netselect-cannot-be-used -Type: error -Description: netselect tool was not found (no other mirror) - Please install netselect tool first (apt-get install netselect) - before installing/configuring this package, or run with a lower - DEBIAN_PRIORITY to choose a specific mirror. - diff --git a/debian/neurodebian.config b/debian/neurodebian.config new file mode 100755 index 0000000..5cec864 --- /dev/null +++ b/debian/neurodebian.config @@ -0,0 +1,89 @@ +#!/bin/bash +set -e + +. /usr/share/debconf/confmodule + +db_capb backup # allow to go back, for that we implement that STATE loop + +debug() +{ + [ "${DEBCONF_DEBUG:-}" != "developer" ] || echo -e "D: $*" >&2 +} + +db_settitle neurodebian/title + +if [ "$1" = "configure" ]; then + # Must have been called in preinst state, so no nd-configurerepo + # tool is yet installed, thus delay asking questions to + # whenever will be called in postinst state + which nd-configurerepo 1>/dev/null 2>&1 || exit 0 +fi + +# Create temporary directory which will be reused +export ND_AE_TEMPDIR=$(mktemp -d) +trap "rm -rf \"$ND_AE_TEMPDIR\"" TERM INT EXIT + +neurodebian_releases="auto" + +# This implements a simple state machine so the back button can be handled. +# taken from debconf demo example +STATE=1 +while [ "$STATE" != 0 -a "$STATE" != 8 ]; do + case $STATE in + 1) + export neurodebian_releases="$(ND_IFS=', ' nd-configurerepo --print-releases)" + debug "releases: $neurodebian_releases" + db_subst neurodebian/release releases "$neurodebian_releases" + db_input medium neurodebian/release || true + ;; + 2) + export neurodebian_mirrors="$(ND_IFS=', ' nd-configurerepo --print-mirrors)" + debug "mirrors: $neurodebian_mirrors" + db_subst neurodebian/mirror mirrors "$neurodebian_mirrors" + db_input medium neurodebian/mirror || true + mirror_selection_ret="$RET" + debug "mirror select return: <$mirror_selection_ret>" + ;; + 3) db_input medium neurodebian/flavor || true ;; + 4) db_input medium neurodebian/components || true ;; + 5) db_input low neurodebian/overwrite || true ;; + 6) db_input low neurodebian/suffix || true ;; + 7) db_input medium neurodebian/run-update-note || true ;; + esac + + if db_go; then +# Ubuntus managed to remove netselect "to accompany apt-netselect" +# https://bugs.launchpad.net/ubuntu/+source/netselect/+bug/337377 +# So for now remove this mandatory demanding of netselect for "best", and +# rely on logic in nd-configurerepo to select default mirror (currently origin) +# as the 'best' +# +# case $STATE in +# 2) +# db_metaget neurodebian/mirror value +# selected_mirror="$RET" +# # TODOs: +# # - handle custom +# # - separate out alias from url +# debug "selected mirror: $selected_mirror" +# if [ "$selected_mirror" = "best" ] && ! which netselect &>/dev/null; then +# if [ "$mirror_selection_ret" = "30 question skipped" ]; then +# # if the question was not even shown, we would +# # not get a chance to specify mirror, thus +# # better just fail altogether and demand intervention +# db_input high neurodebian/netselect-cannot-be-used +# exit 1 +# else +# db_input high neurodebian/netselect-not-found +# continue; +# fi +# fi +# esac + STATE=$(($STATE + 1)) + else + STATE=$(($STATE - 1)) + fi +done + +db_stop + diff --git a/debian/neurodebian.install b/debian/neurodebian.install new file mode 100644 index 0000000..93aa380 --- /dev/null +++ b/debian/neurodebian.install @@ -0,0 +1 @@ +tools/nd-configurerepo usr/bin diff --git a/debian/neurodebian.postinst b/debian/neurodebian.postinst new file mode 100755 index 0000000..97cbc86 --- /dev/null +++ b/debian/neurodebian.postinst @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +. /usr/share/debconf/confmodule + + +case "$1" in + configure) + # obtain all the options and call nd-configurerepo + opts="--do-not-update" + db_get neurodebian/release; [ "$RET" = "auto" ] || opts+=" -r '$RET'" + db_get neurodebian/mirror; nd_mirror="${RET##* }" # get just a url if it came together with alias + db_get neurodebian/flavor; nd_flavor="$RET" + db_get neurodebian/components; nd_components="${RET// /}" + + db_get neurodebian/overwrite; [ "$RET" = "true" ] && opts+=" --overwrite" || : + db_get neurodebian/suffix; [ "$RET" = "" ] || opts+=" --suffix='$RET'" || : + + eval nd-configurerepo -m "$nd_mirror" -c "$nd_components" $opts + ;; + abort-upgrade|abort-remove|abort-deconfigure) + # nothing to do + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/neurodebian.postrm b/debian/neurodebian.postrm new file mode 100755 index 0000000..902c3f4 --- /dev/null +++ b/debian/neurodebian.postrm @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +case "$1" in + purge) + rm -f /etc/apt/sources.list.d/neurodebian.sources*.list + ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/neurodebian.templates b/debian/neurodebian.templates new file mode 100644 index 0000000..9782c69 --- /dev/null +++ b/debian/neurodebian.templates @@ -0,0 +1,105 @@ +Template: neurodebian/title +Type: title +Description: NeuroDebian APT repository installer + + +Template: neurodebian/release +Type: select +Choices: auto, ${releases} +Default: auto +Description: Release name of the base system + Specify for which Debian or Ubuntu release (e.g. wheezy or trusty). + . + If 'auto', Debian or Ubuntu release name will be deduced from + apt-cache policy. + + +Template: neurodebian/mirror +Type: select +Choices: origin, best, custom, ${mirrors} +Default: best +Description: NeuroDebian mirror to use: + NeuroDebian project has a number of community-maintainer mirrors + around the globe. + . + If you do not know which mirror URL to choose, select among + . + - origin: original NeuroDebian repository + - best: will try to use netselect to select "closest" mirror. + Depending on the configuration of the firewall, and actual mirror + setup, might fail to select actually closest one. If netselect + is not available, default mirror (possibly 'origin') will be used. + + +Template: neurodebian/flavor +Type: select +Choices: auto, libre, full +Default: auto +Description: NeuroDebian flavor to use: + NeuroDebian project adheres to Debian Free Software Guidelines and + has three areas of the archive in all suites/releases: + . + libre + only the DFSG-compliant materials + full + all three areas (main, contrib, non-free) + auto + determine which flavor to choose based on current output of + apt-cache policy ('full' -- if non-free (Debian) or multiverse + (Ubuntu) areas are enabled) + +Template: neurodebian/components +Type: multiselect +Choices: software, data, devel +Default: software, data +Description: Select NeuroDebian repository components to enable + NeuroDebian repository provides + . + software + Packages containing software packages, often backports of stable + software releases for previous Debian/Ubuntu releases + devel + Additional "bleeding edge" software packages, which might not be a + good fit for being enabled by default. (Similar to Debian + experimental) + data + Packages containing data (e.g. atlases, sample datasets), often + required by software packages. Should generally be enabled. + + +Template: neurodebian/overwrite +Type: boolean +Default: true +Description: Should existing NeuroDebian APT file be overridden? + If not allowed, configuration would fail if there is + an existing apt configuration file for the NeuroDebian. + +Template: neurodebian/suffix +Type: string +Default: +Description: Additional suffix to use in the NeuroDebian APT file name + For instance if you would like to enable additional repository + (e.g. NeuroDebian devel) or release, without interfering with the + main/default configuration file. + +Template: neurodebian/run-update-note +Type: note +Description: Upon completion of installation invoke update in your APT frontend. + For the installed NeuroDebian APT configuration to take an effect, + list of packages needs to be updated. This needs to be done + "manually" (e.g. apt-get update) upon completion of installation of + the neurodebian package. + +Template: neurodebian/netselect-not-found +Type: error +Description: netselect tool was not found + Please install netselect tool first (apt-get install netselect) or + choose a specific mirror. + +Template: neurodebian/netselect-cannot-be-used +Type: error +Description: netselect tool was not found (no other mirror) + Please install netselect tool first (apt-get install netselect) + before installing/configuring this package, or run with a lower + DEBIAN_PRIORITY to choose a specific mirror. + diff --git a/tools/tests/test_neurodebian-repository-deployment b/tools/tests/test_neurodebian-repository-deployment index 19e9a17..0a4583a 100755 --- a/tools/tests/test_neurodebian-repository-deployment +++ b/tools/tests/test_neurodebian-repository-deployment @@ -5,13 +5,13 @@ set -ex apt_file=/etc/apt/sources.list.d/local.list # clean up from a previous test -dpkg --purge neurodebian-repository neurodebian-keyring || : -echo PURGE | debconf-communicate neurodebian-repository || : +dpkg --purge neurodebian neurodebian-keyring || : +echo PURGE | debconf-communicate neurodebian || : rm -rf /tmp/apt $apt_file; mkdir -p /tmp/apt; cd /tmp/apt; rm -f neurodebian-*deb; apt-get update -y; apt-get install -y wget; -wget http://www.onerussian.com/tmp/neurodebian-repository_0.33~a1_all.deb; +wget http://www.onerussian.com/tmp/neurodebian_0.33~a1_all.deb; wget http://www.onerussian.com/tmp/neurodebian-keyring_0.33~a1_all.deb; # generate APT repo @@ -19,7 +19,7 @@ apt-get install -y dpkg-dev ; dpkg-scanpackages . /dev/null > Packages # Add it to the list of available echo "deb file:///tmp/apt ./" >| $apt_file; apt-get update # Install the beast -apt-get install -y --allow-unauthenticated neurodebian-repository +apt-get install -y --allow-unauthenticated neurodebian # Verify that it has correct entries # Very cruel way to figure out the default release. Would fail if # options, such as multiarch, are specified after deb @@ -28,7 +28,7 @@ grep -E "^deb\s+http.* $release main\s*\$" /etc/apt/sources.list.d/neurodebian.s grep -E '^deb\s+http.* data main\s*$' /etc/apt/sources.list.d/neurodebian.sources.list # May be even retrospect stored debconf configuration apt-get install debconf-utils -debconf-get-selections | grep neurodebian-repository/release.*select.*auto +debconf-get-selections | grep neurodebian/release.*select.*auto # And apt-get must be working apt-get update # Make sure it is active