2010-01-25 22:33:37

by Darren Salt

[permalink] [raw]
Subject: [PATCH 1/3] Tweak version handling to allow vendor-specific suffixes without patching. This overrides the "git describe" suffix for when the packaging is in git.

---
Makefile | 4 ++++
version.sh | 13 +++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 2c5fd9e..770efd1 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,11 @@ VERSION_OBJS := $(filter-out version.o, $(OBJS))
version.c: version.sh $(patsubst %.o,%.c,$(VERSION_OBJS)) rfkill.h Makefile \
$(wildcard .git/index .git/refs/tags)
@$(NQ) ' GEN ' $@
+ifeq (,$(VERSION_SUFFIX))
$(Q)./version.sh $@
+else
+ $(Q)./version.sh --suffix "$(VERSION_SUFFIX") $@
+endif

%.o: %.c rfkill.h
@$(NQ) ' CC ' $@
diff --git a/version.sh b/version.sh
index 957684b..8984b39 100755
--- a/version.sh
+++ b/version.sh
@@ -1,9 +1,18 @@
#!/bin/sh

VERSION="0.3"
+
+SUFFIX=
+if test "x$1" = x--suffix; then
+ shift
+ SUFFIX="-$1"
+ shift
+fi
OUT="$1"

-if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+if test "x$SUFFIX" = ''; then
+ v="$VERSION"
+elif head=`git rev-parse --verify HEAD 2>/dev/null`; then
git update-index --refresh --unmerged > /dev/null
descr=$(git describe 2>/dev/null || echo "v$VERSION")

@@ -17,7 +26,7 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
v="$v"-dirty
fi
else
- v="$VERSION"
+ v="$VERSION$SUFFIX"
fi

echo "const char rfkill_version[] = \"$v\";" > "$OUT"
--
1.6.5



2010-01-25 22:33:37

by Darren Salt

[permalink] [raw]
Subject: [PATCH 2/3] Help text: output rfkill type names from an array instead of a static string.

---
rfkill.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/rfkill.c b/rfkill.c
index 8fa4c6a..bda649a 100644
--- a/rfkill.c
+++ b/rfkill.c
@@ -291,6 +291,8 @@ static const char *argv0;

static void usage(void)
{
+ const struct rfkill_type_str *p;
+
fprintf(stderr, "Usage:\t%s [options] command\n", argv0);
fprintf(stderr, "Options:\n");
fprintf(stderr, "\t--version\tshow version (%s)\n", rfkill_version);
@@ -301,7 +303,10 @@ static void usage(void)
fprintf(stderr, "\tblock IDENTIFIER\n");
fprintf(stderr, "\tunblock IDENTIFIER\n");
fprintf(stderr, "where IDENTIFIER is the index no. of an rfkill switch or one of:\n");
- fprintf(stderr, "\t<idx> all wifi wlan bluetooth uwb ultrawideband wimax wwan gps\n");
+ fprintf(stderr, "\t<idx>");
+ for (p = rfkill_type_strings; p->name != NULL; p++)
+ fprintf(stderr, " %s", p->name);
+ fprintf(stderr, "\n");
}

static void version(void)
--
1.6.5


2010-01-25 22:33:37

by Darren Salt

[permalink] [raw]
Subject: [PATCH 3/3] Add rfkill type "fm" to the man page.

---
rfkill.8 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/rfkill.8 b/rfkill.8
index 5bce9fd..aa11fde 100644
--- a/rfkill.8
+++ b/rfkill.8
@@ -24,7 +24,7 @@ or just all of the given type.
.BI block " index|type"
Disable the device corresponding to the given index.
\fItype\fR is one of "all", "wifi", "wlan", "bluetooth", "uwb",
-"ultrawideband", "wimax", "wwan" or "gps".
+"ultrawideband", "wimax", "wwan", "gps" or "fm".
.TP
.BI unblock " index|type"
Enable the device corresponding to the given index. If the device is
--
1.6.5


2010-01-25 22:43:26

by Darren Salt

[permalink] [raw]
Subject: Re: [PATCH 1/3] Tweak version handling to allow vendor-specific suffixes without patching. This overrides the "git describe" suffix for when the packaging is in git.

Ignore this version.sh patch for now – it's a bit broken...

--
| Darren Salt | linux at youmustbejoking | nr. Ashington, | Doon
| using Debian GNU/Linux | or ds ,demon,co,uk | Northumberland | Army
| + http://www.youmustbejoking.demon.co.uk/ & http://tartarus.org/ds/

If this were an actual tagline, it would be funny.

2010-01-25 23:01:14

by Darren Salt

[permalink] [raw]
Subject: [PATCH 1/3] Tweak version handling to allow vendor-specific suffixes without patching.

This overrides the "git describe" suffix for when the packaging is in git.

---
Makefile | 4 ++++
version.sh | 11 ++++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 2c5fd9e..8d6c700 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,11 @@ VERSION_OBJS := $(filter-out version.o, $(OBJS))
version.c: version.sh $(patsubst %.o,%.c,$(VERSION_OBJS)) rfkill.h Makefile
\
$(wildcard .git/index .git/refs/tags)
@$(NQ) ' GEN ' $@
+ifeq (,$(VERSION_SUFFIX))
$(Q)./version.sh $@
+else
+ $(Q)./version.sh --suffix "$(VERSION_SUFFIX)" $@
+endif

%.o: %.c rfkill.h
@$(NQ) ' CC ' $@
diff --git a/version.sh b/version.sh
index 957684b..28b579a 100755
--- a/version.sh
+++ b/version.sh
@@ -1,9 +1,18 @@
#!/bin/sh

VERSION="0.3"
+
+SUFFIX=
+if test "x$1" = x--suffix; then
+ shift
+ SUFFIX="-$1"
+ shift
+fi
OUT="$1"

-if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+if test "x$SUFFIX" != 'x'; then
+ v="$VERSION$SUFFIX"
+elif head=`git rev-parse --verify HEAD 2>/dev/null`; then
git update-index --refresh --unmerged > /dev/null
descr=$(git describe 2>/dev/null || echo "v$VERSION")

--
1.6.5