Line data Source code
1 : /*-
2 : * Copyright (c) 2011-2012 Baptiste Daroussin <bapt@FreeBSD.org>
3 : * Copyright (c) 2012-2013 Matthew Seaman <matthew@FreeBSD.org>
4 : * All rights reserved.
5 : *
6 : * Redistribution and use in source and binary forms, with or without
7 : * modification, are permitted provided that the following conditions
8 : * are met:
9 : * 1. Redistributions of source code must retain the above copyright
10 : * notice, this list of conditions and the following disclaimer
11 : * in this position and unchanged.
12 : * 2. Redistributions in binary form must reproduce the above copyright
13 : * notice, this list of conditions and the following disclaimer in the
14 : * documentation and/or other materials provided with the distribution.
15 : *
16 : * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
17 : * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 : * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 : * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
20 : * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 : * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 : * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 : * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 : * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 : * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 : */
27 :
28 : #ifdef HAVE_CONFIG_H
29 : #include "pkg_config.h"
30 : #endif
31 :
32 : #include <bsd_compat.h>
33 :
34 : #include "pkg.h"
35 : #include "private/pkg.h"
36 : #include "private/event.h"
37 :
38 : int
39 0 : pkg_suggest_arch(struct pkg *pkg, const char *arch, bool isdefault)
40 : {
41 : bool iswildcard;
42 :
43 0 : iswildcard = (strchr(arch, '*') != NULL);
44 :
45 0 : if (iswildcard && isdefault)
46 0 : pkg_emit_developer_mode("Configuration error: arch \"%s\" "
47 : "cannot use wildcards as default", arch);
48 :
49 0 : if (pkg->flags & (PKG_CONTAINS_ELF_OBJECTS|PKG_CONTAINS_STATIC_LIBS)) {
50 0 : if (iswildcard) {
51 : /* Definitely has to be arch specific */
52 0 : pkg_emit_developer_mode("Error: arch \"%s\" -- package "
53 : "installs architecture specific files", arch);
54 : }
55 : } else {
56 0 : if (pkg->flags & PKG_CONTAINS_H_OR_LA) {
57 0 : if (iswildcard) {
58 : /* Could well be arch specific */
59 0 : pkg_emit_developer_mode("Warning: arch \"%s\" "
60 : "-- package installs C/C++ headers or "
61 : "libtool files,\n**** which are often "
62 : "architecture specific", arch);
63 : }
64 : } else {
65 : /* Might be arch independent */
66 0 : if (!iswildcard)
67 0 : pkg_emit_developer_mode("Notice: arch \"%s\" -- "
68 : "no architecture specific files found:\n"
69 : "**** could this package use a wildcard "
70 : "architecture?", arch);
71 : }
72 : }
73 0 : return (EPKG_OK);
74 : }
|