]> sipb.mit.edu Git - ikiwiki.git/commitdiff
add ikiwiki-transition setupformat subcommand.
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 6 Aug 2008 00:40:49 +0000 (20:40 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 6 Aug 2008 00:40:49 +0000 (20:40 -0400)
Also fixed a bug in how aggregateinternal used IkiWiki::Setup::load,
and added checks for arguments to other subcommands.

debian/NEWS
debian/changelog
doc/ikiwiki-transition.mdwn
ikiwiki-transition

index 0f9db4ea386e58c2151624285041210e2567a400..7e76dd9e2217499b2dc5691a19c4b9c5f1832cde 100644 (file)
@@ -1,13 +1,19 @@
 ikiwiki (2.60) unstable; urgency=low
 
   Admin preferences are moving from the web interface to the setup file.
 ikiwiki (2.60) unstable; urgency=low
 
   Admin preferences are moving from the web interface to the setup file.
-  There are three new options in the setup file: locked_pages, banned_users,
-  and allowed_attachments. The admin prefs page can still be used, but
+  There are three new options in the setup file: `locked_pages`, `banned_users`,
+  and `allowed_attachments`. The admin prefs page can still be used, but
   that's deprecated, and the prefs will be hidden if a value is not already
   set. If a value is set in the web interface, you're encouraged to move that
   setting to your setup file now, since version 3.0 will remove the deprecated
   web interface.
 
   that's deprecated, and the prefs will be hidden if a value is not already
   set. If a value is set in the web interface, you're encouraged to move that
   setting to your setup file now, since version 3.0 will remove the deprecated
   web interface.
 
+  Also, the layout of the setup file has changed in a significant way in this
+  release. Old setup files will continue to work, but new features, like the
+  new websetup interface, require a new format setup file. You can convert
+  old setup files into the new format by running 
+  `ikiwiki-transition setupformat ikiwiki.setup`
+
  -- Joey Hess <joeyh@debian.org>  Fri, 01 Aug 2008 17:02:14 -0400
 
 ikiwiki (2.52) unstable; urgency=low
  -- Joey Hess <joeyh@debian.org>  Fri, 01 Aug 2008 17:02:14 -0400
 
 ikiwiki (2.52) unstable; urgency=low
index 127c09361ef5fd6f185389417339946e67dc3d8b..5361d88f7a7bdff243bc2c8d62100574ec6c13f4 100644 (file)
@@ -8,6 +8,8 @@ ikiwiki (2.60) UNRELEASED; urgency=low
   * Large amounts of internal config data reorg.
   * The way wrappers are defined in the setup file has changed. Old setup
     files will continue to work, for now.
   * Large amounts of internal config data reorg.
   * The way wrappers are defined in the setup file has changed. Old setup
     files will continue to work, for now.
+  * ikiwiki-transition setupformat can be used to convert a setup file to the
+    new format.
   * Version control backends promoted to first-class plugins.
   * ikiwiki-update-wikilist: Add -r switch to remove. Default behavior is now
     always to add.
   * Version control backends promoted to first-class plugins.
   * ikiwiki-update-wikilist: Add -r switch to remove. Default behavior is now
     always to add.
index 3290ca7e908b4328c60329523da5cfd973e0ae6f..8b7c3579fabd3c1af8cc58bb43d4a0f7b7d00985 100644 (file)
@@ -25,6 +25,14 @@ Note that if the page contains wiki links with spaces, which some
 older versions of ikiwiki accepted, the prefix_directives transition will
 treat these as preprocessor directives and convert them.
 
 older versions of ikiwiki accepted, the prefix_directives transition will
 treat these as preprocessor directives and convert them.
 
+# setupformat
+
+The `setupformat` mode converts a setup file from using a single `wrappers` block
+to using `cgi_wrapper`, `git_wrapper`, etc.
+
+Note that all comments and any unusual stuff like perl code in the setup
+file will be lost, as it is entirely rewritten by the transition.
+
 # aggregateinternal
 
 The `aggregateinternal` mode moves pages aggregated by the aggregate plugin
 # aggregateinternal
 
 The `aggregateinternal` mode moves pages aggregated by the aggregate plugin
index 3e2c89bf9d0166d2a1b29d56541b4b8c272d75d7..a257347a1ad1da259ecb23ebc9d56f3269f62c5b 100755 (executable)
@@ -51,11 +51,11 @@ sub prefix_directives {
 }
 
 sub indexdb {
 }
 
 sub indexdb {
-       $config{wikistatedir}=shift()."/.ikiwiki";
-
-       if (! defined $config{wikistatedir}) {
+       my $dir=shift;
+       if (! defined $dir) {
                usage();                
        }
                usage();                
        }
+       $config{wikistatedir}=$dir."/.ikiwiki";
 
        # Note: No lockwiki here because ikiwiki already locks it
        # before calling this.  
 
        # Note: No lockwiki here because ikiwiki already locks it
        # before calling this.  
@@ -74,12 +74,12 @@ sub indexdb {
 }
 
 sub hashpassword {
 }
 
 sub hashpassword {
-       $config{wikistatedir}=shift()."/.ikiwiki";
-
-       if (! defined $config{wikistatedir}) {
+       my $dir=shift;
+       if (! defined $dir) {
                usage();                
        }
                usage();                
        }
-       
+       $config{wikistatedir}=$dir."/.ikiwiki";
+
        eval q{use IkiWiki::UserInfo};
        eval q{use Authen::Passphrase::BlowfishCrypt};
        if ($@) {
        eval q{use IkiWiki::UserInfo};
        eval q{use Authen::Passphrase::BlowfishCrypt};
        if ($@) {
@@ -100,10 +100,16 @@ sub hashpassword {
 }
 
 sub aggregateinternal {
 }
 
 sub aggregateinternal {
+       my $setup=shift;
+       if (! defined $setup) {
+               usage();
+       }
+
        require IkiWiki::Setup;
        require IkiWiki::Plugin::aggregate;
 
        require IkiWiki::Setup;
        require IkiWiki::Plugin::aggregate;
 
-       %config = (IkiWiki::defaultconfig(), IkiWiki::Setup::load(shift));
+       %config = IkiWiki::defaultconfig();
+       IkiWiki::Setup::load();
        IkiWiki::checkconfig();
 
        IkiWiki::Plugin::aggregate::migrate_to_internal();
        IkiWiki::checkconfig();
 
        IkiWiki::Plugin::aggregate::migrate_to_internal();
@@ -111,13 +117,48 @@ sub aggregateinternal {
        print "... now add aggregateinternal => 1 to your .setup file\n";
 }
 
        print "... now add aggregateinternal => 1 to your .setup file\n";
 }
 
+sub setupformat {
+       my $setup=shift;
+       if (! defined $setup) {
+               usage();
+       }
+
+       require IkiWiki::Setup;
+
+       %config = IkiWiki::defaultconfig();
+       IkiWiki::Setup::load($setup);
+       IkiWiki::checkconfig();
+       
+       # unpack old-format wrappers setting into new fields
+       foreach my $wrapper (@{$config{wrappers}}) {
+               if ($wrapper->{cgi}) {
+                       print "setting cgi_wrapper to ".$wrapper->{wrapper}."\n";
+                       $config{cgi_wrapper}=$wrapper->{wrapper};
+                       $config{cgi_wrappermode}=$wrapper->{wrappermode}
+                               if exists $wrapper->{wrappermode};
+               }
+               elsif ($config{rcs}) {
+                       print "setting $config{rcs}_wrapper to ".$wrapper->{wrapper}."\n";
+                       $config{$config{rcs}."_wrapper"}=$wrapper->{wrapper};
+                       $config{$config{rcs}."_wrappermode"}=$wrapper->{wrappermode}
+                               if exists $wrapper->{wrappermode};
+               }
+               else {
+                       die "don't know what to do with wrapper ".$wrapper->{wrapper}."\n";
+               }
+       }
+
+       IkiWiki::Setup::dump($setup);
+}
+
 sub usage {
        print STDERR "Usage: ikiwiki-transition type ...\n";
        print STDERR "Currently supported transition subcommands:\n";
 sub usage {
        print STDERR "Usage: ikiwiki-transition type ...\n";
        print STDERR "Currently supported transition subcommands:\n";
-       print STDERR "  prefix_directives file\n";
-       print STDERR "  indexdb srcdir\n";
-       print STDERR "  hashpassword srcdir\n";
-       print STDERR "  aggregateinternal setupfile\n";
+       print STDERR "\tprefix_directives file\n";
+       print STDERR "\tindexdb srcdir\n";
+       print STDERR "\thashpassword srcdir\n";
+       print STDERR "\taggregateinternal setupfile\n";
+       print STDERR "\tsetupformat setupfile\n";
        exit 1;
 }
 
        exit 1;
 }
 
@@ -136,6 +177,9 @@ elsif ($mode eq 'indexdb') {
 elsif ($mode eq 'aggregateinternal') {
        aggregateinternal(@ARGV);
 }
 elsif ($mode eq 'aggregateinternal') {
        aggregateinternal(@ARGV);
 }
+elsif ($mode eq 'setupformat') {
+       setupformat(@ARGV);
+}
 else {
        usage();
 }
 else {
        usage();
 }