{"thread":{"id":"34653","subject":"[GUILT] add FreeBSD support","startedAt":"2013-08-09T12:32:28Z","lastAt":"2013-08-21T02:04:56Z","messageCount":7,"participants":["Zheng Liu","Josef 'Jeff' Sipek","gnehzuil.liu"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"224896","messageId":"1376051548-3126-1-git-send-email-wenqing.lz@taobao.com","threadId":"34653","inReplyTo":null,"subject":"[GUILT] add FreeBSD support","fromName":"Zheng Liu","fromEmail":"gnehzuil.liu@gmail.com","sentAt":"2013-08-09T12:32:28Z","receivedAt":"2013-08-09T12:32:28Z","isPatch":false,"sender":{"key":"gnehzuil.liu@gmail.com","avatar":null},"body":"From: Zheng Liu <gnehzuil.liu@gmail.com>\n\nCurrently guilt doesn't support FreeBSD platform.  This commit tries to\nadd this support.  The file called 'os.FreeBSD' is copied from os.Darwin\ndue to these two platforms have almost the same command tools.\n\nSigned-off-by: Zheng Liu <gnehzuil.liu@gmail.com>\n---\nHi all,\n\nAfter applied this patch, the regression test 010 and 060 will fail because\nof the output format.  After fixing these issues, all the regression tests\nwill pass.\n\nP.S. I don't subscribe git@ mailing list.  So please put my email address\nin Cc list.  Thanks!\n\nRegards,\n\t\t\t\t\t\t- Zheng\n\n os.FreeBSD | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 70 insertions(+)\n create mode 100644 os.FreeBSD\n\ndiff --git a/os.FreeBSD b/os.FreeBSD\nnew file mode 100644\nindex 0000000..3f23121\n--- /dev/null\n+++ b/os.FreeBSD\n@@ -0,0 +1,70 @@\n+# usage: touch_date <unix ts> <file>\n+touch_date()\n+{\n+\ttouch -t `date -r $1 +%Y%m%d%H%M.%S` \"$2\"\n+}\n+\n+# usage: last_modified <file>\n+last_modified()\n+{\n+\tstat -f \"%m\" \"$1\"\n+}\n+\n+# usage: format_last_modified <file>\n+format_last_modified()\n+{\n+\tstat -f \"%Sm\" -t \"%Y-%m-%d %H:%M:%S %z\" \"$1\"\n+}\n+\n+# usage: head_n [count]\n+head_n()\n+{\n+\tif [ \"$1\" -gt 0 ]; then\n+\t\thead -n \"$1\"\n+\tfi\n+}\n+\n+# usage: sha1 [file]\n+sha1()\n+{\n+\tif [ $# = 1 ]\n+\tthen\n+\t\topenssl dgst -sha1 \"$1\" | sed \"s,SHA1.\\(.*\\).= \\(.*\\),\\2  \\1,\"\n+\telse\n+\t\topenssl dgst -sha1 | sed 's,\\(.*= \\)*\\(.*\\),\\2  -,'\n+\tfi\n+}\n+\n+# usage: cp_a <src> <dst>\n+cp_a()\n+{\n+\tcp -pR \"$1\" \"$2\"\n+}\n+\n+# usage: _tac\n+_tac()\n+{\n+\tsed -e '1!G;h;$!d'\n+}\n+\n+_seq()\n+{\n+\t(\n+\t\tif [ $# -eq 1 ]\n+\t\tthen\n+\t\t\t/usr/bin/jot $1\n+\t\telif [ $# -eq 2 ]\n+\t\tthen\n+\t\t\tn1=$((${2} - ${1} + 1))\n+\t\t\tn2=$1\n+\t\t\t/usr/bin/jot $n1 $n2\n+\t\telif [ $# -eq 3 ]\n+\t\tthen\n+\t\t\tnum1=$1\n+\t\t\tincr=$2\n+\t\t\tnum2=$3\n+\t\t\t/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/'\n+\t\tfi\n+\t)\n+\treturn 0\n+}\n-- \n1.8.3.4\n"},{"id":"224907","messageId":"20130809144641.GK22686@poseidon.cudanet.local","threadId":"34653","inReplyTo":"1376051548-3126-1-git-send-email-wenqing.lz@taobao.com","subject":"Re: [GUILT] add FreeBSD support","fromName":"Josef 'Jeff' Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2013-08-09T14:46:42Z","receivedAt":"2013-08-09T14:46:42Z","isPatch":false,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:\n> From: Zheng Liu <gnehzuil.liu@gmail.com>\n> \n> Currently guilt doesn't support FreeBSD platform.  This commit tries to\n> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin\n> due to these two platforms have almost the same command tools.\n\nOut of curiosity, is it identical?  I eyeballed it, and they do look\nidentical.  There's probably a better way to do this whole os-specific\nthing, but this will work well enough for now.\n\nJeff.\n\n> Signed-off-by: Zheng Liu <gnehzuil.liu@gmail.com>\n> ---\n> Hi all,\n> \n> After applied this patch, the regression test 010 and 060 will fail because\n> of the output format.  After fixing these issues, all the regression tests\n> will pass.\n> \n> P.S. I don't subscribe git@ mailing list.  So please put my email address\n> in Cc list.  Thanks!\n> \n> Regards,\n> \t\t\t\t\t\t- Zheng\n> \n>  os.FreeBSD | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 70 insertions(+)\n>  create mode 100644 os.FreeBSD\n> \n> diff --git a/os.FreeBSD b/os.FreeBSD\n> new file mode 100644\n> index 0000000..3f23121\n> --- /dev/null\n> +++ b/os.FreeBSD\n> @@ -0,0 +1,70 @@\n> +# usage: touch_date <unix ts> <file>\n> +touch_date()\n> +{\n> +\ttouch -t `date -r $1 +%Y%m%d%H%M.%S` \"$2\"\n> +}\n> +\n> +# usage: last_modified <file>\n> +last_modified()\n> +{\n> +\tstat -f \"%m\" \"$1\"\n> +}\n> +\n> +# usage: format_last_modified <file>\n> +format_last_modified()\n> +{\n> +\tstat -f \"%Sm\" -t \"%Y-%m-%d %H:%M:%S %z\" \"$1\"\n> +}\n> +\n> +# usage: head_n [count]\n> +head_n()\n> +{\n> +\tif [ \"$1\" -gt 0 ]; then\n> +\t\thead -n \"$1\"\n> +\tfi\n> +}\n> +\n> +# usage: sha1 [file]\n> +sha1()\n> +{\n> +\tif [ $# = 1 ]\n> +\tthen\n> +\t\topenssl dgst -sha1 \"$1\" | sed \"s,SHA1.\\(.*\\).= \\(.*\\),\\2  \\1,\"\n> +\telse\n> +\t\topenssl dgst -sha1 | sed 's,\\(.*= \\)*\\(.*\\),\\2  -,'\n> +\tfi\n> +}\n> +\n> +# usage: cp_a <src> <dst>\n> +cp_a()\n> +{\n> +\tcp -pR \"$1\" \"$2\"\n> +}\n> +\n> +# usage: _tac\n> +_tac()\n> +{\n> +\tsed -e '1!G;h;$!d'\n> +}\n> +\n> +_seq()\n> +{\n> +\t(\n> +\t\tif [ $# -eq 1 ]\n> +\t\tthen\n> +\t\t\t/usr/bin/jot $1\n> +\t\telif [ $# -eq 2 ]\n> +\t\tthen\n> +\t\t\tn1=$((${2} - ${1} + 1))\n> +\t\t\tn2=$1\n> +\t\t\t/usr/bin/jot $n1 $n2\n> +\t\telif [ $# -eq 3 ]\n> +\t\tthen\n> +\t\t\tnum1=$1\n> +\t\t\tincr=$2\n> +\t\t\tnum2=$3\n> +\t\t\t/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/'\n> +\t\tfi\n> +\t)\n> +\treturn 0\n> +}\n> -- \n> 1.8.3.4\n> \n\n-- \nResearch, n.:\n  Consider Columbus:\n    He didn't know where he was going.\n    When he got there he didn't know where he was.\n    When he got back he didn't know where he had been.\n    And he did it all on someone else's money.\n"},{"id":"224909","messageId":"68E9B1AC-A3A3-47DD-B0A7-07752428D16D@gmail.com","threadId":"34653","inReplyTo":"20130809144641.GK22686@poseidon.cudanet.local","subject":"Re: [GUILT] add FreeBSD support","fromName":"gnehzuil.liu","fromEmail":"gnehzuil.liu@gmail.com","sentAt":"2013-08-09T15:04:45Z","receivedAt":"2013-08-09T15:04:45Z","isPatch":false,"sender":{"key":"gnehzuil.liu@gmail.com","avatar":null},"body":"在 2013-8-9，下午10:46，Josef 'Jeff' Sipek <jeffpc@josefsipek.net> 写道：\n\n> On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:\n>> From: Zheng Liu <gnehzuil.liu@gmail.com>\n>> \n>> Currently guilt doesn't support FreeBSD platform.  This commit tries to\n>> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin\n>> due to these two platforms have almost the same command tools.\n> \n> Out of curiosity, is it identical?  I eyeballed it, and they do look\n> identical.  There's probably a better way to do this whole os-specific\n> thing, but this will work well enough for now.\n\nYes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to improve this os-specific thing.    Any idea?\n\nRegards,\n                                                  - Zheng\n\n> \n> Jeff.\n> \n>> Signed-off-by: Zheng Liu <gnehzuil.liu@gmail.com>\n>> ---\n>> Hi all,\n>> \n>> After applied this patch, the regression test 010 and 060 will fail because\n>> of the output format.  After fixing these issues, all the regression tests\n>> will pass.\n>> \n>> P.S. I don't subscribe git@ mailing list.  So please put my email address\n>> in Cc list.  Thanks!\n>> \n>> Regards,\n>>                        - Zheng\n>> \n>> os.FreeBSD | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>> 1 file changed, 70 insertions(+)\n>> create mode 100644 os.FreeBSD\n>> \n>> diff --git a/os.FreeBSD b/os.FreeBSD\n>> new file mode 100644\n>> index 0000000..3f23121\n>> --- /dev/null\n>> +++ b/os.FreeBSD\n>> @@ -0,0 +1,70 @@\n>> +# usage: touch_date <unix ts> <file>\n>> +touch_date()\n>> +{\n>> +    touch -t `date -r $1 +%Y%m%d%H%M.%S` \"$2\"\n>> +}\n>> +\n>> +# usage: last_modified <file>\n>> +last_modified()\n>> +{\n>> +    stat -f \"%m\" \"$1\"\n>> +}\n>> +\n>> +# usage: format_last_modified <file>\n>> +format_last_modified()\n>> +{\n>> +    stat -f \"%Sm\" -t \"%Y-%m-%d %H:%M:%S %z\" \"$1\"\n>> +}\n>> +\n>> +# usage: head_n [count]\n>> +head_n()\n>> +{\n>> +    if [ \"$1\" -gt 0 ]; then\n>> +        head -n \"$1\"\n>> +    fi\n>> +}\n>> +\n>> +# usage: sha1 [file]\n>> +sha1()\n>> +{\n>> +    if [ $# = 1 ]\n>> +    then\n>> +        openssl dgst -sha1 \"$1\" | sed \"s,SHA1.\\(.*\\).= \\(.*\\),\\2  \\1,\"\n>> +    else\n>> +        openssl dgst -sha1 | sed 's,\\(.*= \\)*\\(.*\\),\\2  -,'\n>> +    fi\n>> +}\n>> +\n>> +# usage: cp_a <src> <dst>\n>> +cp_a()\n>> +{\n>> +    cp -pR \"$1\" \"$2\"\n>> +}\n>> +\n>> +# usage: _tac\n>> +_tac()\n>> +{\n>> +    sed -e '1!G;h;$!d'\n>> +}\n>> +\n>> +_seq()\n>> +{\n>> +    (\n>> +        if [ $# -eq 1 ]\n>> +        then\n>> +            /usr/bin/jot $1\n>> +        elif [ $# -eq 2 ]\n>> +        then\n>> +            n1=$((${2} - ${1} + 1))\n>> +            n2=$1\n>> +            /usr/bin/jot $n1 $n2\n>> +        elif [ $# -eq 3 ]\n>> +        then\n>> +            num1=$1\n>> +            incr=$2\n>> +            num2=$3\n>> +            /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/'\n>> +        fi\n>> +    )\n>> +    return 0\n>> +}\n>> -- \n>> 1.8.3.4\n> \n> -- \n> Research, n.:\n>  Consider Columbus:\n>    He didn't know where he was going.\n>    When he got there he didn't know where he was.\n>    When he got back he didn't know where he had been.\n>    And he did it all on someone else's money.\n"},{"id":"224910","messageId":"20130809152046.GL22686@poseidon.cudanet.local","threadId":"34653","inReplyTo":"68E9B1AC-A3A3-47DD-B0A7-07752428D16D@gmail.com","subject":"Re: [GUILT] add FreeBSD support","fromName":"Josef 'Jeff' Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2013-08-09T15:20:46Z","receivedAt":"2013-08-09T15:20:46Z","isPatch":false,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:\n> �� 2013-8-9������10:46��Josef 'Jeff' Sipek <jeffpc@josefsipek.net> д����\n> \n> > On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:\n> >> From: Zheng Liu <gnehzuil.liu@gmail.com>\n> >> \n> >> Currently guilt doesn't support FreeBSD platform.  This commit tries to\n> >> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin\n> >> due to these two platforms have almost the same command tools.\n> > \n> > Out of curiosity, is it identical?  I eyeballed it, and they do look\n> > identical.  There's probably a better way to do this whole os-specific\n> > thing, but this will work well enough for now.\n> \n> Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to\n> improve this os-specific thing.    Any idea?\n\nSo, I'm a bit torn between some \"build-time\" checking that generates\nsomething like an \"os\" file based on what it detects and something that\nhappens at runtime.  I like that currently there's nothing to do - you just\nclone the repo and you're set.  At the same time, the more code can be\navoided executing the faster (in theory) guilt gets.\n\nFeel free to experiment.\n\nJeff.\n\n-- \nThe reasonable man adapts himself to the world; the unreasonable one\npersists in trying to adapt the world to himself. Therefore all progress\ndepends on the unreasonable man.\n\t\t- George Bernard Shaw\n"},{"id":"225499","messageId":"20130820074415.GA27247@gmail.com","threadId":"34653","inReplyTo":"20130809152046.GL22686@poseidon.cudanet.local","subject":"Re: [GUILT] add FreeBSD support","fromName":"Zheng Liu","fromEmail":"gnehzuil.liu@gmail.com","sentAt":"2013-08-20T07:44:16Z","receivedAt":"2013-08-20T07:44:16Z","isPatch":false,"sender":{"key":"gnehzuil.liu@gmail.com","avatar":null},"body":"Hi Josef,\n\nOn Fri, Aug 09, 2013 at 11:20:46AM -0400, Josef 'Jeff' Sipek wrote:\n> On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:\n> > ?? 2013-8-9??????10:46??Josef 'Jeff' Sipek <jeffpc@josefsipek.net> д????\n> > \n> > > On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:\n> > >> From: Zheng Liu <gnehzuil.liu@gmail.com>\n> > >> \n> > >> Currently guilt doesn't support FreeBSD platform.  This commit tries to\n> > >> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin\n> > >> due to these two platforms have almost the same command tools.\n> > > \n> > > Out of curiosity, is it identical?  I eyeballed it, and they do look\n> > > identical.  There's probably a better way to do this whole os-specific\n> > > thing, but this will work well enough for now.\n> > \n> > Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to\n> > improve this os-specific thing.    Any idea?\n> \n> So, I'm a bit torn between some \"build-time\" checking that generates\n> something like an \"os\" file based on what it detects and something that\n> happens at runtime.  I like that currently there's nothing to do - you just\n> clone the repo and you're set.  At the same time, the more code can be\n> avoided executing the faster (in theory) guilt gets.\n\nSorry for the late reply.  I did a simple experiment that tries to fold\nall os.* files into one file and uses a if statement to export functions\naccording to different platforms.  But frankly I don't like this because\nit is not very clearly.  So IMHO we'd better add a 'os.FreeBSD' file to\nsupport FreeBSD platform.\n\nI attach the patch in this mail.  It is not very mature.  If you think\nit is worthwhile improving this patch.  Please review it.  All feedbacks\nare always welcome.\n\nRegards,\n                                                - Zheng\n\n---\n Makefile            |   2 +-\n guilt               |   8 ++--\n os                  | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n os.Darwin           |  70 ---------------------------\n os.Linux            |  57 ----------------------\n os.SunOS            |  57 ----------------------\n regression/scaffold |   4 +-\n 7 files changed, 141 insertions(+), 191 deletions(-)\n create mode 100644 os\n delete mode 100644 os.Darwin\n delete mode 100644 os.Linux\n delete mode 100644 os.SunOS\n\ndiff --git a/Makefile b/Makefile\nindex b38c1e4..395abc1 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2,7 +2,7 @@ PREFIX?=/usr/local\n DESTDIR?=\n INSTALL?=install\n \n-OSFILES = $(filter-out $(wildcard *~),$(wildcard os.*))\n+OSFILES = os\n SCRIPTS = $(filter-out $(wildcard *~),$(wildcard guilt-*))\n \n .PHONY: all \ndiff --git a/guilt b/guilt\nindex e9b2aab..718bed0 100755\n--- a/guilt\n+++ b/guilt\n@@ -906,10 +906,10 @@ pager=\"more\"\n \n UNAME_S=`uname -s`\n \n-if [ -r \"$GUILT_PATH/os.$UNAME_S\" ]; then\n-\t. \"$GUILT_PATH/os.$UNAME_S\"\n-elif [ -r \"$GUILT_PATH/../lib/guilt/os.$UNAME_S\" ]; then\n-\t. \"$GUILT_PATH/../lib/guilt/os.$UNAME_S\"\n+if [ -r \"$GUILT_PATH/os\" ]; then\n+\t. \"$GUILT_PATH/os\"\n+elif [ -r \"$GUILT_PATH/../lib/guilt/os\" ]; then\n+\t. \"$GUILT_PATH/../lib/guilt/os\"\n else\n \tdie \"Unsupported operating system: $UNAME_S\"\n fi\ndiff --git a/os b/os\nnew file mode 100644\nindex 0000000..6d1bc01\n--- /dev/null\n+++ b/os\n@@ -0,0 +1,134 @@\n+UNAME_S=`uname -s`\n+\n+if [ $UNAME_S == 'FreeBSD' ] || [ $UNAME_S == 'Darwin' ]; then\n+\t# usage: touch_date <unix ts> <file>\n+\ttouch_date()\n+\t{\n+\t\ttouch -t `date -r $1 +%Y%m%d%H%M.%S` \"$2\"\n+\t}\n+\n+\t# usage: last_modified <file>\n+\tlast_modified()\n+\t{\n+\t\tstat -f \"%m\" \"$1\"\n+\t}\n+\n+\t# usage: format_last_modified <file>\n+\tformat_last_modified()\n+\t{\n+\t\tstat -f \"%Sm\" -t \"%Y-%m-%d %H:%M:%S %z\" \"$1\"\n+\t}\n+\n+\t# usage: head_n [count]\n+\thead_n()\n+\t{\n+\t\tif [ \"$1\" -gt 0 ]; then\n+\t\t\thead -n \"$1\"\n+\t\tfi\n+\t}\n+\n+\t# usage: sha1 [file]\n+\tsha1()\n+\t{\n+\t\tif [ $# = 1 ]\n+\t\tthen\n+\t\t\topenssl dgst -sha1 \"$1\" | sed \"s,SHA1.\\(.*\\).= \\(.*\\),\\2  \\1,\"\n+\t\telse\n+\t\t\topenssl dgst -sha1 | sed 's,\\(.*= \\)*\\(.*\\),\\2  -,'\n+\t\tfi\n+\t}\n+\n+\t# usage: cp_a <src> <dst>\n+\tcp_a()\n+\t{\n+\t\tcp -pR \"$1\" \"$2\"\n+\t}\n+\n+\t# usage: _tac\n+\t_tac()\n+\t{\n+\t\tsed -e '1!G;h;$!d'\n+\t}\n+\n+\t_seq()\n+\t{\n+\t\t(\n+\t\t\tif [ $# -eq 1 ]\n+\t\t\tthen\n+\t\t\t\t/usr/bin/jot $1\n+\t\t\telif [ $# -eq 2 ]\n+\t\t\tthen\n+\t\t\t\tn1=$((${2} - ${1} + 1))\n+\t\t\t\tn2=$1\n+\t\t\t\t/usr/bin/jot $n1 $n2\n+\t\t\telif [ $# -eq 3 ]\n+\t\t\tthen\n+\t\t\t\tnum1=$1\n+\t\t\t\tincr=$2\n+\t\t\t\tnum2=$3\n+\t\t\t\t/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/'\n+\t\t\tfi\n+\t\t)\n+\t\treturn 0\n+\t}\n+elif [ $UNAME_S == 'Linux' ] || [ $UNAME_S == 'SunOS' ]; then\n+\t# usage: touch_date <unix ts> <file>\n+\ttouch_date()\n+\t{\n+\t\ttouch -d @$1 \"$2\"\n+\t}\n+\n+\t# usage: last_modified <file>\n+\tlast_modified()\n+\t{\n+\t\tstat -c \"%Y\" \"$1\"\n+\t}\n+\n+\t# usage: format_last_modified <file>\n+\tformat_last_modified()\n+\t{\n+\t\t# must strip nano-second part otherwise git gets very\n+\t\t# confused, and makes up strange timestamps from the past\n+\t\t# (chances are it decides to interpret it as a unix\n+\t\t# timestamp).\n+\t\tstat -c \"%y\" \"$1\" | sed -e '\n+\ts/^\\([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/'\n+\t}\n+\n+\t# usage: head_n [count]\n+\thead_n()\n+\t{\n+\t\thead -n \"$1\"\n+\t}\n+\n+\t# usage: sha1 [file]\n+\tsha1()\n+\t{\n+\t\tif [ $# = 1 ]\n+\t\tthen\n+\t\t\tsha1sum \"$1\"\n+\t\telse\n+\t\t\tsha1sum\n+\t\tfi\n+\t}\n+\n+\t# usage: cp_a <src> <dst>\n+\tcp_a()\n+\t{\n+\t\tcp -a \"$1\" \"$2\"\n+\t}\n+\n+\t# usage: _tac\n+\t_tac()\n+\t{\n+\t\ttac\n+\t}\n+\n+\t_seq()\n+\t{\n+\t\tseq \"$@\"\n+\t\treturn $?\n+\t}\n+else\n+\tdie \"Unsupported operating system: $UNAME_S\"\n+fi\ndiff --git a/os.Darwin b/os.Darwin\ndeleted file mode 100644\nindex 3f23121..0000000\n--- a/os.Darwin\n+++ /dev/null\n@@ -1,70 +0,0 @@\n-# usage: touch_date <unix ts> <file>\n-touch_date()\n-{\n-\ttouch -t `date -r $1 +%Y%m%d%H%M.%S` \"$2\"\n-}\n-\n-# usage: last_modified <file>\n-last_modified()\n-{\n-\tstat -f \"%m\" \"$1\"\n-}\n-\n-# usage: format_last_modified <file>\n-format_last_modified()\n-{\n-\tstat -f \"%Sm\" -t \"%Y-%m-%d %H:%M:%S %z\" \"$1\"\n-}\n-\n-# usage: head_n [count]\n-head_n()\n-{\n-\tif [ \"$1\" -gt 0 ]; then\n-\t\thead -n \"$1\"\n-\tfi\n-}\n-\n-# usage: sha1 [file]\n-sha1()\n-{\n-\tif [ $# = 1 ]\n-\tthen\n-\t\topenssl dgst -sha1 \"$1\" | sed \"s,SHA1.\\(.*\\).= \\(.*\\),\\2  \\1,\"\n-\telse\n-\t\topenssl dgst -sha1 | sed 's,\\(.*= \\)*\\(.*\\),\\2  -,'\n-\tfi\n-}\n-\n-# usage: cp_a <src> <dst>\n-cp_a()\n-{\n-\tcp -pR \"$1\" \"$2\"\n-}\n-\n-# usage: _tac\n-_tac()\n-{\n-\tsed -e '1!G;h;$!d'\n-}\n-\n-_seq()\n-{\n-\t(\n-\t\tif [ $# -eq 1 ]\n-\t\tthen\n-\t\t\t/usr/bin/jot $1\n-\t\telif [ $# -eq 2 ]\n-\t\tthen\n-\t\t\tn1=$((${2} - ${1} + 1))\n-\t\t\tn2=$1\n-\t\t\t/usr/bin/jot $n1 $n2\n-\t\telif [ $# -eq 3 ]\n-\t\tthen\n-\t\t\tnum1=$1\n-\t\t\tincr=$2\n-\t\t\tnum2=$3\n-\t\t\t/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/'\n-\t\tfi\n-\t)\n-\treturn 0\n-}\ndiff --git a/os.Linux b/os.Linux\ndeleted file mode 100644\nindex aaebf88..0000000\n--- a/os.Linux\n+++ /dev/null\n@@ -1,57 +0,0 @@\n-# usage: touch_date <unix ts> <file>\n-touch_date()\n-{\n-\ttouch -d @$1 \"$2\"\n-}\n-\n-# usage: last_modified <file>\n-last_modified()\n-{\n-\tstat -c \"%Y\" \"$1\"\n-}\n-\n-# usage: format_last_modified <file>\n-format_last_modified()\n-{\n-\t# must strip nano-second part otherwise git gets very\n-\t# confused, and makes up strange timestamps from the past\n-\t# (chances are it decides to interpret it as a unix\n-\t# timestamp).\n-\tstat -c \"%y\" \"$1\" | sed -e '\n-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/'\n-}\n-\n-# usage: head_n [count]\n-head_n()\n-{\n-\thead -n \"$1\"\n-}\n-\n-# usage: sha1 [file]\n-sha1()\n-{\n-\tif [ $# = 1 ]\n-\tthen\n-\t\tsha1sum \"$1\"\n-\telse\n-\t\tsha1sum\n-\tfi\n-}\n-\n-# usage: cp_a <src> <dst>\n-cp_a()\n-{\n-\tcp -a \"$1\" \"$2\"\n-}\n-\n-# usage: _tac\n-_tac()\n-{\n-\ttac\n-}\n-\n-_seq()\n-{\n-\tseq \"$@\"\n-\treturn $?\n-}\ndiff --git a/os.SunOS b/os.SunOS\ndeleted file mode 100644\nindex aaebf88..0000000\n--- a/os.SunOS\n+++ /dev/null\n@@ -1,57 +0,0 @@\n-# usage: touch_date <unix ts> <file>\n-touch_date()\n-{\n-\ttouch -d @$1 \"$2\"\n-}\n-\n-# usage: last_modified <file>\n-last_modified()\n-{\n-\tstat -c \"%Y\" \"$1\"\n-}\n-\n-# usage: format_last_modified <file>\n-format_last_modified()\n-{\n-\t# must strip nano-second part otherwise git gets very\n-\t# confused, and makes up strange timestamps from the past\n-\t# (chances are it decides to interpret it as a unix\n-\t# timestamp).\n-\tstat -c \"%y\" \"$1\" | sed -e '\n-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/'\n-}\n-\n-# usage: head_n [count]\n-head_n()\n-{\n-\thead -n \"$1\"\n-}\n-\n-# usage: sha1 [file]\n-sha1()\n-{\n-\tif [ $# = 1 ]\n-\tthen\n-\t\tsha1sum \"$1\"\n-\telse\n-\t\tsha1sum\n-\tfi\n-}\n-\n-# usage: cp_a <src> <dst>\n-cp_a()\n-{\n-\tcp -a \"$1\" \"$2\"\n-}\n-\n-# usage: _tac\n-_tac()\n-{\n-\ttac\n-}\n-\n-_seq()\n-{\n-\tseq \"$@\"\n-\treturn $?\n-}\ndiff --git a/regression/scaffold b/regression/scaffold\nindex 546d8c6..4d4613b 100644\n--- a/regression/scaffold\n+++ b/regression/scaffold\n@@ -25,8 +25,8 @@ function die\n \n UNAME_S=`uname -s`\n \n-if [ -r \"$REG_DIR/../os.$UNAME_S\" ]; then\n-\t. \"$REG_DIR/../os.$UNAME_S\"\n+if [ -r \"$REG_DIR/../os\" ]; then\n+\t. \"$REG_DIR/../os\"\n else\n \tdie \"Unsupported operating system: $UNAME_S\"\n fi\n-- \n1.8.3.4\n"},{"id":"225525","messageId":"20130820152547.GC8172@poseidon.cudanet.local","threadId":"34653","inReplyTo":"20130820074415.GA27247@gmail.com","subject":"Re: [GUILT] add FreeBSD support","fromName":"Josef 'Jeff' Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2013-08-20T15:25:48Z","receivedAt":"2013-08-20T15:25:48Z","isPatch":false,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Tue, Aug 20, 2013 at 03:44:16PM +0800, Zheng Liu wrote:\n> Hi Josef,\n> \n> On Fri, Aug 09, 2013 at 11:20:46AM -0400, Josef 'Jeff' Sipek wrote:\n> > On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:\n> > > ?? 2013-8-9??????10:46??Josef 'Jeff' Sipek <jeffpc@josefsipek.net> д????\n> > > \n> > > > On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:\n> > > >> From: Zheng Liu <gnehzuil.liu@gmail.com>\n> > > >> \n> > > >> Currently guilt doesn't support FreeBSD platform.  This commit tries to\n> > > >> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin\n> > > >> due to these two platforms have almost the same command tools.\n> > > > \n> > > > Out of curiosity, is it identical?  I eyeballed it, and they do look\n> > > > identical.  There's probably a better way to do this whole os-specific\n> > > > thing, but this will work well enough for now.\n> > > \n> > > Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to\n> > > improve this os-specific thing.    Any idea?\n> > \n> > So, I'm a bit torn between some \"build-time\" checking that generates\n> > something like an \"os\" file based on what it detects and something that\n> > happens at runtime.  I like that currently there's nothing to do - you just\n> > clone the repo and you're set.  At the same time, the more code can be\n> > avoided executing the faster (in theory) guilt gets.\n> \n> Sorry for the late reply.  I did a simple experiment that tries to fold\n> all os.* files into one file and uses a if statement to export functions\n> according to different platforms.  But frankly I don't like this because\n> it is not very clearly.  So IMHO we'd better add a 'os.FreeBSD' file to\n> support FreeBSD platform.\n\nYeah, sounds like the simplest (at least for the moment).  I'll commit it.\nThanks.\n\nFWIW, the idea I was thinking about was to make \"make all\" figure out\nvarious parts of the system and construct an os file.\n\nJeff.\n\n-- \nUNIX is user-friendly ... it's just selective about who its friends are\n"},{"id":"225587","messageId":"20130821020456.GA6217@gmail.com","threadId":"34653","inReplyTo":"20130820152547.GC8172@poseidon.cudanet.local","subject":"Re: [GUILT] add FreeBSD support","fromName":"Zheng Liu","fromEmail":"gnehzuil.liu@gmail.com","sentAt":"2013-08-21T02:04:56Z","receivedAt":"2013-08-21T02:04:56Z","isPatch":false,"sender":{"key":"gnehzuil.liu@gmail.com","avatar":null},"body":"On Tue, Aug 20, 2013 at 11:25:48AM -0400, Josef 'Jeff' Sipek wrote:\n> On Tue, Aug 20, 2013 at 03:44:16PM +0800, Zheng Liu wrote:\n> > Hi Josef,\n> > \n> > On Fri, Aug 09, 2013 at 11:20:46AM -0400, Josef 'Jeff' Sipek wrote:\n> > > On Fri, Aug 09, 2013 at 11:04:45PM +0800, gnehzuil.liu wrote:\n> > > > ?? 2013-8-9??????10:46??Josef 'Jeff' Sipek <jeffpc@josefsipek.net> д????\n> > > > \n> > > > > On Fri, Aug 09, 2013 at 08:32:28PM +0800, Zheng Liu wrote:\n> > > > >> From: Zheng Liu <gnehzuil.liu@gmail.com>\n> > > > >> \n> > > > >> Currently guilt doesn't support FreeBSD platform.  This commit tries to\n> > > > >> add this support.  The file called 'os.FreeBSD' is copied from os.Darwin\n> > > > >> due to these two platforms have almost the same command tools.\n> > > > > \n> > > > > Out of curiosity, is it identical?  I eyeballed it, and they do look\n> > > > > identical.  There's probably a better way to do this whole os-specific\n> > > > > thing, but this will work well enough for now.\n> > > > \n> > > > Yes, it is identical.  Sorry, I am a newbie for guilt, but I am happy to\n> > > > improve this os-specific thing.    Any idea?\n> > > \n> > > So, I'm a bit torn between some \"build-time\" checking that generates\n> > > something like an \"os\" file based on what it detects and something that\n> > > happens at runtime.  I like that currently there's nothing to do - you just\n> > > clone the repo and you're set.  At the same time, the more code can be\n> > > avoided executing the faster (in theory) guilt gets.\n> > \n> > Sorry for the late reply.  I did a simple experiment that tries to fold\n> > all os.* files into one file and uses a if statement to export functions\n> > according to different platforms.  But frankly I don't like this because\n> > it is not very clearly.  So IMHO we'd better add a 'os.FreeBSD' file to\n> > support FreeBSD platform.\n> \n> Yeah, sounds like the simplest (at least for the moment).  I'll commit it.\n> Thanks.\n> \n> FWIW, the idea I was thinking about was to make \"make all\" figure out\n> various parts of the system and construct an os file.\n\nYes, I thought this.  We can create a os.in file and generate a os file\nafter running \"make\" command.  But currently os.* looks like the\nsimplest solution.\n\nRegards,\n                                                - Zheng\n"}]}