pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/pkg_install/files



Module Name:    pkgsrc
Committed By:   joerg
Date:           Fri Oct 11 11:57:41 UTC 2019

Modified Files:
        pkgsrc/pkgtools/pkg_install/files/admin: main.c pkg_admin.1
            pkg_admin.cat
        pkgsrc/pkgtools/pkg_install/files/lib: version.h

Log Message:
pkg_install-20191008: Add pkg_admin digest command


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 pkgsrc/pkgtools/pkg_install/files/admin/main.c
cvs rdiff -u -r1.37 -r1.38 \
    pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1
cvs rdiff -u -r1.6 -r1.7 \
    pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.cat
cvs rdiff -u -r1.177 -r1.178 pkgsrc/pkgtools/pkg_install/files/lib/version.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/pkg_install/files/admin/main.c
diff -u pkgsrc/pkgtools/pkg_install/files/admin/main.c:1.66 pkgsrc/pkgtools/pkg_install/files/admin/main.c:1.67
--- pkgsrc/pkgtools/pkg_install/files/admin/main.c:1.66 Mon Feb 26 23:45:02 2018
+++ pkgsrc/pkgtools/pkg_install/files/admin/main.c      Fri Oct 11 11:57:41 2019
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.66 2018/02/26 23:45:02 ginsbach Exp $       */
+/*     $NetBSD: main.c,v 1.67 2019/10/11 11:57:41 joerg Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,10 +7,10 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.66 2018/02/26 23:45:02 ginsbach Exp $");
+__RCSID("$NetBSD: main.c,v 1.67 2019/10/11 11:57:41 joerg Exp $");
 
 /*-
- * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999-2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -59,8 +59,10 @@ __RCSID("$NetBSD: main.c,v 1.66 2018/02/
 #endif
 #ifndef NETBSD
 #include <nbcompat/md5.h>
+#include <nbcompat/sha2.h>
 #else
 #include <md5.h>
+#include <sha2.h>
 #endif
 #if HAVE_LIMITS_H
 #include <limits.h>
@@ -93,6 +95,7 @@ static const char Options[] = "C:K:SVbd:
 int    quiet, verbose;
 
 static void set_unset_variable(char **, Boolean);
+static void digest_input(char **);
 
 /* print usage message and exit */
 void 
@@ -521,6 +524,9 @@ main(int argc, char *argv[])
        } else if (strcasecmp(argv[0], "unset") == 0) {
                argv++;         /* "unset" */
                set_unset_variable(argv, TRUE);
+       } else if (strcasecmp(argv[0], "digest") == 0) {
+               argv++;         /* "digest" */
+               digest_input(argv);
        } else if (strcasecmp(argv[0], "config-var") == 0) {
                argv++;
                if (argv == NULL || argv[1] != NULL)
@@ -736,3 +742,22 @@ set_unset_variable(char **argv, Boolean 
 
        return;
 }
+
+static void
+digest_input(char **argv)
+{
+       char digest[SHA256_DIGEST_STRING_LENGTH];
+       int failures = 0;
+
+       while (*argv != NULL) {
+               if (SHA256_File(*argv, digest)) {
+                       puts(digest);
+               } else {
+                       warn("cannot process %s", *argv);
+                       ++failures;
+               }
+               argv++;
+       }
+       if (failures)
+               exit(EXIT_FAILURE);
+}

Index: pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1
diff -u pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1:1.37 pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1:1.38
--- pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1:1.37    Tue Oct  8 21:33:35 2019
+++ pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.1 Fri Oct 11 11:57:41 2019
@@ -1,10 +1,11 @@
-.\"    $NetBSD: pkg_admin.1,v 1.37 2019/10/08 21:33:35 joerg Exp $
+.\"    $NetBSD: pkg_admin.1,v 1.38 2019/10/11 11:57:41 joerg Exp $
 .\"
-.\" Copyright (c) 1999-2010 The NetBSD Foundation, Inc.
+.\" Copyright (c) 1999-2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Hubert Feyrer <hubert%feyrer.de@localhost>.
+.\" by Hubert Feyrer <hubert%feyrer.de@localhost> and
+.\" by Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -27,7 +28,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 25, 2018
+.Dd October 8, 2019
 .Dt PKG_ADMIN 1
 .Os
 .Sh NAME
@@ -182,6 +183,9 @@ otherwise it exits with error.
 Print the current value of
 .Ar variable
 as used after parsing the configuration file.
+.It Cm digest Ar file ...
+Compute a SHA256 message digest of
+.Ar file .
 .It Cm dump
 Dump the contents of the package database, similar to
 .Cm pkg_info -F .

Index: pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.cat
diff -u pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.cat:1.6 pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.cat:1.7
--- pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.cat:1.6   Tue Oct  8 21:33:35 2019
+++ pkgsrc/pkgtools/pkg_install/files/admin/pkg_admin.cat       Fri Oct 11 11:57:41 2019
@@ -105,6 +105,9 @@ OOPPTTIIOONNSS
              Print the current value of _v_a_r_i_a_b_l_e as used after parsing the
              configuration file.
 
+     ddiiggeesstt _f_i_l_e _._._.
+             Compute a SHA256 message digest of _f_i_l_e.
+
      dduummpp    Dump the contents of the package database, similar to ppkkgg__iinnffoo
              --FF.  Columns are printed for the key field used in the pkgdb -
              the filename -, and the data field - the package the file belongs
@@ -206,4 +209,4 @@ HHIISSTTOORRYY
 AAUUTTHHOORRSS
      The ppkkgg__aaddmmiinn command was written by Hubert Feyrer.
 
-pkgsrc                         February 25, 2018                        pkgsrc
+pkgsrc                         October 8, 2019                          pkgsrc

Index: pkgsrc/pkgtools/pkg_install/files/lib/version.h
diff -u pkgsrc/pkgtools/pkg_install/files/lib/version.h:1.177 pkgsrc/pkgtools/pkg_install/files/lib/version.h:1.178
--- pkgsrc/pkgtools/pkg_install/files/lib/version.h:1.177       Fri Apr  5 22:53:29 2019
+++ pkgsrc/pkgtools/pkg_install/files/lib/version.h     Fri Oct 11 11:57:41 2019
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.177 2019/04/05 22:53:29 sevan Exp $      */
+/*     $NetBSD: version.h,v 1.178 2019/10/11 11:57:41 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 20190405
+#define PKGTOOLS_VERSION 20191008
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index