Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 231482 | Differences between
and this patch

Collapse All | Expand All

(-)a/WebappConfig/config.py (+16 lines)
Lines 490-495 class Config: Link Here
490
                         ' when creating virtual files. <NOTE>: some pack'
490
                         ' when creating virtual files. <NOTE>: some pack'
491
                         'ages will not work if you use this option')
491
                         'ages will not work if you use this option')
492
492
493
        group.add_option('--cp',
494
                         '--copy',
495
                         action='store_true',
496
                         help = 'Directly copy the webapp files from'
497
             ' the /usr/share/webapps/ directory when installing'
498
             ' the webapp.')
499
493
        group.add_option('--virtual-files',
500
        group.add_option('--virtual-files',
494
                         '--vf',
501
                         '--vf',
495
                         type = 'choice',
502
                         type = 'choice',
Lines 845-850 class Config: Link Here
845
                            'user'         : 'vhost_config_uid',
852
                            'user'         : 'vhost_config_uid',
846
                            'group'        : 'vhost_config_gid',
853
                            'group'        : 'vhost_config_gid',
847
                            'soft'         : 'g_soft',
854
                            'soft'         : 'g_soft',
855
                            'copy'         : 'g_copy',
848
                            'virtual_files': 'vhost_config_virtual_files',
856
                            'virtual_files': 'vhost_config_virtual_files',
849
                            'default_dirs' : 'vhost_config_default_dirs',
857
                            'default_dirs' : 'vhost_config_default_dirs',
850
                            'pretend'      : 'g_pretend',
858
                            'pretend'      : 'g_pretend',
Lines 990-995 class Config: Link Here
990
            OUT.debug('Selecting soft links' , 7)
998
            OUT.debug('Selecting soft links' , 7)
991
999
992
            self.config.set('USER', 'g_link_type', 'soft')
1000
            self.config.set('USER', 'g_link_type', 'soft')
1001
1002
        elif (self.config.has_option('USER', 'g_copy') and
1003
              self.config.getboolean('USER', 'g_copy')):
1004
1005
            OUT.debug('Selecting copying of links', 7)
1006
1007
            self.config.set('USER', 'g_link_type', 'clone')
1008
993
        else:
1009
        else:
994
1010
995
            OUT.debug('Selecting hard links' , 7)
1011
            OUT.debug('Selecting hard links' , 7)
(-)a/WebappConfig/worker.py (+36 lines)
Lines 495-500 class WebappAdd: Link Here
495
                    OUT.debug('Trying to softlink', 8)
495
                    OUT.debug('Trying to softlink', 8)
496
496
497
                    if not self.__p:
497
                    if not self.__p:
498
                        if self.__v:
499
                            print("\n>>> SOFTLINKING FILE: ")
500
                            print(">>> Source: " + src_name +
501
                                  "\n>>> Destination: " + dst_name + "\n")
498
                        os.symlink(src_name, dst_name)
502
                        os.symlink(src_name, dst_name)
499
503
500
                    my_contenttype = 'sym'
504
                    my_contenttype = 'sym'
Lines 504-515 class WebappAdd: Link Here
504
                    if self.__v:
508
                    if self.__v:
505
                        OUT.warn('Failed to softlink (' + str(e) + ')')
509
                        OUT.warn('Failed to softlink (' + str(e) + ')')
506
510
511
            elif self.__link_type == 'clone':
512
                try:
513
514
                    OUT.debug('Trying to copy files directly', 8)
515
516
                    if not self.__p:
517
                        if self.__v:
518
                            print("\n>>> COPYING FILE: ")
519
                            print(">>> Source: " + src_name +
520
                                  "\n>>> Destination: " + dst_name + "\n")
521
                        shutil.copy(src_name, dst_name)
522
523
                    my_contenttype = 'file'
524
525
                except Exception as e:
526
527
                    if self.__v:
528
                        OUT.warn('Failed to copy (' + str(e) + ')')
529
507
            elif os.path.islink(src_name):
530
            elif os.path.islink(src_name):
508
                try:
531
                try:
509
532
510
                    OUT.debug('Trying to copy symlink', 8)
533
                    OUT.debug('Trying to copy symlink', 8)
511
534
512
                    if not self.__p:
535
                    if not self.__p:
536
                        if self.__v:
537
                            print("\n>>> SYMLINK COPY: ")
538
                            print(">>> Source: " + src_name +
539
                                  "\n>>> Destination: " + dst_name + "\n")
513
                        os.symlink(os.readlink(src_name), dst_name)
540
                        os.symlink(os.readlink(src_name), dst_name)
514
541
515
                    my_contenttype = 'sym'
542
                    my_contenttype = 'sym'
Lines 525-530 class WebappAdd: Link Here
525
                    OUT.debug('Trying to hardlink', 8)
552
                    OUT.debug('Trying to hardlink', 8)
526
553
527
                    if not self.__p:
554
                    if not self.__p:
555
                        if self.__v:
556
                            print("\n>>> HARDLINKING FILE: ")
557
                            print(">>> Source: " + src_name +
558
                                  "\n>>> Destination: " + dst_name + "\n")
528
                        os.link(src_name, dst_name)
559
                        os.link(src_name, dst_name)
529
560
530
                    my_contenttype = 'file'
561
                    my_contenttype = 'file'
Lines 535-541 class WebappAdd: Link Here
535
                        OUT.warn('Failed to hardlink (' + str(e) + ')')
566
                        OUT.warn('Failed to hardlink (' + str(e) + ')')
536
567
537
        if not my_contenttype:
568
        if not my_contenttype:
569
538
            if not self.__p:
570
            if not self.__p:
571
                if self.__v:
572
                    print("\n>>> COPYING FILE: ")
573
                    print(">>> Source: " + src_name +
574
                          "\n>>> Destination: " + dst_name + "\n")
539
                shutil.copy(src_name, dst_name)
575
                shutil.copy(src_name, dst_name)
540
            my_contenttype = 'file'
576
            my_contenttype = 'file'
541
577
(-)a/doc/webapp-config.8.xml (-5 / +14 lines)
Lines 68-73 Link Here
68
	  <arg choice="opt">
68
	  <arg choice="opt">
69
	    <option>-dghusDE</option>
69
	    <option>-dghusDE</option>
70
	    <option>--soft</option>
70
	    <option>--soft</option>
71
	    <option>--copy</option>
71
	    <option>--secure</option>
72
	    <option>--secure</option>
72
	  </arg>
73
	  </arg>
73
	  <arg choice="req">
74
	  <arg choice="req">
Lines 217-230 Link Here
217
	</refsect2>
218
	</refsect2>
218
219
219
	<refsect2>
220
	<refsect2>
220
	  <title>Hard Linking vs Soft Linking</title>
221
	  <title>File Copying Options</title>
221
	  <para>A <glossterm>virtual copy</glossterm> is built mostly by creating hard links to files under <filename>/usr/share/webapps</filename>.  If a hard link cannot be created, the file is copied from <filename>/usr/share/webapps</filename> instead.</para>
222
	  <para>A <glossterm>virtual copy</glossterm> is built mostly by creating hard links to files under <filename>/usr/share/webapps</filename>.  If a hard link cannot be created, the file is copied from <filename>/usr/share/webapps</filename> instead.</para>
222
	  <para>Hard links can only be created to files on the same filesystem.  If you keep <filename>/usr/share/webapps</filename> and <filename>/var/www</filename> on different filesystems, <command>webapp-config</command> cannot use hard links, and will be forced to copy the files instead.</para>
223
	  <para>Hard links can only be created to files on the same filesystem.  If you keep <filename>/usr/share/webapps</filename> and <filename>/var/www</filename> on different filesystems, <command>webapp-config</command> cannot use hard links, and will be forced to copy the files instead.</para>
223
	  <para>There are two ways to get around the hard link problem.</para>
224
	  <para>There are three ways to get around the hard link problem.</para>
224
	  <para>The easiest way is to make <filename>/usr/share/webapps</filename> a symlink to a directory under <filename>/var/www</filename>.  For most people, this will ensure that everything is on the same filesystem.</para>
225
	  <para>The easiest way is to make <filename>/usr/share/webapps</filename> a symlink to a directory under <filename>/var/www</filename>.  For most people, this will ensure that everything is on the same filesystem.</para>
225
	  <para>However, if you keep the websites you host on separate filesystems (like I do), then <command>webapp-config</command> is never going to be able to hard-link files for you.</para>
226
	  <para>However, if you keep the websites you host on separate filesystems (like I do), then <command>webapp-config</command> is never going to be able to hard-link files for you.</para>
226
	  <para>You can choose to use the <option>--soft</option> command-line switch instead.  This switch tells <command>webapp-config</command> to create symbolic links instead of hard links.  Symbolic links work across filesystems.</para>
227
	  <para>As an alternative you can choose to use the <option>--soft</option> command-line switch.  This switch tells <command>webapp-config</command> to create symbolic links instead of hard links.  Symbolic links work across filesystems.</para>
227
	  <para>The problem with using symbolic links is that some packages do not work when the virtual copy is made from symbolic links.  Many users - and system administrators alas - have also complained that they find directories full of symbolic links confusing.  For these reasons, symbolic links are not used by default in <command>webapp-config</command> any more.</para>
228
	  <para>The problem with using symbolic links is that some packages do not work when the virtual copy is made from symbolic links.  Many users - and system administrators alas - have also complained that they find directories full of symbolic links confusing.  For these reasons, symbolic links are not used by default in <command>webapp-config</command> any more.</para>
229
          <para>You may also choose the <option>--copy</option> command-line switch.  This particular switch tells <command>webapp-config</command> to directly copy the files from <filename>/usr/share/webapps/</filename> instead of hard links.  Copying directly works across filesystems with the drawback of using more space but if you are going to use it across file systems you may want this instead of symbolic links, as this means that the files in <filename>/usr/share/webapps/</filename> will not be touched when the files in the location of your virtualhost are altered.</para>
228
	</refsect2>
230
	</refsect2>
229
231
230
        <refsect2>
232
        <refsect2>
Lines 465-476 Link Here
465
	  <varlistentry>
467
	  <varlistentry>
466
	    <term><option>--soft</option></term>
468
	    <term><option>--soft</option></term>
467
	    <listitem>
469
	    <listitem>
468
	      <para>Use this option to create the virtual copy using symbolic links instead of hard links.</para>
470
	      <para>Use this option to create the virtual copy using symbolic links.</para>
469
	      <para>You may find this option useful if <filename>/usr/share/webapps</filename> is on a different filesystem to your htdocs directories.  However, it has been discovered that some packages do not work with this option, which is why it is no longer the default behaviour.  You are always better off making <filename>/usr/share/webapps</filename> a symlink to a directory on the same filesystem as your htdocs directories.</para>
471
	      <para>You may find this option useful if <filename>/usr/share/webapps</filename> is on a different filesystem to your htdocs directories.  However, it has been discovered that some packages do not work with this option, which is why it is no longer the default behaviour.  You are always better off making <filename>/usr/share/webapps</filename> a symlink to a directory on the same filesystem as your htdocs directories.</para>
470
	    </listitem>
472
	    </listitem>
471
	  </varlistentry>
473
	  </varlistentry>
472
474
473
	  <varlistentry>
475
	  <varlistentry>
476
	    <term><option>--cp</option></term>
477
	    <term><option>--copy</option></term>
478
	    <listitem>
479
	      <para>Use this option to create the virtual copy by copying the files from the <filename>/usr/share/webapps/</filename> directories.</para>
480
	      <para>This option is useful if you want to copy the files directly from <filename>/usr/share/webapps/</filename> to your virtual host in /var/www without the use of softlinks, or hardlinks. Be aware that because this is a direct copying of files it will prove to take up more space on your filesystem as opposed to the other two options since you are duplicating the webapp.</para>
481
	  </varlistentry>
482
483
	  <varlistentry>
474
	    <term><option>--secure</option></term>
484
	    <term><option>--secure</option></term>
475
	    <listitem>
485
	    <listitem>
476
	      <para>Use this option to install into the <filename>htdocs-secure</filename> directory rather than into the <filename>htdocs</filename> directory.</para>
486
	      <para>Use this option to install into the <filename>htdocs-secure</filename> directory rather than into the <filename>htdocs</filename> directory.</para>
477
- 

Return to bug 231482