Repo file generation II. + URL Question

Bohuslav Kabrda bkabrda at redhat.com
Mon May 27 12:07:44 UTC 2013


Hi,
thanks for your effor Tomas, please see few comments below:

----- Original Message -----
> Hi,
> 
> I fixed the SQL query, please comment before I push. I also have a
> design-related question, if I may.
> 
> Currently, the baseurl in the .repo file points to the root of the
> repo. However, if a build is done on multiple architectures, will that
> work, or do I need a baseurl pointing to that architecture
> subdirectory? Based on the answer, I will also implement a link from
> the copr overview page to the respective .repo files.
> 

Seth would probably know this best. Seth?

> Thank you, TR
> 

<snip>

> + at coprs_ns.route('/detail/<username>/<coprname>/<chrootname>.repo', methods =
> ['GET'])

- methods = ['GET'] is default, you don't need to specify that explicitly
- If I get it correctly, the .repo filename is only chroot_name? That would mean something like "fedora-18-x86_64.repo"? If so, this would only allow you to have one copr in your yum.repos.d, right?



<snip>

> +    urls = [build.results for build in copr.builds if build.results != None]

- I don't really like this. This will take _all_ the builds and traverse and create a list of possibly all of them (since you can assume that almost all builds are complete after the copr has lived for some time). I'd suggest using a generator with the same expression and use it to traverse builds - something along the lines of:

urls = (<the same that you have>)
for u in urls:
    if u:
        break
else:
    # all traversed, but no finished build found => page_not_found

# if we get here, u is a finished build => render repofile

> +    if not urls:
> +        return page_not_found('Repository not initialized: No builds in
> {0}/{1} have finished.'.format(username, coprname))
> +
> +    response =
> flask.make_response(flask.render_template('coprs/coprchroot.repo',
> copr=copr, url=urls[0]))
> +    response.mimetype='text/plain'
> +    return response



Could you please fix these nits before committing?
Thanks a lot,
Slavek.

-- 
Regards,
Bohuslav "Slavek" Kabrda.


More information about the copr-devel mailing list