summaryrefslogtreecommitdiffstats
path: root/release/taritup
blob: 95aed21ee24815bbf90f3b0c0b8bf7ce11f41296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash

  source `dirname $0`/common $1 $2

  if test $isl10n -eq 1; then
    cd $package
    echo "making per-language tarballs"
    cat subdirs | while read lang; do
      rsubdir=$package-$lang-$version
      mv $lang $rsubdir
      tar --owner=root --group=root -c --exclude autom4te.cache $rsubdir | bzip2 -9 > ../../sources/$package/$rsubdir.tar.bz2
      mv $rsubdir $lang
    done
    cd ..
  else

   echo "mv $package $package-$version"
   mv $package $package-$version || exit 1
   echo "tar cjf $package-$version.tar.bz2 $package-$version"
   tar --owner=root --group=root -cf $package-$version.tar $package-$version || exit 1
  fi

  # Xdelta
  if test "$package" = "kde-l10n" -o "$package" = "kde-i18n"; then
    cd ../sources
    # for kde-l10n we only generate xdelta for the small files
    # #### double-check this code
    files=`cd $package && ls -1 $package-*-$version.tar.bz2 2> /dev/null`
    for file in $files; do
	lang=${file/$package-/}
	lang=${lang/-$version.tar.bz2/}
	oldlang=`ls -1 ../sources-old/$package/$package-$lang-*tar.bz2 2>/dev/null | tail -n 1`
	if test -n "$oldlang" && test -r "$oldlang"; then
	    cp $oldlang $package
	    echo "bunzip2 $package/$package-$lang-$version.tar.bz2"
	    bunzip2 $package/$package-$lang-$version.tar.bz2
	    cd $package
	    ../$scriptpath/xdelta $package-$lang-*.bz2 $package-$lang-$version.tar
	    cd ..
	    rm -f $package/$package-$lang-*.bz2
	    echo "bzip2 $package/$package-$lang-$version.tar"
	    bzip2 $package/$package-$lang-$version.tar
	fi
    done
    cd ../dirty

  else
    # generate xdeltas
    if test "$package" = "koffice"; then
        # For KOffice, the modules are named "koffice" and "koffice-l10n"
        # so search for koffice*tar.bz2 returns 2 files.
        oldpackage=`ls -1 ../sources-old/$package*tar.bz2 2>/dev/null | fgrep -v l10n`
    else
        # Normal case, no problem with a pseudo-duplicate
        oldpackage=`ls -1 ../sources-old/$package*tar.bz2 2>/dev/null | tail -n 1`
    fi
    if test -n "$oldpackage" && test -r $oldpackage; then 
        cp $oldpackage .
        $scriptpath/xdelta $package*tar.bz2 $package*tar
        mv $package*.tar.xdelta ../sources
    fi
  fi

  if test $isl10n -eq 0; then
    echo "bzip2 -9 $package-$version.tar"
    rm -f $package-$version.tar.bz2
    bzip2 -9 $package-$version.tar
    mv $package-$version.tar.bz2 ../sources
    echo "rm -f $package*tar"
    rm -f $package*tar
    echo "rm -rf $package-$version"
    rm -rf $package-$version
  fi

  rm -rf dirty/$package || exit 1