From eece12345dcdb2f592a3051244bed6ed8d8b69b3 Mon Sep 17 00:00:00 2001 From: joerg Date: Wed, 13 May 2009 03:33:50 +0000 Subject: pkg_install-20090513: Add pkg_create -F, which explicitly provides the compression type. --- pkgtools/pkg_install/files/create/build.c | 24 +++++++++++++++++++----- pkgtools/pkg_install/files/create/create.h | 3 ++- pkgtools/pkg_install/files/create/main.c | 14 ++++++++++---- pkgtools/pkg_install/files/create/pkg_create.1 | 14 ++++++++++++-- pkgtools/pkg_install/files/lib/version.h | 4 ++-- 5 files changed, 45 insertions(+), 14 deletions(-) (limited to 'pkgtools') diff --git a/pkgtools/pkg_install/files/create/build.c b/pkgtools/pkg_install/files/create/build.c index 3869358ee01..ee223c34044 100644 --- a/pkgtools/pkg_install/files/create/build.c +++ b/pkgtools/pkg_install/files/create/build.c @@ -1,4 +1,4 @@ -/* $NetBSD: build.c,v 1.11 2009/03/08 17:26:23 joerg Exp $ */ +/* $NetBSD: build.c,v 1.12 2009/05/13 03:33:50 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: build.c,v 1.11 2009/03/08 17:26:23 joerg Exp $"); +__RCSID("$NetBSD: build.c,v 1.12 2009/05/13 03:33:50 joerg Exp $"); /*- * Copyright (c) 2007 Joerg Sonnenberger . @@ -239,12 +239,26 @@ make_dist(const char *pkg, const char *suffix, const package_t *plist) archive_entry_linkresolver_set_strategy(resolver, archive_format(archive)); - if (strcmp(suffix, "tbz") == 0 || strcmp(suffix, "tar.bz2") == 0) + if (CompressionType == NULL) { + if (strcmp(suffix, "tbz") == 0 || + strcmp(suffix, "tar.bz2") == 0) + CompressionType = "bzip2"; + else if (strcmp(suffix, "tgz") == 0 || + strcmp(suffix, "tar.gz") == 0) + CompressionType = "gzip"; + else + CompressionType = "none"; + } + + if (strcmp(CompressionType, "bzip2") == 0) archive_write_set_compression_bzip2(archive); - else if (strcmp(suffix, "tgz") == 0 || strcmp(suffix, "tar.gz") == 0) + else if (strcmp(CompressionType, "gzip") == 0) archive_write_set_compression_gzip(archive); - else + else if (strcmp(CompressionType, "none") == 0) archive_write_set_compression_none(archive); + else + errx(1, "Unspported compression type for -F: %s", + CompressionType); archive_name = xasprintf("%s.%s", pkg, suffix); diff --git a/pkgtools/pkg_install/files/create/create.h b/pkgtools/pkg_install/files/create/create.h index 97406c75c7f..73dde690b99 100644 --- a/pkgtools/pkg_install/files/create/create.h +++ b/pkgtools/pkg_install/files/create/create.h @@ -1,4 +1,4 @@ -/* $NetBSD: create.h,v 1.11 2009/05/13 03:18:05 joerg Exp $ */ +/* $NetBSD: create.h,v 1.12 2009/05/13 03:33:50 joerg Exp $ */ /* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */ @@ -55,6 +55,7 @@ extern char *SrcDir; extern char *realprefix; extern char *DefaultOwner; extern char *DefaultGroup; +extern char *CompressionType; extern int PlistOnly; extern int RelativeLinks; extern int update_pkgdb; diff --git a/pkgtools/pkg_install/files/create/main.c b/pkgtools/pkg_install/files/create/main.c index 63fc12139ca..b1165c77916 100644 --- a/pkgtools/pkg_install/files/create/main.c +++ b/pkgtools/pkg_install/files/create/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.14 2009/05/13 03:18:05 joerg Exp $ */ +/* $NetBSD: main.c,v 1.15 2009/05/13 03:33:50 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: main.c,v 1.14 2009/05/13 03:18:05 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.15 2009/05/13 03:33:50 joerg Exp $"); /* * FreeBSD install - a package for the installation and maintainance @@ -26,7 +26,7 @@ __RCSID("$NetBSD: main.c,v 1.14 2009/05/13 03:18:05 joerg Exp $"); #include "lib.h" #include "create.h" -static const char Options[] = "B:C:D:EFI:K:L:OP:S:T:UVb:c:d:f:g:i:k:ln:p:r:s:u:v"; +static const char Options[] = "B:C:D:EF:I:K:L:OP:S:T:UVb:c:d:f:g:i:k:ln:p:r:s:u:v"; char *Prefix = NULL; char *Comment = NULL; @@ -47,6 +47,7 @@ char *SrcDir = NULL; char *DefaultOwner = NULL; char *DefaultGroup = NULL; char *realprefix = NULL; +char *CompressionType = NULL; int update_pkgdb = 1; int create_views = 0; int PlistOnly = 0; @@ -58,7 +59,8 @@ usage(void) { fprintf(stderr, "usage: pkg_create [-ElOUVv] [-B build-info-file] [-b build-version-file]\n" - " [-C cpkgs] [-D displayfile] [-I realprefix] [-i iscript]\n" + " [-C cpkgs] [-D displayfile] [-F compression] \n" + " [-I realprefix] [-i iscript]\n" " [-K pkg_dbdir] [-k dscript] [-L SrcDir]\n" " [-n preserve-file] [-P dpkgs] [-p prefix] [-r rscript]\n" " [-S size-all-file] [-s size-pkg-file]\n" @@ -89,6 +91,10 @@ main(int argc, char **argv) create_views = 1; break; + case 'F': + CompressionType = optarg; + break; + case 'I': realprefix = optarg; break; diff --git a/pkgtools/pkg_install/files/create/pkg_create.1 b/pkgtools/pkg_install/files/create/pkg_create.1 index 143603dddc8..ecfaa06a214 100644 --- a/pkgtools/pkg_install/files/create/pkg_create.1 +++ b/pkgtools/pkg_install/files/create/pkg_create.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_create.1,v 1.19 2009/04/24 14:00:25 joerg Exp $ +.\" $NetBSD: pkg_create.1,v 1.20 2009/05/13 03:33:50 joerg Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -24,7 +24,7 @@ .\" [jkh] Took John's changes back and made some additional extensions for .\" better integration with FreeBSD's new ports collection. .\" -.Dd April 24, 2009 +.Dd May 13, 2009 .Dt PKG_CREATE 1 .Os .Sh NAME @@ -46,6 +46,9 @@ .Op Fl D Ar displayfile .Ek .Bk -words +.Op Fl F Ar compression +.Ek +.Bk -words .Op Fl g Ar group .Ek .Bk -words @@ -160,6 +163,13 @@ or, if preceded by the argument itself. .It Fl E Add an empty views file to the package. +.It Fl F Ar compression +Use +.Ar compression +as compression algorithm. +This overrides the heuristic to guess the compression type from the +output name. +Currently supported values are bzip2, gzip and none. .It Fl f Ar packlist Fetch .Pq packing list diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h index 6e5fe0b9f87..4d20ceeffb5 100644 --- a/pkgtools/pkg_install/files/lib/version.h +++ b/pkgtools/pkg_install/files/lib/version.h @@ -1,4 +1,4 @@ -/* $NetBSD: version.h,v 1.126 2009/05/02 16:14:37 reed Exp $ */ +/* $NetBSD: version.h,v 1.127 2009/05/13 03:33:50 joerg Exp $ */ /* * Copyright (c) 2001 Thomas Klausner. All rights reserved. @@ -27,6 +27,6 @@ #ifndef _INST_LIB_VERSION_H_ #define _INST_LIB_VERSION_H_ -#define PKGTOOLS_VERSION "20090502" +#define PKGTOOLS_VERSION "20090513" #endif /* _INST_LIB_VERSION_H_ */ -- cgit v1.2.3