Create git repo on fedora review server for every new package: issue #4 #5
Conversation
bdf2a7a
to
458a3bd
Compare
@@ -77,6 +82,14 @@ def newpackage(db, method, data, username): | |||
else: | |||
result.flash.append(("Package successfully created!", "success")) | |||
result.redirect = ('package', {"name": pkg.name}) | |||
|
|||
# create spec template using package infrormation | |||
data = create__spec_template(pkg.name, pkg.summary) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stupid question, but is there a reason for the two _
there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pypingou sorry I haven't observed it.
e1633d0
to
fd8bb18
Compare
@pypingou removed the spec file addition. |
@pypingou @abompard The changes made is working fine. Here is the link to the snapshots I had captured for the repository on client as well as server side. |
''' | ||
gitrepo = os.path.join(gitfolder, '%s.git' % name) | ||
if os.path.exists(gitrepo): | ||
raise 'The project repo "%s" already exists' % name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of raising a bare string, can you raise an exception with that string as its message? i.e.,
raise IOError('The project repo "%s" already exists' % name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than this change, this set of changes looks pretty good to me.
update requirements.txt remove extra underscore remove dummy spec file update create_git_repo method
fd8bb18
to
3928385
Compare
@ralphbean updated 👍 |
@rahulrrixe did you forget to push? I do not see the change here. |
@pypingou it is already updated, I have squashed the commits. |
Indeed, I see it now, must have been a cache issue PEBKAC :) |
@pypingou is anything else needed for this PR? |
else: | ||
result.flash.append(("Package successfully created!", "success")) | ||
result.redirect = ('package', {"name": pkg.name}) | ||
|
||
# Add git repo creation message | ||
if create_git_repo(pkg.name, gitfolder): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the folder does not exist?
-- Nevermind it's handled below :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the IOError is not handled, in case of error the user will just see an error 500 page. It would be better to catch the exception and handle it.
Plus, the "if" construct here is strange, the create_git_repo function does not return True or False. It's a very C-like way of writing code ;-) Better use try/except/else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rahulrrixe ping - any response to the feedback here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ralphbean @abompard, I have made required changes as you have suggested. Sorry for the delay as I was traveling.
Looks good to me, I'll let @abompard have the final word :) |
@abompard, can you take a look at this? |
@abompard I think I should create a separate file for git operation in |
|
||
APP = flask.Flask(__name__) | ||
APP.jinja_env.trim_blocks = True | ||
APP.jinja_env.lstrip_blocks = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to consider if you want this or not (project wide, you can also do it locally for loop or if) as it may make the html produced quite un-readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pypingou our application will not get large number of requests for now and so I don't think we need this much of optimization on cost of readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to agree which is why I brought the question :)
eb0c9d6
to
0e399ee
Compare
@pypingou I have removed the |
@@ -0,0 +1,83 @@ | |||
{% extends 'layout.html' %} {% import 'macros.html' as macros %} {% block git %} {% include "/git/git_layout.html" %} {% endblock %} {% block content%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can split this line over multiple lines, it will make it easier to read
@@ -21,7 +21,7 @@ | |||
# secret key used to generate unique csrf token | |||
SECRET_KEY = 'Change-me-Im-famous' | |||
|
|||
## If the authentication method is `fas`: | |||
# If the authentication method is `fas`: | |||
# To log in, the user must be a member of one of these groups | |||
REQUIRED_GROUPS = ('packager', 'provenpackager') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I don't think we'll need provenpackager, but we will need a way to know if someone is a sponsor and that might require a change either in Ipsilon or in flask-fas-openid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add new group in flask-fas-openid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's not about new group, it's about the status of someone in that group (user, sponsor, administrator)
@abompard everything is fine now 👍 |
Create git repo on fedora review server for every new package: issue #4
Thanks Rahul. |
@abompard @pypingou I have created a new function
create_git_repo
which get called up when any new package get added on the review server. It then create a git repository in folder specified on the config file and also adds the default spec file to it.For e.g.
When user "foo" add a package named "bar" for review then a git repo get created in the folder
/var/git/foo/bar.git
with bar.spec file in it.