[yum-git] docs/Makefile docs/yum-groups-manager.1 yum-groups-manager.py yum-utils.spec

James Antill james at linux.duke.edu
Sat Aug 23 05:38:41 UTC 2008


 docs/Makefile             |    2 
 docs/yum-groups-manager.1 |  109 ++++++++++++++++++++++++++++++++++++++++++++++
 yum-groups-manager.py     |   37 +++++++--------
 yum-utils.spec            |    1 
 4 files changed, 129 insertions(+), 20 deletions(-)

New commits:
commit 00c62091f54724f5cf2be93cd8b9c92a45f9de54
Author: James Antill <james at and.org>
Date:   Sat Aug 23 01:38:24 2008 -0400

    Write man page for yum-groups-manger, tweak the cmd a bit to match docs

diff --git a/docs/Makefile b/docs/Makefile
index ad95261..c3f946e 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,5 +1,5 @@
 DOCS = repoquery package-cleanup repo-rss yumdownloader yum-builddep yum-changelog reposync \
-       yum-list-data yum-filter-data yum-verify yum-utils yum-aliases yum-debug-dump yum-versionlock
+       yum-list-data yum-filter-data yum-verify yum-utils yum-aliases yum-debug-dump yum-versionlock yum-groups-manager
 DOCS5 = yum-changelog.conf yum-versionlock.conf
 DOCS8 = yum-security yum-complete-transaction 
 
diff --git a/docs/yum-groups-manager.1 b/docs/yum-groups-manager.1
new file mode 100644
index 0000000..88a47f0
--- /dev/null
+++ b/docs/yum-groups-manager.1
@@ -0,0 +1,109 @@
+.\" yum-groups-manager
+.TH "yum-groups-manager" "1" "2008 Aug 23" "" ""
+.SH "NAME"
+yum-groups-manager - create and edit yum's group metadata
+.SH "SYNOPSIS"
+\fByum-groups-manager\fP [options] [packages]
+.SH "DESCRIPTION"
+\fByum-groups-manager\fP is used to create or edit a group metadata file for a
+yum repository. This is often much easier than writting/editing the XML by hand.
+The \fByum-groups-manager\fP can load an entire file of groups metadata and
+either create a new group or edit an existing group and then write all of the
+groups metadata back out.
+.SH "OPTIONS"
+.IP "\fB\-h, \-\-help\fP"
+Display a help message, and then quit.
+.IP "\fB\-\-version\fP"
+Display a version message, and then quit.
+.IP "\fB\-n, \-\-name\fP"
+The name to lookup/use for the group. If you specify an existing group id, then
+the group with that id will have it's name changed to this value.
+.IP "\fB\-\-id\fP"
+The id to lookup/use for the group. If you don't specify an id, but do specify a
+name that doesn't refer to an existing group, then an id for the group is
+generated based on the name.
+.IP "\fB\-\-description\fP"
+The description to use for the group.
+.IP "\fB\-\-mandatory\fP"
+Store the package names specified within the mandatory section of the specified
+group, the default is to use the default section. This overrides the optional
+argument.
+.IP "\fB\-\-optional\fP"
+Store the package names specified within the optional section of the specified
+group, the default is to use the default section. This option is overridden by
+the mandatory argument.
+.IP "\fB\-\-dependencies\fP"
+Also include the names of the direct dependencies for each package specified.
+.IP "\fB\-\-not\-user\-visible\fP"
+Make the group not visible in yum grouplist.
+.IP "\fB\-\-user\-visible\fP"
+Make the group visible in yum grouplist (this is the default).
+.IP "\fB\-\-display\-order\fP"
+Change the integer which controls the order groups are presented in, for example
+in yum grouplist.
+.IP "\fB\-\-load\fP"
+Load the groups metadata information from the specified file, before
+performing any operataions. This option can be specified multiple times.
+.IP "\fB\-\-save\fP"
+Save the result to this file, you can specify the name of a file you are
+loading from as the data will only be when all the operations have been
+performed. This option can also be specified multiple times.
+.IP "\fB\-\-merge\fP"
+This is the same as loading and saving a file, however the "merge" file is
+loaded before any others and saved last.
+.IP "\fB\-\-print\fP"
+Also print the result to stdout, if saving or merging.
+.IP "\fB\-\-remove\fP"
+Instead of adding package, remove them. Note that the packages are removed from
+all sections (default, mandatory and optional).
+.IP "\fB\-\-translated\-name\fP"
+This is another name for the group within the locale given. The syntax is
+lang:text. Eg. en:my-group-name-in-english
+.IP "\fB\-\-translated\-description\fP"
+This is another description for the group within the locale given. The syntax is
+lang:text. Eg. en:my-group-description-in-english.
+
+.SH "YUM OPTIONS"
+The following options are meant to be the same as those with the same name
+in yum.
+.IP "\fB\-c CONFIG, \-\-config=CONFIG\fP"
+.IP "\fB\-\-quiet\fP"
+.IP "\fB\-\-verbose\fP"
+.IP "\fB\-\-enablerepo\fP"
+.IP "\fB\-\-disablerepo\fP"
+.IP "\fB\-\-noplugins\fP"
+.IP "\fB\-C, \-\-cache\fP"
+.IP "\fB\-\-tempcache\fP"
+
+.SH "EXAMPLES"
+.IP "Create a new group metadata file, with a group called yum containing all the packages that start with yum:"
+\fB yum-groups-manager --name YUM --save groups.xml 'yum*'\fP
+.IP "After the above command, load the groups.xml data, work with the yum group, make the group not user visible, and remove the yum-skip-broken and yum-priorities packages from it:"
+\fB yum-groups-manager -n YUM --merge groups.xml --remove yum-skip-broken yum-priorities --not-user-visible\fP
+.IP "After the above commands, add a description and a translated name to the yum group:"
+\fB yum-groups-manager -n YUM --merge groups.xml --description 'This is a group with most of the yum packages in it' --translated-name 'en:yum packages'\fP
+.SH "FILES"
+\fByum-groups-manager\fP uses the yum libraries for retrieving information and
+packages. If no configuration file is specified, the default yum
+configuration will be used.
+.PP
+.nf 
+/etc/yum.conf
+/etc/yum/repos.d/
+.fi
+.SH "SEE ALSO"
+.nf
+.I yum (8)
+.I yum.conf (5)
+http://linux.duke.edu/yum/
+.fi
+.SH "AUTHORS"
+.nf 
+See the Authors file included with this program.
+.fi
+.SH "BUGS"
+.nf
+There are a couple of options you can't set, yet. Most notabley you cannot put
+package names into the conditional section (where they are installed with
+groupinstall only if another package is installed).
+.fi
diff --git a/yum-groups-manager.py b/yum-groups-manager.py
index 97b92aa..75393dc 100755
--- a/yum-groups-manager.py
+++ b/yum-groups-manager.py
@@ -16,7 +16,7 @@ from urlgrabber.progress import TextMeter
 
 def setup_opts():
     version = "0.0.1"
-    vers_txt = "Manage yum groups data version %s" % version
+    vers_txt = "Manage yum groups metadata version %s" % version
     usage_txt = "%prog [pkg-wildcard]..."
     parser =  optparse.OptionParser(usage = usage_txt, version = vers_txt)
 
@@ -29,17 +29,21 @@ def setup_opts():
                       help="make the package names be in the optional section")
     parser.add_option("--dependencies", action="store_true",
                       help="add the dependencies for this package")
-    parser.add_option("--not-user-visible", action="store_false", default=True,
+    parser.add_option("--user-visible", dest="user_visible",
+                      action="store_true", default=None,
+                      help="make this a user visible group (default)")
+    parser.add_option("--not-user-visible", dest="user_visible",
+                      action="store_false", default=None,
                       help="make this a non-user visible group")
     parser.add_option("--description", help="description for the group")
     parser.add_option("--display-order", help="sort order override")
 
     parser.add_option("--load", action="append", default=[],
-                      help="load groups data from file and merge")
-    parser.add_option("--save",
-                      help="save groups data to file (don't print)")
+                      help="load groups metadata from file")
+    parser.add_option("--save", action="append", default=[],
+                      help="save groups metadata to file (don't print)")
     parser.add_option("--merge",
-                      help="load and save groups data to file (don't print)")
+                      help="load and save groups metadata to file (don't print)")
     parser.add_option("--print", dest="print2stdout",
                       action="store_true", default=None,
                       help="print the result to stdout")
@@ -71,7 +75,8 @@ def setup_opts():
                       help="run from cache only")
     parser.add_option("--tempcache", action="store_true",
                       help="use private cache (default when used as non-root)")
-    parser.add_option("-c", dest="conffile", help="config file location")
+    parser.add_option("-c", "--config",
+                      dest="conffile", help="config file location")
 
     return parser
 
@@ -179,6 +184,7 @@ def main():
 
     if opts.merge:
         opts.load.insert(0, opts.merge)
+        opts.save.append(opts.merge)
 
     loaded_files = False
     for fname in opts.load:
@@ -228,6 +234,8 @@ def main():
         group.description = opts.description
     if opts.display_order:
         group.display_order = int(opts.display_order)
+    if opts.user_visible is not None:
+        group.user_visible = opts.user_visible
     for tn in opts.i18nname or []:
         lang, text = trans_data(yb, tn)
         group.translated_name[lang] = text
@@ -266,25 +274,16 @@ def main():
         else:
             group.default_packages[pkgname]   = 1
 
-    if opts.save:
-      try:
-        fo = open(opts.save, "wb")
-        fo.write(comps.xml())
-        del fo
-      except IOError, e:
-        yb.logger.error(e)
-        sys.exit(50)
-    if opts.merge:
+    for fname in opts.save:
       try:
-        fo = open(opts.merge, "wb")
+        fo = open(fname, "wb")
         fo.write(comps.xml())
         del fo
       except IOError, e:
         yb.logger.error(e)
         sys.exit(50)
 
-    if (opts.print2stdout or
-        (opts.print2stdout is None and not (opts.save or opts.merge))):
+    if (opts.print2stdout or (opts.print2stdout is None and not opts.save)):
         print comps.xml()
 
 if __name__ == "__main__":
diff --git a/yum-utils.spec b/yum-utils.spec
index da4793c..e7b6118 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -358,6 +358,7 @@ fi
 %{_mandir}/man1/yum-builddep.1.*
 %{_mandir}/man1/yum-debug-dump.1.*
 %{_mandir}/man8/yum-complete-transaction.8.*
+%{_mandir}/man1/yum-groups-manager.8.*
 %{_mandir}/man1/yumdownloader.1.*
 
 %files -n yum-updateonboot



More information about the Yum-cvs-commits mailing list