From dca8d12bb926a9f39de9b7523df60d3da9f1cebd Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Sep 24 2016 03:00:37 +0000 Subject: [PATCH 1/3] add latest targets for atomic deliverables Signed-off-by: Adam Miller --- diff --git a/build.d/build.py b/build.d/build.py index 3909ef3..4b35e75 100755 --- a/build.d/build.py +++ b/build.d/build.py @@ -193,6 +193,20 @@ def process_dir(dirpath, filenames): for key2, value in entry.items(): getattr(globalvar, key1)[key2] = value + # Write htaccess rewrite and informational files for 'latest' + with open(os.path.join(options.output, ".htaccess"), 'w') as htaccess_f: + for artifact in collected_atomic_vars['release']['redir_map']: + htaccess_f.write('Redirect 302 "/{}_latest" "{}"\n'.format( + artifact, + collected_atomic_vars['release']['redir_map'][artifact]['redirect'] + ) + ) + #for artifact in collected_atomic_vars['release']['redir_map']: + # with open(os.path.join(options.output, "{}_latest".format(artifact))) as artifact_f: + # artifact_f.write( + # collected_atomic_vars['release']['redir_map'][artifact]['filename'] + # ) + # This is *not* cached if update_atomic_age is not None: # Go get two-week-atomic release info from datagrepper @@ -280,6 +294,8 @@ def main(): options.input = options.input.rstrip('/') + '/' if options.output is not None: options.output = options.output.rstrip('/') + '/' + #FIXME + print options process(args) if __name__ == "__main__": diff --git a/getfedora.org/build/atomic_vars.py b/getfedora.org/build/atomic_vars.py index 8f69764..00e3ec1 100755 --- a/getfedora.org/build/atomic_vars.py +++ b/getfedora.org/build/atomic_vars.py @@ -120,6 +120,10 @@ def make_templates(release): def collect(release): results = collections.defaultdict(dict) + # This is the information needed to provide "latest" download targets that + # redirect to the actual mirrormanager url via htpasswd file + results['release']['redir_map'] = collections.defaultdict(dict) + for idx, composedate_prefix, iso_size_prefix in make_templates(release): log.info("Looking for latest atomic release for %s" % idx) @@ -171,6 +175,12 @@ def collect(release): url_key = mapping[key] + "_url" results['release'][url_key] = download_url + # Provide the redirect rule mapping + img_filename = download_url.split('/')[-1] + results['release']['redir_map'][key] = {} + results['release']['redir_map'][key]['redirect'] = download_url + results['release']['redir_map'][key]['filename'] = img_filename + # Figure out which of our vars we're going to set, and set it iso_size_key = iso_size_prefix + mapping[key] results['iso_size'][iso_size_key] = str(length) From 20504e190100d1b9c6aae75774bd2b37270d7a36 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Sep 27 2016 16:57:32 +0000 Subject: [PATCH 2/3] add latest targets filenames for scripting purposes Signed-off-by: Adam Miller --- diff --git a/build.d/build.py b/build.d/build.py index 4b35e75..77512ee 100755 --- a/build.d/build.py +++ b/build.d/build.py @@ -201,11 +201,13 @@ def process_dir(dirpath, filenames): collected_atomic_vars['release']['redir_map'][artifact]['redirect'] ) ) - #for artifact in collected_atomic_vars['release']['redir_map']: - # with open(os.path.join(options.output, "{}_latest".format(artifact))) as artifact_f: - # artifact_f.write( - # collected_atomic_vars['release']['redir_map'][artifact]['filename'] - # ) + # Write a file that returns the artifact name that corresponds to + # the current 'latest' (for scripting purposes). + for artifact in collected_atomic_vars['release']['redir_map']: + with open(os.path.join(options.output, "{}_latest_filename".format(artifact)), 'w') as artifact_f: + artifact_f.write( + collected_atomic_vars['release']['redir_map'][artifact]['filename'] + ) # This is *not* cached if update_atomic_age is not None: diff --git a/httpd/conf/httpd.conf.in b/httpd/conf/httpd.conf.in index 6259172..8de701b 100644 --- a/httpd/conf/httpd.conf.in +++ b/httpd/conf/httpd.conf.in @@ -2,13 +2,13 @@ # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See for detailed information. -# In particular, see +# In particular, see # # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure -# consult the online docs. You have been warned. +# consult the online docs. You have been warned. # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the @@ -37,7 +37,7 @@ PidFile run/httpd.pid # ports, instead of the default. See also the # directive. # -# Change this to Listen on specific IP addresses as shown below to +# Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 @@ -108,7 +108,7 @@ LoadModule cgi_module /etc/httpd/modules/mod_cgi.so # # If you wish httpd to run as a different user or group, you must run -# httpd as root initially and it will switch. +# httpd as root initially and it will switch. # # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for @@ -149,7 +149,7 @@ ServerName localhost:80 # # Deny access to the entirety of your server's filesystem. You must -# explicitly permit access to web content directories in other +# explicitly permit access to web content directories in other # blocks below. # @@ -204,7 +204,7 @@ DocumentRoot "@DOCUMENTROOT@" # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # - AllowOverride None + AllowOverride All # # Controls who can get stuff from this server. @@ -222,8 +222,8 @@ DirectoryIndex index.html index.html.var # -# The following lines prevent .htaccess and .htpasswd files from being -# viewed by Web clients. +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. # Require all denied @@ -277,8 +277,8 @@ LogLevel warn # - # Redirect: Allows you to tell clients about documents that used to - # exist in your server's namespace, but do not anymore. The client + # Redirect: Allows you to tell clients about documents that used to + # exist in your server's namespace, but do not anymore. The client # will make a new request for the document at its new location. # Example: # Redirect permanent /foo http://www.example.com/bar @@ -295,7 +295,7 @@ LogLevel warn # the filesystem path. # - # ScriptAlias: This controls which directories contain server scripts. + # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that # documents in the target directory are treated as applications and # run by the server when requested rather than as documents sent to the @@ -366,7 +366,7 @@ LogLevel warn # # Specify a default charset for all content served; this enables -# interpretation of all content as UTF-8 by default. To use the +# interpretation of all content as UTF-8 by default. To use the # default browser choice (ISO-8859-1), or to allow the META tags # in HTML content to override this choice, comment out this # directive: @@ -394,10 +394,10 @@ MIMEMagicFile /etc/httpd/conf/magic # # -# EnableMMAP and EnableSendfile: On systems that support it, +# EnableMMAP and EnableSendfile: On systems that support it, # memory-mapping or the sendfile syscall may be used to deliver # files. This usually improves server performance, but must -# be turned off when serving from networked-mounted +# be turned off when serving from networked-mounted # filesystems or if support for these functions is otherwise # broken on your system. # Defaults if commented: EnableMMAP On, EnableSendfile Off @@ -435,21 +435,21 @@ MaxRequestsPerChild 4000 StartServers 2 MaxClients 150 MinSpareThreads 25 -MaxSpareThreads 75 +MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 -# DefaultLanguage and AddLanguage allows you to specify the language of -# a document. You can then use content negotiation to give a browser a +# DefaultLanguage and AddLanguage allows you to specify the language of +# a document. You can then use content negotiation to give a browser a # file in a language the user can understand. # # Specify a default language. This means that all data -# going out without a specific language tag (see below) will +# going out without a specific language tag (see below) will # be marked with this one. You probably do NOT want to set # this unless you are sure it is correct for all cases. # -# * It is generally better to not mark a page as +# * It is generally better to not mark a page as # * being a certain language than marking it with the wrong # * language! # @@ -460,8 +460,8 @@ MaxRequestsPerChild 0 # language code is pl) may wish to use "AddLanguage pl .po" to # avoid the ambiguity with the common suffix for perl scripts. # -# Note 2: The example entries below illustrate that in some cases -# the two character 'Language' abbreviation is not identical to +# Note 2: The example entries below illustrate that in some cases +# the two character 'Language' abbreviation is not identical to # the two character 'Country' code for its country, # E.g. 'Danmark/dk' versus 'Danish/da'. # @@ -485,7 +485,7 @@ MaxRequestsPerChild 0 # Just list the languages in decreasing order of preference. We have # more or less alphabetized them here. You probably want to change this. # -#LanguagePriority en +#LanguagePriority en # # ForceLanguagePriority allows you to serve a result page rather than @@ -496,7 +496,7 @@ ForceLanguagePriority Prefer Fallback # # Specify a default charset for all content served; this enables -# interpretation of all content as UTF-8 by default. To use the +# interpretation of all content as UTF-8 by default. To use the # default browser choice (ISO-8859-1), or to allow the META tags # in HTML content to override this choice, comment out this # directive: From da0ed2c34bb4e1104d8c98499d6568664cfb5002 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Sep 27 2016 21:05:13 +0000 Subject: [PATCH 3/3] remove incorrectly left over debug output Signed-off-by: Adam Miller --- diff --git a/build.d/build.py b/build.d/build.py index 77512ee..ce0bfce 100755 --- a/build.d/build.py +++ b/build.d/build.py @@ -296,8 +296,6 @@ def main(): options.input = options.input.rstrip('/') + '/' if options.output is not None: options.output = options.output.rstrip('/') + '/' - #FIXME - print options process(args) if __name__ == "__main__":