Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
		@@ -287,9 +287,9 @@ def main():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            from os.path import basename  # To get the short name
 | 
					            from os.path import basename  # To get the short name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            output.error(
 | 
					            output.eerror(
 | 
				
			||||||
                "The short ebuild name '%s' is ambiguous. Please specify" %
 | 
					                "The short ebuild name '%s' is ambiguous. Please specify" %
 | 
				
			||||||
                    basename(pkgs[0]),
 | 
					                    basename(pkgs[0]) +
 | 
				
			||||||
                "one of the above fully-qualified ebuild names instead."
 | 
					                "one of the above fully-qualified ebuild names instead."
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
            exit_helper(1)
 | 
					            exit_helper(1)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,11 +77,12 @@ ROBOTS_TXT_BLACKLIST_DOMAINS = [
 | 
				
			|||||||
    '(.*)sourceforge(.*)',
 | 
					    '(.*)sourceforge(.*)',
 | 
				
			||||||
    '(.*)github.com',
 | 
					    '(.*)github.com',
 | 
				
			||||||
    '(.*)berlios(.*)',
 | 
					    '(.*)berlios(.*)',
 | 
				
			||||||
    '(.*)qt.nokia.com(.*)',
 | 
					    '(.*)qt\.nokia\.com(.*)',
 | 
				
			||||||
    '(.*)chromium.org(.*)',
 | 
					    '(.*)chromium\.org(.*)',
 | 
				
			||||||
    '(.*)nodejs.org(.*)',
 | 
					    '(.*)nodejs\.org(.*)',
 | 
				
			||||||
    '(.*)download.mono-project.com(.*)',
 | 
					    '(.*)download\.mono-project\.com(.*)',
 | 
				
			||||||
    '(.*)fedorahosted.org(.*)',
 | 
					    '(.*)fedorahosted\.org(.*)',
 | 
				
			||||||
 | 
					    '(.*)download\.tuxfamily\.org(.*)',
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from out import EuscanOutput
 | 
					from out import EuscanOutput
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,6 +70,7 @@ def scan_html(data, url, pattern):
 | 
				
			|||||||
                 match.group(0))
 | 
					                 match.group(0))
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return results
 | 
					    return results
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -373,27 +373,28 @@ def tryurl(fileurl, template):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def regex_from_template(template):
 | 
					def regex_from_template(template):
 | 
				
			||||||
    # Escape
 | 
					    # Escape
 | 
				
			||||||
    template = re.escape(template)
 | 
					    regexp = re.escape(template)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Unescape specific stuff
 | 
					    # Unescape specific stuff
 | 
				
			||||||
    template = template.replace('\$\{', '${')
 | 
					    regexp = regexp.replace('\$\{', '${')
 | 
				
			||||||
    template = template.replace('\}', '}')
 | 
					    regexp = regexp.replace('\}', '}')
 | 
				
			||||||
    template = template.replace('}\.$', '}.$')
 | 
					    regexp = regexp.replace('}\.$', '}.$')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Replace ${\d+}
 | 
					    # Replace ${\d+}
 | 
				
			||||||
    #template = template.replace('${0}', r'([\d]+?)')
 | 
					    #regexp = regexp.replace('${0}', r'([\d]+?)')
 | 
				
			||||||
    template = re.sub(r'(\$\{\d+\}(\.?))+', r'([\w\.]+?)', template)
 | 
					    regexp = re.sub(r'(\$\{\d+\}(\.?))+', r'([\w\.]+?)', regexp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #template = re.sub(r'(\$\{\d+\}\.?)+', r'([\w]+?)', template)
 | 
					    #regexp = re.sub(r'(\$\{\d+\}\.?)+', r'([\w]+?)', regexp)
 | 
				
			||||||
    #template = re.sub(r'(\$\{\d+\}\.+)+', '(.+?)\.', template)
 | 
					    #regexp = re.sub(r'(\$\{\d+\}\.+)+', '(.+?)\.', regexp)
 | 
				
			||||||
    #template = re.sub(r'(\$\{\d+\})+', '(.+?)', template)
 | 
					    #regexp = re.sub(r'(\$\{\d+\})+', '(.+?)', regexp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Full version
 | 
					    # Full version
 | 
				
			||||||
    template = template.replace('${PV}', _v)
 | 
					    regexp = regexp.replace('${PV}', _v)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # End
 | 
					    # End
 | 
				
			||||||
    template = template + r'/?$'
 | 
					    regexp = regexp + r'/?$'
 | 
				
			||||||
    return template
 | 
					
 | 
				
			||||||
 | 
					    return regexp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def basedir_from_template(template):
 | 
					def basedir_from_template(template):
 | 
				
			||||||
@@ -417,7 +418,7 @@ def generate_scan_paths(url):
 | 
				
			|||||||
    path = prefix + ":/"
 | 
					    path = prefix + ":/"
 | 
				
			||||||
    for chunk in chunks:
 | 
					    for chunk in chunks:
 | 
				
			||||||
        if '${' in chunk:
 | 
					        if '${' in chunk:
 | 
				
			||||||
            steps.append((path, regex_from_template(chunk)))
 | 
					            steps.append((path, '^(?:|.*/)'  + regex_from_template(chunk)))
 | 
				
			||||||
            path = ""
 | 
					            path = ""
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            path += "/"
 | 
					            path += "/"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user