]> git.pld-linux.org Git - packages/poldek.git/blame - poldek-git.patch
- rel 4.1
[packages/poldek.git] / poldek-git.patch
CommitLineData
a881abeb
MB
1commit 2f6b86835cbbad530f838bcf5d3e183f92eb3396
2Author: Marcin Banasiak <marcin.banasiak@gmail.com>
3Date: Thu Sep 27 17:44:19 2012 +0200
4
5 Change the way how / is stored in dirindex
6
7 Previously, / was stored in dirindex with leading slash (i.e. as //)
8 what caused various side effects as:
9
10 filesystem-4.0-12.x86_64 obsoleted by filesystem-4.0-13.x86_64
11 filesystem-4.0-13.x86_64 marks FHS-2.3-35.x86_64 (cap //)
12 error: FHS-2.3-35.x86_64: equal version installed, give up
13
14diff --git a/pkgdir/pkgdir_dirindex.c b/pkgdir/pkgdir_dirindex.c
15index a6f422f..abfd05c 100644
16--- a/pkgdir/pkgdir_dirindex.c
17+++ b/pkgdir/pkgdir_dirindex.c
18@@ -103,10 +103,14 @@ static int package_key(char *key, int size, const struct pkg *pkg, int prefix)
19 static tn_buf *dirarray_join(tn_buf *nbuf, tn_array *arr, char *sep)
20 {
21 int i, size = n_array_size(arr);
22+
23 for (i=0; i < size; i++) {
24- n_buf_printf(nbuf, "%s%s", (char*)n_array_nth(arr, i),
25- i < size - 1 ? sep : "");
26+ const char *dirname = n_array_nth(arr, i);
27+
28+ n_buf_printf(nbuf, "%s%s%s", *dirname != '/' ? "/" : "",
29+ dirname, i < size - 1 ? sep : "");
30 }
31+
32 return nbuf;
33 }
34
35@@ -179,7 +183,8 @@ static int store_from_previous(uint32_t package_no, struct pkg *pkg, struct tndb
36
37 while (*tl) {
38 const char *dir = *tl;
39- dir = dir + 1; /* skip '/' */
40+ if (dir[1] != '\0')
41+ dir = dir + 1; /* skip '/' only when strlen(dir) > 1 */
42 add_to_path_index(path_index, dir, package_no);
43 tl++;
44 }
45@@ -238,15 +243,13 @@ void store_package(uint32_t package_no, struct pkg *pkg, struct tndb *db,
46
47 if (required) {
48 n_buf_clean(nbuf);
49- n_buf_printf(nbuf, "/"); /* prefix all by '/' */
50- nbuf = dirarray_join(nbuf, required, ":/");
51+ nbuf = dirarray_join(nbuf, required, ":");
52 tndb_put(db, key, klen, n_buf_ptr(nbuf), n_buf_size(nbuf));
53 }
54
55 if (owned) {
56 n_buf_clean(nbuf);
57- n_buf_printf(nbuf, "/"); /* prefix all by '/' */
58- nbuf = dirarray_join(nbuf, owned, ":/");
59+ nbuf = dirarray_join(nbuf, owned, ":");
60
61 /* ugly, but what for another package_key() call */
62 key[1] = PREFIX_PKGKEY_OWNDIR;
63@@ -323,9 +326,13 @@ static int dirindex_create(const struct pkgdir *pkgdir, const char *path,
64 for (i=0; i < n_array_size(directories); i++) {
65 const char *path = n_array_nth(directories, i);
66 tn_array *ids = n_hash_get(path_index, path);
67+ int j;
68
69 n_buf_clean(nbuf);
70- nbuf = dirarray_join(nbuf, ids, ":");
71+ for (j = 0; j < n_array_size(ids); j++) {
72+ n_buf_printf(nbuf, "%s%s", (char *)n_array_nth(ids, j),
73+ j < n_array_size(ids) - 1 ? ":" : "");
74+ }
75
76 DBGF(" dir %s %s\n", path, (char*)n_buf_ptr(nbuf));
77
78@@ -774,11 +781,11 @@ tn_array *get_package_directories_as_array(const struct pkgdir *pkgdir,
79
80 dirs = n_array_new(n, free, (tn_fn_cmp)strcmp);
81 while (*tl) {
82- if (**tl)
83+ if (**tl)
84 n_array_push(dirs, n_strdup(*tl));
85 tl++;
86 }
87-
88+
89 n_str_tokl_free(tl_save);
90 n_free(val);
91
92@@ -809,7 +816,7 @@ static tn_array *do_dirindex_get(const struct pkgdir_dirindex *dirindex,
93 unsigned char val[8192];
94 int n, found, pkgs_passsed = 1;
95
96- if (*path == '/')
97+ if (*path == '/' && path[1] != '\0')
98 path++;
99
100 if (!tndb_get_str(dirindex->db, path, val, sizeof(val)))
101@@ -877,7 +884,7 @@ int pkgdir_dirindex_pkg_has_path(const struct pkgdir *pkgdir,
102
103 DBGF("%s %s\n", pkg_id(pkg), path);
104
105- if (*path == '/')
106+ if (*path == '/' && path[1] != '\0')
107 path++;
108
109 if (!tndb_get_str(dirindex->db, path, val, sizeof(val)))
a5f27c71
MB
110commit f575c9bbe3cdd8f2d6ef27eb73dcc270c1a8a3f2
111Author: Marcin Banasiak <marcin.banasiak@gmail.com>
112Date: Sun Oct 7 12:41:42 2012 +0200
113
114 Provide function body for inlined pkg_id
115
116diff --git a/pkg.c b/pkg.c
117index 6e83694..227fe14 100644
118--- a/pkg.c
119+++ b/pkg.c
120@@ -1463,11 +1463,6 @@ struct pkg *pkg_link(struct pkg *pkg)
121 return pkg;
122 }
123
124-const char *pkg_id(const struct pkg *p)
125-{
126- return p->_nvr;
127-}
128-
129 int pkg_id_snprintf(char *str, size_t size, const struct pkg *pkg)
130 {
131 return n_snprintf(str, size, "%s", pkg_id(pkg));
132diff --git a/pkg.h b/pkg.h
133index f0d71ac..ec6cc6d 100644
134--- a/pkg.h
135+++ b/pkg.h
136@@ -231,7 +231,11 @@ EXPORT const char *pkg_pkgdirpath(const struct pkg *pkg);
137 EXPORT unsigned pkg_file_url_type(const struct pkg *pkg);
138
139
140-EXPORT extern__inline const char *pkg_id(const struct pkg *p);
141+static inline const char *pkg_id(const struct pkg *p)
142+{
143+ return p->_nvr;
144+}
145+
146 EXPORT int pkg_id_snprintf(char *str, size_t size, const struct pkg *pkg);
147 EXPORT int pkg_idevr_snprintf(char *str, size_t size, const struct pkg *pkg);
148
149commit ce00c5a5311fb6d77fcf96b04bca5cf2904d90ae
150Author: Marcin Banasiak <marcin.banasiak@gmail.com>
151Date: Sun Oct 7 12:46:36 2012 +0200
152
153 Kill redundant EXPORT in pm.h
154
155diff --git a/pm/pm.h b/pm/pm.h
156index 9913168..a20c305 100644
157--- a/pm/pm.h
158+++ b/pm/pm.h
159@@ -204,7 +204,7 @@ EXPORT int pm_get_dbdepdirs(struct pm_ctx *ctx,
160
161 EXPORT struct pkg *pm_load_package(struct pm_ctx *ctx,
162 tn_alloc *na, const char *path, unsigned ldflags);
163-EXPORT struct pkgdir;
164+struct pkgdir;
165 EXPORT struct pkgdir *pkgdb_to_pkgdir(struct pm_ctx *ctx, const char *rootdir,
166 const char *path, unsigned pkgdir_ldflags,
167 const char *key, ...);
This page took 0.046685 seconds and 4 git commands to generate.