tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

UUID package for PostgreSQL



I would like to import a set of packages for creating UUIDs within
PostgreSQL.  Essentially, these are wrappers around the OS sha1 and
md5 functions, all using identical code but linked against the
difference versions of PostgreSQL.  I propose a common directory
(databases/postgresql-uuid) to hold the common parts
(DESCR,Makefile.common,distinfo,patches-*) and three specific ones for
the packages (databases/postgresqlXX-uuid/Makefile).  Below are three
files that illustrate the essential parts of this.

I would appreciate comments on this proposal, both in general and in
response to several questions that I have.

- The source code for this package gives the following license text:

  /*-------------------------------------------------------------------------
   *
   * UUID generation functions for FreeBSD
   *
   * Copyright (c) 2009 Andrew Gierth
   *
   * Some parts originated from contrib/uuid-ossp, which is
   * Copyright (c) 2007-2008 PostgreSQL Global Development Group
   *
   * Permission to use, copy, modify, and distribute this software for
   * any purpose with or without fee is hereby granted, provided that
   * the above copyright notice and this permission notice appear in all
   * copies.
   *
   * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
   * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
   * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR
   * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
   *-------------------------------------------------------------------------
   */

   Does this mean that the PostgreSQL license applies or something
   else?

- I cannot find any license information for the PostgreSQL packages
  within pkgsrc.  Should there be no LICENSE definition for this
  package?

- I don't know enough about the variants of SHA1 naming; can anyone
  provide information on what might be appropriate patches for other
  systems?  Shall I just go with this one patch that I can verify and
  let people update the patches as needed?

- Successful building of this depends on my recent change to
  postgresqlXX-client/Makefile to correct the definition of LD.  Does
  that mean that the revision for the -client packages should be
  bumped?

Thanks alot for your help.

Cheers,
Brook

===============   postgresql90-uuid/Makefile   ============================

# $NetBSD$
#

PGSQL_VERSION=  90

.include "../../databases/postgresql-uuid/Makefile.common"

===============   postgresql-uuid/Makefile.common   =======================

# $NetBSD$
#
# used by databases/postgresql83-uuid
# used by databases/postgresql84-uuid
# used by databases/postgresql90-uuid

DISTNAME=       uuid-freebsd-1.0.2
PKGNAME=        postgresql${PGSQL_VERSION}-uuid
CATEGORIES=     databases
MASTER_SITES=   http://pgfoundry.org/frs/download.php/2605/
EXTRACT_SUFX=   .tgz

MAINTAINER=     brook%nmsu.edu@localhost
HOMEPAGE=       http://pgfoundry.org/projects/uuid-freebsd/
COMMENT=        UUID creation functions for PostgreSQL
#LICENSE=       # TODO: (see mk/license.mk)

PKG_DESTDIR_SUPPORT=    user-destdir

USE_TOOLS+=     gmake

.include "../../mk/bsd.prefs.mk"

# The original package was written for FreeBSD, so no patches should
# be necessary in that case.  Because of inconsitencies in the naming
# of SHA1 functions, other systems may need different patch sets so
# keep them distinct.
.if !empty(OPSYS:MNetBSD)
PATCHDIR=       ../../databases/postgresql-uuid/patches-NetBSD
.endif
DESCR_SRC=      ../../databases/postgresql-uuid/DESCR
PLIST_SRC=      ../../databases/postgresql-uuid/PLIST
DISTINFO_FILE=  ${.CURDIR}/../../databases/postgresql-uuid/distinfo

post-extract:
        ${MV} ${WRKSRC}/uuid-freebsd.c ${WRKSRC}/uuid.c
        ${MV} ${WRKSRC}/uninstall_uuid-freebsd.sql \
                ${WRKSRC}/uninstall_uuid.sql
        ${MV} ${WRKSRC}/uuid-freebsd.sql.in ${WRKSRC}/uuid.sql.in

.include "../../databases/postgresql${PGSQL_VERSION}-client/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

===============   patches-NetBSD/patch-ab   ===============================

$NetBSD$

--- uuid.c.orig 2010-03-14 03:04:29.000000000 -0600
+++ uuid.c      2011-02-12 10:51:10.000000000 -0700
@@ -40,7 +40,7 @@
 #undef uuid_hash
 
 #include <md5.h>
-#include <sha.h>
+#include <sha1.h>
 
 PG_MODULE_MAGIC;
 
@@ -158,13 +158,13 @@
 
        case 5:  /* namespace-based SHA1 uuids */
        {
-           SHA_CTX ctx;
+           SHA1_CTX ctx;
            unsigned char buf[20];
 
-           SHA1_Init(&ctx);
-           SHA1_Update(&ctx, ns, 16);
-           SHA1_Update(&ctx, (unsigned char *)ptr, len);
-           SHA1_Final(buf, &ctx);
+           SHA1Init(&ctx);
+           SHA1Update(&ctx, ns, 16);
+           SHA1Update(&ctx, (unsigned char *)ptr, len);
+           SHA1Final(buf, &ctx);
 
            sprintf(strbuf,
                    "%02x%02x%02x%02x-"


Home | Main Index | Thread Index | Old Index