Cross package maker. DEB/RPM generation or conversion. Derived from jordansissel/fpm.

⌈⌋ ⎇ branch:  cross package maker


Check-in [9a96d3c3c4]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:- add more tests
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9a96d3c3c4990e81160f58db62cb6a690d377068
User & Date: jls@semicomplete.com 2011-09-08 17:28:00
Context
2011-09-08
17:29
- fix test check-in: 2dc553dee0 user: jls@semicomplete.com tags: trunk
17:28
- add more tests check-in: 9a96d3c3c4 user: jls@semicomplete.com tags: trunk
16:38
Merge pull request #102 from chrisa/fix_multiple_paths Restore support for multiple specified paths in the Dir source. check-in: a55bd5618a user: jls@semicomplete.com tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added test/dir-deb.out.template.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
tmp/
tmp/TMPDIR/
tmp/TMPDIR/a/
tmp/TMPDIR/a/d/
tmp/TMPDIR/a/d/hello
tmp/TMPDIR/a/e/
tmp/TMPDIR/a/f/
tmp/TMPDIR/a/hello
tmp/TMPDIR/b/
tmp/TMPDIR/b/d/
tmp/TMPDIR/b/e/
tmp/TMPDIR/b/f/
tmp/TMPDIR/c/
tmp/TMPDIR/c/d/
tmp/TMPDIR/c/d/hello
tmp/TMPDIR/c/e/
tmp/TMPDIR/c/f/

Added test/dir-deb.test.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

run() {
  mkdir -p $tmpdir/{a,b,c}/{d,e,f}
  touch $tmpdir/a/hello
  touch $tmpdir/a/d/hello
  touch $tmpdir/c/d/hello

  prefix=/opt/foo/bar

  fpm -s dir -t deb -n testing -a all $tmpdir

  file=testing_1.0_all.deb
  dpkg -c $file | fex '{6:}' | sort > $output
  #ar p $file data.tar.gz | tar -ztf - | sort > $output
  sed -e "s,TMPDIR,$(basename $tmpdir)," $expected.template > $expected

  rm $file
}

clean() {
  rm $expected
}

Added test/dir-rpm.out.template.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
tmp/
tmp/TMPDIR/
tmp/TMPDIR/a/
tmp/TMPDIR/a/d/
tmp/TMPDIR/a/d/hello
tmp/TMPDIR/a/e/
tmp/TMPDIR/a/f/
tmp/TMPDIR/a/hello
tmp/TMPDIR/b/
tmp/TMPDIR/b/d/
tmp/TMPDIR/b/e/
tmp/TMPDIR/b/f/
tmp/TMPDIR/c/
tmp/TMPDIR/c/d/
tmp/TMPDIR/c/d/hello
tmp/TMPDIR/c/e/
tmp/TMPDIR/c/f/

Added test/dir-rpm.test.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

run() {
  mkdir -p $tmpdir/{a,b,c}/{d,e,f}
  touch $tmpdir/a/hello
  touch $tmpdir/a/d/hello
  touch $tmpdir/c/d/hello

  fpm -s dir -t rpm -n testing -a all $tmpdir

  file=testing-1.0.noarch.rpm
  rpm -qlp $file > $output
  sed -e "s,TMPDIR,$(basename $tmpdir)," $expected.template > $expected

  rm $file
}

clean() {
  rm $expected
}

Changes to test/gem-deb.test.



1
2
3
4
5
6
7






run() {
  fpm -s gem -t deb -v 3.1.0 rails

  file=rubygem-rails_3.1.0_all.deb
  dpkg -c $file | fex '{6:}' > $output
  rm $file
}




>
>

|

|



>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
RAILS_VERSION=3.1.0

run() {
  fpm -s gem -t deb -v $RAILS_VERSION rails

  file=rubygem-rails_${RAILS_VERSION}_all.deb
  dpkg -c $file | fex '{6:}' > $output
  rm $file
}

clean() {
  rm rails-${RAILS_VERSION}.gem
}

Changes to test/test.sh.

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
#!/bin/sh

fpm() {
  ../bin/fpm "$@" > $debugout 2> $debugerr






}

cleanup() {
  rm -f $tmpout $debugout $debugerr
  [ ! -z "$tmpdir" ] && rm -r $tmpdir





}

main() {
  set -e
  test="$1"
  tmpdir=$(mktemp -d)
  debugout=$(mktemp)
  debugerr=$(mktemp)
  output=$(mktemp)
  expected=${1%.test}.out

  echo "Loading $test"
  . "./$test"

  # Run the test.
  run

  # Compare output
  diff -u $output $expected
  diffstatus=$?


  cleanup




  if [ $diffstatus -ne 0 ] ; then

    echo "Fail: $test"
    echo "FPM STDOUT"
    cat $debugout
    echo "FPM STDERR"
    cat $debugerr
    return 1


  else

    echo "OK: $test"
    return 0
  fi
}

main "$@"




>
>
>
>
>
>





>
>
>
>
>



<

















>
|
>
>
>
|
|
>
|
<
|
<
|
|
>
>
|
>
|
|
|



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
#!/bin/sh

fpm() {
  ../bin/fpm "$@" > $debugout 2> $debugerr
  status=$?

  if [ "$status" -ne 0 ] ; then
    fail
  fi
  return $status
}

cleanup() {
  rm -f $tmpout $debugout $debugerr
  [ ! -z "$tmpdir" ] && rm -r $tmpdir

  # Run clean if defined.
  if type clean 2> /dev/null | grep -q "function" ; then
    clean
  fi
}

main() {

  test="$1"
  tmpdir=$(mktemp -d)
  debugout=$(mktemp)
  debugerr=$(mktemp)
  output=$(mktemp)
  expected=${1%.test}.out

  echo "Loading $test"
  . "./$test"

  # Run the test.
  run

  # Compare output
  diff -u $output $expected
  diffstatus=$?

  if [ $diffstatus -ne 0 ] ; then
    fail
  else
    ok
  fi
}

fail() { 
  echo "Fail: $test"

  sed -e 's/^/stdout: /' $debugout

  sed -e 's/^/stderr: /' $debugerr
  cleanup
  exit 1
}

ok() {
  echo "OK: $test"
  cleanup
  exit 0
}

main "$@"