]> git.sur5r.net Git - kconfig-frontends/commitdiff
ksync: also get kernel changeset
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue, 24 Jan 2012 21:45:59 +0000 (22:45 +0100)
committerYann E. MORIN" <yann.morin.1998@free.fr>
Tue, 24 Jan 2012 21:45:59 +0000 (22:45 +0100)
When syncing the parser+frontends, also grab the kernel changeset
we are syncing from, for later forensics, if needed.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
.version
configure.ac
ksync.sh
scripts/version.sh [new file with mode: 0755]

index cbb0de2b6f39c0aca03856a9fb54d976e10bd53a..9d268f9fc6cf3850e51d195e1453e1f21ebb7aef 100644 (file)
--- a/.version
+++ b/.version
@@ -1 +1,2 @@
+3.3.0-rc1 4a7cbb56fdbd92a47f57ca8b25bf5db35f0d6518 Saber-toothed Squirrel
 hg
index 837999d4a8d7adb860c86eee09b563d4df123e37..9cedf96a9c6815f55cac246b755ab6338167d0ea 100644 (file)
@@ -2,7 +2,10 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.67])
-AC_INIT([kconfig-frontends], [m4_esyscmd_s([cat .version])], [nobody@nowhere.org])
+AC_INIT(
+    [kconfig-frontends],
+    [m4_esyscmd_s([./scripts/version.sh])],
+    [nobody@nowhere.org])
 AC_CONFIG_SRCDIR([frontends/conf/conf.c])
 # Use a config.h to avoid brazilions -DHAVE_FOO on compile lines
 AC_CONFIG_HEADERS([config.h])
index c8a2dc1aac4cb464a2bedb2255a7009415999d20..9be213d81b50640fb62969d714009c33c696e656 100755 (executable)
--- a/ksync.sh
+++ b/ksync.sh
@@ -5,15 +5,7 @@ my_name="${0##*/}"
 # If an argument is given, it's the location
 # of the Linux kernel source tree
 k_dir="${1}"
-if [ -n "${k_dir}" -a -d "${k_dir}/kernel" ]; then
-    # Get the version
-    eval $( head -n 5 "${k_dir}/Makefile"                       \
-            |sed -r -e 's/^/K_/; s/"//g; s/ = ?/="/; s/$/"/;'   \
-          )
-    printf "Found Linux kernel %d.%d.%d%s '%s'\n"           \
-          "${K_VERSION}" "${K_PATCHLEVEL}" "${K_SUBLEVEL}"  \
-          "${K_EXTRAVERSION}" "${K_NAME}"
-else
+if [ ! \( -n "${k_dir}" -a -d "${k_dir}/kernel" \) ]; then
     if [ -n "${k_dir}" ]; then
         printf "%s: \`%s': not a Linux kernel source tree\n"    \
                "${my_name}" "${k_dir}"
@@ -23,8 +15,29 @@ else
     exit 1
 fi
 
-exec <misc/kernel2kfrontends.list
+# Get the kernel version
+eval $( head -n 5 "${k_dir}/Makefile"                       \
+        |sed -r -e 's/^/K_/; s/"//g; s/ = ?/="/; s/$/"/;'   \
+      )
+k_cset="$( cd "${k_dir}";                   \
+           git log -n 1 --pretty='format:%H' \
+         )"
+printf "Found Linux kernel %d.%d.%d%s '%s' (%7.7s)\n"   \
+       "${K_VERSION}" "${K_PATCHLEVEL}" "${K_SUBLEVEL}" \
+       "${K_EXTRAVERSION}" "${K_NAME}" "${k_cset}"
+
+# Get the kconfig-frontends version
+kf_version="$( tail -n 1 .version )"
 
+# Store the new version
+printf "%d.%d.%d%s %s %s\n%s\n"             \
+       "${K_VERSION}" "${K_PATCHLEVEL}"     \
+       "${K_SUBLEVEL}" "${K_EXTRAVERSION}"  \
+       "${k_cset}" "${K_NAME}"              \
+       "${kf_version}"                      \
+       >.version
+
+exec <misc/kernel2kfrontends.list
 while read k_file trash kf_file; do
     cp -v "${k_dir}/${k_file}" "${kf_file}"
     if [ -f "${kf_file}.patch" ]; then
diff --git a/scripts/version.sh b/scripts/version.sh
new file mode 100755 (executable)
index 0000000..36bb0ca
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+k_ver="$(  head -n 1 .version |cut -d ' ' -f 1  )"
+k_cset="$( head -n 1 .version |cut -d ' ' -f 2  )"
+k_name="$( head -n 1 .version |cut -d ' ' -f 3- )"
+kf_ver="$( tail -n 1 .version                   )"
+
+case "${k_ver}" in
+    *-rc*)  k_ver="${k_ver}_$( printf "%-7.7s" "${k_cset}" )";;
+    *)      ;;
+esac
+k_ver="$( echo "${k_ver}" |tr '-' '_' )"
+
+case "${kf_ver}" in
+    hg) kf_ver="-hg_$( hg id -i -r . )";;
+    "") kf_ver="";;
+    *)  kf_ver="-${kf_ver}";;
+esac
+
+echo "${k_ver}${kf_ver}"