diff options
author | rillig <rillig@pkgsrc.org> | 2005-07-30 20:38:30 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2005-07-30 20:38:30 +0000 |
commit | 8250b297f7429e51061961560b82269ff413ca52 (patch) | |
tree | 59f2a93810fb68f69040f9d2a9a14db4c68f49de /pkgtools | |
parent | f66c5f2ae12f0a8fff0dd5dc0cfead9f9fdce57f (diff) | |
download | pkgsrc-8250b297f7429e51061961560b82269ff413ca52.tar.gz |
Removed the package as it has not been working since 2001. Ok'ed by
wennmach.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkgconflict/DESCR | 10 | ||||
-rw-r--r-- | pkgtools/pkgconflict/Makefile | 38 | ||||
-rw-r--r-- | pkgtools/pkgconflict/PLIST | 4 | ||||
-rw-r--r-- | pkgtools/pkgconflict/files/dewey_cmp.c | 292 | ||||
-rwxr-xr-x | pkgtools/pkgconflict/files/pkgconflict | 155 | ||||
-rwxr-xr-x | pkgtools/pkgconflict/files/pkgdbextract | 40 |
6 files changed, 0 insertions, 539 deletions
diff --git a/pkgtools/pkgconflict/DESCR b/pkgtools/pkgconflict/DESCR deleted file mode 100644 index 2c811a5c9a5..00000000000 --- a/pkgtools/pkgconflict/DESCR +++ /dev/null @@ -1,10 +0,0 @@ -pkgconflict is a script that searches for conflicting packages. - -In a first step it gathers the package and file names of all known -packages. The source for this step is either the contents of -/var/db/pkg, or a directory where the builk builds saved the -package databases. - -In a second step, it calls a database system, PostgreSQL, to -determine which packages have common file names. Packages with -registered CONFLICT lines are filtered out. diff --git a/pkgtools/pkgconflict/Makefile b/pkgtools/pkgconflict/Makefile deleted file mode 100644 index a3cac57b1fc..00000000000 --- a/pkgtools/pkgconflict/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# $NetBSD: Makefile,v 1.15 2005/06/17 03:50:29 jlam Exp $ -# - -DISTNAME= pkgconflict-0.4 -CATEGORIES= pkgtools -MASTER_SITES= # empty -DISTFILES= # empty - -MAINTAINER= wennmach@NetBSD.org -COMMENT= Scripts to find conflicting packages in pkgsrc - -WRKSRC= ${WRKDIR} -NO_CHECKSUM= yes -NO_CONFIGURE= yes -PKG_INSTALLATION_TYPES= overwrite pkgviews - -.include "../../mk/bsd.prefs.mk" - -CPPFLAGS+= -I${PGSQL_PREFIX}/include/postgresql/server - -INSTALLATION_DIRS= bin lib/postgresql - -post-extract: - @for f in dewey_cmp.c pkgconflict pkgdbextract; do \ - ${SED} -e 's|@PREFIX@|${PREFIX}|g' ${FILESDIR}/$$f >${WRKSRC}/$$f; \ - done - -do-build: - cd ${WRKSRC} && ${COMPILE.c} -fPIC dewey_cmp.c - cd ${WRKSRC} && ${LINK.c} -shared -o dewey_cmp.so dewey_cmp.o - -do-install: - ${INSTALL_LIB} ${WRKSRC}/dewey_cmp.so ${PREFIX}/lib/postgresql/ - ${INSTALL_SCRIPT} ${WRKSRC}/pkgconflict ${PREFIX}/bin/ - ${INSTALL_SCRIPT} ${WRKSRC}/pkgdbextract ${PREFIX}/bin/ - -.include "../../mk/pgsql.buildlink3.mk" -.include "../../mk/bsd.pkg.mk" diff --git a/pkgtools/pkgconflict/PLIST b/pkgtools/pkgconflict/PLIST deleted file mode 100644 index a0a9f1700d0..00000000000 --- a/pkgtools/pkgconflict/PLIST +++ /dev/null @@ -1,4 +0,0 @@ -@comment $NetBSD: PLIST,v 1.2 2005/01/05 21:15:15 tv Exp $ -lib/postgresql/dewey_cmp.so -bin/pkgconflict -bin/pkgdbextract diff --git a/pkgtools/pkgconflict/files/dewey_cmp.c b/pkgtools/pkgconflict/files/dewey_cmp.c deleted file mode 100644 index 21fdb2aecb8..00000000000 --- a/pkgtools/pkgconflict/files/dewey_cmp.c +++ /dev/null @@ -1,292 +0,0 @@ -/* $NetBSD: dewey_cmp.c,v 1.2 2001/04/10 14:20:16 wennmach Exp $ */ - -/* - * Implement the comparision of a package name with a dewey pattern - * for use with PostgreSQL. - * - * Author: Lex Wennmacher, - * almost entirely based on the dewey routines written by: Hubert Feyrer - * (taken from: basesrc/usr.sbin/pkg_install/lib/str.c, version 1.28) - */ - -#include <sys/cdefs.h> -#if 0 -static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp"; -#else -__RCSID("$NetBSD: dewey_cmp.c,v 1.2 2001/04/10 14:20:16 wennmach Exp $"); -#endif - -/* - * FreeBSD install - a package for the installation and maintainance - * of non-core utilities. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Jordan K. Hubbard - * 18 July 1993 - * - * Miscellaneous string utilities. - * - */ - -#include <sys/param.h> -#include <sys/stat.h> -#include <sys/file.h> -#include <sys/queue.h> - -#include <ctype.h> -#include <dirent.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <unistd.h> - -#include <assert.h> -#include <err.h> -#include <fnmatch.h> - -int pmatch(const char *, const char *); - -typedef enum deweyop_t { - GT, - GE, - LT, - LE -} deweyop_t; - -/* - * Compare two dewey decimal numbers - */ -static int -deweycmp(char *a, deweyop_t op, char *b) -{ - int ad; - int bd; - char *a_nb; - char *b_nb; - int in_nb = 0; - int cmp; - - assert(a != NULL); - assert(b != NULL); - - /* Null out 'n' in any "nb" suffixes for initial pass */ - if ((a_nb = strstr(a, "nb"))) - *a_nb = 0; - if ((b_nb = strstr(b, "nb"))) - *b_nb = 0; - - for (;;) { - if (*a == 0 && *b == 0) { - if (!in_nb && (a_nb || b_nb)) { - /* - * If exact match on first pass, test - * "nb<X>" suffixes in second pass - */ - in_nb = 1; - if (a_nb) - a = a_nb + 2; /* Skip "nb" suffix */ - if (b_nb) - b = b_nb + 2; /* Skip "nb" suffix */ - } else { - cmp = 0; - break; - } - } - - ad = bd = 0; - for (; *a && *a != '.'; a++) { - ad = (ad * 10) + (*a - '0'); - } - for (; *b && *b != '.'; b++) { - bd = (bd * 10) + (*b - '0'); - } - if ((cmp = ad - bd) != 0) { - break; - } - if (*a == '.') - ++a; - if (*b == '.') - ++b; - } - /* Replace any nulled 'n' */ - if (a_nb) - *a_nb = 'n'; - if (b_nb) - *b_nb = 'n'; - return (op == GE) ? cmp >= 0 : (op == GT) ? cmp > 0 : - (op == LE) ? cmp <= 0 : cmp < 0; -} - -/* - * Perform alternate match on "pkg" against "pattern", - * calling pmatch (recursively) to resolve any other patterns. - * Return 1 on match, 0 otherwise - */ -static int -alternate_match(const char *pattern, const char *pkg) -{ - char *sep; - char buf[FILENAME_MAX]; - char *last; - char *alt; - char *cp; - int cnt; - int found; - - if ((sep = strchr(pattern, '{')) == (char *) NULL) { - errx(1, "alternate_match(): '{' expected in `%s'", pattern); - } - (void)strncpy(buf, pattern, (size_t) (sep - pattern)); - alt = &buf[sep - pattern]; - last = (char *) NULL; - for (cnt = 0, cp = sep; *cp && last == (char *) NULL; cp++) { - if (*cp == '{') { - cnt++; - } else if (*cp == '}' && --cnt == 0 && last == (char *) NULL) { - last = cp + 1; - } - } - if (cnt != 0) { - errx(1, "Malformed alternate `%s'", pattern); - } - for (found = 0, cp = sep + 1; *sep != '}'; cp = sep + 1) { - for (cnt = 0, sep = cp; cnt > 0 || (cnt == 0 && *sep != '}' && - *sep != ','); sep++) { - if (*sep == '{') { - cnt++; - } else if (*sep == '}') { - cnt--; - } - } - (void)snprintf(alt, sizeof(buf) - (alt - buf), "%.*s%s", - (int)(sep - cp), cp, last); - if (pmatch(buf, pkg) == 1) { - found = 1; - } - } - return found; -} - -/* - * Perform dewey match on "pkg" against "pattern". - * Return 1 on match, 0 otherwise - */ -static int -dewey_match(const char *pattern, const char *pkg) -{ - deweyop_t op; - char *cp; - char *sep; - char *ver; - char name[FILENAME_MAX]; - int n; - - if ((sep = strpbrk(pattern, "<>")) == NULL) { - errx(1, "dewey_match(): '<' or '>' expected in `%s'", pattern); - } - (void)snprintf(name, sizeof(name), "%.*s", (int)(sep - pattern), - pattern); - op = (*sep == '>') ? (*(sep + 1) == '=') ? GE : GT : (*(sep + 1) == '=') - ? LE : LT; - ver = (op == GE || op == LE) ? sep + 2 : sep + 1; - n = (int) (sep - pattern); - if ((cp = strrchr(pkg, '-')) != (char *) NULL) { - if (strncmp(pkg, name, (size_t)(cp - pkg)) == 0 && - n == cp - pkg) { - if (deweycmp(cp + 1, op, ver)) { - return 1; - } - } - } - return 0; -} - -/* - * Perform glob match on "pkg" against "pattern". - * Return 1 on match, 0 otherwise - */ -static int -glob_match(const char *pattern, const char *pkg) -{ - return fnmatch(pattern, pkg, FNM_PERIOD) == 0; -} - -/* - * Perform simple match on "pkg" against "pattern". - * Return 1 on match, 0 otherwise - */ -static int -simple_match(const char *pattern, const char *pkg) -{ - return strcmp(pattern, pkg) == 0; -} - -/* - * Match pkg against pattern, return 1 if matching, 0 else - */ -int -pmatch(const char *pattern, const char *pkg) -{ - if (strchr(pattern, '{') != (char *) NULL) { - /* emulate csh-type alternates */ - return alternate_match(pattern, pkg); - } - if (strpbrk(pattern, "<>") != (char *) NULL) { - /* perform relational dewey match on version number */ - return dewey_match(pattern, pkg); - } - if (strpbrk(pattern, "*?[]") != (char *) NULL) { - /* glob match */ - return glob_match(pattern, pkg); - } - - /* no alternate, dewey or glob match -> simple compare */ - return simple_match(pattern, pkg); -} - - -/* pkg_cmp is used to implement the ~~~ operator in PostgreSQL */ -#include <postgres.h> -#include <utils/builtins.h> - -bool -pkg_cmp(text *vpkg, text *vpattern) -{ - char *pkg; - char *pattern; - int len; - -/* Should never happen, but catch it anyway */ - if (vpkg == NULL || vpattern == NULL) - return false; - -/* - * Convert vpkg, vpattern from PostgreSQL built-in type "text" - * to type "char *". - * We wildly use "palloc" to allocate memory and never free it; - * this ist done automatically by PostgreSQL after each transaction. - */ - len = VARSIZE(vpkg) - VARHDRSZ; - pkg = (char *)palloc(len + 1); - memmove(pkg, VARDATA(vpkg), len); - pkg[len] = '\0'; - - len = VARSIZE(vpattern) - VARHDRSZ; - pattern = (char *)palloc(len + 1); - memmove(pattern, VARDATA(vpattern), len); - pattern[len] = '\0'; - - if (pmatch((const char *)pattern, (const char *)pkg) == 1) - return true; - - return false; -} diff --git a/pkgtools/pkgconflict/files/pkgconflict b/pkgtools/pkgconflict/files/pkgconflict deleted file mode 100755 index 122bc6d44c1..00000000000 --- a/pkgtools/pkgconflict/files/pkgconflict +++ /dev/null @@ -1,155 +0,0 @@ -#!/bin/csh -f -# $NetBSD: pkgconflict,v 1.3 2005/01/05 21:15:15 tv Exp $ -# -# pkgconflict: A script to find conflicting packages in pkgsrc -# Author: Lex Wennmacher <wennmach@netbsd.org> -# - -set PREFIX=@PREFIX@ - -if ($#argv > 1) then - echo Usage: pkgconflict [BASEDIR] - exit -1 -endif - -# BASEDIR is the directory where the packages databases live -# The default location in /var/db/pkg, but can be changed to -# a different directory, e. g. to the place where the bulk builds -# saved the packages databases -if ($#argv == 1) then - set BASEDIR=$1 -else - set BASEDIR="/var/db/pkg" -endif - -if (! -d $BASEDIR) then - echo pkgconflict: error: BASEDIR, $BASEDIR, does not exist. - exit -1 -endif - -psql -l >& /dev/null -if ($status != 0) then - echo pkgconflict: error: PostgreSQL must be installed and configured." - exit -1 -endif - -if (! -x $PREFIX/lib/postgresql/dewey_cmp.so) then - echo pkgconflict: error: no executable $PREFIX/lib/postgresql/dewey_cmp.so - exit -1 -endif - -set testfile=.test.$$ -rm -f $testfile -touch $testfile -if (! -e $testfile) then -# XXX if (! -w .) should be simpler, but I'm not sure if it really works - echo pkgconflict: error: local directory must be writable. - exit -1 -endif -rm -f $testfile - -echo pkgconflict: started `date` -echo " " - -if (! -d RCS) mkdir RCS - -rm -f pkgfiles -touch pkgfiles - -rm -f registered_conflicts -touch registered_conflicts - -foreach dir ($BASEDIR/*) - if (-d $dir) then - set basename=$dir:t - echo processig $basename - set contents=$dir/+CONTENTS - if (-e $contents) then - awk '/^@cwd/ {cwd=$2} \ - /^@name/ {name=$2} \ - /^@ignore/ {skip=1} \ - /^[^@].*$/ {if (skip==1) skip=0; else print name "\t" cwd "/" $1}' \ - $contents >> pkgfiles - awk '/^@name/ {name=$2} \ - /^@pkgcfl/ {print name "\t" $2} \ - END {print name "\t" substr(name, 0, match(name, "-[^-]*$")) "*"}' \ - $contents >> registered_conflicts - endif - endif -end - -echo " " - -if (-e CFL-files) ci -l -t-version0 -m"script-based checkin" CFL-files -rm -f CFL-files - -if (-e CFL-count) ci -l -t-version0 -m"script-based checkin" CFL-count -rm -f CFL-count - -echo " " -echo pkgconflict: Done processing packages `date` -echo pkgconflict: Invoking PostgreSQL to generate database summaries. -echo " " - -set DATABASE=tmp.$$ -createdb $DATABASE -psql $DATABASE << --EOI-- -create function - pkg_cmp(text, text) - returns bool - as '$PREFIX/lib/postgresql/dewey_cmp.so' - language 'C'; -create operator ~~~ ( - leftarg = text, - rightarg = text, - procedure = pkg_cmp); -create table pkgfiles ( - pkg text, file text); -copy pkgfiles from '`pwd`/pkgfiles'; -create table registered_conflicts ( - pkg text, pattern text); -copy registered_conflicts from '`pwd`/registered_conflicts'; -\o CFL-files -\qecho 'CFL-files table generated `date`' -\qecho 'This table contains:' -\qecho ' a pair of conflicting packages (first 2 columns)' -\qecho ' name of the common file (third column)' -\qecho ' ' -select - p1.pkg as pkg1, p2.pkg as pkg2, p1.file - from pkgfiles p1, pkgfiles p2 - where (p1.file = p2.file) - and (not exists ( - select - r.pkg - from registered_conflicts r - where (p1.pkg = r.pkg) and (p2.pkg ~~~ r.pattern))) - order by 1 asc; -\o CFL-count -\qecho 'CFL-count table generated `date`' -\qecho 'This table contains:' -\qecho ' a pair of conflicting packages (unique) (first 2 columns)' -\qecho ' the count of conflicting files (third column)' -\qecho ' ' -select - distinct on (p1.pkg, p2.pkg) - p1.pkg, p2.pkg, count(p1.file) - from pkgfiles p1, pkgfiles p2 - where (p1.file = p2.file) - and not exists ( - select r.pkg from - registered_conflicts r - where (p1.pkg = r.pkg) and (p2.pkg ~~~ r.pattern)) - group by p1.pkg, p2.pkg - order by 1 asc; -\o null -drop table pkgfiles; -drop table registered_conflicts; -\q ---EOI-- -dropdb $DATABASE -rm -f null pkgfiles registered_conflicts - -echo " " -echo pkgconflict: Done `date`. -exit diff --git a/pkgtools/pkgconflict/files/pkgdbextract b/pkgtools/pkgconflict/files/pkgdbextract deleted file mode 100755 index aa882ad13d1..00000000000 --- a/pkgtools/pkgconflict/files/pkgdbextract +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/csh -f -# $NetBSD: pkgdbextract,v 1.2 2001/04/10 14:09:20 wennmach Exp $ -# -# pkgdbextract: tool to extract packages databases from binary packages -# into a destination directory, suitable for use with pkgconflict -# -# Author: Lex Wennmacher <wennmach@netbsd.org> -# - -# Usage pkgdbextract BASEDIR package1.tgz [ package2.tgz ... ] - -set nargs=$#argv -if ($nargs < 2) then - echo pkgdbextract: usage: pkgdbextract BASEDIR package1.tgz [ package2.tgz ... ] - exit -1 -endif - -set BASEDIR=$1 - -if (! -d $BASEDIR) mkdir -p $BASEDIR -if (! -d $BASEDIR) then - echo could not create $BASEDIR - exit -1 -endif - -# Loop over all packages (args 2 - ) -foreach pkg (`echo $argv[2-]`) - if (-e $pkg) then - set pkgbinname=$pkg:t - set pkgname=$pkgbinname:r - set DESTDIR=$BASEDIR/$pkgname - mkdir -p $DESTDIR - cat $pkg | (cd $DESTDIR; tar --fast-read -xzf - +CONTENTS) - else -# It is not an error if a package can not be read - echo "pkgdbextract: warning: $pkg not readable" - endif -end - -exit 0 |