[xml/sgml-commit] [xml-core] 12/13: Add an optional sorting switch to sort the catalog entries, used by default while adding data through dh_installxmlcatalogs
Mattia Rizzolo
mattia at debian.org
Fri Sep 30 16:59:03 UTC 2016
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch master
in repository xml-core.
commit cf34c692f1fccd0b09b02432cf2dd3c74daee2f0
Author: Joseph Herlant <herlantj at gmail.com>
Date: Thu Feb 27 12:07:52 2014 +0100
Add an optional sorting switch to sort the catalog entries, used by default while adding data through dh_installxmlcatalogs
Closes: #626036
---
debhelper/dh_installxmlcatalogs | 1 +
tools/update-xmlcatalog | 22 ++++++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/debhelper/dh_installxmlcatalogs b/debhelper/dh_installxmlcatalogs
index cd0a743..8af987e 100755
--- a/debhelper/dh_installxmlcatalogs
+++ b/debhelper/dh_installxmlcatalogs
@@ -123,6 +123,7 @@ init();
sub add_xmlcat_cmd ($$$;$) {
my ($pkg, $type, $id, $local) = @_;
my $cmd = 'update-xmlcatalog';
+ $cmd .= ' --sort';
$cmd .= ' --add';
$cmd .= " --type $type";
$cmd .= " --id \"$id\"";
diff --git a/tools/update-xmlcatalog b/tools/update-xmlcatalog
index 293cea0..33c02f4 100755
--- a/tools/update-xmlcatalog
+++ b/tools/update-xmlcatalog
@@ -84,6 +84,17 @@ Indicates the XML catalog file entry type (public, system, uri).
Displays the usage information.
+=item B<--verbose>
+
+Optional switch to make a verbose output.
+
+=item B<--sort>
+
+Optional switch to sort the manipulated catalog content.
+
+Tip: To sort a catalog without adding or removing an item,
+just add an already existing item to the catalog.
+
=back
=head1 NOTES
@@ -144,6 +155,7 @@ use vars qw( $package );
use vars qw( $root );
use vars qw( $type $id );
use vars qw( $verbose );
+use vars qw( $sort );
## ----------------------------------------------------------------------
if ( ! GetOptions(
@@ -157,6 +169,7 @@ if ( ! GetOptions(
'root' => \$root,
'type=s' => \$type,
'verbose' => \$verbose,
+ 'sort' => \$sort,
)
)
{
@@ -483,7 +496,9 @@ sub write_catalog_data
open( CATALOG_DATA, '>', $catalog_data )
or die "$name: cannot open catalog data $catalog_data for writing: $!";
my $counter = 0;
- for my $key ( keys %catalog )
+ # Adding the optional sort of the catalog. See #626036.
+ my @catalog_keys = ( $sort ? sort keys %catalog : keys %catalog );
+ for my $key ( @catalog_keys )
{
print( CATALOG_DATA "<$key><$catalog{ $key }>\n" );
$counter++;
@@ -543,7 +558,9 @@ sub write_catalog
## ------------------------------------------------------------------
my $counter = 0;
- for my $key ( keys %catalog )
+ # Adding the optional sort of the catalog. See #626036.
+ my @catalog_keys = ( $sort ? sort keys %catalog : keys %catalog );
+ for my $key ( @catalog_keys )
{
push( @catalog, "<$key $catalog{ $key }/>" );
$counter++;
@@ -615,6 +632,7 @@ With:
Options:
--verbose = be verbose
+ --sort = sorts the manipulated catalog content
END
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-xml-sgml/xml-core.git
More information about the debian-xml-sgml-commit
mailing list