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

⌈⌋ ⎇ branch:  cross package maker


Check-in [98c478918a]

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

Overview
Comment:- add work-in-progress to build packages with pkgsrc
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 98c478918a45e732ecec5938606867b239328e52
User & Date: jls@semicomplete.com 2011-06-08 07:42:21
Context
2011-06-08
07:43
Merge branch 'master' of github.com:jordansissel/fpm check-in: 17fdbf1d4a user: jls@semicomplete.com tags: trunk
07:42
- add work-in-progress to build packages with pkgsrc check-in: 98c478918a user: jls@semicomplete.com tags: trunk
2011-05-18
19:07
version bump check-in: 13c250f081 user: jls@semicomplete.com tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added misc/pkgsrc.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
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
#!/bin/sh

if [ ! -f "mk/bsd.pkg.mk" ]  ; then
  # TODO(sissel): Maybe download pkgsrc ourselves.
  echo "Current directory doesn't appear to be a pkgsrc tree. ($PWD)"
  echo "I was expecting to find file: ./mk/bsd.pkg.mk"
  exit 1
fi

if [ ! -f "build/usr/local/bin/bmake" ] ; then
  # TODO(sissel): Maybe bootstrap ourselves.
  echo "This script requires pkgsrc to be bootstrapped in a specific way."
  echo "I expected to find file: build/usr/local/bin/bmake and did not"
  echo 
  echo "Bootstrap with:"
  echo "SH=/bin/bash ./bootstrap/bootstrap --unprivileged --prefix $PWD/build/usr/local --pkgdbdir $PWD/pkgdb"
  exit 1
fi

# TODO(sissel): put some flags.

LOCALBASE="/usr/local"
DESTDIR=$PWD/build

mkdir -p "$DESTDIR"

export PATH=$DESTDIR/$LOCALBASE/bin:$DESTDIR/$LOCALBASE/sbin:$PATH

for i in "$@" ; do
  # process dependencies first before the final target.
  set -- $(bmake -C "$@" show-depends-pkgpaths) "$@"
done

TARGETS="$*"

for target in $TARGETS; do
  set --

  eval "$(bmake -C $target show-vars-eval VARS="PKGNAME PKGVERSION")"
  name="$(echo "$PKGNAME" | sed -e "s/-$PKGVERSION\$//")" 
  orig_version=${PKGVERSION}
  version=${PKGVERSION}-pkgsrc

  # Purge old package
  rm packages/All/$PKGNAME.tgz

  pkg_delete $name > /dev/null 2>&1

  bmake -C $target clean || exit 1
  bmake -C $target USE_DESTDIR=yes LOCALBASE=$LOCALBASE PREFIX=$LOCALBASE \
    DESTDIR=$DESTDIR SKIP_DEPENDS=yes \
    clean package || exit 1

  # Start building fpm args
  set -- -n "$name" -v "$version" --prefix $LOCALBASE 
  
  # Skip the pkgsrc package metadata files
  set -- "$@" --exclude '+*'

  # Handle deps
  for dep in $(bmake -C $target show-depends-pkgpaths) ; do
    eval "$(bmake -C $dep show-vars-eval VARS="PKGNAME PKGVERSION")"
    PKGNAME="$(echo "$PKGNAME" | sed -e "s/-$PKGVERSION\$//")"
    set -- "$@" -d "$PKGNAME (= $PKGVERSION-pkgsrc)"
  done

  set -- -s tar -t deb "$@" 
  set -- "$@" packages/All/$name-$orig_version.tgz 
  fpm "$@" 
done