diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-06-19 12:35:26 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-06-19 12:35:58 +0000 |
commit | c01343bad073860e4d0392bdde6623bf0e3678a8 (patch) | |
tree | 99a436836df5fe80630744b51402ea515d202718 /main/sircbot | |
parent | c1a704f5ed54b15c41a78aa6c31c969597e86578 (diff) | |
download | aports-c01343bad073860e4d0392bdde6623bf0e3678a8.tar.bz2 aports-c01343bad073860e4d0392bdde6623bf0e3678a8.tar.xz |
main/sircbot: upgrade to 0.4
Diffstat (limited to 'main/sircbot')
-rw-r--r-- | main/sircbot/APKBUILD | 52 | ||||
-rw-r--r-- | main/sircbot/disconnect-fix.patch | 194 |
2 files changed, 41 insertions, 205 deletions
diff --git a/main/sircbot/APKBUILD b/main/sircbot/APKBUILD index 109a1ac44a..9e326da15f 100644 --- a/main/sircbot/APKBUILD +++ b/main/sircbot/APKBUILD @@ -1,7 +1,8 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> +_luaversions="5.1 5.2 5.3" pkgname=sircbot -pkgver=0.3 -pkgrel=1 +pkgver=0.4 +pkgrel=0 pkgdesc="Minimalistic IRC bot" url="http://git.alpinelinux.org/cgit/sircbot/" arch="all" @@ -9,10 +10,14 @@ license="GPL-2" pkgusers="sircbot" pkggroups="sircbot" depends= -makedepends="lua-dev" -install="$pkgname.pre-install" +makedepends="" subpackages="lua-sircbot:luamod" -source="http://dev.alpinelinux.org/archive/sircbot/sircbot-$pkgver.tar.bz2 +for _i in $_luaversions; do + makedepends="$makedepends lua$_i-dev" + subpackages="$subpackages lua$_i-sircbot:split_${_i/./_}" +done +install="$pkgname.pre-install" +source="http://dev.alpinelinux.org/archive/sircbot/sircbot-$pkgver.tar.xz disconnect-fix.patch sircbot.initd sircbot.confd @@ -26,31 +31,56 @@ prepare() { build() { cd "$_builddir" make || return 1 + for i in $_luaversions; do + make LUA_VERSION=$i || return 1 + done } package() { cd "$_builddir" make install DESTDIR="$pkgdir" prefix=/usr + for i in $_luaversions; do + make install-lua DESTDIR="$pkgdir" prefix=/usr LUA_VERSION=$i \ + || return 1 + done install -o sircbot -g sircbot -d "$pkgdir"/var/run/sircbot install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname } luamod() { - pkgdesc="Luamodule for sirbot client" - mkdir -p "$subpkgdir"/usr/ - mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ + pkgdesc="sirbot client for Lua" + mkdir -p "$subpkgdir" +} + +_split() { + local d= _ver=$1 + pkgdesc="Sircbot client for Lua $_ver" + install_if="lua$_ver lua-sircbot=$pkgver-r$pkgrel" + depends= + cd "$pkgdir" + for d in usr/lib/lua usr/share/lua; do + if [ -d "$pkgdir"/$d/$_ver ]; then + mkdir -p "$subpkgdir"/$d + mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/ || return 1 + fi + done } -md5sums="bad605639450640276341044f3d96190 sircbot-0.3.tar.bz2 + +for _v in $_luaversions; do + eval "split_${_v/./_}() { _split $_v; }" +done + +md5sums="e9b10d19ed30521e1950cab0b66c79a2 sircbot-0.4.tar.xz 4ba720163ca111f1cb7c9c369a370e05 disconnect-fix.patch c89aa17a632d2338daefa1fd99b82f5d sircbot.initd 8443ac189030c7b8beb8e579dc16ebc7 sircbot.confd" -sha256sums="0631a74260ebb6698a58ea68067387c29d533c0db9ba7147b834a77a8758202d sircbot-0.3.tar.bz2 +sha256sums="3f32fe97131402f827a6acba8507c372e53ce19690e732d226bb9a4d89313ce0 sircbot-0.4.tar.xz 61da3159e48426f04f1fb4df31420a3faa72b52b6fddb342709406f89025a554 disconnect-fix.patch f49ebfc6717fd34f946b8afbe7df50ddde59f0347b4300610cc6d6997710d1e7 sircbot.initd b0bf9767150e486815aada1761b6fca7b7838df3045082ff8083167dbce613e6 sircbot.confd" -sha512sums="fe5a201fa92a25831e7107d8036f32e6b79d39814129f584e106484344e974037ddc016a5c3240a9c2a2540975b41356f80dba2507ee33750ce26ab751c201b8 sircbot-0.3.tar.bz2 +sha512sums="1f91581548dcc2d3f6d0da31591027792271994b86ffce73141de828eff27595a1df8a364988e0c5349996e36ae8879b166c84d6024a194626e61c9dc9e96816 sircbot-0.4.tar.xz ab0102d04b42826102ee705dc2b4a3202391619b4df7365bda8cc47715a0537a1656bcc32869628e70aa3467837dd7a7ca6aac6843c3fd046aba7832fed91ed6 disconnect-fix.patch 501bcf92aed2819dd902eab31470282b5951916f3d52bab6d8eb3a14e01690f10b5a9b52488bfdcf1aa5ada44840e918dbe93ba23d891389e5d8dbe4b9a40efb sircbot.initd 315167ec664ce859908fcd230f6e0c604a0b02e56286156ba6ec76c32d6d514726acb493fe7a13b44d9255ec2e34fe4b2a6f02edf039b06e487cea6528d4d6a7 sircbot.confd" diff --git a/main/sircbot/disconnect-fix.patch b/main/sircbot/disconnect-fix.patch deleted file mode 100644 index 523264a632..0000000000 --- a/main/sircbot/disconnect-fix.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 93d007481e25c9db88e8b16117b0378d51951bb6 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Thu, 07 Mar 2013 15:20:22 +0000 -Subject: fix segfault when IRC server does disconnect - -and fix lots of whitespace damage ---- -diff --git a/irc.c b/irc.c -index 92a925e..5832421 100644 ---- a/irc.c -+++ b/irc.c -@@ -14,11 +14,11 @@ static int tcp_connect(const char *host, int port) - struct sockaddr_in addr; - struct hostent *h; - int sock = socket(AF_INET, SOCK_STREAM, 0); -- if (sock < 0) -+ if (sock < 0) - return sock; - - h = gethostbyname(host); -- if (h == NULL) -+ if (h == NULL) - return -1; - - memset(&addr, 0, sizeof(addr)); -@@ -38,17 +38,17 @@ struct irc_session *irc_connect(const char* server, int port, const char *nick, - { - char buf[256]; - struct irc_session *sess; -- -+ - sess = malloc(sizeof(struct irc_session)); - if (sess == NULL) - return NULL; -- -+ - sess->nick = nick; - sess->server = server; - sess->fd = tcp_connect(server, port); -- if (sess->fd < 0) -+ if (sess->fd < 0) - return NULL; -- -+ - /* login */ - if (pass) - irc_send(sess, "PASS", pass); -@@ -79,7 +79,9 @@ int irc_send_ping(struct irc_session *s) - - int irc_close(struct irc_session *s, const char *msg) - { -- irc_send(s, "QUIT", msg ? msg : ""); -- close(s->fd); -+ if (s->fd > 0) { -+ irc_send(s, "QUIT", msg ? msg : ""); -+ close(s->fd); -+ } - free(s); - } -diff --git a/sircbot.c b/sircbot.c -index b85d7d0..7d9c1a3 100644 ---- a/sircbot.c -+++ b/sircbot.c -@@ -56,8 +56,8 @@ struct sircbot_socket_callback { - int (*callback)(struct sircbot_session *sb, struct pollfd *fds, - void *ctx); - }; -- -- -+ -+ - static int foreground = 0; - static int sigterm = 0; - static int flush_rate = 2; -@@ -90,7 +90,7 @@ int daemonize(const char *pidfile, const char *logfile) - /* exit parent */ - if (pid > 0) - exit(0); -- -+ - /* detatch to controling terminal */ - setsid(); - -@@ -220,10 +220,10 @@ int run_hooks(char *user, char *rcpt, char* data) - /* exit parent */ - if (pid > 0) - exit(0); -- -+ - snprintf(dir, sizeof(dir), "/etc/" PROGNAME ".d/%s", rcpt); - printf("DEBUG: running scripts in %s\n", dir); -- execlp("/bin/run-parts", "/bin/run-parts", "-a", user, -+ execlp("/bin/run-parts", "/bin/run-parts", "-a", user, - "-a", data, "-a", rcpt, dir, NULL); - log_err("run-parts"); - exit(1); -@@ -302,17 +302,21 @@ int parse_irc_data(struct sircbot_session *sb, char *buf) - } - - /* callback functions */ --static int irc_server_cb(struct sircbot_session *sb, struct pollfd *fds, -+static int irc_server_cb(struct sircbot_session *sb, struct pollfd *fds, - void *ctx) - { - char buf[4096]; - int r; - struct irc_session *sess = (struct irc_session *) ctx; - -- if (fds->revents & POLLHUP) -+ if (fds->revents & POLLHUP) { - /* server hang up on us */ -+ printf("DEBUG: %s: connection closed\n", sess ? sess->server : "null"); -+ close(sess->fd); -+ sess->fd = -1; - return 0; -- -+ } -+ - if (fds->revents & POLLERR) { - log_err(sess->server); - return -1; -@@ -340,7 +344,7 @@ int channel_extend_fd_array(struct sircbot_channel *chan) - chan->fd_array[i] = -1; - return 0; - } -- -+ - - void channel_add_connection(struct sircbot_channel *chan, int fd) - { -@@ -428,7 +432,7 @@ static int irc_reset_pollfds(struct sircbot_session *sb, struct pollfd *fds, - fds[n].fd = sb->sess->fd; - fds[n].events = POLLIN; - fds[n].revents = 0; -- cb[n].context = NULL; -+ cb[n].context = sb->sess; - cb[n].callback = &irc_server_cb; - n++; - -@@ -474,18 +478,24 @@ static int send_fifo_queue(struct irc_session *sess, - return r; - } - --static void join_channels(struct sircbot_session *sb) -+static int join_channels(struct sircbot_session *sb) - { - time_t now = time(NULL); - int i; - /* wait atleast 5 secs before we join a channel */ - for (i = 0; i < sb->numchan; i++) -- if ((now - sb->chan[i].last_closetime) > 5 -- && sb->chan[i].listen_fd < 0) { -+ if ((now - sb->chan[i].last_closetime) > 5 -+ && sb->chan[i].listen_fd < 0 && sb->sess != NULL) { -+ int r = 0; - printf("DEBUG: joining %s\n", sb->chan[i].name); - sb->chan[i].last_closetime = now; -- irc_send(sb->sess, "JOIN", sb->chan[i].name); -+ r = irc_send(sb->sess, "JOIN", sb->chan[i].name); -+ if (r < 0) { -+ printf("DEBUG: error %s: %s\n", sb->sess->server, strerror(r)); -+ return r; -+ } - } -+ return 0; - } - - static int irc_loop(struct sircbot_session *sb) -@@ -504,7 +514,8 @@ static int irc_loop(struct sircbot_session *sb) - tv.tv_sec = 1; - tv.tv_nsec = 0; - while (!sigterm) { -- join_channels(sb); -+ if (join_channels(sb) < 0) -+ goto ret_err; - n = irc_reset_pollfds(sb, fds, cbs, maxfds); - r = ppoll(fds, n, &tv, &sigmask); - if (r < 0) { -@@ -633,11 +644,11 @@ int main(int argc, char *argv[]) - sleep(10); - continue; - } -- -+ - irc_loop(&sb); - irc_close(sb.sess, "bye"); - /* reset channel sockets */ -- for (i = 0; i < argc; i++) -+ for (i = 0; i < argc; i++) - close_channel_socket(&sb.chan[i], 0); - if (sigterm) - break; --- -cgit v0.9.0.3 |