Re: [linux-dvb] [PATCH] v4l-dvb: add $DESTDIR support

2007-03-09 Thread Ludwig Nussel
Trent Piepho wrote:
 On Thu, 8 Mar 2007, Ludwig Nussel wrote:
  Trent Piepho wrote:
Following patch adds $DESTDIR support so one can install the kernel
modules into a directory other than / as non-root user. That's
useful when building an rpm or compiling for a different machine.
 
-print OUT \t/sbin/depmod -a \${KERNELRELEASE}\n\n;
+print OUT \tif [ -w / ]; then /sbin/depmod -a \${KERNELRELEASE}; 
fi\n\n;
  
   This doesn't seem correct.  Shouldn't it be:
   print OUT \t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b 
   \$(DESTDIR))\n\n;
 
  One needs to run depmod when the modules get installed to their final 
  location.
  $DESTDIR is incomplete so it doesn't make sense to run depmod here already.
 
 When compiling an RPM package DESTDIR may not be the final location, but
 that is not the only reason one might want to use DESTDIR.  One could
 repair a mounted root fs after booting from a rescue CD or be trying to
 create a bootable MythTV image.

Well, obviously noone cared about such exotic use cased yet. Anyways here a
patch that adds your change as well, please apply.

Signed-off-by: Ludwig Nussel [EMAIL PROTECTED]

diff -r f71d56dfeb0d v4l/scripts/make_makefile.pl
--- a/v4l/scripts/make_makefile.pl  Wed Mar 07 12:28:33 2007 -0200
+++ b/v4l/scripts/make_makefile.pl  Fri Mar 09 15:45:49 2007 +0100
@@ -134,12 +134,12 @@ print OUT [EMAIL PROTECTED] --strip-debug \$(in
 
 while (my ($dir, $files) = each %instdir) {
print OUT [EMAIL PROTECTED] -e \\\nInstalling \$(KDIR26)/$dir 
files:\\n;
-   print OUT [EMAIL PROTECTED] -d \$(KDIR26)/$dir\n;
+   print OUT [EMAIL PROTECTED] -d \$(DESTDIR)\$(KDIR26)/$dir\n;
print OUT [EMAIL PROTECTED] i in , join(' ', keys %$files), ;do ;
print OUT if [ -e \\$\$i\ ]; then echo -n \\$\$i \;;
-   print OUT  install -m 644 -c \$\$i \$(KDIR26)/$dir; fi; done; 
echo;\n\n;
+   print OUT  install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; 
done; echo;\n\n;
 }
-print OUT \t/sbin/depmod -a \${KERNELRELEASE}\n\n;
+print OUT \t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b 
\$(DESTDIR))\n\n;
 
 # Creating Remove rule
 print OUT media-rminstall::\n;
@@ -149,13 +149,13 @@ while ( my ($dir, $files) = each(%instdi
print OUT [EMAIL PROTECTED] -e \\\nRemoving old \$(KDIR26)/$dir 
files:\\n;
print OUT [EMAIL PROTECTED]', join(' ', keys %$files), '; ;
 
-   print OUT for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i ]; then 
;
+   print OUT for i in \$\$files;do if [ -e 
\$(DESTDIR)\$(KDIR26)/$dir/\$\$i ]; then ;
print OUT echo -n \\$\$i \;;
-   print OUT  rm \$(KDIR26)/$dir/\$\$i; fi; done; ;
+   print OUT  rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i; fi; done; ;
 
-   print OUT for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i.gz ]; 
then ;
+   print OUT for i in \$\$files;do if [ -e 
\$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz ]; then ;
print OUT echo -n \\$\$i.gz \;;
-   print OUT  rm \$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n;
+   print OUT  rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz; fi; done; 
echo;\n\n;
 }
 
 # Print dependencies of Makefile.media

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE Labs
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)


___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [PATCH] v4l-dvb: add $DESTDIR support

2007-03-09 Thread Trent Piepho
On Fri, 9 Mar 2007, Ludwig Nussel wrote:
This doesn't seem correct.  Shouldn't it be:
print OUT \t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b 
\$(DESTDIR))\n\n;
  
   One needs to run depmod when the modules get installed to their final 
   location.
   $DESTDIR is incomplete so it doesn't make sense to run depmod here 
   already.
 
  When compiling an RPM package DESTDIR may not be the final location, but
  that is not the only reason one might want to use DESTDIR.  One could
  repair a mounted root fs after booting from a rescue CD or be trying to
  create a bootable MythTV image.

Also consider what would happen if someone tried to rebuild the rpm as root
or another user who would write to /.  The modules would be installed in
the rpm buildroot, but depmod would be run on their system modules.  If the
kernel v4l-dvb is being built against isn't the one that is being run, then
they'll get a new directory in /lib/modules when they build the rpm.


 Well, obviously noone cared about such exotic use cased yet. Anyways here a
 patch that adds your change as well, please apply.

Patch applied.

___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [PATCH] v4l-dvb: add $DESTDIR support

2007-03-08 Thread Ludwig Nussel
Trent Piepho wrote:
  Following patch adds $DESTDIR support so one can install the kernel
  modules into a directory other than / as non-root user. That's
  useful when building an rpm or compiling for a different machine.
 
  Signed-off-by: Ludwig Nussel [EMAIL PROTECTED]
 
  diff -r 44676649301d v4l/scripts/make_makefile.pl
  --- a/v4l/scripts/make_makefile.pl  Tue Mar 06 19:15:19 2007 +0100
  +++ b/v4l/scripts/make_makefile.pl  Wed Mar 07 14:35:40 2007 +0100
  @@ -134,12 +134,12 @@ print OUT [EMAIL PROTECTED] --strip-debug \$(in
 
   while (my ($dir, $files) = each %instdir) {
  print OUT [EMAIL PROTECTED] -e \\\nInstalling \$(KDIR26)/$dir 
  files:\\n;
  -   print OUT [EMAIL PROTECTED] -d \$(KDIR26)/$dir\n;
  +   print OUT [EMAIL PROTECTED] -d \$(DESTDIR)\$(KDIR26)/$dir\n;
  print OUT [EMAIL PROTECTED] i in , join(' ', keys %$files), ;do ;
  print OUT if [ -e \\$\$i\ ]; then echo -n \\$\$i \;;
  -   print OUT  install -m 644 -c \$\$i \$(KDIR26)/$dir; fi; done; 
  echo;\n\n;
  +   print OUT  install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; 
  done; echo;\n\n;
   }
 
 This part looks ok.
 
  -print OUT \t/sbin/depmod -a \${KERNELRELEASE}\n\n;
  +print OUT \tif [ -w / ]; then /sbin/depmod -a \${KERNELRELEASE}; fi\n\n;
 
 This doesn't seem correct.  Shouldn't it be:
 print OUT \t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b 
 \$(DESTDIR))\n\n;

One needs to run depmod when the modules get installed to their final location.
$DESTDIR is incomplete so it doesn't make sense to run depmod here already.

   # Creating Remove rule
   print OUT media-rminstall::\n;
 
 Seems like the rminstall rule should use DESTDIR too.

It's not that useful there as you can just rm -rf $DESTDIR. Anyways here's a
patch that includes rminstall:

diff -r f71d56dfeb0d v4l/scripts/make_makefile.pl
--- a/v4l/scripts/make_makefile.pl  Wed Mar 07 12:28:33 2007 -0200
+++ b/v4l/scripts/make_makefile.pl  Thu Mar 08 08:59:11 2007 +0100
@@ -134,12 +134,12 @@ print OUT [EMAIL PROTECTED] --strip-debug \$(in
 
 while (my ($dir, $files) = each %instdir) {
print OUT [EMAIL PROTECTED] -e \\\nInstalling \$(KDIR26)/$dir 
files:\\n;
-   print OUT [EMAIL PROTECTED] -d \$(KDIR26)/$dir\n;
+   print OUT [EMAIL PROTECTED] -d \$(DESTDIR)\$(KDIR26)/$dir\n;
print OUT [EMAIL PROTECTED] i in , join(' ', keys %$files), ;do ;
print OUT if [ -e \\$\$i\ ]; then echo -n \\$\$i \;;
-   print OUT  install -m 644 -c \$\$i \$(KDIR26)/$dir; fi; done; 
echo;\n\n;
+   print OUT  install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; 
done; echo;\n\n;
 }
-print OUT \t/sbin/depmod -a \${KERNELRELEASE}\n\n;
+print OUT \tif [ -w / ]; then /sbin/depmod -a \${KERNELRELEASE}; fi\n\n;
 
 # Creating Remove rule
 print OUT media-rminstall::\n;
@@ -149,13 +149,13 @@ while ( my ($dir, $files) = each(%instdi
print OUT [EMAIL PROTECTED] -e \\\nRemoving old \$(KDIR26)/$dir 
files:\\n;
print OUT [EMAIL PROTECTED]', join(' ', keys %$files), '; ;
 
-   print OUT for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i ]; then 
;
+   print OUT for i in \$\$files;do if [ -e 
\$(DESTDIR)\$(KDIR26)/$dir/\$\$i ]; then ;
print OUT echo -n \\$\$i \;;
-   print OUT  rm \$(KDIR26)/$dir/\$\$i; fi; done; ;
+   print OUT  rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i; fi; done; ;
 
-   print OUT for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i.gz ]; 
then ;
+   print OUT for i in \$\$files;do if [ -e 
\$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz ]; then ;
print OUT echo -n \\$\$i.gz \;;
-   print OUT  rm \$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n;
+   print OUT  rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz; fi; done; 
echo;\n\n;
 }
 
 # Print dependencies of Makefile.media

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE Labs
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)


___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [PATCH] v4l-dvb: add $DESTDIR support

2007-03-08 Thread Trent Piepho
On Thu, 8 Mar 2007, Ludwig Nussel wrote:
 Trent Piepho wrote:
   Following patch adds $DESTDIR support so one can install the kernel
   modules into a directory other than / as non-root user. That's
   useful when building an rpm or compiling for a different machine.

   -print OUT \t/sbin/depmod -a \${KERNELRELEASE}\n\n;
   +print OUT \tif [ -w / ]; then /sbin/depmod -a \${KERNELRELEASE}; 
   fi\n\n;
 
  This doesn't seem correct.  Shouldn't it be:
  print OUT \t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b 
  \$(DESTDIR))\n\n;

 One needs to run depmod when the modules get installed to their final 
 location.
 $DESTDIR is incomplete so it doesn't make sense to run depmod here already.

When compiling an RPM package DESTDIR may not be the final location, but
that is not the only reason one might want to use DESTDIR.  One could
repair a mounted root fs after booting from a rescue CD or be trying to
create a bootable MythTV image.

If I can write to /, then the modules go to DESTDIR but depmod is run on /.
That doesn't seem consistent.  And if I can't write to / (say it's read
only) but can write to the module install directory, then depmod isn't run,
even if I plan to boot a system with those modules.

Also, the kernel's modules_install target will run depmod on with -b
$(INSTALL_MOD_PATH) if the modules are being installed to a directory other
than the root.  I think it makes sense to be consistent with the kernel's
behavior.

___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [PATCH] v4l-dvb: add $DESTDIR support

2007-03-07 Thread Trent Piepho
 Following patch adds $DESTDIR support so one can install the kernel
 modules into a directory other than / as non-root user. That's
 useful when building an rpm or compiling for a different machine.

 Signed-off-by: Ludwig Nussel [EMAIL PROTECTED]

 diff -r 44676649301d v4l/scripts/make_makefile.pl
 --- a/v4l/scripts/make_makefile.plTue Mar 06 19:15:19 2007 +0100
 +++ b/v4l/scripts/make_makefile.plWed Mar 07 14:35:40 2007 +0100
 @@ -134,12 +134,12 @@ print OUT [EMAIL PROTECTED] --strip-debug \$(in

  while (my ($dir, $files) = each %instdir) {
   print OUT [EMAIL PROTECTED] -e \\\nInstalling \$(KDIR26)/$dir 
 files:\\n;
 - print OUT [EMAIL PROTECTED] -d \$(KDIR26)/$dir\n;
 + print OUT [EMAIL PROTECTED] -d \$(DESTDIR)\$(KDIR26)/$dir\n;
   print OUT [EMAIL PROTECTED] i in , join(' ', keys %$files), ;do ;
   print OUT if [ -e \\$\$i\ ]; then echo -n \\$\$i \;;
 - print OUT  install -m 644 -c \$\$i \$(KDIR26)/$dir; fi; done; 
 echo;\n\n;
 + print OUT  install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; 
 done; echo;\n\n;
  }

This part looks ok.

 -print OUT \t/sbin/depmod -a \${KERNELRELEASE}\n\n;
 +print OUT \tif [ -w / ]; then /sbin/depmod -a \${KERNELRELEASE}; fi\n\n;

This doesn't seem correct.  Shouldn't it be:
print OUT \t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b 
\$(DESTDIR))\n\n;

  # Creating Remove rule
  print OUT media-rminstall::\n;

Seems like the rminstall rule should use DESTDIR too.

___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb