[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.49-69-g53033af
Andreas Beckmann
anbe at debian.org
Fri Feb 22 21:26:09 UTC 2013
The following commit has been merged in the develop branch:
commit a3649aaf6ffad2629af19b19c2d5800bb0d8279d
Author: Andreas Beckmann <anbe at debian.org>
Date: Wed Feb 20 19:48:01 2013 +0100
read_config.sh: support RFC822 wrapped+indented lines
it is also allowed to have non-indented comments between
wrapped+indented lines
python ConfigParser supports this, too
(and I really want to split+wrap the '[global] sections = ...' line)
Signed-off-by: Andreas Beckmann <anbe at debian.org>
diff --git a/debian/changelog b/debian/changelog
index 3d3e364..4ffab90 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,7 @@ piuparts (0.50) UNRELEASED; urgency=low
* debian/rules: Set 'prefix' and 'DESTDIR' for build and install.
* lib/read_config.sh: Factored out the piuparts.conf reading function that
is used by all master/slave shell scripts. Shipped in piuparts.common.
+ - Add support for RFC822 line continuation (wrap + indent) and comments.
* master-bin/slave-bin: Switch to sourcing read_config.sh.
* pre_install_exceptions: Handle bootcd-ia64 installation in squeeze.
* post_distupgrade_exceptions: Handle libdb4.8 removal in wheezy.
diff --git a/lib/read_config.sh b/lib/read_config.sh
index 6a43692..0962750 100644
--- a/lib/read_config.sh
+++ b/lib/read_config.sh
@@ -1,4 +1,4 @@
-# Copyright © 2011 Andreas Beckmann <debian at abeckmann.de>
+# Copyright © 2011, 2013 Andreas Beckmann <anbe at debian.org>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -30,7 +30,7 @@ get_config_value()
test -n "$1" && test "$1" = "$(echo "$1" | tr -c -d '[:alnum:]_')" || exit 1
section="$2"
key="$3"
- value="$(sed -rn '\#^\['"$section"'\]#,/^\[/ {/^'"$key"'\s*=/ {s/^'"$key"'\s*=\s*//; s/\s*$//; p}}' "$PIUPARTS_CONF")"
+ value="$(sed -rn '\#^\['"$section"'\]#,/^\[/ {/^'"$key"'\s*=/,/^[^ \t#]/ {/^#/d; /^'"$key"'\s*=|^\s/!d; s/^'"$key"'\s*=\s*//; s/^\s*//; s/\s*$//; /^$/d; p}}' "$PIUPARTS_CONF")"
test -n "$value" || value="$4"
if [ -z "$value" ]; then
echo "'$key' not set in section [$section] of $PIUPARTS_CONF, exiting." >&2
--
piuparts git repository
More information about the Piuparts-commits
mailing list