[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian for Linux/{non-i386} / source packaging



I wrote:
> Indeed. We're discussing changeing the source format. Perhaps it
> is best to have
> 1. an unmodified source
> 2. a "debianize" script [description deleted]

Having seen no response to this yet, I'll illustrate my idea of
a "debianize" script.

#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1995-09-08 21:33 MET DST by <ray@zensunni>.
# Source directory was `/home/ray/debian-klooi'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   1596 -rw-r--r-- debianize/README
#   3724 -rwxr--r-- debianize/debianize
#  10240 -rw-r--r-- debianize/demo.tar
#
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  echo 'WARNING: not restoring timestamps.  Consider getting and'
  echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
# ============= debianize/README ==============
if test ! -d 'debianize'; then
  echo 'x - creating directory debianize'
  mkdir 'debianize'
fi
if test -f 'debianize/README' && test X"$1" != X"-c"; then
  echo 'x - skipping debianize/README (file already exists)'
else
  echo 'x - extracting debianize/README (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'debianize/README' &&
"debianize" is an illustration of the way I'd like to see debianization
being done:
- distribute orginal source tars
- use a single script (containing embedded patches) to 
X  - extract the package ("demo.tar")
X  - apply generic patches (including generic debian.* files)
X  - apply architecture-specific patches (if now architecture is specified,
X    use the current one (based on /bin/arch)).
X  This script should be automatically constructable from the separate
X  pieces of code and patch. (This is probably not true for my script,
X  but it illustrates the idea). This approach is comparable to
X  perl5-style diffs and shars.
X
This approach has the following advantages:
- it is easy for the user:
X  - just a single file to download
X  - patches by default for the current architecture
X  - consistent across packages (like debian.rules usage).
X  - no need to check if a package untars in the current dir or in a subdir
X  - multiple packages can be compiled without requiring interaction with
X    the user (which Bogus notes files do (at least that's what I gathered
X    from the discussion))
- it is easy for the developer: 
X  - the script itself is (nearly) automatically constructable
X  - it anticipates Debian on non-i386 system (see the "Debian/m68k" 
X    discussion, and remember the "Debian/AXP" messages).
X  - no duplication of architecture-independent patches.
X  - it is flexible, e.g. files can be moved around. 
X
The only disadvantage I can think of right now, is that these 
"script diffs" are somewhat larger than architecture-specific diffs
would be.
X
Ray (jdassen@wi.LeidenUniv.nl)
SHAR_EOF
  $shar_touch -am 0908212495 'debianize/README' &&
  chmod 0644 'debianize/README' ||
  echo 'restore of debianize/README failed'
  shar_count="`wc -c < 'debianize/README'`"
  test 1596 -eq "$shar_count" ||
    echo "debianize/README: original size 1596, current size $shar_count"
fi
# ============= debianize/debianize ==============
if test -f 'debianize/debianize' && test X"$1" != X"-c"; then
  echo 'x - skipping debianize/debianize (file already exists)'
else
  echo 'x - extracting debianize/debianize (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'debianize/debianize' &&
#!/usr/bin/perl
X
use Getopt::Long;
X
# Known architectures. 1 iff supported by this package.
%archs = (
X  'i386' => 1,
X  'alpha' => 1,
X  'm68k' => 0,
);
X
$autoabbrev = 1; 
if (!GetOptions('arch=s', 'verbose', 'help')) {
X  &usage;
X  die "Error parsing options!\n";
}
X
if (defined($opt_help)) {
X  &usage;
X  exit(0);
}
X
$verbose = defined($opt_verbose);
X
if (!defined($opt_arch)) {
X  $opt_arch = `/bin/arch`;
X  chop($opt_arch);
}
if ($opt_arch eq "i486" || $opt_arch eq "i586") {
X  $opt_arch = "i386";
}
$opt_arch = lc $opt_arch;
X
print 'Architecture: "' . $opt_arch . '"' . "\n" if $verbose;
X
if (!defined($archs{$opt_arch})) {
X  &usage;
X  die('Unknown architecture: "' . $opt_arch . "'");
}
if (!($archs{$opt_arch})) {
X  die('Architecture "' . $opt_arch . '" not supported for this package.');
}
X
&debianize_for_generic;
$_ = $opt_arch;
SWITCH: {
X  /i386/ && do { &debianize_for_i386; last SWITCH};
X  /alpha/ && do { &debianize_for_alpha; last SWITCH};
X  #default
}
X
X
sub usage {
X  print <<'END_OF_MESSAGE';
Usage: debianize [options]
Options: 
X  --verbose			for verbose messages
X  --arch "architecture"		debianize for "architecture"
X  --help			this message
END_OF_MESSAGE
X  print "Possible values for architecture: ";
X  foreach $key (keys %archs) {
X    print $key;
X    if (!$archs{$key}) {
X      print "[!]";
X    }
X    print " ";
X  }
X  print "\n";
X  print "[!] means not supported for this package\n\n";
}
X
X
sub debianize_for_generic {
X  print "Executing generic script\n" if $verbose;
X  system <<END_OF_GENERIC_DEBIANIZE_SCRIPT;
echo "This is the generic script"
# demo.tar extracts in the current dir. Therefore we do it in a new subdir.
mkdir demo
cd demo ; tar xf ../demo.tar
END_OF_GENERIC_DEBIANIZE_SCRIPT
X
X  open(PATCH, ">/tmp/generic_patch");
X  print PATCH <<'END_OF_GENERIC_PATCH';
*** demo	Fri Sep  8 19:50:01 1995
--- demo.generic	Fri Sep  8 19:50:46 1995
***************
*** 1,5 ****
--- 1,6 ----
X  #include<stdio.h>
X  
X  int main() {
+   /* this comment has been added via a generic patch */
X    printf("This is the unmodified source\n");
X  }
END_OF_GENERIC_PATCH
X  close(PATCH);
X  system('cd demo; patch -p </tmp/generic_patch; find . -name \*.orig | xargs rm -f');
}
X
X
X
sub debianize_for_i386 {
X  print "Executing i386 specific script\n" if $verbose;  
X  system <<END_OF_I386_DEBIANIZE_SCRIPT;
echo "This is the i386 specific script"
END_OF_I386_DEBIANIZE_SCRIPT
X  open(PATCH, ">/tmp/i386_patch");
X  print PATCH <<'END_OF_I386_PATCH';
*** demo	Fri Sep  8 19:50:46 1995
--- demo.i386	Fri Sep  8 19:51:13 1995
***************
*** 2,6 ****
X  
X  int main() {
X    /* this comment has been added via a generic patch */
!   printf("This is the unmodified source\n");
X  }
--- 2,6 ----
X  
X  int main() {
X    /* this comment has been added via a generic patch */
!   printf("This program has been patched for i386\n");
X  }
END_OF_I386_PATCH
X  close(PATCH);
X  system('cd demo; patch -p </tmp/i386_patch; find . -name \*.orig | xargs rm -f');
}
X
X
X
sub debianize_for_alpha {
X  print "Executing alpha specific script\n" if $verbose;  
X  system <<END_OF_ALPHA_DEBIANIZE_SCRIPT;
echo "This is the alpha specific script"
END_OF_ALPHA_DEBIANIZE_SCRIPT
X  open(PATCH, ">/tmp/alpha_patch");
X  print PATCH <<'END_OF_ALPHA_PATCH';
*** demo	Fri Sep  8 19:50:46 1995
--- demo.alpha	Fri Sep  8 19:51:13 1995
***************
*** 2,6 ****
X  
X  int main() {
X    /* this comment has been added via a generic patch */
!   printf("This is the unmodified source\n");
X  }
--- 2,6 ----
X  
X  int main() {
X    /* this comment has been added via a generic patch */
!   printf("This program has been patched for alpha\n");
X  }
END_OF_ALPHA_PATCH
X  close(PATCH);
X  system('cd demo; patch -p </tmp/alpha_patch; find . -name \*.orig | xargs rm -f');
}
SHAR_EOF
  $shar_touch -am 0908203395 'debianize/debianize' &&
  chmod 0744 'debianize/debianize' ||
  echo 'restore of debianize/debianize failed'
  shar_count="`wc -c < 'debianize/debianize'`"
  test 3724 -eq "$shar_count" ||
    echo "debianize/debianize: original size 3724, current size $shar_count"
fi
# ============= debianize/demo.tar ==============
if test -f 'debianize/demo.tar' && test X"$1" != X"-c"; then
  echo 'x - skipping debianize/demo.tar (file already exists)'
else
  echo 'x - extracting debianize/demo.tar (binary)'
  sed 's/^X//' << 'SHAR_EOF' | uudecode &&
begin 600 debianize/demo.tar
M9&5M;P``````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````#$P,#8T-"``("`Q-S4P(``@("`Q-#0@`"`@("`@("`@,3$W
M("`V,#(T,3`Q,3$Q("`Q,#$P,0`@,```````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````!U<W1A<B`@`')A>0``
M````````````````````````````````````=7-E<G,`````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````````````C:6YC;'5D93QS=&1I;RYH/@H*:6YT(&UA:6XH
M*2!["B`@<')I;G1F*")4:&ES(&ES('1H92!U;FUO9&EF:65D('-O=7)C95QN
M(BD["GT*````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
9````````````````````````````````````
`
end
SHAR_EOF
  $shar_touch -am 0908195195 'debianize/demo.tar' &&
  chmod 0644 'debianize/demo.tar' ||
  echo 'restore of debianize/demo.tar failed'
  shar_count="`wc -c < 'debianize/demo.tar'`"
  test 10240 -eq "$shar_count" ||
    echo "debianize/demo.tar: original size 10240, current size $shar_count"
fi
exit 0
-- 
Obsig: developing a new sig


Reply to: