threads / discuss / 34653

[GUILT] add FreeBSD support

Subject: [GUILT] add FreeBSD support

## tl;dr

7 messages between Aug 9, 2013 and Aug 21, 2013.

replies: 6people: 2as markdown or json

Zheng Liu· Aug 9, 2013, 12:32 UTC · lore
From: Zheng Liu <gnehzuil.liu@gmail.com>

Currently guilt doesn't support FreeBSD platform. This commit tries to add this support. The file called 'os.FreeBSD' is copied from os.Darwin due to these two platforms have almost the same command tools.

Signed-off-by: Zheng Liu <gnehzuil.liu@gmail.com>
---
Hi all,

After applied this patch, the regression test 010 and 060 will fail because of the output format. After fixing these issues, all the regression tests will pass.

P.S. I don't subscribe git@ mailing list. So please put my email address in Cc list. Thanks!

Regards,
						- Zheng
 os.FreeBSD | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 os.FreeBSD
diff --git a/os.FreeBSD b/os.FreeBSD
new file mode 100644
index 0000000..3f23121
--- /dev/null
+++ b/os.FreeBSD
@@ -0,0 +1,70 @@
+# usage: touch_date <unix ts> <file>
+touch_date()
+{
+	touch -t `date -r $1 +%Y%m%d%H%M.%S` "$2"
+}
+
+# usage: last_modified <file>
+last_modified()
+{
+	stat -f "%m" "$1"
+}
+
+# usage: format_last_modified <file>
+format_last_modified()
+{
+	stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S %z" "$1"
+}
+
+# usage: head_n [count]
+head_n()
+{
+	if [ "$1" -gt 0 ]; then
+		head -n "$1"
+	fi
+}
+
+# usage: sha1 [file]
+sha1()
+{
+	if [ $# = 1 ]
+	then
+		openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2  \1,"
+	else
+		openssl dgst -sha1 | sed 's,\(.*= \)*\(.*\),\2  -,'
+	fi
+}
+
+# usage: cp_a <src> <dst>
+cp_a()
+{
+	cp -pR "$1" "$2"
+}
+
+# usage: _tac
+_tac()
+{
+	sed -e '1!G;h;$!d'
+}
+
+_seq()
+{
+	(
+		if [ $# -eq 1 ]
+		then
+			/usr/bin/jot $1
+		elif [ $# -eq 2 ]
+		then
+			n1=$((${2} - ${1} + 1))
+			n2=$1
+			/usr/bin/jot $n1 $n2
+		elif [ $# -eq 3 ]
+		then
+			num1=$1
+			incr=$2
+			num2=$3
+			/usr/bin/awk -v n1=$num1 -v n2=$num2 -v add=$incr 'BEGIN{ for(i=n1; i<=n2; i+=add) print i;}' | /usr/bin/sed -E '/e/s/^.+e.+$/0/'
+		fi
+	)
+	return 0
+}
-- 
1.8.3.4
Josef 'Jeff' Sipek· Aug 9, 2013, 14:46 UTC · re: Zheng Liu · lore

Re: [GUILT] add FreeBSD support

On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:
Show 5 quoted lines
> From: Zheng Liu <gnehzuil.liu@gmail.com>
> 
> Currently guilt doesn't support FreeBSD platform.  This commit tries to
> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin
> due to these two platforms have almost the same command tools.

Out of curiosity, is it identical? I eyeballed it, and they do look identical. There's probably a better way to do this whole os-specific thing, but this will work well enough for now.

Jeff.
Show 97 quoted lines
> Signed-off-by: Zheng Liu <gnehzuil.liu@gmail.com>
> ---
> Hi all,
> 
> After applied this patch, the regression test 010 and 060 will fail because
> of the output format.  After fixing these issues, all the regression tests
> will pass.
> 
> P.S. I don't subscribe git@ mailing list.  So please put my email address
> in Cc list.  Thanks!
> 
> Regards,
> 						- Zheng
> 
>  os.FreeBSD | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 70 insertions(+)
>  create mode 100644 os.FreeBSD
> 
> diff --git a/os.FreeBSD b/os.FreeBSD
> new file mode 100644
> index 0000000..3f23121
> --- /dev/null
> +++ b/os.FreeBSD
> @@ -0,0 +1,70 @@
> +# usage: touch_date <unix ts> <file>
> +touch_date()
> +{
> +	touch -t `date -r $1 +%Y%m%d%H%M.%S` "$2"
> +}
> +
> +# usage: last_modified <file>
> +last_modified()
> +{
> +	stat -f "%m" "$1"
> +}
> +
> +# usage: format_last_modified <file>
> +format_last_modified()
> +{
> +	stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S %z" "$1"
> +}
> +
> +# usage: head_n [count]
> +head_n()
> +{
> +	if [ "$1" -gt 0 ]; then
> +		head -n "$1"
> +	fi
> +}
> +
> +# usage: sha1 [file]
> +sha1()
> +{
> +	if [ $# = 1 ]
> +	then
> +		openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2  \1,"
> +	else
> +		openssl dgst -sha1 | sed 's,\(.*= \)*\(.*\),\2  -,'
> +	fi
> +}
> +
> +# usage: cp_a <src> <dst>
> +cp_a()
> +{
> +	cp -pR "$1" "$2"
> +}
> +
> +# usage: _tac
> +_tac()
> +{
> +	sed -e '1!G;h;$!d'
> +}
> +
> +_seq()
> +{
> +	(
> +		if [ $# -eq 1 ]
> +		then
> +			/usr/bin/jot $1
> +		elif [ $# -eq 2 ]
> +		then
> +			n1=$((${2} - ${1} + 1))
> +			n2=$1
> +			/usr/bin/jot $n1 $n2
> +		elif [ $# -eq 3 ]
> +		then
> +			num1=$1
> +			incr=$2
> +			num2=$3
> +			/usr/bin/awk -v n1=$num1 -v n2=$num2 -v add=$incr 'BEGIN{ for(i=n1; i<=n2; i+=add) print i;}' | /usr/bin/sed -E '/e/s/^.+e.+$/0/'
> +		fi
> +	)
> +	return 0
> +}
> -- 
> 1.8.3.4
> 
-- 
Research, n.:
  Consider Columbus:
    He didn't know where he was going.
    When he got there he didn't know where he was.
    When he got back he didn't know where he had been.
    And he did it all on someone else's money.
gnehzuil.liu· Aug 9, 2013, 15:04 UTC · re: Josef 'Jeff' Sipek · lore

Re: [GUILT] add FreeBSD support

在 2013-8-9,下午10:46,Josef 'Jeff' Sipek <jeffpc@josefsipek.net> 写道:
Show 10 quoted lines
> On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:
>> From: Zheng Liu <gnehzuil.liu@gmail.com>
>> 
>> Currently guilt doesn't support FreeBSD platform.  This commit tries to
>> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin
>> due to these two platforms have almost the same command tools.
> 
> Out of curiosity, is it identical?  I eyeballed it, and they do look
> identical.  There's probably a better way to do this whole os-specific
> thing, but this will work well enough for now.
Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to improve this os-specific thing.    Any idea?
Regards,
                                                  - Zheng
Show 107 quoted lines
> 
> Jeff.
> 
>> Signed-off-by: Zheng Liu <gnehzuil.liu@gmail.com>
>> ---
>> Hi all,
>> 
>> After applied this patch, the regression test 010 and 060 will fail because
>> of the output format.  After fixing these issues, all the regression tests
>> will pass.
>> 
>> P.S. I don't subscribe git@ mailing list.  So please put my email address
>> in Cc list.  Thanks!
>> 
>> Regards,
>>                        - Zheng
>> 
>> os.FreeBSD | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 70 insertions(+)
>> create mode 100644 os.FreeBSD
>> 
>> diff --git a/os.FreeBSD b/os.FreeBSD
>> new file mode 100644
>> index 0000000..3f23121
>> --- /dev/null
>> +++ b/os.FreeBSD
>> @@ -0,0 +1,70 @@
>> +# usage: touch_date <unix ts> <file>
>> +touch_date()
>> +{
>> +    touch -t `date -r $1 +%Y%m%d%H%M.%S` "$2"
>> +}
>> +
>> +# usage: last_modified <file>
>> +last_modified()
>> +{
>> +    stat -f "%m" "$1"
>> +}
>> +
>> +# usage: format_last_modified <file>
>> +format_last_modified()
>> +{
>> +    stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S %z" "$1"
>> +}
>> +
>> +# usage: head_n [count]
>> +head_n()
>> +{
>> +    if [ "$1" -gt 0 ]; then
>> +        head -n "$1"
>> +    fi
>> +}
>> +
>> +# usage: sha1 [file]
>> +sha1()
>> +{
>> +    if [ $# = 1 ]
>> +    then
>> +        openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2  \1,"
>> +    else
>> +        openssl dgst -sha1 | sed 's,\(.*= \)*\(.*\),\2  -,'
>> +    fi
>> +}
>> +
>> +# usage: cp_a <src> <dst>
>> +cp_a()
>> +{
>> +    cp -pR "$1" "$2"
>> +}
>> +
>> +# usage: _tac
>> +_tac()
>> +{
>> +    sed -e '1!G;h;$!d'
>> +}
>> +
>> +_seq()
>> +{
>> +    (
>> +        if [ $# -eq 1 ]
>> +        then
>> +            /usr/bin/jot $1
>> +        elif [ $# -eq 2 ]
>> +        then
>> +            n1=$((${2} - ${1} + 1))
>> +            n2=$1
>> +            /usr/bin/jot $n1 $n2
>> +        elif [ $# -eq 3 ]
>> +        then
>> +            num1=$1
>> +            incr=$2
>> +            num2=$3
>> +            /usr/bin/awk -v n1=$num1 -v n2=$num2 -v add=$incr 'BEGIN{ for(i=n1; i<=n2; i+=add) print i;}' | /usr/bin/sed -E '/e/s/^.+e.+$/0/'
>> +        fi
>> +    )
>> +    return 0
>> +}
>> -- 
>> 1.8.3.4
> 
> -- 
> Research, n.:
>  Consider Columbus:
>    He didn't know where he was going.
>    When he got there he didn't know where he was.
>    When he got back he didn't know where he had been.
>    And he did it all on someone else's money.
Josef 'Jeff' Sipek· Aug 9, 2013, 15:20 UTC · re: gnehzuil.liu · lore

Re: [GUILT] add FreeBSD support

On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:
Show 15 quoted lines
> �� 2013-8-9������10:46��Josef 'Jeff' Sipek <jeffpc@josefsipek.net> ���
> 
> > On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:
> >> From: Zheng Liu <gnehzuil.liu@gmail.com>
> >> 
> >> Currently guilt doesn't support FreeBSD platform.  This commit tries to
> >> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin
> >> due to these two platforms have almost the same command tools.
> > 
> > Out of curiosity, is it identical?  I eyeballed it, and they do look
> > identical.  There's probably a better way to do this whole os-specific
> > thing, but this will work well enough for now.
> 
> Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to
> improve this os-specific thing.    Any idea?

So, I'm a bit torn between some "build-time" checking that generates something like an "os" file based on what it detects and something that happens at runtime. I like that currently there's nothing to do - you just clone the repo and you're set. At the same time, the more code can be avoided executing the faster (in theory) guilt gets.

Feel free to experiment.
Jeff.
-- 
The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.
		- George Bernard Shaw
Zheng Liu· Aug 20, 2013, 07:44 UTC · re: Josef 'Jeff' Sipek · lore

Re: [GUILT] add FreeBSD support

Hi Josef,
On Fri, Aug 09, 2013 at 11:20:46AM -0400, Josef 'Jeff' Sipek wrote:
Show 22 quoted lines
> On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:
> > ?? 2013-8-9??????10:46??Josef 'Jeff' Sipek <jeffpc@josefsipek.net> д????
> > 
> > > On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:
> > >> From: Zheng Liu <gnehzuil.liu@gmail.com>
> > >> 
> > >> Currently guilt doesn't support FreeBSD platform.  This commit tries to
> > >> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin
> > >> due to these two platforms have almost the same command tools.
> > > 
> > > Out of curiosity, is it identical?  I eyeballed it, and they do look
> > > identical.  There's probably a better way to do this whole os-specific
> > > thing, but this will work well enough for now.
> > 
> > Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to
> > improve this os-specific thing.    Any idea?
> 
> So, I'm a bit torn between some "build-time" checking that generates
> something like an "os" file based on what it detects and something that
> happens at runtime.  I like that currently there's nothing to do - you just
> clone the repo and you're set.  At the same time, the more code can be
> avoided executing the faster (in theory) guilt gets.

Sorry for the late reply. I did a simple experiment that tries to fold all os.* files into one file and uses a if statement to export functions according to different platforms. But frankly I don't like this because it is not very clearly. So IMHO we'd better add a 'os.FreeBSD' file to support FreeBSD platform.

I attach the patch in this mail. It is not very mature. If you think it is worthwhile improving this patch. Please review it. All feedbacks are always welcome.

Regards,
                                                - Zheng
---
 Makefile            |   2 +-
 guilt               |   8 ++--
 os                  | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 os.Darwin           |  70 ---------------------------
 os.Linux            |  57 ----------------------
 os.SunOS            |  57 ----------------------
 regression/scaffold |   4 +-
 7 files changed, 141 insertions(+), 191 deletions(-)
 create mode 100644 os
 delete mode 100644 os.Darwin
 delete mode 100644 os.Linux
 delete mode 100644 os.SunOS
diff --git a/Makefile b/Makefile
index b38c1e4..395abc1 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ PREFIX?=/usr/local
 DESTDIR?=
 INSTALL?=install
 
-OSFILES = $(filter-out $(wildcard *~),$(wildcard os.*))
+OSFILES = os
 SCRIPTS = $(filter-out $(wildcard *~),$(wildcard guilt-*))
 
 .PHONY: all 
diff --git a/guilt b/guilt
index e9b2aab..718bed0 100755
--- a/guilt
+++ b/guilt
@@ -906,10 +906,10 @@ pager="more"
 
 UNAME_S=`uname -s`
 
-if [ -r "$GUILT_PATH/os.$UNAME_S" ]; then
-	. "$GUILT_PATH/os.$UNAME_S"
-elif [ -r "$GUILT_PATH/../lib/guilt/os.$UNAME_S" ]; then
-	. "$GUILT_PATH/../lib/guilt/os.$UNAME_S"
+if [ -r "$GUILT_PATH/os" ]; then
+	. "$GUILT_PATH/os"
+elif [ -r "$GUILT_PATH/../lib/guilt/os" ]; then
+	. "$GUILT_PATH/../lib/guilt/os"
 else
 	die "Unsupported operating system: $UNAME_S"
 fi
diff --git a/os b/os
new file mode 100644
index 0000000..6d1bc01
--- /dev/null
+++ b/os
@@ -0,0 +1,134 @@
+UNAME_S=`uname -s`
+
+if [ $UNAME_S == 'FreeBSD' ] || [ $UNAME_S == 'Darwin' ]; then
+	# usage: touch_date <unix ts> <file>
+	touch_date()
+	{
+		touch -t `date -r $1 +%Y%m%d%H%M.%S` "$2"
+	}
+
+	# usage: last_modified <file>
+	last_modified()
+	{
+		stat -f "%m" "$1"
+	}
+
+	# usage: format_last_modified <file>
+	format_last_modified()
+	{
+		stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S %z" "$1"
+	}
+
+	# usage: head_n [count]
+	head_n()
+	{
+		if [ "$1" -gt 0 ]; then
+			head -n "$1"
+		fi
+	}
+
+	# usage: sha1 [file]
+	sha1()
+	{
+		if [ $# = 1 ]
+		then
+			openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2  \1,"
+		else
+			openssl dgst -sha1 | sed 's,\(.*= \)*\(.*\),\2  -,'
+		fi
+	}
+
+	# usage: cp_a <src> <dst>
+	cp_a()
+	{
+		cp -pR "$1" "$2"
+	}
+
+	# usage: _tac
+	_tac()
+	{
+		sed -e '1!G;h;$!d'
+	}
+
+	_seq()
+	{
+		(
+			if [ $# -eq 1 ]
+			then
+				/usr/bin/jot $1
+			elif [ $# -eq 2 ]
+			then
+				n1=$((${2} - ${1} + 1))
+				n2=$1
+				/usr/bin/jot $n1 $n2
+			elif [ $# -eq 3 ]
+			then
+				num1=$1
+				incr=$2
+				num2=$3
+				/usr/bin/awk -v n1=$num1 -v n2=$num2 -v add=$incr 'BEGIN{ for(i=n1; i<=n2; i+=add) print i;}' | /usr/bin/sed -E '/e/s/^.+e.+$/0/'
+			fi
+		)
+		return 0
+	}
+elif [ $UNAME_S == 'Linux' ] || [ $UNAME_S == 'SunOS' ]; then
+	# usage: touch_date <unix ts> <file>
+	touch_date()
+	{
+		touch -d @$1 "$2"
+	}
+
+	# usage: last_modified <file>
+	last_modified()
+	{
+		stat -c "%Y" "$1"
+	}
+
+	# usage: format_last_modified <file>
+	format_last_modified()
+	{
+		# must strip nano-second part otherwise git gets very
+		# confused, and makes up strange timestamps from the past
+		# (chances are it decides to interpret it as a unix
+		# timestamp).
+		stat -c "%y" "$1" | sed -e '
+	s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)\.[0-9]* \(.*\)$/\1-\2-\3 \4:\5:\6 \7/'
+	}
+
+	# usage: head_n [count]
+	head_n()
+	{
+		head -n "$1"
+	}
+
+	# usage: sha1 [file]
+	sha1()
+	{
+		if [ $# = 1 ]
+		then
+			sha1sum "$1"
+		else
+			sha1sum
+		fi
+	}
+
+	# usage: cp_a <src> <dst>
+	cp_a()
+	{
+		cp -a "$1" "$2"
+	}
+
+	# usage: _tac
+	_tac()
+	{
+		tac
+	}
+
+	_seq()
+	{
+		seq "$@"
+		return $?
+	}
+else
+	die "Unsupported operating system: $UNAME_S"
+fi
diff --git a/os.Darwin b/os.Darwin
deleted file mode 100644
index 3f23121..0000000
--- a/os.Darwin
+++ /dev/null
@@ -1,70 +0,0 @@
-# usage: touch_date <unix ts> <file>
-touch_date()
-{
-	touch -t `date -r $1 +%Y%m%d%H%M.%S` "$2"
-}
-
-# usage: last_modified <file>
-last_modified()
-{
-	stat -f "%m" "$1"
-}
-
-# usage: format_last_modified <file>
-format_last_modified()
-{
-	stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S %z" "$1"
-}
-
-# usage: head_n [count]
-head_n()
-{
-	if [ "$1" -gt 0 ]; then
-		head -n "$1"
-	fi
-}
-
-# usage: sha1 [file]
-sha1()
-{
-	if [ $# = 1 ]
-	then
-		openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2  \1,"
-	else
-		openssl dgst -sha1 | sed 's,\(.*= \)*\(.*\),\2  -,'
-	fi
-}
-
-# usage: cp_a <src> <dst>
-cp_a()
-{
-	cp -pR "$1" "$2"
-}
-
-# usage: _tac
-_tac()
-{
-	sed -e '1!G;h;$!d'
-}
-
-_seq()
-{
-	(
-		if [ $# -eq 1 ]
-		then
-			/usr/bin/jot $1
-		elif [ $# -eq 2 ]
-		then
-			n1=$((${2} - ${1} + 1))
-			n2=$1
-			/usr/bin/jot $n1 $n2
-		elif [ $# -eq 3 ]
-		then
-			num1=$1
-			incr=$2
-			num2=$3
-			/usr/bin/awk -v n1=$num1 -v n2=$num2 -v add=$incr 'BEGIN{ for(i=n1; i<=n2; i+=add) print i;}' | /usr/bin/sed -E '/e/s/^.+e.+$/0/'
-		fi
-	)
-	return 0
-}
diff --git a/os.Linux b/os.Linux
deleted file mode 100644
index aaebf88..0000000
--- a/os.Linux
+++ /dev/null
@@ -1,57 +0,0 @@
-# usage: touch_date <unix ts> <file>
-touch_date()
-{
-	touch -d @$1 "$2"
-}
-
-# usage: last_modified <file>
-last_modified()
-{
-	stat -c "%Y" "$1"
-}
-
-# usage: format_last_modified <file>
-format_last_modified()
-{
-	# must strip nano-second part otherwise git gets very
-	# confused, and makes up strange timestamps from the past
-	# (chances are it decides to interpret it as a unix
-	# timestamp).
-	stat -c "%y" "$1" | sed -e '
-s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)\.[0-9]* \(.*\)$/\1-\2-\3 \4:\5:\6 \7/'
-}
-
-# usage: head_n [count]
-head_n()
-{
-	head -n "$1"
-}
-
-# usage: sha1 [file]
-sha1()
-{
-	if [ $# = 1 ]
-	then
-		sha1sum "$1"
-	else
-		sha1sum
-	fi
-}
-
-# usage: cp_a <src> <dst>
-cp_a()
-{
-	cp -a "$1" "$2"
-}
-
-# usage: _tac
-_tac()
-{
-	tac
-}
-
-_seq()
-{
-	seq "$@"
-	return $?
-}
diff --git a/os.SunOS b/os.SunOS
deleted file mode 100644
index aaebf88..0000000
--- a/os.SunOS
+++ /dev/null
@@ -1,57 +0,0 @@
-# usage: touch_date <unix ts> <file>
-touch_date()
-{
-	touch -d @$1 "$2"
-}
-
-# usage: last_modified <file>
-last_modified()
-{
-	stat -c "%Y" "$1"
-}
-
-# usage: format_last_modified <file>
-format_last_modified()
-{
-	# must strip nano-second part otherwise git gets very
-	# confused, and makes up strange timestamps from the past
-	# (chances are it decides to interpret it as a unix
-	# timestamp).
-	stat -c "%y" "$1" | sed -e '
-s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)\.[0-9]* \(.*\)$/\1-\2-\3 \4:\5:\6 \7/'
-}
-
-# usage: head_n [count]
-head_n()
-{
-	head -n "$1"
-}
-
-# usage: sha1 [file]
-sha1()
-{
-	if [ $# = 1 ]
-	then
-		sha1sum "$1"
-	else
-		sha1sum
-	fi
-}
-
-# usage: cp_a <src> <dst>
-cp_a()
-{
-	cp -a "$1" "$2"
-}
-
-# usage: _tac
-_tac()
-{
-	tac
-}
-
-_seq()
-{
-	seq "$@"
-	return $?
-}
diff --git a/regression/scaffold b/regression/scaffold
index 546d8c6..4d4613b 100644
--- a/regression/scaffold
+++ b/regression/scaffold
@@ -25,8 +25,8 @@ function die
 
 UNAME_S=`uname -s`
 
-if [ -r "$REG_DIR/../os.$UNAME_S" ]; then
-	. "$REG_DIR/../os.$UNAME_S"
+if [ -r "$REG_DIR/../os" ]; then
+	. "$REG_DIR/../os"
 else
 	die "Unsupported operating system: $UNAME_S"
 fi
-- 
1.8.3.4
Josef 'Jeff' Sipek· Aug 20, 2013, 15:25 UTC · re: Zheng Liu · lore

Re: [GUILT] add FreeBSD support

On Tue, Aug 20, 2013 at 03:44:16PM +0800, Zheng Liu wrote:
Show 31 quoted lines
> Hi Josef,
> 
> On Fri, Aug 09, 2013 at 11:20:46AM -0400, Josef 'Jeff' Sipek wrote:
> > On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:
> > > ?? 2013-8-9??????10:46??Josef 'Jeff' Sipek <jeffpc@josefsipek.net> д????
> > > 
> > > > On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:
> > > >> From: Zheng Liu <gnehzuil.liu@gmail.com>
> > > >> 
> > > >> Currently guilt doesn't support FreeBSD platform.  This commit tries to
> > > >> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin
> > > >> due to these two platforms have almost the same command tools.
> > > > 
> > > > Out of curiosity, is it identical?  I eyeballed it, and they do look
> > > > identical.  There's probably a better way to do this whole os-specific
> > > > thing, but this will work well enough for now.
> > > 
> > > Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to
> > > improve this os-specific thing.    Any idea?
> > 
> > So, I'm a bit torn between some "build-time" checking that generates
> > something like an "os" file based on what it detects and something that
> > happens at runtime.  I like that currently there's nothing to do - you just
> > clone the repo and you're set.  At the same time, the more code can be
> > avoided executing the faster (in theory) guilt gets.
> 
> Sorry for the late reply.  I did a simple experiment that tries to fold
> all os.* files into one file and uses a if statement to export functions
> according to different platforms.  But frankly I don't like this because
> it is not very clearly.  So IMHO we'd better add a 'os.FreeBSD' file to
> support FreeBSD platform.

Yeah, sounds like the simplest (at least for the moment). I'll commit it. Thanks.

FWIW, the idea I was thinking about was to make "make all" figure out various parts of the system and construct an os file.

Jeff.
-- 
UNIX is user-friendly ... it's just selective about who its friends are
Zheng Liu· Aug 21, 2013, 02:04 UTC · re: Josef 'Jeff' Sipek · lore

Re: [GUILT] add FreeBSD support

On Tue, Aug 20, 2013 at 11:25:48AM -0400, Josef 'Jeff' Sipek wrote:
Show 38 quoted lines
> On Tue, Aug 20, 2013 at 03:44:16PM +0800, Zheng Liu wrote:
> > Hi Josef,
> > 
> > On Fri, Aug 09, 2013 at 11:20:46AM -0400, Josef 'Jeff' Sipek wrote:
> > > On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:
> > > > ?? 2013-8-9??????10:46??Josef 'Jeff' Sipek <jeffpc@josefsipek.net> д????
> > > > 
> > > > > On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:
> > > > >> From: Zheng Liu <gnehzuil.liu@gmail.com>
> > > > >> 
> > > > >> Currently guilt doesn't support FreeBSD platform.  This commit tries to
> > > > >> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin
> > > > >> due to these two platforms have almost the same command tools.
> > > > > 
> > > > > Out of curiosity, is it identical?  I eyeballed it, and they do look
> > > > > identical.  There's probably a better way to do this whole os-specific
> > > > > thing, but this will work well enough for now.
> > > > 
> > > > Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to
> > > > improve this os-specific thing.    Any idea?
> > > 
> > > So, I'm a bit torn between some "build-time" checking that generates
> > > something like an "os" file based on what it detects and something that
> > > happens at runtime.  I like that currently there's nothing to do - you just
> > > clone the repo and you're set.  At the same time, the more code can be
> > > avoided executing the faster (in theory) guilt gets.
> > 
> > Sorry for the late reply.  I did a simple experiment that tries to fold
> > all os.* files into one file and uses a if statement to export functions
> > according to different platforms.  But frankly I don't like this because
> > it is not very clearly.  So IMHO we'd better add a 'os.FreeBSD' file to
> > support FreeBSD platform.
> 
> Yeah, sounds like the simplest (at least for the moment).  I'll commit it.
> Thanks.
> 
> FWIW, the idea I was thinking about was to make "make all" figure out
> various parts of the system and construct an os file.

Yes, I thought this. We can create a os.in file and generate a os file after running "make" command. But currently os.* looks like the simplest solution.

Regards,
                                                - Zheng

← back to recent threads