From 3e459c3da6338dccafefae87823f1649b2a9d59b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 8 Aug 2014 14:05:52 -0400 Subject: [PATCH] ENH: report to debconf interface what would be the release/flavor to be used if 'auto' gets selected --- debian/neurodebian.config | 13 ++++++++++--- debian/neurodebian.templates | 11 ++++++----- tools/nd-configurerepo | 24 +++++++++++++++++++++--- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/debian/neurodebian.config b/debian/neurodebian.config index 5cec864..ea6f628 100755 --- a/debian/neurodebian.config +++ b/debian/neurodebian.config @@ -31,20 +31,27 @@ STATE=1 while [ "$STATE" != 0 -a "$STATE" != 8 ]; do case $STATE in 1) - export neurodebian_releases="$(ND_IFS=', ' nd-configurerepo --print-releases)" + neurodebian_releases="$(ND_IFS=', ' nd-configurerepo --print-releases)" + debian_release="$(ND_IFS=', ' nd-configurerepo --print-release)" + if [ -z "$debian_release" ]; then # just a failover + debian_release="sid" + fi debug "releases: $neurodebian_releases" db_subst neurodebian/release releases "$neurodebian_releases" + db_subst neurodebian/release release "$debian_release" db_input medium neurodebian/release || true ;; 2) - export neurodebian_mirrors="$(ND_IFS=', ' nd-configurerepo --print-mirrors)" + 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 ;; + 3) neurodebian_flavor="$(ND_IFS=', ' nd-configurerepo --print-flavor)" + db_subst neurodebian/flavor flavor "$neurodebian_flavor" + 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 ;; diff --git a/debian/neurodebian.templates b/debian/neurodebian.templates index 9782c69..1d54520 100644 --- a/debian/neurodebian.templates +++ b/debian/neurodebian.templates @@ -10,8 +10,10 @@ 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. + If 'auto', Debian or Ubuntu release name will be '${release}' as + deduced from the output of apt-cache policy. If the release of your + system is not '${release}' -- please choose specific one which + matches best. Template: neurodebian/mirror @@ -44,9 +46,8 @@ Description: NeuroDebian flavor to use: 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) + according to output of apt-cache policy '${flavor}' will be used. + If that is not the flavor you need, select manually another one. Template: neurodebian/components Type: multiselect diff --git a/tools/nd-configurerepo b/tools/nd-configurerepo index 72993d4..5720fe8 100755 --- a/tools/nd-configurerepo +++ b/tools/nd-configurerepo @@ -37,6 +37,8 @@ ae_defun_only=${ND_AE_DEFUN_ONLY:-} # mode to source this file as a "library" ae_sudo= exe_dir=$(dirname $0) +do_print_release= +do_print_flavor= # TODOs: # - apt priority! (so we could avoid automagic upgrades etc) @@ -116,13 +118,19 @@ Options: of Debian or Ubuntu origin with highest priority. --print-releases - Return a list of releases present in NeuroDebian repository. + Print a list of releases present in NeuroDebian repository. + + --print-release + Print the release deduced from the output of apt-cache policy. -f, --flavor=full|libre Which flavor of the repository should be enabled: libre -- Only main component, containing only DFSG-compliant content. full -- Includes main, contrib, and non-free. - If not specified -- deduced from the output of apt-cache policy + If not specified -- deduced from the output of apt-cache policy. + + --print-flavor + Print the flavor deduced from the output of apt-cache policy. -c, --components=c1,c2,c3 Comma separated list of components to enable among: @@ -362,7 +370,7 @@ assure_command_from_package() # Note that we use `"$@"' to let each command-line parameter expand to a # separate word. The quotes around `$@' are essential! # We need CLOPTS as the `eval set --' would nuke the return value of getopt. -CLOPTS=`getopt -o h,r:,m:,f:,c:,q,v,n --long help,version,quiet,verbose,mirror:,release:,flavor:,components:,suffix:,overwrite,sources,no-sources,install,dry-run,do-not-update,print-releases,print-mirrors,print-best-mirror -n 'nd-configurerepo' -- "$@"` +CLOPTS=`getopt -o h,r:,m:,f:,c:,q,v,n --long help,version,quiet,verbose,mirror:,release:,flavor:,components:,suffix:,overwrite,sources,no-sources,install,dry-run,do-not-update,print-releases,print-release,print-mirrors,print-best-mirror,print-flavor -n 'nd-configurerepo' -- "$@"` if [ $? != 0 ] ; then error 2 "Problem with parsing cmdline. Terminating..." @@ -384,6 +392,8 @@ while true ; do --print-mirrors) get_mirrors; exit 0;; --print-best-mirror) netselect_mirror; exit 0;; --print-releases) get_releases; exit 0;; + --print-release) do_print_release=1; shift;; + --print-flavor) do_print_flavor=1; shift;; -n|--dry-run) ae_dry_run=1; shift;; --suffix) shift; ae_suffix="$1"; shift;; --overwrite) ae_overwrite="$1"; shift;; @@ -419,10 +429,18 @@ apt_policy=$(get_apt_policy "Debian,Ubuntu" ) if [ -z "$ae_release" ]; then ae_release=$(echo "$apt_policy" | head -1 | sed -e 's/.*,n=\([^,]*\),.*/\1/g') + if [ ! -z "$do_print_release" ]; then + echo $ae_release + exit 0 + fi fi if [ -z "$ae_flavor" ]; then ae_flavor=$(echo "$apt_policy" | grep -e ",n=$ae_release," | grep -qe 'c=\(non-free\|multiverse\)' && echo "full" || echo "libre") + if [ ! -z "$do_print_flavor" ]; then + echo $ae_flavor + exit 0 + fi fi # -- 2.39.2