1 --- pkgscore.c 17 Oct 2002 15:54:53 -0000 1.2
2 +++ pkgscore.c 14 Nov 2002 13:35:19 -0000
11 tn_array *read_patterns(const char *fpath, tn_array *patterns, unsigned type)
17 +void pkgscore_match_init(struct pkgscore_s *psc, struct pkg *pkg)
22 + n += n_snprintf(psc->pkgbuf, sizeof(psc->pkgbuf), "%s:", pkg->pkgdir->name);
24 + psc->pkgname_off = n;
26 + pkg_snprintf(&psc->pkgbuf[n], sizeof(psc->pkgbuf) - n, pkg);
32 +int pkgscore_match(struct pkgscore_s *psc, const char *mask)
34 + if (fnmatch(mask, psc->pkg->name, 0) == 0)
37 + if (psc->pkgname_off && fnmatch(mask, &psc->pkgbuf[psc->pkgname_off], 0) == 0)
40 + return fnmatch(mask, psc->pkgbuf, 0) == 0;
45 void packages_score(tn_array *pkgs, tn_array *patterns, unsigned scoreflag)
51 if (n_array_size(patterns) == 0)
55 for (i=0; i < n_array_size(pkgs); i++) {
56 - struct pkg *pkg = n_array_nth(pkgs, i);
59 + struct pkgscore_s psc;
63 - n += n_snprintf(pkgbuf, sizeof(pkgbuf), "%s:", pkg->pkgdir->name);
65 - pkg_snprintf(&pkgbuf[n], sizeof(pkgbuf) - n, pkg);
66 + pkg = n_array_nth(pkgs, i);
67 + pkgscore_match_init(&psc, pkg);
69 - for (j=0; j<n_array_size(patterns); j++) {
70 + for (j=0; j < n_array_size(patterns); j++) {
71 const char *mask = n_array_nth(patterns, j);
73 - if (fnmatch(mask, &pkgbuf[n], 0) == 0 || (n && fnmatch(mask, pkgbuf, 0) == 0)) {
75 + if (pkgscore_match(&psc, mask)) {
78 - msgn(3, "held %s", pkg_snprintf_s(pkg));
79 + msgn(1, "held %s", pkg_snprintf_s(pkg));
80 DBGMSG_F("HELD %s\n", pkg_snprintf_s(pkg));
81 pkg_score(pkg, PKG_HELD);
83 --- pkgset-install.c 7 Nov 2002 16:43:26 -0000 1.79
84 +++ pkgset-install.c 14 Nov 2002 13:35:19 -0000
85 @@ -1778,15 +1778,20 @@
88 for (i=0; i < n_array_size(upg->uninst_set->dbpkgs); i++) {
89 - struct dbpkg *dbpkg = n_array_nth(upg->uninst_set->dbpkgs, i);
90 + struct dbpkg *dbpkg;
91 + struct pkgscore_s psc;
93 + dbpkg = n_array_nth(upg->uninst_set->dbpkgs, i);
94 + pkgscore_match_init(&psc, dbpkg->pkg);
96 for (j=0; j < n_array_size(upg->inst->hold_patterns); j++) {
97 const char *mask = n_array_nth(upg->inst->hold_patterns, j);
99 - if (fnmatch(mask, dbpkg->pkg->name, 0) == 0) {
101 + if (pkgscore_match(&psc, mask)) {
102 logn(LOGERR, _("%s: refusing to uninstall held package"),
103 - pkg_snprintf_s(dbpkg->pkg));
104 + pkg_snprintf_s(dbpkg->pkg));
110 @@ -2228,6 +2233,9 @@
111 if (inst->flags & INSTS_INSTALL)
112 n_assert((inst->flags & INSTS_UPGRADE) == 0);
115 + packages_mark(ps->pkgs, 0, PKG_INTERNALMARK | PKG_INDIRMARK);
117 unmark_name_dups(ps->pkgs);
119 mem_info(1, "ENTER pkgset_install:");
120 @@ -2241,6 +2249,8 @@
122 if (inst->flags & INSTS_JUSTPRINTS)
123 inst->flags &= ~INSTS_PARTICLE;
127 for (i = 0; i < n_array_size(ps->ordered_pkgs); i++) {
128 struct pkg *pkg = n_array_nth(ps->ordered_pkgs, i);
129 @@ -2270,8 +2280,15 @@
130 inst->flags &= ~INSTS_PARTICLE;
133 - pkgset_mark(ps, PS_MARK_OFF_ALL);
135 + packages_mark(ps->pkgs, 0, PKG_INDIRMARK | PKG_DIRMARK);
136 + //pkgset_mark(ps, PS_MARK_OFF_ALL);
138 + for (i = 0; i < n_array_size(ps->ordered_pkgs); i++) {
139 + struct pkg *pkg = n_array_nth(ps->ordered_pkgs, i);
140 + if (pkg_is_marked_i(pkg))
141 + printf("MARKED %s\n", pkg_snprintf_s(pkg));
144 for (i = 0; i < n_array_size(ps->ordered_pkgs); i++) {
145 struct pkg *pkg = n_array_nth(ps->ordered_pkgs, i);
147 @@ -2302,7 +2319,8 @@
148 if (!do_install(ps, &upg, iinf))
151 - pkgset_mark(ps, PS_MARK_OFF_ALL);
152 + packages_mark(ps->pkgs, 0, PKG_INDIRMARK | PKG_DIRMARK);
153 + //pkgset_mark(ps, PS_MARK_OFF_ALL);
154 reset_upgrade_s(&upg);
157 @@ -2312,6 +2330,7 @@
158 nerr = !do_install(ps, &upg, iinf);
162 destroy_upgrade_s(&upg);
163 mem_info(1, "RETURN pkgset_install:");
165 --- pkgset.c 24 Oct 2002 16:23:10 -0000 1.54
166 +++ pkgset.c 14 Nov 2002 13:35:19 -0000
173 static void mapfn_mark(struct pkg *pkg, unsigned *flags)
176 @@ -745,13 +745,42 @@
181 void pkgset_mark(struct pkgset *ps, unsigned flags)
184 n_array_map_arg(ps->pkgs, (tn_fn_map2) mapfn_mark, &flags);
191 + unsigned flags_off;
195 +static void mapfn_mark2(struct pkg *pkg, struct flags_s *fs)
200 + pkg->flags |= fs->flags_on;
203 + pkg->flags &= ~fs->flags_off;
207 +void packages_mark(tn_array *pkgs, unsigned flags_on, unsigned flags_off)
211 + fs.flags_on = flags_on;
212 + fs.flags_off = flags_off;
214 + n_array_map_arg(pkgs, (tn_fn_map2) mapfn_mark2, &fs);
219 inline static int mark_package(struct pkg *pkg, int nodeps)
222 int i, nerr = 0, nodeps = 0, npatterns = 0;
224 - pkgset_mark(ps, PS_MARK_OFF_ALL);
225 + packages_mark(ps->pkgs, 0, PKG_INDIRMARK | PKG_DIRMARK);
226 + //pkgset_mark(ps, PS_MARK_OFF_ALL);
228 if (ps->flags & PSMODE_INSTALL_DIST)
229 nodeps = inst->flags & INSTS_NODEPS;
233 if ((inst->flags & INSTS_FORCE) == 0)
234 - pkgset_mark(ps, PS_MARK_OFF_ALL);
235 + packages_mark(ps->pkgs, 0, PKG_INDIRMARK | PKG_DIRMARK);
236 + //pkgset_mark(ps, PS_MARK_OFF_ALL);
237 logn(LOGERR, _("Buggy package set."));
240 --- pkgset.h 24 Oct 2002 16:23:10 -0000 1.36
241 +++ pkgset.h 14 Nov 2002 13:35:19 -0000
242 @@ -143,12 +143,14 @@
244 int uninstall_usrset(struct usrpkgset *ups, struct inst_s *inst,
245 struct install_info *iinf);
248 #define PS_MARK_OFF_ALL (1 << 0)
249 #define PS_MARK_OFF_DEPS (1 << 1)
250 #define PS_MARK_ON_INTERNAL (1 << 2) /* use with one of above PS_MARK_* */
252 void pkgset_mark(struct pkgset *ps, unsigned markflags);
256 int pkgset_fetch_pkgs(const char *destdir, tn_array *pkgs, int nosubdirs);
260 int pkgset_rpmprovides(const struct pkgset *ps, const struct capreq *req);
269 +void pkgscore_match_init(struct pkgscore_s *psc, struct pkg *pkg);
270 +int pkgscore_match(struct pkgscore_s *psc, const char *mask);
271 void packages_score(tn_array *pkgs, tn_array *patterns, unsigned scoreflag);
273 +void packages_mark(tn_array *pkgs, unsigned flags_on, unsigned flags_off);
275 +#define packages_unmark_all(pkgs) packages_mark(pkgs, 0, PKG_INDIRMARK | PKG_DIRMARK)
277 int packages_fetch(tn_array *pkgs, const char *destdir, int nosubdirs);
278 int packages_rpminstall(tn_array *pkgs, struct pkgset *ps, struct inst_s *inst);
280 --- shell/install.c 18 Oct 2002 10:34:41 -0000 1.22
281 +++ shell/install.c 14 Nov 2002 13:35:19 -0000
286 - pkgset_mark(cmdarg->sh_s->pkgset, PS_MARK_OFF_ALL);
287 + packages_unmark_all(cmdarg->sh_s->pkgset->pkgs);
289 for (i=0; i < n_array_size(shpkgs); i++) {
290 struct shpkg *shpkg = n_array_nth(shpkgs, i);
291 --- vfile/vftp/ftp.c 7 Nov 2002 16:43:30 -0000 1.19
292 +++ vfile/vftp/ftp.c 14 Nov 2002 13:35:20 -0000
305 +static int vftp_sigint_reached(void)
308 + if ((v = sigint_reached()) && vftp_errno == 0)
309 + vftp_set_err(EINTR, _("connection cancelled"));
315 static int do_ftp_cmd(int sock, char *fmt, va_list args)
317 char buf[1024], tmp_fmt[256];
320 - if (sigint_reached())
321 + if (vftp_sigint_reached())
324 snprintf(tmp_fmt, sizeof(tmp_fmt), "%s\r\n", fmt);
326 FD_SET(sockfd, &fdset);
328 if ((rc = select(sockfd + 1, &fdset, NULL, NULL, &to)) < 0) {
329 - if (sigint_reached()) {
330 + if (vftp_sigint_reached()) {
338 - if (sigint_reached()) {
339 - vftp_set_err(vftp_errno, _("connection canceled"));
340 + if (vftp_sigint_reached())
345 vftp_set_err(vftp_errno, "%s: %m", _("unexpected EOF"));
350 - if (sigint_reached())
351 + if (vftp_sigint_reached())
354 ftp_response_init(&resp);
356 if (response_complete(&resp))
359 - if (sigint_reached()) {
360 + if (vftp_sigint_reached()) {
371 sockfd = socket(resp->ai_family, resp->ai_socktype, resp->ai_protocol);
375 vftp_errno = errno = ETIMEDOUT;
377 + else if (vftp_sigint_reached()) {
385 *addr->ai_addr = *resp->ai_addr;
393 if ((sockfd = to_connect(host, portstr, addr)) < 0)
396 - if (sigint_reached())
397 + if (vftp_sigint_reached())
404 rc = select(in_fd + 1, &fdset, NULL, NULL, &tv);
405 - if (sigint_reached()) {
406 + if (vftp_sigint_reached()) {
410 @@ -939,13 +951,13 @@
411 if ((total_size = ftpcn_size(cn, path)) < 0)
414 - if (sigint_reached())
415 + if (vftp_sigint_reached())
418 if ((sockfd = ftpcn_pasv(cn)) <= 0)
421 - if (sigint_reached())
422 + if (vftp_sigint_reached())
426 --- vfile/vhttp/http.c 7 Nov 2002 16:43:31 -0000 1.12
427 +++ vfile/vhttp/http.c 14 Nov 2002 13:35:20 -0000
429 vhttp_errno = err_no;
432 +static int vhttp_sigint_reached(void)
435 + if ((v = sigint_reached()) && vhttp_errno == 0)
436 + vhttp_set_err(EINTR, _("connection cancelled"));
442 static char *make_req_line(char *buf, int size, char *fmt, ...)
446 FD_SET(sockfd, &fdset);
448 if ((rc = select(sockfd + 1, &fdset, NULL, NULL, &to)) < 0) {
449 - if (sigint_reached()) {
450 + if (vhttp_sigint_reached()) {
458 - if (sigint_reached()) {
459 - vhttp_set_err(vhttp_errno, _("connection canceled"));
460 + if (vhttp_sigint_reached())
466 vhttp_set_err(vhttp_errno, "%s: %m", _("unexpected EOF"));
472 - if (sigint_reached()) {
473 + if (vhttp_sigint_reached()) {
479 vhttp_errno = errno = ETIMEDOUT;
481 - else if (sigint_reached() && errno == EINTR)
482 - vhttp_errno = EINTR;
484 + else if (vhttp_sigint_reached() && errno == EINTR)
493 vhttp_set_err(errno, _("unable to connect to %s:%s: %m"), host, service);
503 rc = select(in_fd + 1, &fdset, NULL, NULL, &tv);
504 - if (sigint_reached()) {
505 + if (vhttp_sigint_reached()) {