From c796562e33cfd80c94524abe95d3a87dd4842c3d Mon Sep 17 00:00:00 2001 From: psc Date: Tue, 12 Apr 2011 08:36:04 +0000 Subject: [PATCH] Apply fix for #6613 Several changes in gosa-si to properly support multiple repositories in different pathes: - Add a new configuration option repo-basepath, which stores the common prefix of repositories (e.g. /srv/www) - Determine relative path of a repository by extracting the path component of a repository URL as stord in gosa (e.g. http://localhost/repo -> /repo) and make it the repo_path - Process all repo_path'es (when adding packages and scanning debconf templates) git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@20705 594d385d-05f5-0310-b6e9-bd551577e9d8 --- trunk/gosa-si/gosa-si-server | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/trunk/gosa-si/gosa-si-server b/trunk/gosa-si/gosa-si-server index 9d574ed06..b3c88c1d8 100755 --- a/trunk/gosa-si/gosa-si-server +++ b/trunk/gosa-si/gosa-si-server @@ -79,11 +79,10 @@ my ($xml); my $sources_list; my $max_clients; my %repo_files=(); -my $repo_path; my %repo_dirs=(); # Variables declared in config file are always set to 'our' -our (%cfg_defaults, $log_file, $pid_file, +our (%cfg_defaults, $log_file, $pid_file, $repo_basepath, $server_ip, $server_port, $ClientPackages_key, $dns_lookup, $arp_activ, $gosa_unit_tag, $GosaPackages_key, $gosa_timeout, @@ -228,8 +227,9 @@ our $logged_in_user_date_of_expiry = 600; %cfg_defaults = ( "general" => { - "log-file" => [\$log_file, "/var/run/".$prg.".log"], - "pid-file" => [\$pid_file, "/var/run/".$prg.".pid"], + "log-file" => [\$log_file, "/var/run/".$prg.".log"], + "pid-file" => [\$pid_file, "/var/run/".$prg.".pid"], + "repo-basepath" => [\$repo_basepath, "/srv/www"], }, "server" => { "ip" => [\$server_ip, "0.0.0.0"], @@ -244,7 +244,6 @@ our $logged_in_user_date_of_expiry = 600; "messaging" => [\$messaging_file_name, '/var/lib/gosa-si/messaging.db'], "foreign-clients" => [\$foreign_clients_file_name, '/var/lib/gosa-si/foreign_clients.db'], "source-list" => [\$sources_list, '/etc/apt/sources.list'], - "repo-path" => [\$repo_path, '/srv/www/repository'], "ldap-uri" => [\$ldap_uri, ""], "ldap-base" => [\$ldap_base, ""], "ldap-admin-dn" => [\$ldap_admin_dn, ""], @@ -2777,7 +2776,10 @@ sub run_create_packages_list_db { sub create_packages_list_db { my ($ldap_handle, $sources_file, $session_id) = @_; - + + # Cleanup repo basepath + $repo_basepath = File::Spec->canonpath($repo_basepath); + # it should not be possible to trigger a recreation of packages_list_db # while packages_list_db is under construction, so set flag packages_list_under_construction # which is tested befor recreation can be started @@ -2997,7 +2999,10 @@ sub parse_package_info { my ($baseurl, $dist, $section, $session_id)= @_; my ($package); if (not defined $session_id) { $session_id = 0; } - my ($path) = ($baseurl =~ m%://[^/]*(.*)$%); + my ($path) = ($baseurl =~ m%://[^/]*/(.*)$%); + + my $repo_path = File::Spec->join($repo_basepath, $path); + $repo_dirs{ "${repo_path}/pool" } = 1; foreach $package ("Packages.gz"){ @@ -3091,6 +3096,8 @@ sub parse_package { # Trigger for filename if ($line =~ /^Filename:\s/){ my ($filename) = ($line =~ /^Filename: (.*)$/); + # Construct real path + my $repo_path = File::Spec->join($repo_basepath, $srv_path); store_fileinfo( $package, $filename, $dist, $srv_path, $version, $repo_path ); next; } -- 2.30.2