add the maven_support flag to tag_config
This commit is contained in:
parent
124fad90f0
commit
22662c32f6
6 changed files with 48 additions and 39 deletions
9
cli/koji
9
cli/koji
|
|
@ -3136,6 +3136,7 @@ def handle_add_tag(options, session, args):
|
|||
parser = OptionParser(usage=usage)
|
||||
parser.add_option("--parent", help=_("Specify parent"))
|
||||
parser.add_option("--arches", help=_("Specify arches"))
|
||||
parser.add_option("--maven-support", action="store_true", help=_("Enable creation of Maven repos for this tag"))
|
||||
(options, args) = parser.parse_args(args)
|
||||
if len(args) != 1:
|
||||
parser.error(_("Please specify a name for the tag"))
|
||||
|
|
@ -3149,6 +3150,8 @@ def handle_add_tag(options, session, args):
|
|||
opts['parent'] = options.parent
|
||||
if options.arches:
|
||||
opts['arches'] = ' '.join(options.arches.replace(',',' ').split())
|
||||
if options.maven_support:
|
||||
opts['maven_support'] = True
|
||||
session.createTag(args[0],**opts)
|
||||
|
||||
def handle_edit_tag(options, session, args):
|
||||
|
|
@ -3162,6 +3165,8 @@ def handle_edit_tag(options, session, args):
|
|||
parser.add_option("--lock", action="store_true", help=_("Lock the tag"))
|
||||
parser.add_option("--unlock", action="store_true", help=_("Unlock the tag"))
|
||||
parser.add_option("--rename", help=_("Rename the tag"))
|
||||
parser.add_option("--maven-support", action="store_true", help=_("Enable creation of Maven repos for this tag"))
|
||||
parser.add_option("--no-maven-support", action="store_true", help=_("Disable creation of Maven repos for this tag"))
|
||||
(options, args) = parser.parse_args(args)
|
||||
if len(args) != 1:
|
||||
parser.error(_("Please specify a name for the tag"))
|
||||
|
|
@ -3181,6 +3186,10 @@ def handle_edit_tag(options, session, args):
|
|||
opts['locked'] = True
|
||||
if options.rename:
|
||||
opts['name'] = options.rename
|
||||
if options.maven_support:
|
||||
opts['maven_support'] = True
|
||||
if options.no_maven_support:
|
||||
opts['maven_support'] = False
|
||||
#XXX change callname
|
||||
session.editTag2(tag,**opts)
|
||||
|
||||
|
|
|
|||
|
|
@ -339,6 +339,7 @@ CREATE TABLE tag_config (
|
|||
arches TEXT,
|
||||
perm_id INTEGER REFERENCES permissions(id),
|
||||
locked BOOLEAN NOT NULL DEFAULT 'false',
|
||||
maven_support BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
-- versioned - see desc above
|
||||
create_event INTEGER NOT NULL REFERENCES events(id) DEFAULT get_event(),
|
||||
revoke_event INTEGER REFERENCES events(id),
|
||||
|
|
|
|||
|
|
@ -2110,7 +2110,7 @@ def lookup_build_target(info,strict=False,create=False):
|
|||
"""Get the id,name for build target"""
|
||||
return lookup_name('build_target',info,strict,create)
|
||||
|
||||
def create_tag(name, parent=None, arches=None, perm=None, locked=False):
|
||||
def create_tag(name, parent=None, arches=None, perm=None, locked=False, maven_support=False):
|
||||
"""Create a new tag"""
|
||||
|
||||
context.session.assertPerm('admin')
|
||||
|
|
@ -2131,12 +2131,9 @@ def create_tag(name, parent=None, arches=None, perm=None, locked=False):
|
|||
#there may already be an id for a deleted tag, this will reuse it
|
||||
tag_id = get_tag_id(name,create=True)
|
||||
|
||||
c=context.cnx.cursor()
|
||||
|
||||
q = """INSERT INTO tag_config (tag_id,arches,perm_id,locked)
|
||||
VALUES (%(tag_id)i,%(arches)s,%(perm)s,%(locked)s)"""
|
||||
context.commit_pending = True
|
||||
c.execute(q,locals())
|
||||
q = """INSERT INTO tag_config (tag_id,arches,perm_id,locked,maven_support)
|
||||
VALUES (%(tag_id)i,%(arches)s,%(perm)i,%(locked)s,%(maven_support)s)"""
|
||||
_dml(q, locals())
|
||||
|
||||
if parent_id:
|
||||
data = {'parent_id': parent_id,
|
||||
|
|
@ -2145,7 +2142,9 @@ def create_tag(name, parent=None, arches=None, perm=None, locked=False):
|
|||
'intransitive': False,
|
||||
'noconfig': False,
|
||||
'pkg_filter': ''}
|
||||
writeInheritanceData(get_tag(name)['id'],data)
|
||||
writeInheritanceData(tag_id, data)
|
||||
|
||||
return tag_id
|
||||
|
||||
def get_tag(tagInfo,strict=False):
|
||||
"""Get tag information based on the tagInfo. tagInfo may be either
|
||||
|
|
@ -2156,7 +2155,8 @@ def get_tag(tagInfo,strict=False):
|
|||
- name
|
||||
- perm_id (may be null)
|
||||
- arches (may be null)
|
||||
- locked (may be null)
|
||||
- locked
|
||||
- maven_support
|
||||
|
||||
If there is no tag matching the given tagInfo, and strict is False,
|
||||
return None. If strict is True, raise a GenericError.
|
||||
|
|
@ -2165,7 +2165,7 @@ def get_tag(tagInfo,strict=False):
|
|||
in tag_config. A tag whose name appears in the tag table but has no
|
||||
active tag_config entry is considered deleted.
|
||||
"""
|
||||
fields = ('id', 'name', 'perm_id', 'arches', 'locked')
|
||||
fields = ('id', 'name', 'perm_id', 'arches', 'locked', 'maven_support')
|
||||
q = """SELECT %s FROM tag_config
|
||||
JOIN tag ON tag_config.tag_id = tag.id
|
||||
WHERE tag_config.active = TRUE
|
||||
|
|
@ -2192,6 +2192,7 @@ def edit_tag(tagInfo, **kwargs):
|
|||
arches: change the arch list
|
||||
locked: lock or unlock the tag
|
||||
perm: change the permission requirement
|
||||
maven_support: whether Maven repos should be generated for the tag
|
||||
"""
|
||||
|
||||
context.session.assertPerm('admin')
|
||||
|
|
@ -2228,7 +2229,7 @@ def edit_tag(tagInfo, **kwargs):
|
|||
#check for changes
|
||||
data = tag.copy()
|
||||
changed = False
|
||||
for key in ('perm_id','arches','locked'):
|
||||
for key in ('perm_id','arches','locked','maven_support'):
|
||||
if kwargs.has_key(key) and data[key] != kwargs[key]:
|
||||
changed = True
|
||||
data[key] = kwargs[key]
|
||||
|
|
@ -2246,9 +2247,9 @@ def edit_tag(tagInfo, **kwargs):
|
|||
_dml(update, data)
|
||||
|
||||
insert = """INSERT INTO tag_config
|
||||
(tag_id, arches, perm_id, locked, create_event)
|
||||
(tag_id, arches, perm_id, locked, maven_support, create_event)
|
||||
VALUES
|
||||
(%(id)i, %(arches)s, %(perm_id)s, %(locked)s, %(event_id)i)"""
|
||||
(%(id)i, %(arches)s, %(perm_id)s, %(locked)s, %(maven_support)s, %(event_id)i)"""
|
||||
_dml(insert, data)
|
||||
|
||||
def old_edit_tag(tagInfo, name, arches, locked, permissionID):
|
||||
|
|
|
|||
|
|
@ -657,27 +657,18 @@ def tagcreate(req):
|
|||
form = req.form
|
||||
|
||||
if form.has_key('add'):
|
||||
params = {}
|
||||
name = form['name'].value
|
||||
arches = form['arches'].value
|
||||
if form.has_key('locked'):
|
||||
locked = True
|
||||
else:
|
||||
locked = False
|
||||
params['arches'] = form['arches'].value
|
||||
params['locked'] = form.has_key('locked')
|
||||
permission = form['permission'].value
|
||||
if permission == 'none':
|
||||
permission = None
|
||||
else:
|
||||
permission = int(permission)
|
||||
if permission != 'none':
|
||||
params['perm'] = int(permission)
|
||||
params['maven_support'] = form.has_key('maven_support')
|
||||
|
||||
server.createTag(name)
|
||||
tag = server.getTag(name)
|
||||
|
||||
if tag == None:
|
||||
raise koji.GenericError, 'error creating tag "%s"' % name
|
||||
tagID = server.createTag(name, **params)
|
||||
|
||||
server.editTag(tag['id'], name, arches, locked, permission)
|
||||
|
||||
mod_python.util.redirect(req, 'taginfo?tagID=%i' % tag['id'])
|
||||
mod_python.util.redirect(req, 'taginfo?tagID=%i' % tagID)
|
||||
elif form.has_key('cancel'):
|
||||
mod_python.util.redirect(req, 'tags')
|
||||
else:
|
||||
|
|
@ -700,16 +691,16 @@ def tagedit(req, tagID):
|
|||
form = req.form
|
||||
|
||||
if form.has_key('save'):
|
||||
name = form['name'].value
|
||||
arches = form['arches'].value
|
||||
locked = bool(form.has_key('locked'))
|
||||
params = {}
|
||||
params['name'] = form['name'].value
|
||||
params['arches'] = form['arches'].value
|
||||
params['locked'] = form.has_key('locked')
|
||||
permission = form['permission'].value
|
||||
if permission == 'none':
|
||||
permission = None
|
||||
else:
|
||||
permission = int(permission)
|
||||
if permission != 'none':
|
||||
params['perm'] = int(permission)
|
||||
params['maven_support'] = form.has_key('maven_support')
|
||||
|
||||
server.editTag(tag['id'], name, arches, locked, permission)
|
||||
server.editTag2(tag['id'], **params)
|
||||
|
||||
mod_python.util.redirect(req, 'taginfo?tagID=%i' % tag['id'])
|
||||
elif form.has_key('cancel'):
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<td><input type="text" name="arches" value="#if $tag then $tag.arches else ''#"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Locked</th>
|
||||
<th>Locked?</th>
|
||||
<td><input type="checkbox" name="locked" value="yes" #if $tag and $tag.locked then 'checked' else ''#>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -38,6 +38,10 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Maven Support?</th>
|
||||
<td><input type="checkbox" name="maven_support" value="yes" #if $tag and $tag.maven_support then 'checked' else ''#>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
#if $tag
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@
|
|||
<tr>
|
||||
<th>Permission</th><td>#if $tag.perm_id then $allPerms[$tag.perm_id] else 'none'#</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Maven Support?</th><td class="$str($tag.maven_support).lower()">#if $tag.maven_support then 'yes' else 'no'#</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Inheritance</th>
|
||||
<td class="tree">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue