Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Create git repo on fedora review server for every new package: issue #4 #5

Merged
merged 31 commits into from Aug 5, 2015

Conversation

fluffybeing
Copy link
Contributor

@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.

@fluffybeing fluffybeing changed the title Create git repo on fedora review server for every new package Create git repo on fedora review server for every new package: issue #4 Mar 18, 2015
@@ -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)
Copy link
Member

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?

Copy link
Contributor Author

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.

@fluffybeing fluffybeing force-pushed the git-integeration branch 2 times, most recently from e1633d0 to fd8bb18 Compare March 23, 2015 18:01
@fluffybeing
Copy link
Contributor Author

@pypingou removed the spec file addition.

@fluffybeing
Copy link
Contributor Author

@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.
http://cl.ly/image/362W1R1R032F
http://cl.ly/image/340d0f1j0S0s

'''
gitrepo = os.path.join(gitfolder, '%s.git' % name)
if os.path.exists(gitrepo):
raise 'The project repo "%s" already exists' % name
Copy link
Contributor

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)

Copy link
Contributor

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
@fluffybeing
Copy link
Contributor Author

@ralphbean updated 👍

@pypingou
Copy link
Member

@rahulrrixe did you forget to push? I do not see the change here.

@fluffybeing
Copy link
Contributor Author

@pypingou it is already updated, I have squashed the commits.

@pypingou
Copy link
Member

Indeed, I see it now, must have been a cache issue PEBKAC :)

@fluffybeing
Copy link
Contributor Author

@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):
Copy link
Member

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 :)

Copy link
Member

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@pypingou
Copy link
Member

pypingou commented Apr 5, 2015

Looks good to me, I'll let @abompard have the final word :)

@ralphbean
Copy link
Contributor

@abompard, can you take a look at this?

@fluffybeing
Copy link
Contributor Author

@abompard I think I should create a separate file for git operation in /lib directory. What is your view on this?


APP = flask.Flask(__name__)
APP.jinja_env.trim_blocks = True
APP.jinja_env.lstrip_blocks = True
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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 :)

@fluffybeing
Copy link
Contributor Author

@pypingou I have removed the split_ref.

@@ -0,0 +1,83 @@
{% extends 'layout.html' %} {% import 'macros.html' as macros %} {% block git %} {% include "/git/git_layout.html" %} {% endblock %} {% block content%}
Copy link
Member

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')
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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)

@fluffybeing
Copy link
Contributor Author

@abompard everything is fine now 👍

abompard added a commit that referenced this pull request Aug 5, 2015
Create git repo on fedora review server for every new package: issue #4
@abompard abompard merged commit 93af9b9 into fedora-infra:master Aug 5, 2015
@abompard
Copy link
Member

abompard commented Aug 5, 2015

Thanks Rahul.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants