2012-08-06 18:55:15

by Ozan Çağlayan

[permalink] [raw]
Subject: [PATCH 1/2] compat-wireless: Minor cosmetic changes in admin-update.sh

- Move functions above everything,
- Use $HOME instead of /home/$USER which fails when run as root,
- Enhance comments
- Mention about compat/bin/get-compat-trees for fetching the trees.

Signed-off-by: Ozan Çağlayan <[email protected]>
---
scripts/admin-update.sh | 175 +++++++++++++++++++++++++++++-------------------
1 file changed, 105 insertions(+), 70 deletions(-)

diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh
index bcd17b8..3558801 100755
--- a/scripts/admin-update.sh
+++ b/scripts/admin-update.sh
@@ -12,29 +12,6 @@
# You can specify where your GIT_TREE is by doing:
#
# export GIT_TREE=/home/mcgrof/linux-next/
-#
-# for example
-#
-GIT_URL="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
-GIT_COMPAT_URL="git://github.com/mcgrof/compat.git"
-
-INCLUDE_NET_BT="hci_core.h l2cap.h bluetooth.h rfcomm.h hci.h hci_mon.h mgmt.h sco.h smp.h a2mp.h"
-NET_BT_DIRS="bluetooth bluetooth/bnep bluetooth/cmtp bluetooth/rfcomm bluetooth/hidp"
-
-INCLUDE_LINUX="ieee80211.h nl80211.h"
-INCLUDE_LINUX="$INCLUDE_LINUX pci_ids.h eeprom_93cx6.h"
-INCLUDE_LINUX="$INCLUDE_LINUX ath9k_platform.h"
-INCLUDE_LINUX="$INCLUDE_LINUX wl12xx.h"
-INCLUDE_LINUX="$INCLUDE_LINUX rndis.h"
-
-# For rndis_wext
-INCLUDE_LINUX_USB="usbnet.h rndis_host.h"
-
-INCLUDE_LINUX_SPI="libertas_spi.h"
-
-# The good new yummy stuff
-INCLUDE_NET="cfg80211.h ieee80211_radiotap.h cfg80211-wext.h"
-INCLUDE_NET="$INCLUDE_NET mac80211.h lib80211.h regulatory.h"

# Pretty colors
GREEN="\033[01;32m"
@@ -46,19 +23,71 @@ PURPLE="\033[35m"
CYAN="\033[36m"
UNDERLINE="\033[02m"

-NET_DIRS="wireless mac80211 rfkill"
+# File in which code metrics will be written
CODE_METRICS=code-metrics.txt

+# The GIT URL's for linux-next and compat trees
+GIT_URL="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
+GIT_COMPAT_URL="git://github.com/mcgrof/compat.git"
+
+####################
+# Helper functions #
+# ##################
+
+# Refresh patches using quilt
+patchRefresh() {
+ if [ -d patches.orig ] ; then
+ rm -rf .pc patches/series
+ else
+ mkdir patches.orig
+ fi
+
+ export QUILT_PATCHES=$1
+
+ mv -u $1/* patches.orig/
+
+ for i in patches.orig/*.patch; do
+ if [ ! -f "$i" ]; then
+ echo -e "${RED}No patches found in $1${NORMAL}"
+ break;
+ fi
+ echo -e "${GREEN}Refresh backport patch${NORMAL}: ${BLUE}$i${NORMAL}"
+ quilt import $i
+ quilt push -f
+ RET=$?
+ if [[ $RET -ne 0 ]]; then
+ echo -e "${RED}Refreshing $i failed${NORMAL}, update it"
+ echo -e "use ${CYAN}quilt edit [filename]${NORMAL} to apply the failed part manually"
+ echo -e "use ${CYAN}quilt refresh${NORMAL} after the files are corrected and rerun this script"
+ cp patches.orig/README $1/README
+ exit $RET
+ fi
+ QUILT_DIFF_OPTS="-p" quilt refresh -p ab --no-index --no-timestamp
+ done
+ quilt pop -a
+
+ cp patches.orig/README $1/README
+ rm -rf patches.orig .pc $1/series
+}
+
+###
+# usage() function
+###
usage() {
- printf "Usage: $0 [ refresh] [ --help | -h | -s | -n | -p | -c ]\n"
+ printf "Usage: $0 [refresh] [ --help | -h | -s | -n | -p | -c ]\n"

- printf "${GREEN}%10s${NORMAL} - will update your all your patch offsets using quilt\n" "refresh"
- printf "${GREEN}%10s${NORMAL} - get and apply pending-stable/ fixes purging old files there\n" "-s"
- printf "${GREEN}%10s${NORMAL} - apply the patches linux-next-cherry-picks directory\n" "-n"
- printf "${GREEN}%10s${NORMAL} - apply the patches on the linux-next-pending directory\n" "-p"
- printf "${GREEN}%10s${NORMAL} - apply the patches on the crap directory\n" "-c"
+ printf "${GREEN}%10s${NORMAL} - Update all your patch offsets using quilt\n" "refresh"
+ printf "${GREEN}%10s${NORMAL} - Get and apply pending-stable/ fixes purging old files there\n" "-s"
+ printf "${GREEN}%10s${NORMAL} - Apply the patches from linux-next-cherry-picks directory\n" "-n"
+ printf "${GREEN}%10s${NORMAL} - Apply the patches from linux-next-pending directory\n" "-p"
+ printf "${GREEN}%10s${NORMAL} - Apply the patches from crap directory\n" "-c"
}

+###
+# Code metrics related functions
+# 4 parameters get passed to them:
+# (ORIG_CODE, CHANGES, ADD, DEL)
+###
brag_backport() {
COMPAT_FILES_CODE=$(find ./ -type f -name \*.[ch] | egrep "^./compat/|include/linux/compat" |
xargs wc -l | tail -1 | awk '{print $1}')
@@ -134,6 +163,21 @@ nagometer() {

}

+# First check cmdline args to understand
+# which patches to apply and which release tag to set.
+#
+# Release tags (with corresponding cmdline switches):
+# ---------------------------------------------------
+# s: Include pending-stable/*.patch (-s)
+# n: Include linux-next-cherry-picks/*.patch (-n)
+# p: Include linux-next-pending/*.patch (-p)
+# c: Include crap/*.patch (-c)
+# Note that the patches under patches/ are applied by default.
+#
+# If "refresh" is given as a cmdline argument, the script
+# uses quilt to refresh the patches. This is useful if patches
+# can not be applied correctly after a code update in $GIT_URL.
+
EXTRA_PATCHES="patches"
REFRESH="n"
GET_STABLE_PENDING="n"
@@ -184,15 +228,18 @@ fi

# User exported this variable
if [ -z $GIT_TREE ]; then
- GIT_TREE="/home/$USER/linux-next/"
+ GIT_TREE="$HOME/linux-next/"
if [ ! -d $GIT_TREE ]; then
echo "Please tell me where your linux-next git tree is."
echo "You can do this by exporting its location as follows:"
echo
- echo " export GIT_TREE=/home/$USER/linux-next/"
+ echo " export GIT_TREE=$HOME/linux-next/"
echo
echo "If you do not have one you can clone the repository:"
echo " git clone $GIT_URL"
+ echo
+ echo "Alternatively, you can use get-compat-trees script "
+ echo "from compat.git tree to fetch the necessary trees."
exit 1
fi
else
@@ -200,21 +247,45 @@ else
fi

if [ -z $GIT_COMPAT_TREE ]; then
- GIT_COMPAT_TREE="/home/$USER/compat/"
+ GIT_COMPAT_TREE="$HOME/compat/"
if [ ! -d $GIT_COMPAT_TREE ]; then
echo "Please tell me where your compat git tree is."
echo "You can do this by exporting its location as follows:"
echo
- echo " export GIT_COMPAT_TREE=/home/$USER/compat/"
+ echo " export GIT_COMPAT_TREE=$HOME/compat/"
echo
echo "If you do not have one you can clone the repository:"
echo " git clone $GIT_COMPAT_URL"
+ echo
+ echo "Alternatively, you can use get-compat-trees script "
+ echo "from compat.git tree to fetch the necessary trees."
exit 1
fi
else
echo "You said to use git tree at: $GIT_COMPAT_TREE for compat"
fi

+# Now define what files to copy from $GIT_URL
+INCLUDE_NET_BT="hci_core.h l2cap.h bluetooth.h rfcomm.h hci.h hci_mon.h mgmt.h sco.h smp.h a2mp.h"
+NET_BT_DIRS="bluetooth bluetooth/bnep bluetooth/cmtp bluetooth/rfcomm bluetooth/hidp"
+
+INCLUDE_LINUX="ieee80211.h nl80211.h"
+INCLUDE_LINUX="$INCLUDE_LINUX pci_ids.h eeprom_93cx6.h"
+INCLUDE_LINUX="$INCLUDE_LINUX ath9k_platform.h"
+INCLUDE_LINUX="$INCLUDE_LINUX wl12xx.h"
+INCLUDE_LINUX="$INCLUDE_LINUX rndis.h"
+
+# For rndis_wext
+INCLUDE_LINUX_USB="usbnet.h rndis_host.h"
+
+INCLUDE_LINUX_SPI="libertas_spi.h"
+
+# The good new yummy stuff
+INCLUDE_NET="cfg80211.h ieee80211_radiotap.h cfg80211-wext.h"
+INCLUDE_NET="$INCLUDE_NET mac80211.h lib80211.h regulatory.h"
+
+NET_DIRS="wireless mac80211 rfkill"
+
# Drivers that have their own directory
DRIVERS="drivers/net/wireless/ath"
DRIVERS="$DRIVERS drivers/net/wireless/ath/carl9170"
@@ -522,42 +593,6 @@ if [[ "$GET_STABLE_PENDING" = y ]]; then
cd $LAST_DIR
fi

-# Refresh patches using quilt
-patchRefresh() {
- if [ -d patches.orig ] ; then
- rm -rf .pc patches/series
- else
- mkdir patches.orig
- fi
-
- export QUILT_PATCHES=$1
-
- mv -u $1/* patches.orig/
-
- for i in patches.orig/*.patch; do
- if [ ! -f "$i" ]; then
- echo -e "${RED}No patches found in $1${NORMAL}"
- break;
- fi
- echo -e "${GREEN}Refresh backport patch${NORMAL}: ${BLUE}$i${NORMAL}"
- quilt import $i
- quilt push -f
- RET=$?
- if [[ $RET -ne 0 ]]; then
- echo -e "${RED}Refreshing $i failed${NORMAL}, update it"
- echo -e "use ${CYAN}quilt edit [filename]${NORMAL} to apply the failed part manually"
- echo -e "use ${CYAN}quilt refresh${NORMAL} after the files are corrected and rerun this script"
- cp patches.orig/README $1/README
- exit $RET
- fi
- QUILT_DIFF_OPTS="-p" quilt refresh -p ab --no-index --no-timestamp
- done
- quilt pop -a
-
- cp patches.orig/README $1/README
- rm -rf patches.orig .pc $1/series
-}
-
ORIG_CODE=$(find ./ -type f -name \*.[ch] |
egrep -v "^./compat/|include/linux/compat" |
xargs wc -l | tail -1 | awk '{print $1}')
--
1.7.11.2



2012-08-06 18:56:04

by Ozan Çağlayan

[permalink] [raw]
Subject: [PATCH 2/2] compat-wireless: Small cosmetic changes

Change old tree names to reflect the new ones, continue to replace
occurences of compat-* with compat-drivers.

Signed-off-by: Ozan Çağlayan <[email protected]>
---
scripts/admin-clean.sh | 2 +-
scripts/gen-compat-autoconf.sh | 2 +-
scripts/gen-stable-release.sh | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/admin-clean.sh b/scripts/admin-clean.sh
index 340a197..dd26670 100755
--- a/scripts/admin-clean.sh
+++ b/scripts/admin-clean.sh
@@ -11,4 +11,4 @@ rm -f .compat_base_tree
rm -f .compat_base_tree_version
rm -f .compat_version
rm -f code-metrics.txt
-echo "Cleaned wireless-bt-compat-2.6"
+echo "Cleaned compat-drivers"
diff --git a/scripts/gen-compat-autoconf.sh b/scripts/gen-compat-autoconf.sh
index 41b1973..f9fed36 100755
--- a/scripts/gen-compat-autoconf.sh
+++ b/scripts/gen-compat-autoconf.sh
@@ -136,7 +136,7 @@ cat <<EOF
* Automatically generated C config: don't edit
* $DATE
* compat-drivers: $CREL
- * linux-2.6: $KREL
+ * linux: $KREL
*/
#define COMPAT_RELEASE "$CREL"
#define COMPAT_KERNEL_RELEASE "$KREL"
diff --git a/scripts/gen-stable-release.sh b/scripts/gen-stable-release.sh
index c28e2cd..e787052 100755
--- a/scripts/gen-stable-release.sh
+++ b/scripts/gen-stable-release.sh
@@ -110,7 +110,7 @@ function check_for_updates()
git fetch
git reset --hard origin
;;
- *) # Based on a stable 2.6.x.y release, lets just move to the target branch
+ *) # Based on a stable {2.6.x.y, 3.x.y} release, lets just move to the target branch
# we'll only ask for object updates if and only if you asked us to with -f,
# otherwise we eat up whatever you already have on your existing branch.
git checkout -f
@@ -121,7 +121,7 @@ function check_for_updates()
esac
}

-# We will not update your linux-2.6-allstable git tree by default. You can force
+# We will not update your linux-stable git tree by default. You can force
# an update by two methods:
#
# a) Specifying a different target branch
@@ -134,7 +134,7 @@ fi

echo "On $ALL_STABLE_TREE: $TARGET_BRANCH"

-# At this point your linux-2.6-allstable tree should be up to date
+# At this point your linux-stable tree should be up to date
# with the target kernel you want to use. Lets now make sure you are
# on matching compat-drivers branch.

--
1.7.11.2


2012-08-06 19:33:01

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH 2/2] compat-wireless: Small cosmetic changes

On Mon, Aug 6, 2012 at 11:55 AM, Ozan Çağlayan <[email protected]> wrote:
> Change old tree names to reflect the new ones, continue to replace
> occurences of compat-* with compat-drivers.
>
> Signed-off-by: Ozan Çağlayan <[email protected]>

Applied and pushed, thanks!

Luis

2012-08-06 19:31:21

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH 1/2] compat-wireless: Minor cosmetic changes in admin-update.sh

On Mon, Aug 6, 2012 at 11:55 AM, Ozan Çağlayan <[email protected]> wrote:
> - Move functions above everything,
> - Use $HOME instead of /home/$USER which fails when run as root,
> - Enhance comments
> - Mention about compat/bin/get-compat-trees for fetching the trees.
>
> Signed-off-by: Ozan Çağlayan <[email protected]>

I've applied this, thanks! In the future though please break down the
above changes into more atomic patches. This makes review and
bisecting easier if ever needed.

Luis