Blob Blame History Raw
Name:           deco-archive
Version:        1.4
Release:        3%{?dist}
Summary:        Extraction scripts for various archive formats for use of deco
Group:          Applications/Archiving
License:        GPLv3
URL:            http://hartlich.com/deco/
Source0:        http://hartlich.com/deco/archive/download/%{name}-%{version}.tar.gz
# Use ffmpeg instead of wine+Monkey's Audio for converting ape to wav.
# Patch sent to upstream via email
Patch0:         deco-archive-ape.diff
# Use ffmpeg instead of non-free shorten decoder, which is not available
# in Fedora
Patch1:         deco-archive-shn.diff
# Use unzoo instead of zoo to extract zoo archives. The latter is not available
# in Fedora
Patch2:         deco-archive-zoo.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

Requires:       bzip2,coreutils,cpio,gzip,rpm,tar
Requires:       deco >= 1.5.6

%description
deco-archive provides support for popular archive 
formats to the deco file extraction framework.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1

%build
echo "Nothing to build."

%install
rm -rf %{buildroot} %{name}-ghosts.list %{name}-links.list

make install DESTDIR=%{buildroot} SHARE=%{_datadir}/%{name}

# %%{_var}/lib/deco is owned by deco.
# This is where deco will look for extraction scripts.
install -dm 755 %{buildroot}/%{_var}/lib/deco

# Install the default archivers and add the others to the ghost files list
for i in *; do
   if [[ -d $i || -h $i ]] ; then
      ln -s ../../..%{_datadir}/%{name}/"$i" %{buildroot}/%{_var}/lib/deco
      case $i in
         bz2|cpio|gem|gz|rpm|z|tar|"tar\.bz2"|"tar\.gz"|"tar\.z"|taz|tbz|tbz2|tgz)
            echo "%{_var}/lib/deco/$i" >> %{name}-links.list ;;
         *)
            echo "%ghost %{_var}/lib/deco/$i" >> %{name}-ghosts.list ;;
      esac
   fi
done
sed -e 's@[[\\]@?@g' %{name}-ghosts.list %{name}-links.list > %{name}.files

%clean
rm -rf %{buildroot}


%define do_triggerin() for i in %1; do (if [ ! -e %{_var}/lib/deco/$i ]; then ln -s ../../..%{_datadir}/%{name}/"$i" %{_var}/lib/deco/ || : ; fi); done;
%define do_triggerun() ( [ $2 -gt 0 ] && [ $1 -gt 0 ] ) || (for i in %1; do ( rm -f %{_var}/lib/deco/$i || : ); done;)

# Not handled (yet?):
# dpkg-deb (deb,udeb)

%triggerin -- binutils
%do_triggerin {a,ar}
%triggerun -- binutils
%do_triggerun {a,ar}

%triggerin -- p7zip
%do_triggerin {7z,"7z\.[0-9]{2,}",t7z,"t7z\.[0-9]{2,}","tar\.7z","tar\.7z\.[0-9]{2,}"}
%triggerun -- p7zip
%do_triggerun {7z,"7z\.[0-9]{2,}",t7z,"t7z\.[0-9]{2,}","tar\.7z","tar\.7z\.[0-9]{2,}"}

%triggerin -- unace
%do_triggerin "ace|[c0-9][0-9]{2}"
%triggerun -- unace
%do_triggerun "ace|[c0-9][0-9]{2}"

%triggerin -- ffmpeg
%do_triggerin {ape,shn}
%triggerun -- ffmpeg
%do_triggerun {ape,shn}

%triggerin -- arc
%do_triggerin {arc,ark,sue}
%triggerun -- arc
%do_triggerun {arc,ark,sue}

%triggerin -- arj
%do_triggerin arj
%triggerun -- arj
%do_triggerun arj

%triggerin -- cabextract
%do_triggerin cab
%triggerun -- cabextract
%do_triggerun cab

%triggerin -- unrar
%do_triggerin {cbr,"rar|[rst][0-9]{2}","part[0-9]+\.rar"}
%triggerun -- unrar
%do_triggerun {cbr,"rar|[rst][0-9]{2}","part[0-9]+\.rar"}

%triggerin -- unzip
%do_triggerin {cbz,ear,jar,od{c,f,g,i,m,p,s,t},ot{c,f,g,h,i,p,s,t},oxt,pk{3,4},wsz,xpi,zip}
%triggerun -- unzip
%do_triggerun {cbz,ear,jar,od{c,f,g,i,m,p,s,t},ot{c,f,g,h,i,p,s,t},oxt,pk{3,4},wsz,xpi,zip}

%triggerin -- flac
%do_triggerin flac
%triggerun -- flac
%do_triggerun flac

%triggerin -- lha
%do_triggerin {lha,lzh}
%triggerun -- lha
%do_triggerun {lha,lzh}

%triggerin -- lrzip
%do_triggerin {lrz,"tar\.lrz"}
%triggerun -- lrzip
%do_triggerun {lrz,"tar\.lrz"}

%triggerin -- lzip
%do_triggerin {lz,"tar\.lz"}
%triggerun -- lzip
%do_triggerun {lz,"tar\.lz"}

%triggerin -- lzma
%do_triggerin {lzma,"tar\.lzma",tlz}
%triggerun -- lzma
%do_triggerun {lzma,"tar\.lzma",tlz}

%triggerin -- lzop
%do_triggerin lzo
%triggerun -- lzop
%do_triggerun lzo

%triggerin -- rzip
%do_triggerin {rz,"tar\.rz"}
%triggerun -- rzip
%do_triggerun {rz,"tar\.rz"}

%triggerin -- unalz
%do_triggerin alz
%triggerun -- unalz
%do_triggerun alz

%triggerin -- unzoo
%do_triggerin zoo
%triggerun -- unzoo
%do_triggerun zoo

%files -f %{name}.files
%defattr(-,root,root,-)
%doc LICENSE CREDITS NEWS README
%{_datadir}/%{name}

%changelog
* Sat Apr 04 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 1.4-3
- Handle .zoo format with unzoo (if installed)

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Jan 19 2009 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 1.4-1
- Version update. New extensions: gem and tbz2
- Handle .shn format (shorten) with ffmpeg (if installed)
- Handle .alz format with unalz (if installed)

* Fri Dec 12 2008 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 1.3.1-1
- Version update
- Use ffmpeg instead of wine+Monkey's Audio for converting ape to wav

* Mon Dec 01 2008 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 1.2-6
- Code cleanup

* Sun Nov 30 2008 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 1.2-5
- Workaround for the "broken ghosts".

* Sun Nov 30 2008 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 1.2-4
- Fixed a typo in the %%do_trigger* of tar\.lzma
- Added rpm to the default list
- Attempted to mark the non-default archivers as ghosts

* Thu Nov 20 2008 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 1.2-3
- License is GPLv3.
- Install the scripts in %%{_datadir}/%%{name} and the symlinks in %%{var}/lib/deco.

* Wed Nov 19 2008 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 1.2-2
- Added conditionals to the trigger functions to suppress warnings on updates.

* Wed Oct 29 2008 Orcan Ogetbil <oget [DOT] fedora [AT] gmail [DOT] com> 1.2-1
- Initial build.