#---
## Not really a function it's supposed to parse the command line parameters
@@ -105,7 +105,7 @@ do
done
quill_rc
-if [[ ${QUILL_CONFIG_VERSION/0.2.2/1} != $QUILL_OLD_CONFIG_VERSION ]]; then
+if [[ ${QUILL_CONFIG_VERSION/0.2.2/1} != $QUILL_OUR_CONFIG_VERSION ]]; then
QUILL_MODE="reconfigure"
error_msg "Your quill settings are too old, forcing a reconfiguration!"
quill_rc
@@ -509,10 +509,7 @@ else
# add && where appropriate in DEPENDS
if [[ ${SPELL_OPTIONAL_DEPENDENCIES} != "" ]] || [[ ${SPELL_DEPENDENCIES}
!= "" ]]
then
- sed -e 's/^ *$//' -e 's/[^\\]$/& \&\&/' DEPENDS | tac |
- awk '{ if (removed!=1){ if (sub("&&$","") > 0){ removed=1 }}; print }'
|
- tac > temporary-DEPENDS
- mv temporary-DEPENDS DEPENDS
+ andand_lines DEPENDS
fi
if [[ "${SPELL_CONFLICTS}" != "" ]]
@@ -525,7 +522,7 @@ else
add_provides
fi
- # redo it for fmxml - so it works if the xml didn't contain a valid source
url
+ # redo it for QUILL_FETCH_MODE, perhaps it didn't fetch a valid source url
# first time for other modes
parse_spell_source_file_info
show_spell_source_file_info
@@ -554,12 +551,31 @@ else
if [[ "${BUILDISON}" == "BUILD, " ]]
then
- add_build
+ [[ -e $QUILL_TMP_DIR/${SPELL_SRC_FILE:-uag1au234gaugua} ]] ||
+ { error_msg "Bad or missing source: $SPELL_SRC_FILE"; exit 2; }
+
+ #message "Quill can try to autodetect the build system the package is
using."
+ #message "However for this the source tarball needs to be extracted (can
take a while)."
+ #if query "Do you want quill to try to autodetect the build system?" n
+ #then
+ # BS=$(detect_build_system)
+ # implement_build_system $BS
+ #else
+ add_build
+ #fi
fi
if [[ "${INSTALLISON}" == "INSTALL, " ]]
then
- add_install
+ if [[ -z $BS ]]; then
+ add_install
+ else
+ implement_install_system $BS
+ fi
+ fi
+
+ if [[ ! -z $BS ]]; then
+ add_bs_depends $BS
fi
#-if [[ "${POSTINSTALLISON}" == "POST_INSTALL, " ]]
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index 6f82726..3f2911b 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,12 @@
+2007-03-06 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libcore: fixed saved sudo and gpg default query answer
+ fixed versioning to not loop anymore
+ factored andand_lines out of quill
+ * libdetails: beautified hunt_src_dir, add_details dpesn't unexpand
globals
+ * libbuild: started work on detect_build_system and
implement_build_system
+ * quill: fake call detect_build_system; TODO: INSTALL, DEPENDS
+ * version: 0.2.4-rc1
+
2007-03-05 Andra?? "ruskie" Levstik <ruskie AT mages.ath.cx>
* libdetails: minor fixes to the src dir hunt code and
to the sf misc code, forgot a \, hopefully it will work now
diff --git a/var/lib/quill/modules/libbuild b/var/lib/quill/modules/libbuild
index 1e9f44e..d39c441 100644
--- a/var/lib/quill/modules/libbuild
+++ b/var/lib/quill/modules/libbuild
@@ -1,6 +1,5 @@
#---
## @Synopsis BUILD module for quill
-## @Note DONE
#---
BUILDISON=""
@@ -27,6 +26,100 @@ function add_build() {
fi
$EDITOR BUILD
}
+
+#---
+## @Synopsis ask and try to detect the build system by checking for marker
+## @Synopsis files in the tarball
+#---
+function detect_build_system() {
+ local bs SPELL SOURCE_CACHE
+
+ # we override some sorcery variables to make uncompress_unpack work
+ # uncompress so more file formats are supported than what tar -t can handle
+ # although currently hunt_src_url doesn't support anything else
+ SPELL=$SPELL_NAME
+ SOURCE_CACHE="$QUILL_TMP_DIR"
+ uncompress_unpack "$SPELL_SRC_FILE"
+ cd "$SPELL_SRC_DIR"
+
+ #check for markers
+ if [[ -e setup.py ]]; then
+ bs=python
+ elif [[ -e Rakefile ]]; then
+ bs=rake
+ elif [[ -e Makefile.PL ]]; then
+ bs=PerL
+ elif [[ -e Makefile.pl ]]; then
+ bs=perl
+ elif [[ -e .wscript ]]; then
+ bs=waf
+ elif [[ -e SConstruct ]]; then
+ bs=scons
+ elif [[ -e Makefile ]]; then
+ if [[ -e configure ]]; then
+ bs=make,configure
+ elif [[ -e autogen.sh ]]; then
+ bs=make,autogen,configure
+ else
+ bs=make
+ fi
+ elif [[ -e Jamfile ]]; then
+ if [[ -e configure ]]; then
+ bs=jam,configure
+ elif [[ -e autogen.sh ]]; then
+ bs=jam,autogen,configure
+ else
+ bs=jam
+ fi
+ else
+ error_msg "Couldn't determine the build system, please file a bug."
+ cd ..
+ rm -r "$SPELL_SRC_FILE"
+ return 1
+ fi
+
+ cd ..
+ rm -r "$SPELL_SRC_FILE"
+
+ message "Detected build system: $bs"
+ echo $bs
+}
+
+#---
+## @Synopsis creates a BUILD file according to the build system used
+## @Synopsis unless it is make,configure (default_build)
+#---
+function implement_build_system() {
+ local bs=$1
+ [[ $bs == make,configure ]] && return 0
+
+ if grep -q autogen <<< $bs; then
+ echo "./autogen.sh &&" >> BUILD
+ fi
+ if grep -q configure <<< $bs; then
+ cat <<"FEO" >> BUILD
+ ./configure --prefix=$INSTALL_ROOT/usr \
+ --sysconfdir=$INSTALL_ROOT/etc \
+ --localstatedir=$INSTALL_ROOT/var \
+ --mandir=$INSTALL_ROOT/usr/share/man \
+ --infodir=$INSTALL_ROOT/usr/share/info \
+ $OPTS &&
+ FEO
+ fi
+
+ case $bs in
+ rake) echo "rake" >> BUILD ;;
+ perl) echo "perl Makefile.pl" >> BUILD ;;
+ PerL) echo "perl Makefile.PL" >> BUILD ;;
+ python) echo "python setup.py" >> BUILD ;;
+ waf) echo "waf_build" >> BUILD ;;
+ scons) echo "scons PREFIX=$INSTALL_ROOT/usr" >> BUILD ;;
+ jam) echo "jam" >> BUILD ;;
+ make) echo "make" >> BUILD ;;
+ esac
+
+}
+
#---
##
## This software is free software; you can redistribute it and/or modify
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index dc1ae2f..9861812 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -59,6 +59,7 @@ function quill_hash_get() {
#---
function quill_rc() {
+ local saved
if [[ -f ${QUILL_OLD_QUILLRC} ]]
then
query_msg "With accordance to Source Mage standards moving"
@@ -78,27 +79,34 @@ function quill_rc() {
then
mkdir -p $QUILL_HOME_DIR
touch $QUILL_QUILLRC
- local quill_config_version=$QUILL_CONFIG_VERSION # can get overridden by
the sourcing
. $QUILL_QUILLRC # get the contents if there are any (for defaults)
message "${MESSAGE_COLOR}This will (re)create ${QUILL_QUILLRC} for
you${DEFAULT_COLOR}"
query_string GURU_NAME "${QUERY_COLOR}Please enter your name for the
HISTORY entries.${DEFAULT_COLOR}" "$GURU_NAME"
query_string GURU_EMAIL "${QUERY_COLOR}Please enter your email for the
HISTORY entries.${DEFAULT_COLOR}" "$GURU_EMAIL"
query_string QUILL_SPELL_DIR "${QUERY_COLOR}Where do you want to store
generated spells (absolute path)?${DEFAULT_COLOR}" "$QUILL_SPELL_DIR"
query_string QUILL_GIT_DIR "${QUERY_COLOR}Where is the dir that contains
your git grimoires if you have any (absolute path)?${DEFAULT_COLOR}"
"$QUILL_GIT_DIR"
- if query "Do you want to use sudo where possible?" ${QUILL_SUDO:-n}
- then
+
+ if [[ -z $QUILL_SUDO ]]; then
+ saved=n
+ else
+ [[ -z ${QUILL_SUDO/sudo bash/} ]] && saved=y || saved=n
+ fi
+ if query "Do you want to use sudo where possible?" $saved; then
# we need the bash since we call multiple commands at a time
# and sudo doesn't like just sudo -c "ls; ls; ls"
QUILL_SUDO="sudo bash"
else
QUILL_SUDO="su"
fi
- if query "Do you use guru GPG signatures?" n ; then
- query_list "${QUERY_COLOR}Please select one of the following keys as
the guru signing key${DEFAULT_COLOR}" GURU_GPGKEY "" $(gpg -K | sed -n
"/^sec[^#]/ s,^sec\s*[^/]*/\(\S*\)\s.*$,\1,p")
+
+ [[ -z $GURU_GPGKEY ]] && saved=n || saved=y
+ if query "Do you use guru GPG signatures?" $saved ; then
+ query_list "${QUERY_COLOR}Please select one of the following keys as
the guru signing key${DEFAULT_COLOR}" GURU_GPGKEY "$GURU_GPGKEY" $(gpg -K |
sed -n "/^sec[^#]/ s,^sec\s*[^/]*/\(\S*\)\s.*$,\1,p")
fi
+
message "Thank you. Now generating ${QUILL_QUILLRC}"
cat << QUA > $QUILL_QUILLRC
- QUILL_CONFIG_VERSION="$quill_config_version"
+ QUILL_CONFIG_VERSION="$QUILL_OUR_CONFIG_VERSION"
GURU_NAME="$GURU_NAME"
GURU_EMAIL="$GURU_EMAIL"
QUILL_SPELL_DIR="$QUILL_SPELL_DIR"
@@ -470,6 +478,18 @@ function dir_check() {
}
#---
+## @Synopsis adds && to all full lines not ending by and escape \ or last
line
+#---
+function andand_lines() {
+ local file="$1"
+ sed -e 's/^ *$//' -e 's/[^\\]$/& \&\&/' "$file" |
+ tac |
+ awk '{ if (removed!=1){ if (sub("&&$","") > 0){ removed=1 }}; print }' |
+ tac > "temporary-$file"
+ mv "temporary-$file" "$file"
+}
+
+#---
## @Synopsis prints a colored error message
#---
function error_msg() {
diff --git a/var/lib/quill/modules/libdepends
b/var/lib/quill/modules/libdepends
index b0f8293..e8a2f9b 100644
--- a/var/lib/quill/modules/libdepends
+++ b/var/lib/quill/modules/libdepends
@@ -53,6 +53,10 @@ function add_optional_dependencies() {
done
# "optional_depends ${j} \"enabled-option\" \"disabled-option\"
\"description\""
}
+
+function add_bs_depends() {
+ return
+}
#---
##
## This software is free software; you can redistribute it and/or modify
diff --git a/var/lib/quill/modules/libdetails
b/var/lib/quill/modules/libdetails
index 9a773d1..b4545d0 100644
--- a/var/lib/quill/modules/libdetails
+++ b/var/lib/quill/modules/libdetails
@@ -180,16 +180,17 @@ function hunt_src_dir(){
local compressor
message "Checking for the source directory..."
compressor=$(guess_compressor ${QUILL_TMP_DIR}/${SPELL_SRC_FILE})
+
case "$compressor" in
- bzip2|gzip|compress*|tar) SPELL_SRC_DIR=$(tar tf
"${QUILL_TMP_DIR}/${SPELL_SRC_FILE}" | \
- grep / | \
- sed -e "s=/.*$==g;q") || \
- (error_msg "Error: getting
path from tarball" && \
- return 1) ;;
- *) SPELL_SRC_DIR=${SPELL}-${VERSION} &&
- message "Unsupported format..." &&
- return 2 ;;
+ bzip2|gzip|compress*|tar) true ;;
+ *) SPELL_SRC_DIR=${SPELL}-${VERSION}
+ message "Unsupported format..."
+ return 2 ;;
esac
+ SPELL_SRC_DIR=$(tar tf "${QUILL_TMP_DIR}/${SPELL_SRC_FILE}" |
+ sed -n "1 s=/.*$==p") ||
+ { error_msg "Error: getting path from tarball" && return 1; }
+
message "Done.\n"
}
@@ -198,22 +199,25 @@ function hunt_src_dir(){
#---
function add_details(){
message "Generating the DETAILS file ..."
+ local spell_src_url="$SPELL_SRC_URL"
+ local spell_src_dir="$SPELL_SRC_DIR"
+ local spell_src_file="$SPELL_SRC_FILE"