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:   wiz
Date:           Sun Aug 25 06:08:01 UTC 2024

Modified Files:
        pkgsrc/pkgtools/pkg_install/files/add: perform.c
        pkgsrc/pkgtools/pkg_install/files/lib: version.h

Log Message:
pkg_install: check REQUIRES lines on installation

Fail if any of the required libraries is missing; in particular,
for files from the X set on NetBSD, suggest installing the X sets.

Should fix PR 58433.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 pkgsrc/pkgtools/pkg_install/files/add/perform.c
cvs rdiff -u -r1.193 -r1.194 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/add/perform.c
diff -u pkgsrc/pkgtools/pkg_install/files/add/perform.c:1.122 pkgsrc/pkgtools/pkg_install/files/add/perform.c:1.123
--- pkgsrc/pkgtools/pkg_install/files/add/perform.c:1.122       Fri Jan 26 03:24:49 2024
+++ pkgsrc/pkgtools/pkg_install/files/add/perform.c     Sun Aug 25 06:08:00 2024
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.122 2024/01/26 03:24:49 riastradh Exp $  */
+/*     $NetBSD: perform.c,v 1.123 2024/08/25 06:08:00 wiz Exp $        */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.122 2024/01/26 03:24:49 riastradh Exp $");
+__RCSID("$NetBSD: perform.c,v 1.123 2024/08/25 06:08:00 wiz Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -1115,6 +1115,41 @@ check_implicit_conflict(struct pkg_task 
        return status;
 }
 
+/* check if all REQUIRES files (usually libraries) are installed */
+static int
+check_requires(struct pkg_task *pkg)
+{
+       const char *data, *eol, *next_line;
+       int ret = 0;
+
+       data = pkg->meta_data.meta_build_info;
+
+       for (; data != NULL && *data != '\0'; data = next_line) {
+               if ((eol = strchr(data, '\n')) == NULL) {
+                       eol = data + strlen(data);
+                       next_line = eol;
+               } else
+                       next_line = eol + 1;
+
+               if (strncmp(data, "REQUIRES=", 9) == 0) {
+                       char *library_name = dup_value(data, eol);
+                       struct stat sb;
+                       if (stat(library_name, &sb) != 0 || !S_ISREG(sb.st_mode)) {
+                               warnx("Missing required library: %s", library_name);
+#ifdef __NetBSD__
+                               if (strncmp(library_name, "/usr/X11R7", 10) == 0) {
+                                       warnx("Please make sure to install the X sets");
+                               }
+#endif
+                               ret = 1;
+                       }
+                       free(library_name);
+               }
+       }
+
+       return ret;
+}
+
 /*
  * Install a required dependency and verify its installation.
  */
@@ -1124,7 +1159,7 @@ install_depend_pkg(const char *dep)
        /* XXX check cyclic dependencies? */
        if (Fake || NoRecord) {
                if (!Force) {
-                       warnx("Missing dependency %s\n", dep);
+                       warnx("Missing dependency %s", dep);
                        return 1;
                }
                warnx("Missing dependency %s, continuing", dep);
@@ -1513,6 +1548,9 @@ pkg_do(const char *pkgpath, int mark_aut
        if (check_implicit_conflict(pkg))
                goto clean_memory;
 
+       if (check_requires(pkg))
+               goto clean_memory;
+
        if (pkg->other_version != NULL) {
                /*
                 * Replacing an existing package.

Index: pkgsrc/pkgtools/pkg_install/files/lib/version.h
diff -u pkgsrc/pkgtools/pkg_install/files/lib/version.h:1.193 pkgsrc/pkgtools/pkg_install/files/lib/version.h:1.194
--- pkgsrc/pkgtools/pkg_install/files/lib/version.h:1.193       Thu Aug 15 02:43:58 2024
+++ pkgsrc/pkgtools/pkg_install/files/lib/version.h     Sun Aug 25 06:08:01 2024
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.193 2024/08/15 02:43:58 riastradh Exp $  */
+/*     $NetBSD: version.h,v 1.194 2024/08/25 06:08:01 wiz 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 20240810
+#define PKGTOOLS_VERSION 20240821
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index