pkgng

Check-in [e63fac1544]
Login

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

Overview
Comment:Turn REPOS_DIR into a list or repository to read configuration from By default read configuration from /etc/pkg and /usr/local/etc/pkg/repos Discussed with: jonathan, des, gavin (@BSDCam)
Timelines: family | ancestors | descendants | both | trunk | multi-repos | stash
Files: files | file ages | folders
SHA1: e63fac15446bff676a762e4216092e10336e1f9b
User & Date: bapt@FreeBSD.org 2013-09-10 09:39:23
Context
2013-09-10
09:52
Allow to overwrite repository configure This allows to disable a repository configured in base from a localbase configuration file (convenient for RO base) check-in: 99295c1fc5 user: bapt@FreeBSD.org tags: trunk, multi-repos, stash
09:39
Turn REPOS_DIR into a list or repository to read configuration from By default read configuration from /etc/pkg and /usr/local/etc/pkg/repos Discussed with: jonathan, des, gavin (@BSDCam) check-in: e63fac1544 user: bapt@FreeBSD.org tags: trunk, multi-repos, stash
05:53
Remove stray reference to the -X option, which was removed months ago. Fixes #586 check-in: aa9f3bf739 user: m.seaman@infracaninophile.co.uk tags: trunk, multi-repos, stash
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to libpkg/pkg_config.c.

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
865
866
867
868
869
870
871

872
873
874
875
876
877
878
...
881
882
883
884
885
886
887

888
889
890
891
892
893
894
...
904
905
906
907
908
909
910
911
912
913
914






915
916
917
918
919
920
921
	[PKG_CONFIG_ASSUME_ALWAYS_YES] = {
		PKG_CONFIG_BOOL,
		"ASSUME_ALWAYS_YES",
		NULL,
		"Answer 'yes' to all pkg(8) questions",
	},
	[PKG_CONFIG_REPOS_DIR] = {
		PKG_CONFIG_STRING,
		"REPOS_DIR",
		PREFIX"/etc/pkg/repos/",
		"Location of the repository configuration files"
	},
	[PKG_CONFIG_PLIST_KEYWORDS_DIR] = {
		PKG_CONFIG_STRING,
		"PLIST_KEYWORDS_DIR",
		NULL,
		"Directory containing definitions of plist keywords",
................................................................................
	char *p;
	size_t n;
	char path[MAXPATHLEN];

	if ((d = opendir(repodir)) == NULL)
		return;


	while ((ent = readdir(d))) {
		if ((n = strlen(ent->d_name)) <= 5)
			continue;
		p = &ent->d_name[n - 5];
		if (strcmp(p, ".conf") == 0) {
			snprintf(path, MAXPATHLEN, "%s/%s", repodir, ent->d_name);
			load_repo_file(path);
................................................................................
	closedir(d);
}

static void
load_repositories(const char *repodir)
{
	struct pkg_repo *r;

	const char *url, *pub, *mirror_type;

	pkg_config_string(PKG_CONFIG_REPO, &url);
	pkg_config_string(PKG_CONFIG_REPOKEY, &pub);
	pkg_config_string(PKG_CONFIG_MIRRORS, &mirror_type);

	if (url != NULL) {
................................................................................
			else if (strcasecmp(mirror_type, "http") == 0)
				r->mirror_type = HTTP;
		}
		r->enable = true;
		HASH_ADD_KEYPTR(hh, repos, r->name, strlen(r->name), r);
	}

	if (repodir == NULL)
		pkg_config_string(PKG_CONFIG_REPOS_DIR, &repodir);
	if (repodir != NULL)
		load_repo_files(repodir);






}

int
pkg_init(const char *path, const char *reposdir)
{
	FILE *fp;
	yaml_parser_t parser;







|

|







 







>







 







>







 







<
<
|

>
>
>
>
>
>







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
...
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
...
906
907
908
909
910
911
912


913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
	[PKG_CONFIG_ASSUME_ALWAYS_YES] = {
		PKG_CONFIG_BOOL,
		"ASSUME_ALWAYS_YES",
		NULL,
		"Answer 'yes' to all pkg(8) questions",
	},
	[PKG_CONFIG_REPOS_DIR] = {
		PKG_CONFIG_LIST,
		"REPOS_DIR",
		"/etc/pkg/,"PREFIX"/etc/pkg/repos/",
		"Location of the repository configuration files"
	},
	[PKG_CONFIG_PLIST_KEYWORDS_DIR] = {
		PKG_CONFIG_STRING,
		"PLIST_KEYWORDS_DIR",
		NULL,
		"Directory containing definitions of plist keywords",
................................................................................
	char *p;
	size_t n;
	char path[MAXPATHLEN];

	if ((d = opendir(repodir)) == NULL)
		return;

	pkg_debug(1, "PkgConfig: loading repositories in %s", repodir);
	while ((ent = readdir(d))) {
		if ((n = strlen(ent->d_name)) <= 5)
			continue;
		p = &ent->d_name[n - 5];
		if (strcmp(p, ".conf") == 0) {
			snprintf(path, MAXPATHLEN, "%s/%s", repodir, ent->d_name);
			load_repo_file(path);
................................................................................
	closedir(d);
}

static void
load_repositories(const char *repodir)
{
	struct pkg_repo *r;
	struct pkg_config_value *v;
	const char *url, *pub, *mirror_type;

	pkg_config_string(PKG_CONFIG_REPO, &url);
	pkg_config_string(PKG_CONFIG_REPOKEY, &pub);
	pkg_config_string(PKG_CONFIG_MIRRORS, &mirror_type);

	if (url != NULL) {
................................................................................
			else if (strcasecmp(mirror_type, "http") == 0)
				r->mirror_type = HTTP;
		}
		r->enable = true;
		HASH_ADD_KEYPTR(hh, repos, r->name, strlen(r->name), r);
	}



	if (repodir != NULL) {
		load_repo_files(repodir);
		return;
	}

	v = NULL;
	while (pkg_config_list(PKG_CONFIG_REPOS_DIR, &v) == EPKG_OK)
		load_repo_files(pkg_config_value(v));
}

int
pkg_init(const char *path, const char *reposdir)
{
	FILE *fp;
	yaml_parser_t parser;