diff options
author | alepulver <alepulver@FreeBSD.org> | 2009-07-30 23:47:03 +0800 |
---|---|---|
committer | alepulver <alepulver@FreeBSD.org> | 2009-07-30 23:47:03 +0800 |
commit | f2c3e03ecafae5ec5c5f8e10300881cbbb9fd7d2 (patch) | |
tree | 9ce85558123e3cf32fbe671eea9466a39d7cfbb6 | |
parent | 9b88828d1b001968be8c60b6b3a4076f15caf832 (diff) | |
download | freebsd-ports-graphics-f2c3e03ecafae5ec5c5f8e10300881cbbb9fd7d2.tar.gz freebsd-ports-graphics-f2c3e03ecafae5ec5c5f8e10300881cbbb9fd7d2.tar.zst freebsd-ports-graphics-f2c3e03ecafae5ec5c5f8e10300881cbbb9fd7d2.zip |
- Bump PORTREVISION.
- Should run fine in 8.x now (shm_open path now starts with a slash).
- Avoid harmless rmdir error message when uninstalling.
- Now runs from / instead of /var/tmp (as developers wanted).
-rw-r--r-- | devel/fossology/Makefile | 14 | ||||
-rw-r--r-- | devel/fossology/files/fossology.in | 6 | ||||
-rw-r--r-- | devel/fossology/files/patch-scheduler__lockfs.c | 64 | ||||
-rw-r--r-- | devel/fossology/pkg-plist | 2 |
4 files changed, 69 insertions, 17 deletions
diff --git a/devel/fossology/Makefile b/devel/fossology/Makefile index 0fb0c1fbc35..e79204a5df4 100644 --- a/devel/fossology/Makefile +++ b/devel/fossology/Makefile @@ -11,14 +11,13 @@ # archivers/rpm4 -> archivers/rpm2cpio # # TODO: -# - Add status command to rc.d script (run through "daemon -p ..."). -# - Make it shm_open in /var/tmp from lockfs.c rather than changing -# current directory. +# - Add status command to rc.d script (run through "daemon -p ...") # - Add crontab entry for postgres db optimizations? # PORTNAME= fossology PORTVERSION= 1.1.0 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= SF @@ -97,15 +96,6 @@ post-patch: ${WRKSRC}/cli/fo_notify.php # Add path to repository (might be hardcoded in other parts of FOSSology) @${ECHO_CMD} "${FOSS_DB}" > ${WRKSRC}/common/defconf/RepPath.conf - -# XXX: this is done in rc.d script, but program could be modified as well -# Fix shm file path -# @${REINPLACE_CMD} -Ee 's|"(fossology-scheduler)"|"/var/tmp/\1"|' \ -# ${WRKSRC}/scheduler/lockfs.c -# Do not chdir to "/" as it does not have permission to create files there - @${REINPLACE_CMD} -e 's|daemon(0,|daemon(1,|' \ - ${WRKSRC}/scheduler/scheduler.c \ - ${WRKSRC}/scheduler/fo_watchdog.c # Do not install init.d script (we use our own) @${REINPLACE_CMD} -Ee 's|^(install: all) install-init|\1|' \ ${WRKSRC}/scheduler/Makefile diff --git a/devel/fossology/files/fossology.in b/devel/fossology/files/fossology.in index c9565b27196..5428bc97ff8 100644 --- a/devel/fossology/files/fossology.in +++ b/devel/fossology/files/fossology.in @@ -25,10 +25,8 @@ stop_cmd="fossology_stop" fossology_start() { echo "Starting fossology." -# XXX: Enter /var/tmp because uses shm_open in current directory, -# otherwise patch scheduler.c - cd /var/tmp && ${SCHEDULER} -d -R - cd /var/tmp && ${WATCHDOG} + ${SCHEDULER} -d -R + ${WATCHDOG} } fossology_stop() diff --git a/devel/fossology/files/patch-scheduler__lockfs.c b/devel/fossology/files/patch-scheduler__lockfs.c new file mode 100644 index 00000000000..84f89442d1c --- /dev/null +++ b/devel/fossology/files/patch-scheduler__lockfs.c @@ -0,0 +1,64 @@ +--- scheduler/lockfs.c.orig 2009-07-08 23:45:57.000000000 -0300 ++++ scheduler/lockfs.c 2009-07-30 12:15:25.000000000 -0300 +@@ -32,6 +32,8 @@ + #include "scheduler.h" + #include "logging.h" + ++#define LOCK_PREFIX "/var/tmp" ++ + /******************************************** + LockGetPID() returns PID of process that + owns a lock (or zero if there is no lock). +@@ -43,8 +45,11 @@ + int Handle; + int rc; + char S[10]; ++ char _lockfile[FILENAME_MAX]; ++ ++ snprintf(_lockfile, sizeof(_lockfile), "%s/%s", LOCK_PREFIX, ProcessName); + +- Handle = shm_open(ProcessName,O_RDONLY,0444); ++ Handle = shm_open(_lockfile,O_RDONLY,0444); + if (Handle < 0) + { + /* don't report error if lock file does not exist. That may be normal. */ +@@ -59,7 +64,7 @@ + if (Pid < 2) + { + /* bogus pid can't be less than 2 digits, remove lockfile */ +- if (shm_unlink(ProcessName) == -1) ++ if (shm_unlink(_lockfile) == -1) + LogPrint("*** failed to remove invalid lock file for %s (see LockGetPID). %s\n", ProcessName, strerror(errno)); + return(0); + } +@@ -99,7 +104,11 @@ + ********************************************/ + int UnlockName (char *ProcessName) + { +- return(shm_unlink(ProcessName)); ++ char _lockfile[FILENAME_MAX]; ++ ++ snprintf(_lockfile, sizeof(_lockfile), "%s/%s", LOCK_PREFIX, ProcessName); ++ ++ return(shm_unlink(_lockfile)); + } /* UnlockName() */ + + /******************************************** +@@ -114,13 +123,16 @@ + int rv; + pid_t Pid = 0; + char S[10]; ++ char _lockfile[FILENAME_MAX]; ++ ++ snprintf(_lockfile, sizeof(_lockfile), "%s/%s", LOCK_PREFIX, ProcessName); + + /* return if there is already a lock */ + Pid = LockGetPID(ProcessName); + if (Pid) return (Pid); + + /* No lock, so create the lock file */ +- Handle = shm_open(ProcessName,O_RDWR|O_CREAT|O_EXCL,0744); ++ Handle = shm_open(_lockfile,O_RDWR|O_CREAT|O_EXCL,0744); + if (-1 == Handle) + { + /* create failed */ diff --git a/devel/fossology/pkg-plist b/devel/fossology/pkg-plist index e7ac5f5eab1..2097a33b886 100644 --- a/devel/fossology/pkg-plist +++ b/devel/fossology/pkg-plist @@ -962,7 +962,7 @@ lib/libfossrepo.a @dirrm %%DATADIR%%/agents/licenses/AFL @dirrm %%DATADIR%%/agents/licenses @dirrm %%DATADIR%%/agents -@unexec rmdir %D/%%DATADIR%% >/dev/null || echo "If you are permanently removing FOSSology, please manually remove the repository files in \"%D/%%DATADIR%%\"." | fmt +@unexec rmdir %D/%%DATADIR%% >/dev/null 2>&1 || echo "If you are permanently removing FOSSology, please manually remove the repository files in \"%D/%%DATADIR%%\"." | fmt %%PORTDOCS%%@dirrm %%DOCSDIR%% @dirrm lib/fossology/agents @dirrm lib/fossology |