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

Re: %setup for package.tar.gz +package.xdelta



Circa 2002-Feb-22 17:02:52 +0100 dixit Andreas Gruenbacher:

: Hello,
: 
: I want to build an RPM package from a tar file that needs to be patched with 
: xdelta before unpacking, e.g.,
: 
: 	xdelta patch package.tar.gz package.xdelta package-new.tar.gz
: 	gzip -cd package-new.tar.gz | tar xvfz -
: 
: However all my attempts with or without the %setup macro have failed so far. 
: Is it possible to use %setup for that purpose?
: 
: If I cannot use %setup how can I avoid it? There seems to be some magic going 
: on in addition to the script %setup creates/executes, e.g., the build 
: directory is set to package-ver/.

If you have to manipulate source archives in this fashion, here's my
recommendation (based solely on years of packaging stuff as RPMs, not
on any experience with xdelta):

  Name: blah
  Version: 42
  Source0: blah.tar.gz
  Patch0: blah.xdelta
  ...
  # A macro definition we'll use further down; it's the directory
  # contained in the patched source tarball.
  %define PatchedSourceDir %{name}-%{version}
  ...

  %prep
  # Create the source directory and change to it.
  %setup -c
  
  # Now xdelta the source package (i'm assuming your command above is
  # the right way to do this).
  xdelta patch \
    "${RPM_SOURCE_DIR}/blah.tar.gz" \
    "${RPM_SOURCE_DIR}/blah.xdelta" \
    ./blah-patched.tar.gz
  
  gzip -dc blah-patched.tar.gz |tar -xf -
  cd "%{PatchedSourceDir}"
  
  # Apply any "regular" patches here.

  %build
  cd "%{PatchedSourceDir}"

  # Commands to build software here.

  %install
  cd "%{PatchedSourceDir}"

  # Commands to install software here.

Doing things in this fashion ensures that (a) you don't modify the
original source archive by mistake, and (b) the patched source archive
gets removed when you build with, for example, 'rpm -ba --clean'.

-- 
jim knoble | jmknoble@pobox.com   | http://www.pobox.com/~jmknoble/
(GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491)

Attachment: pgp00007.pgp
Description: PGP signature


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