forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apt-429-less-dependencies.patch
55 lines (53 loc) · 1.93 KB
/
apt-429-less-dependencies.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff --git a/tools/genpkglist.cc b/tools/genpkglist.cc
index 34d78e4..d49bcdb 100644
--- a/tools/genpkglist.cc
+++ b/tools/genpkglist.cc
@@ -80,14 +81,6 @@ typedef struct {
static
int usefulFile(const char *d, const char *b)
{
- // PATH-like directories
- if (endswith(d, "/bin/") || endswith(d, "/sbin/"))
- return 1;
-
- // shared libraries
- if (strncmp(b, "lib", 3) == 0 && strstr(b + 3, ".so"))
- return 1;
-
return 0;
}
@@ -244,6 +237,35 @@ bool copyFields(Header h, Header newHeader,
res = headerGetRawEntry(h, (raptTag) tags[i], &type, &data, &count);
if (res != 1)
continue;
+ if (tags[i] == RPMTAG_REQUIRENAME)
+ {
+ char **requires = (char **)data;
+ size_t package_requires_names = 0;
+ std::vector<std::string> packageRequires;
+ // Save the requires which refer to a given package.
+ for (size_t i = 0, e = count; i != e; ++i)
+ {
+ if (strncmp("cms+", requires[i], 4) != 0
+ && strncmp("external+", requires[i], 9) != 0
+ && strncmp("lcg+", requires[i], 4) != 0)
+ continue;
+ packageRequires.push_back(requires[i]);
+ package_requires_names += packageRequires.back().size() + 1;
+ }
+
+ // Copy only the package requires in a new data structure.
+ void *newData = malloc(package_requires_names + sizeof(char*) * packageRequires.size());
+ char **table = (char**)newData;
+ char *buf = (char *) (newData + packageRequires.size() * sizeof(char*));
+ for (size_t i = 0, e = packageRequires.size(); i != e; ++i)
+ {
+ strcpy(buf, packageRequires[i].c_str());
+ table[i] = buf;
+ buf += packageRequires[i].size() + 1;
+ }
+ headerAddEntry(newHeader, (raptTag) tags[i], type, newData, packageRequires.size());
+ }
+ else
headerAddEntry(newHeader, (raptTag) tags[i], type, data, count);
}