pkgng

Check-in [d88c726baf]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Return EPKG_FATAL if any install pattern is invalid.
Timelines: family | ancestors | descendants | both | trunk | multi-repos | stash
Files: files | file ages | folders
SHA1: d88c726bafb4f328aea6d21404fc73379aa095c9
User & Date: will@firepipe.net 2013-09-20 18:31:16
Context
2013-09-21
10:38
Merge pull request #592 from so14k/add-usage - Fix an error that prevents the use of `pkg add' or `pkg annotate'. check-in: 1d0a5f51c9 user: bapt@FreeBSD.org tags: trunk, multi-repos, stash
06:33
- Fix an error that prevents the use of `pkg add' or `pkg annotate'. check-in: cacc790c7b user: brd@FreeBSD.org tags: trunk, multi-repos, stash
2013-09-20
18:31
Return EPKG_FATAL if any install pattern is invalid. check-in: d88c726baf user: will@firepipe.net tags: trunk, multi-repos, stash
2013-09-19
20:04
Fix build on mips, cleanup now unused ARM macros check-in: e867990aaa user: bapt@FreeBSD.org tags: trunk, multi-repos, stash
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to libpkg/pkg_jobs.c.

794
795
796
797
798
799
800



801
802
803
804
805
806
807
...
810
811
812
813
814
815
816

817
818
819

820
821
822

823
824
825
826
827




828

829




830
831




832
833
834
835
836
837



838
839



840
841
842
843
844
845
846
		else
			break;
	}

	return (false);
}




static int
jobs_solve_install(struct pkg_jobs *j)
{
	struct job_pattern *jp = NULL;
	struct pkg *pkg, *tmp, *p;
	struct pkg_dep *d, *dtmp;
	struct pkgdb_it *it;
................................................................................

	if ((j->flags & PKG_FLAG_PKG_VERSION_TEST) == PKG_FLAG_PKG_VERSION_TEST)
		if (new_pkg_version(j)) {
			pkg_emit_newpkgversion();
			goto order;
		}


	LL_FOREACH(j->patterns, jp) {
		if ((j->flags & PKG_FLAG_RECURSIVE) == PKG_FLAG_RECURSIVE) {
			if ((it = pkgdb_query(j->db, jp->pattern, jp->match)) == NULL)

				return (EPKG_FATAL);

			pkg = NULL;

			while (pkgdb_it_next(it, &pkg, PKG_LOAD_BASIC|PKG_LOAD_RDEPS) == EPKG_OK) {
				d = NULL;
				pkg_get(pkg, PKG_ORIGIN, &origin);
				if (get_remote_pkg(j, origin, MATCH_EXACT, true) == EPKG_FATAL)
					pkg_emit_error("No packages matching '%s', has been found in the repositories", origin);






				while (pkg_rdeps(pkg, &d) == EPKG_OK) {




					if (get_remote_pkg(j, pkg_dep_origin(d), MATCH_EXACT, false) == EPKG_FATAL)
						pkg_emit_error("No packages matching '%s', has been found in the repositories", pkg_dep_origin(d));




				}
			}
			pkgdb_it_free(it);
		} else {
			if (get_remote_pkg(j, jp->pattern, jp->match, true) == EPKG_FATAL)
				pkg_emit_error("No packages matching '%s' has been found in the repositories", jp->pattern);



		}
	}




	if (HASH_COUNT(j->bulk) == 0)
		return (EPKG_OK);

	/* remove everything seen from deps */
	HASH_ITER(hh, j->bulk, pkg, tmp) {
		d = NULL;







>
>
>







 







>


|
>



>
|


|
<
>
>
>
>
|
>

>
>
>
>
|
<
>
>
>
>




|
|
>
>
>
|
|
>
>
>







794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
...
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832

833
834
835
836
837
838
839
840
841
842
843
844

845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
		else
			break;
	}

	return (false);
}

#define	NO_PKGS_MATCHING_STR \
	"No packages matching '%s' available in the repositories"

static int
jobs_solve_install(struct pkg_jobs *j)
{
	struct job_pattern *jp = NULL;
	struct pkg *pkg, *tmp, *p;
	struct pkg_dep *d, *dtmp;
	struct pkgdb_it *it;
................................................................................

	if ((j->flags & PKG_FLAG_PKG_VERSION_TEST) == PKG_FLAG_PKG_VERSION_TEST)
		if (new_pkg_version(j)) {
			pkg_emit_newpkgversion();
			goto order;
		}

	ret = EPKG_OK;
	LL_FOREACH(j->patterns, jp) {
		if ((j->flags & PKG_FLAG_RECURSIVE) == PKG_FLAG_RECURSIVE) {
			it = pkgdb_query(j->db, jp->pattern, jp->match);
			if (it == NULL)
				return (EPKG_FATAL);

			pkg = NULL;
			while (pkgdb_it_next(it, &pkg,
			    PKG_LOAD_BASIC|PKG_LOAD_RDEPS) == EPKG_OK) {
				d = NULL;
				pkg_get(pkg, PKG_ORIGIN, &origin);
				if (get_remote_pkg(j, origin, MATCH_EXACT,

				    true) != EPKG_OK) {
					ret = EPKG_FATAL;
					pkg_emit_error(NO_PKGS_MATCHING_STR,
					    origin);
				}

				while (pkg_rdeps(pkg, &d) == EPKG_OK) {
					const char *dep_origin;
					dep_origin = pkg_dep_origin(d);

					if (get_remote_pkg(j, dep_origin,
					    MATCH_EXACT, false) == EPKG_OK)

						continue;
					ret = EPKG_FATAL;
					pkg_emit_error(NO_PKGS_MATCHING_STR,
					    dep_origin);
				}
			}
			pkgdb_it_free(it);
		} else {
			if (get_remote_pkg(j, jp->pattern, jp->match,
			    true) == EPKG_FATAL) {
				ret = EPKG_FATAL;
				pkg_emit_error(NO_PKGS_MATCHING_STR,
				    jp->pattern);
			}
		}
	}
	if (ret != EPKG_OK)
		return (ret);

	if (HASH_COUNT(j->bulk) == 0)
		return (EPKG_OK);

	/* remove everything seen from deps */
	HASH_ITER(hh, j->bulk, pkg, tmp) {
		d = NULL;