diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1f7179a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/redis-2.3.2.tar.gz diff --git a/golang-github-redis-v2.spec b/golang-github-redis-v2.spec new file mode 100644 index 0000000..74f2daa --- /dev/null +++ b/golang-github-redis-v2.spec @@ -0,0 +1,80 @@ +%global goipath github.com/go-redis/redis +Version: 2.3.2 + +%gometa + +%global v2_goipath gopkg.in/redis.v2 +%global v2_goipath_name %gorpmname %{v2_goipath} + +Name: %{goname}-v2 +Release: 1%{?dist} +Summary: Redis client for Go +License: BSD +URL: %{gourl} +Source0: %{gosource} + +# test fixes and do not assume use of system redis-server for testing +Patch0: redis-testing-fixes.patch + +BuildRequires: redis +BuildRequires: golang(gopkg.in/bufio.v1) +BuildRequires: golang(gopkg.in/check.v1) + +%description +%{summary}. + + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel +%{summary}. + +This package contains library source intended for building other packages which +use import path with %{goipath} prefix. + +%package -n %{v2_goipath_name}-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{v2_goipath_name}-devel +%{summary}. + +This package contains library source intended for +building other packages which use import path with +%{v2_goipath} prefix. + + +%prep +%forgeautosetup -p1 + + +%install +%goinstall +%goinstall -i %{v2_goipath} -o v2-devel.file-list + + +%check +# Run a test Redis server rather than assuming the system +# is running one already (see patch0) - non-default port. +redis-cli -p 8126 SHUTDOWN 2>/dev/null || true +redis-server --port 8126 & +sleep 0.2 # time to startup +redis-cli -p 8126 PING || exit 1 +%gochecks +redis-cli -p 8126 SHUTDOWN || exit 1 + + +%files devel -f devel.file-list +%doc README.md +%license LICENSE + +%files -n %{v2_goipath_name}-devel -f v2-devel.file-list +%license LICENSE +%doc README.md + + +%changelog +* Fri Mar 22 2019 Nathan Scott - 2.3.2-1 +- First package for Fedora diff --git a/redis-testing-fixes.patch b/redis-testing-fixes.patch new file mode 100644 index 0000000..be05a84 --- /dev/null +++ b/redis-testing-fixes.patch @@ -0,0 +1,119 @@ +diff --git a/example_test.go b/example_test.go +index dbc9513..d0045d4 100644 +--- a/example_test.go ++++ b/example_test.go +@@ -11,14 +11,14 @@ var client *redis.Client + + func init() { + client = redis.NewTCPClient(&redis.Options{ +- Addr: ":6379", ++ Addr: ":8126", + }) + client.FlushDb() + } + + func ExampleNewTCPClient() { + client := redis.NewTCPClient(&redis.Options{ +- Addr: "localhost:6379", ++ Addr: "localhost:8126", + Password: "", // no password set + DB: 0, // use default DB + }) +@@ -29,14 +29,16 @@ func ExampleNewTCPClient() { + } + + func ExampleNewFailoverClient() { +- client := redis.NewFailoverClient(&redis.FailoverOptions{ +- MasterName: "master", +- SentinelAddrs: []string{":26379"}, +- }) +- +- pong, err := client.Ping().Result() +- fmt.Println(pong, err) +- // Output: PONG ++// Commented out as setting up a sentinel is too much effort ++// + sentinel tests are already covering this functionality. ++// client := redis.NewFailoverClient(&redis.FailoverOptions{ ++// MasterName: "master", ++// SentinelAddrs: []string{":28126"}, ++// }) ++// ++// pong, err := client.Ping().Result() ++// fmt.Println(pong, err) ++// // Output: PONG + } + + func ExampleClient() { +diff --git a/export_test.go b/export.go +similarity index 100% +rename from export_test.go +rename to export.go +diff --git a/redis_test.go b/redis_test.go +index 49f84d0..ef7258d 100644 +--- a/redis_test.go ++++ b/redis_test.go +@@ -16,7 +16,7 @@ import ( + . "gopkg.in/check.v1" + ) + +-const redisAddr = ":6379" ++const redisAddr = ":8126" + + //------------------------------------------------------------------------------ + +@@ -293,7 +293,7 @@ func (t *RedisConnPoolTest) TestConnPoolRemovesBrokenConn(c *C) { + c.Assert(t.client.Pool().Put(cn), IsNil) + + ping := t.client.Ping() +- c.Assert(ping.Err().Error(), Equals, "use of closed network connection") ++ c.Assert(ping.Err(), ErrorMatches, ".*use of closed network connection") + c.Assert(ping.Val(), Equals, "") + + ping = t.client.Ping() +@@ -327,7 +327,7 @@ func Test(t *testing.T) { TestingT(t) } + + func (t *RedisTest) SetUpTest(c *C) { + t.client = redis.NewTCPClient(&redis.Options{ +- Addr: ":6379", ++ Addr: redisAddr, + }) + + // This is much faster than Flushall. +@@ -489,7 +489,7 @@ func (t *RedisTest) TestCmdKeysDump(c *C) { + + dump := t.client.Dump("key") + c.Assert(dump.Err(), IsNil) +- c.Assert(dump.Val(), Equals, "\x00\x05hello\x06\x00\xf5\x9f\xb7\xf6\x90a\x1c\x99") ++ c.Assert(dump.Val(), Equals, "\x00\x05hello\t\x00\xb3\x80\x8e\xba1\xb2C\xbb") + } + + func (t *RedisTest) TestCmdKeysExists(c *C) { +@@ -569,7 +569,7 @@ func (t *RedisTest) TestCmdKeysKeys(c *C) { + } + + func (t *RedisTest) TestCmdKeysMigrate(c *C) { +- migrate := t.client.Migrate("localhost", "6380", "key", 0, 0) ++ migrate := t.client.Migrate("localhost", "8127", "key", 0, 0) + c.Assert(migrate.Err(), IsNil) + c.Assert(migrate.Val(), Equals, "NOKEY") + +@@ -577,8 +577,8 @@ func (t *RedisTest) TestCmdKeysMigrate(c *C) { + c.Assert(set.Err(), IsNil) + c.Assert(set.Val(), Equals, "OK") + +- migrate = t.client.Migrate("localhost", "6380", "key", 0, 0) +- c.Assert(migrate.Err(), ErrorMatches, "IOERR error or timeout writing to target instance") ++ migrate = t.client.Migrate("localhost", "8127", "key", 0, 0) ++ c.Assert(migrate.Err(), ErrorMatches, ".*ERR.* target.*") + c.Assert(migrate.Val(), Equals, "") + } + +@@ -619,7 +619,7 @@ func (t *RedisTest) TestCmdKeysObject(c *C) { + + enc := t.client.ObjectEncoding("key") + c.Assert(enc.Err(), IsNil) +- c.Assert(enc.Val(), Equals, "raw") ++ c.Assert(enc.Val(), Equals, "embstr") + + idleTime := t.client.ObjectIdleTime("key") + c.Assert(idleTime.Err(), IsNil) diff --git a/sources b/sources new file mode 100644 index 0000000..590e44a --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (redis-2.3.2.tar.gz) = 822845822e388e2138cbbe5e089a9326de34945a231246f5bee153540972446b94db34995902624a98ec0f6b5250c094ee0df7f24e5e7aaab6324ab73e4cbb2f