On Mon, Apr 25, 2011 at 01:14:18PM -0500, George McCollister wrote:
> opkg and opkg-utils can now be used to build .ipk files and generate
> images from them.

Please split into multiple commits. E.g. to add a host tool, some
generalization, and finlly the actual ipkg/opkg selection.

> Signed-off-by: George McCollister <george.mccollis...@gmail.com>
> ---
>  generic/etc/opkg/opkg.conf                      |   12 ++++++
>  patches/opkg-utils-r4747/env_python.patch       |   45 ++++++++++++++++++++++
>  patches/opkg-utils-r4747/series                 |    1 +
>  rules/host-ipkg-utils.in                        |    2 -
>  rules/host-ipkg.in                              |    3 +-
>  rules/host-opkg-utils.in                        |    7 +++
>  rules/host-opkg-utils.make                      |   44 +++++++++++++++++++++
>  rules/host-opkg.in                              |   11 +++++
>  rules/host-opkg.make                            |   47 
> +++++++++++++++++++++++
>  rules/host-package-management.in                |   18 +++++++++
>  rules/post/image_ipkg.make                      |   13 +++++-
>  rules/post/ptxd_make_xpkg_common.make           |   10 +++++
>  rules/post/virtual.make                         |    5 ++
>  scripts/ipkg-push                               |    5 ++-
>  scripts/lib/ptxd_make_image_prepare_work_dir.sh |   21 +++++++---
>  scripts/lib/ptxd_make_ipkg_common.sh            |    7 ++-
>  scripts/lib/ptxd_make_ipkg_finish.sh            |    3 +-
>  scripts/lib/ptxd_make_opkg_common.sh            |   21 ++++++++++
>  scripts/lib/ptxd_make_opkg_finish.sh            |   45 ++++++++++++++++++++++
>  scripts/lib/ptxd_make_xpkg_fixup.sh             |    3 +-
>  scripts/lib/ptxd_make_xpkg_prepare.sh           |    7 ++-
>  21 files changed, 308 insertions(+), 22 deletions(-)
>  create mode 100644 generic/etc/opkg/opkg.conf
>  create mode 100644 patches/opkg-utils-r4747/env_python.patch
>  create mode 100644 patches/opkg-utils-r4747/series
>  create mode 100644 rules/host-opkg-utils.in
>  create mode 100644 rules/host-opkg-utils.make
>  create mode 100644 rules/host-opkg.in
>  create mode 100644 rules/host-opkg.make
>  create mode 100644 rules/host-package-management.in
>  create mode 100644 scripts/lib/ptxd_make_opkg_common.sh
>  create mode 100644 scripts/lib/ptxd_make_opkg_finish.sh
> 
> diff --git a/generic/etc/opkg/opkg.conf b/generic/etc/opkg/opkg.conf
> new file mode 100644
> index 0000000..e9c75c1
> --- /dev/null
> +++ b/generic/etc/opkg/opkg.conf
> @@ -0,0 +1,12 @@
> +#
> +# /etc/opkg/opkg.conf
> +#
> +
> +# src: <url-of-opkg-repository>
> +@SRC@
> +
> +dest root    /
> +
> +arch @ARCH@  10
> +arch all     1
> +arch noarch  1
> diff --git a/patches/opkg-utils-r4747/env_python.patch 
> b/patches/opkg-utils-r4747/env_python.patch
> new file mode 100644
> index 0000000..717e13d

This patch need a header.

> --- /dev/null
> +++ b/patches/opkg-utils-r4747/env_python.patch
> @@ -0,0 +1,45 @@
> +diff -Naur opkg-utils-r4747/opkg-list-fields 
> opkg-utils-r4747.new/opkg-list-fields
> +--- opkg-utils-r4747/opkg-list-fields        2011-04-05 15:24:18.000000000 
> -0500
> ++++ opkg-utils-r4747.new/opkg-list-fields    2011-04-12 09:50:28.000000000 
> -0500
> +@@ -1,4 +1,4 @@
> +-#!/usr/bin/python
> ++#!/usr/bin/env python
> + 
> + import sys, opkg
> + 
> +diff -Naur opkg-utils-r4747/opkg-make-index 
> opkg-utils-r4747.new/opkg-make-index
> +--- opkg-utils-r4747/opkg-make-index 2011-04-05 15:24:18.000000000 -0500
> ++++ opkg-utils-r4747.new/opkg-make-index     2011-04-12 09:50:43.000000000 
> -0500
> +@@ -1,4 +1,4 @@
> +-#!/usr/bin/python
> ++#!/usr/bin/env python
> + 
> + import sys, os, posixpath
> + from glob import glob
> +diff -Naur opkg-utils-r4747/opkg-show-deps 
> opkg-utils-r4747.new/opkg-show-deps
> +--- opkg-utils-r4747/opkg-show-deps  2011-04-05 15:24:18.000000000 -0500
> ++++ opkg-utils-r4747.new/opkg-show-deps      2011-04-12 09:49:15.000000000 
> -0500
> +@@ -1,4 +1,4 @@
> +-#!/usr/bin/python
> ++#!/usr/bin/env python
> + 
> + import sys, os, posixpath
> + from glob import glob
> +diff -Naur opkg-utils-r4747/opkg-unbuild opkg-utils-r4747.new/opkg-unbuild
> +--- opkg-utils-r4747/opkg-unbuild    2011-04-05 15:24:18.000000000 -0500
> ++++ opkg-utils-r4747.new/opkg-unbuild        2011-04-12 09:49:35.000000000 
> -0500
> +@@ -1,4 +1,4 @@
> +-#!/usr/bin/python
> ++#!/usr/bin/env python
> + 
> + import sys, os, re
> + 
> +diff -Naur opkg-utils-r4747/opkg-update-index 
> opkg-utils-r4747.new/opkg-update-index
> +--- opkg-utils-r4747/opkg-update-index       2011-04-05 15:24:18.000000000 
> -0500
> ++++ opkg-utils-r4747.new/opkg-update-index   2011-04-12 09:50:01.000000000 
> -0500
> +@@ -1,4 +1,4 @@
> +-#!/usr/bin/env python2.1
> ++#!/usr/bin/env python
> + 
> + import sys, os
> + from glob import glob
> diff --git a/patches/opkg-utils-r4747/series b/patches/opkg-utils-r4747/series
> new file mode 100644
> index 0000000..237a9b9
> --- /dev/null
> +++ b/patches/opkg-utils-r4747/series
> @@ -0,0 +1 @@
> +env_python.patch
> diff --git a/rules/host-ipkg-utils.in b/rules/host-ipkg-utils.in
> index ff5018a..da10ff0 100644
> --- a/rules/host-ipkg-utils.in
> +++ b/rules/host-ipkg-utils.in
> @@ -2,8 +2,6 @@
>  
>  config HOST_IPKG_UTILS
>       tristate
> -     # no prompt, policy is that we always need it
> -     default y
>       help
>         ipkg-utils let you build packages in the ipkg format.
>  
> diff --git a/rules/host-ipkg.in b/rules/host-ipkg.in
> index 00c8b2a..fa8b1d6 100644
> --- a/rules/host-ipkg.in
> +++ b/rules/host-ipkg.in
> @@ -2,8 +2,7 @@
>  
>  config HOST_IPKG
>       tristate
> -     default y
> -     # no prompt, policy is that we always need it
> +     select HOST_IPKG_UTILS
>       help
>         ipkg is used on the development host to install packets into
>         some directory. Example:
> diff --git a/rules/host-opkg-utils.in b/rules/host-opkg-utils.in
> new file mode 100644
> index 0000000..5f1b143
> --- /dev/null
> +++ b/rules/host-opkg-utils.in
> @@ -0,0 +1,7 @@
> +## SECTION=hosttools_noprompt
> +
> +config HOST_OPKG_UTILS
> +     tristate
> +     help
> +       opkg-utils let you build packages in the opkg format.
> +
> diff --git a/rules/host-opkg-utils.make b/rules/host-opkg-utils.make
> new file mode 100644
> index 0000000..e831714
> --- /dev/null
> +++ b/rules/host-opkg-utils.make
> @@ -0,0 +1,44 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2005 by Robert Schwebel
> +#               2010 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>

This is a new file. Just your (C) is fine.

> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +HOST_PACKAGES-$(PTXCONF_HOST_OPKG_UTILS) += host-opkg-utils
> +
> +#
> +# Paths and names
> +#
> +HOST_OPKG_UTILS_VERSION      := r4747
> +HOST_OPKG_UTILS              := opkg-utils-$(HOST_OPKG_UTILS_VERSION)
> +HOST_OPKG_UTILS_SUFFIX       := tar.gz
> +HOST_OPKG_UTILS_URL  := 
> http://fixme/packages/opkg-utils/$(HOST_OPKG_UTILS).$(HOST_OPKG_UTILS_SUFFIX)
> +HOST_OPKG_UTILS_SOURCE       := 
> $(SRCDIR)/$(HOST_OPKG_UTILS).$(HOST_OPKG_UTILS_SUFFIX)
> +HOST_OPKG_UTILS_DIR  := $(HOST_BUILDDIR)/$(HOST_OPKG_UTILS)
> +
> +# 
> ----------------------------------------------------------------------------
> +# Get
> +# 
> ----------------------------------------------------------------------------
> +
> +$(HOST_OPKG_UTILS_SOURCE):
> +     @$(call targetinfo)
> +     @$(call get, HOST_OPKG_UTILS)

remove this stage.

> +
> +# 
> ----------------------------------------------------------------------------
> +# Prepare
> +# 
> ----------------------------------------------------------------------------
> +
> +HOST_OPKG_UTILS_CONF_TOOL := NO
> +HOST_OPKG_UTILS_MAKE_OPT := PREFIX= $(HOST_ENV_CC)
> +HOST_OPKG_UTILS_INSTALL_OPT := $(HOST_OPKG_UTILS_MAKE_OPT) install

please align the ':='

> +
> +# vim: syntax=make
> diff --git a/rules/host-opkg.in b/rules/host-opkg.in
> new file mode 100644
> index 0000000..7309eb0
> --- /dev/null
> +++ b/rules/host-opkg.in
> @@ -0,0 +1,11 @@
> +## SECTION=hosttools_noprompt
> +
> +config HOST_OPKG
> +     tristate
> +     select HOST_OPKG_UTILS
> +     help
> +       opkg is used on the development host to install packets into
> +       some directory. Example:
> +
> +             opkg-cl -o . --force-depends -f ../generic/etc/opkg.conf 
> install foo.ipk
> +
> diff --git a/rules/host-opkg.make b/rules/host-opkg.make
> new file mode 100644
> index 0000000..4996028
> --- /dev/null
> +++ b/rules/host-opkg.make
> @@ -0,0 +1,47 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2005 by Robert Schwebel
> +#               2008, 2009 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>

dito.

> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +HOST_PACKAGES-$(PTXCONF_HOST_OPKG) += host-opkg
> +
> +#
> +# Paths and names
> +#
> +
> +HOST_OPKG    = $(OPKG)
> +HOST_OPKG_DIR        = $(HOST_BUILDDIR)/$(HOST_OPKG)
> +
> +# 
> ----------------------------------------------------------------------------
> +# Prepare
> +# 
> ----------------------------------------------------------------------------
> +
> +HOST_OPKG_ENV        := $(HOST_ENV)
> +
> +#
> +# autoconf
> +#
> +HOST_OPKG_CONF_TOOL  := autoconf
> +HOST_OPKG_CONF_OPT   := \
> +     $(HOST_AUTOCONF) \
> +     --enable-shave \
> +     --with-opkglockfile=/lock
> +
> +HOST_OPKG_CONF_OPT += --disable-pathfinder
> +HOST_OPKG_CONF_OPT += --disable-curl
> +HOST_OPKG_CONF_OPT += --disable-sha256
> +HOST_OPKG_CONF_OPT += --disable-openssl
> +HOST_OPKG_CONF_OPT += --disable-ssl-curl
> +HOST_OPKG_CONF_OPT += --disable-gpg
> +
> +# vim: syntax=make
> diff --git a/rules/host-package-management.in 
> b/rules/host-package-management.in
> new file mode 100644
> index 0000000..6e60274
> --- /dev/null
> +++ b/rules/host-package-management.in
> @@ -0,0 +1,18 @@
> +## SECTION=hosttools
> +
> +choice
> +     prompt "package management  "
> +     default HOST_PACKAGE_MANAGEMENT_IPKG
> +
> +     config HOST_PACKAGE_MANAGEMENT_IPKG
> +             bool
> +             select HOST_IPKG
> +             prompt "ipkg   "
> +
> +     config HOST_PACKAGE_MANAGEMENT_OPKG
> +             bool
> +             select HOST_OPKG
> +             prompt "opkg   "
> +endchoice
> +
> +#source "generated/libc.in"
> diff --git a/rules/post/image_ipkg.make b/rules/post/image_ipkg.make
> index 0385383..6eb9b1b 100644
> --- a/rules/post/image_ipkg.make
> +++ b/rules/post/image_ipkg.make
> @@ -11,6 +11,12 @@
>  
>  SEL_ROOTFS-$(PTXCONF_IMAGE_IPKG_PUSH_TO_REPOSITORY) += $(STATEDIR)/ipkg-push
>  
> +ifdef PTXCONF_HOST_PACKAGE_MANAGEMENT_OPKG
> +package_type := opkg
> +else
> +package_type := ipkg
> +endif
> +

I think I prefer (in rules/host-package-management.in):

config HOST_PACKAGE_MANAGEMENT
        string
        default "ipkg" if HOST_PACKAGE_MANAGEMENT_IPKG
        default "opkg" if HOST_PACKAGE_MANAGEMENT_OPKG

>  ipkg-push : $(STATEDIR)/ipkg-push
>  
>  $(STATEDIR)/ipkg-push: $(STATEDIR)/host-ipkg-utils.install.post 
> $(STATEDIR)/world.targetinstall
> @@ -18,13 +24,14 @@ $(STATEDIR)/ipkg-push: 
> $(STATEDIR)/host-ipkg-utils.install.post $(STATEDIR)/worl
>  ifdef PTXCONF_IMAGE_IPKG_FORCED_PUSH
>       rm  -rf 
> $(PTXCONF_SETUP_IPKG_REPOSITORY)/$(PTXCONF_PROJECT)/dists/$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION)
>  endif
> -     @echo "pushing ipkg pakets to ipkg-repository..."
> +     @echo "pushing ipkg packets to ipkg-repository..."
>       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/ipkg-push \
>               --ipkgdir  $(call remove_quotes,$(PKGDIR)) \
>               --repodir  $(call 
> remove_quotes,$(PTXCONF_SETUP_IPKG_REPOSITORY)) \
>               --revision $(call remove_quotes,$(PTXDIST_VERSION_FULL)) \
>               --project  $(call remove_quotes,$(PTXCONF_PROJECT)) \
> -             --dist     $(call 
> remove_quotes,$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION))
> +             --dist     $(call 
> remove_quotes,$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION)) \
> +             --type     $(package_type)
>       @echo "ipkg-repository updated"
>       @touch $@
>  
> @@ -38,7 +45,7 @@ $(PKGDIR)/Packages: $(STATEDIR)/host-ipkg-utils.install.post
>       @echo "Creating ipkg index '$@'..."
>       @rm -f $(PKGDIR)/Packages*
>       @$(HOST_ENV) \
> -             ipkg-make-index -l "$(PKGDIR)/Packages.filelist" -p "$(@)" 
> "$(PKGDIR)" 
> +             $(package_type)-make-index -l "$(PKGDIR)/Packages.filelist" -p 
> "$(@)" "$(PKGDIR)" 
>       @echo "done."
>  
>  # vim: syntax=make
> diff --git a/rules/post/ptxd_make_xpkg_common.make 
> b/rules/post/ptxd_make_xpkg_common.make
> index c7bff35..9ef7dd1 100644
> --- a/rules/post/ptxd_make_xpkg_common.make
> +++ b/rules/post/ptxd_make_xpkg_common.make
> @@ -1,6 +1,7 @@
>  # -*-makefile-*-
>  #
>  # Copyright (C) 2009, 2010 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>
>  #
>  # See CREDITS for details about who has contributed to this project.
>  #
> @@ -12,12 +13,21 @@
>  # $1: xpkg label
>  # $2: PKG, uppercase pkg name
>  #
> +ifdef PTXCONF_HOST_PACKAGE_MANAGEMENT_OPKG
> +xpkg/env/impl = \
> +     $(call world/env, $(2))                                                 
> \
> +     CROSS_STRIP="$(call ptx/escape,$(CROSS_STRIP))"                         
> \
> +     pkg_xpkg="$(call ptx/escape,$(1))"                                      
> \
> +     pkg_opkg_extra_args=$(PTXCONF_IMAGE_OPKG_EXTRA_ARGS)                    
> \
> +     pkg_xpkg_type="opkg"
> +else
>  xpkg/env/impl = \
>       $(call world/env, $(2))                                                 
> \
>       CROSS_STRIP="$(call ptx/escape,$(CROSS_STRIP))"                         
> \
>       pkg_xpkg="$(call ptx/escape,$(1))"                                      
> \
>       pkg_ipkg_extra_args=$(PTXCONF_IMAGE_IPKG_EXTRA_ARGS)                    
> \
>       pkg_xpkg_type="ipkg"
> +endif

if you add both "pkg_opkg_extra_args=" and "pkg_ipkg_extra_args=" add use
"pkg_xpkg_type=$(PTXCONF_HOST_PACKAGE_MANAGEMENT)" (as I defined above),
then the "ifdef" is unnecessary.

>  
>  #
>  # $1: xpkg label
> diff --git a/rules/post/virtual.make b/rules/post/virtual.make
> index a484e52..4ba83fc 100644
> --- a/rules/post/virtual.make
> +++ b/rules/post/virtual.make
> @@ -1,6 +1,7 @@
>  # -*-makefile-*-
>  #
>  # Copyright (C) 2003-2010 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>
>  # See CREDITS for details about who has contributed to this project.
>  #
>  # For further information about the PTXdist project and license conditions
> @@ -19,6 +20,10 @@ ifdef PTXCONF_HOST_IPKG_UTILS
>  $(STATEDIR)/virtual-cross-tools.install: 
> $(STATEDIR)/host-ipkg-utils.install.post
>  endif
>  
> +ifdef PTXCONF_HOST_OPKG_UTILS
> +$(STATEDIR)/virtual-cross-tools.install: 
> $(STATEDIR)/host-opkg-utils.install.post
> +endif
> +
>  ifdef PTXCONF_CROSS_PKG_CONFIG_WRAPPER
>  $(STATEDIR)/virtual-cross-tools.install: 
> $(STATEDIR)/cross-pkg-config-wrapper.install.post
>  endif
> diff --git a/scripts/ipkg-push b/scripts/ipkg-push
> index fec0916..a2eb9ab 100755
> --- a/scripts/ipkg-push
> +++ b/scripts/ipkg-push

I think a follow-up patch to rename this to xpkg-push is appropriate.

> @@ -31,6 +31,7 @@ usage() {
>       echo "  --revision <revision>      dist revision name to be updated"
>       echo "  --project  <projectname>   project name"
>       echo "  --dist     <distname>      use this to make a dist release 
> (optional)"
> +     echo "  --type     <package type>  specify package type (default: ipkg)"
>       echo
>       exit 0
>  }
> @@ -40,6 +41,7 @@ REPODIR=
>  DISTREVISION=
>  PROJECT=
>  DIST=
> +TYPE=ipkg
>  
>  
>  #
> @@ -53,6 +55,7 @@ while [ $# -gt 0 ]; do
>               --revision) DISTREVISION=`ptxd_abspath $2`; shift 2 ;;
>               --project)  PROJECT=$2;                     shift 2 ;;
>               --dist)     DIST=$2;                        shift 2 ;;
> +             --type)     TYPE=$2;                        shift 2 ;;
>               *)  usage "unknown option $1" ;;
>       esac
>  done
> @@ -190,7 +193,7 @@ done
>  
>  echo "creating index.....: "
>  
> -(cd $REPODIR/$PROJECT/dists/$DIST && ipkg-make-index . > Packages)
> +(cd $REPODIR/$PROJECT/dists/$DIST && ${TYPE}-make-index . > Packages)
>  
>  exit
>  
> diff --git a/scripts/lib/ptxd_make_image_prepare_work_dir.sh 
> b/scripts/lib/ptxd_make_image_prepare_work_dir.sh
> index 055494e..3da2f2b 100644
> --- a/scripts/lib/ptxd_make_image_prepare_work_dir.sh
> +++ b/scripts/lib/ptxd_make_image_prepare_work_dir.sh
> @@ -1,6 +1,7 @@
>  #!/bin/bash
>  #
>  # Copyright (C) 2010 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>
>  #
>  # See CREDITS for details about who has contributed to this project.
>  #
> @@ -23,11 +24,19 @@
>  # out:
>  # - $image_permissions               file containing all permissions
>  #
> -ptxd_make_image_extract_ipkg_files() {
> +ptxd_make_image_extract_xpkg_files() {
>      # FIXME: consolidate "ptxd_install_setup_src"
>      local src="/etc/ipkg.conf"
> -    local ipkg_conf="${PTXDIST_TEMPDIR}/${FUNCNAME}_ipkg.conf"
> +    local xpkg_conf="${PTXDIST_TEMPDIR}/${FUNCNAME}_xpkg.conf"
> +    local xpkg_type

I think xpkg_type should be defined from HOST_PACKAGE_MANAGEMENT in
image/env

>      local -a list ptxd_reply
> +    if ptxd_get_ptxconf "PTXCONF_HOST_PACKAGE_MANAGEMENT_OPKG" > /dev/null; 
> then
> +        src="/etc/opkg/opkg.conf"
> +     xpkg_type="opkg"
> +    else
> +        src="/etc/ipkg.conf"

Indent.

> +     xpkg_type="ipkg"
> +    fi
>      list=( \
>       "${PTXDIST_WORKSPACE}/projectroot${PTXDIST_PLATFORMSUFFIX}${src}" \
>       "${PTXDIST_WORKSPACE}/projectroot${src}${PTXDIST_PLATFORMSUFFIX}" \
> @@ -51,10 +60,10 @@ ${list[*]}
>  
>      ARCH="${PTXDIST_IPKG_ARCH_STRING}" \
>      SRC="${PTXCONF_IPKG_IPKG_CONF_URL}" \
> -     ptxd_replace_magic "${ptxd_reply}" > "${ipkg_conf}" &&
> +     ptxd_replace_magic "${ptxd_reply}" > "${xpkg_conf}" &&
>  
>      DESTDIR="${image_work_dir}" \
> -     fakeroot -- ipkg-cl -f "${ipkg_conf}" -o "${image_work_dir}" \
> +     fakeroot -- ${xpkg_type}-cl -f "${xpkg_conf}" -o "${image_work_dir}" \
>       install "${ptxd_reply_ipkg_files[@]}" &&
>      if ! cat "${ptxd_reply_perm_files[@]}" > "${image_permissions}"; then
>       echo "${PTXDIST_LOG_PROMPT}error: failed read permission files" >&2
> @@ -63,12 +72,12 @@ ${list[*]}
>  
>      return
>  }
> -export -f ptxd_make_image_extract_ipkg_files
> +export -f ptxd_make_image_extract_xpkg_files
>  
>  
>  ptxd_make_image_prepare_work_dir() {
>      ptxd_make_image_init &&
>      ptxd_get_ipkg_files &&
> -    ptxd_make_image_extract_ipkg_files
> +    ptxd_make_image_extract_xpkg_files
>  }
>  export -f ptxd_make_image_prepare_work_dir
> diff --git a/scripts/lib/ptxd_make_ipkg_common.sh 
> b/scripts/lib/ptxd_make_ipkg_common.sh
> index eb7151c..5d2f83a 100644
> --- a/scripts/lib/ptxd_make_ipkg_common.sh
> +++ b/scripts/lib/ptxd_make_ipkg_common.sh
> @@ -1,6 +1,7 @@
>  #!/bin/bash
>  #
>  # Copyright (C) 2009 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>
>  #
>  # See CREDITS for details about who has contributed to this project.
>  #
> @@ -14,7 +15,7 @@
>  #
>  ptxd_make_ipkg_init() {
>      pkg_ipkg_tmp="${pkg_xpkg_tmp}/ipkg"
> -    pkg_ipkg_control_dir="${pkg_ipkg_tmp}/CONTROL"
> -    pkg_ipkg_control="${pkg_ipkg_control_dir}/control"
> +    pkg_xpkg_control_dir="${pkg_ipkg_tmp}/CONTROL"
> +    pkg_xpkg_control="${pkg_xpkg_control_dir}/control"
>  }
> -export -f ptxd_make_ipkg_init
> \ No newline at end of file
> +export -f ptxd_make_ipkg_init
> diff --git a/scripts/lib/ptxd_make_ipkg_finish.sh 
> b/scripts/lib/ptxd_make_ipkg_finish.sh
> index 8f91916..fe91954 100644
> --- a/scripts/lib/ptxd_make_ipkg_finish.sh
> +++ b/scripts/lib/ptxd_make_ipkg_finish.sh
> @@ -2,6 +2,7 @@
>  #
>  # Copyright (C) 2005, 2006, 2007 Robert Schwebel <r.schwe...@pengutronix.de>
>  #               2008, 2009, 2010 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>
>  #
>  # See CREDITS for details about who has contributed to this project.
>  #
> @@ -30,7 +31,7 @@ ptxd_make_ipkg_finish() {
>      dep="${pkg_xpkg_deps[*]}"
>      dep="${dep// /, }"
>  
> -    sed -i -e "s:@DEPENDS@:${dep}:g" "${pkg_ipkg_control}" || return
> +    sed -i -e "s:@DEPENDS@:${dep}:g" "${pkg_xpkg_control}" || return
>  
>      local -a fake_args
>      if [ -f "${pkg_fake_env}" ]; then
> diff --git a/scripts/lib/ptxd_make_opkg_common.sh 
> b/scripts/lib/ptxd_make_opkg_common.sh
> new file mode 100644
> index 0000000..ac6d672
> --- /dev/null
> +++ b/scripts/lib/ptxd_make_opkg_common.sh
> @@ -0,0 +1,21 @@
> +#!/bin/bash
> +#
> +# Copyright (C) 2009 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +
> +#
> +# initialize variables needed to package opkgs
> +#
> +ptxd_make_opkg_init() {
> +    pkg_opkg_tmp="${pkg_xpkg_tmp}/opkg"
> +    pkg_xpkg_control_dir="${pkg_opkg_tmp}/CONTROL"
> +    pkg_xpkg_control="${pkg_xpkg_control_dir}/control"
> +}
> +export -f ptxd_make_opkg_init
> diff --git a/scripts/lib/ptxd_make_opkg_finish.sh 
> b/scripts/lib/ptxd_make_opkg_finish.sh
> new file mode 100644
> index 0000000..97e1034
> --- /dev/null
> +++ b/scripts/lib/ptxd_make_opkg_finish.sh
> @@ -0,0 +1,45 @@
> +#!/bin/bash
> +#
> +# Copyright (C) 2005, 2006, 2007 Robert Schwebel <r.schwe...@pengutronix.de>
> +#               2008, 2009, 2010 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# the actual opkg package creation, will run in fakeroot
> +#
> +ptxd_make_opkg_finish_impl() {
> +    chown -R 0:0 "${pkg_xpkg_tmp}" &&
> +    ptxd_make_xpkg_pkg "${pkg_opkg_tmp}" "${pkg_xpkg_cmds}" 
> "${pkg_xpkg_perms}" &&
> +    opkg-build ${pkg_opkg_extra_args} "${pkg_opkg_tmp}" "${ptx_pkg_dir}"
> +}
> +export -f ptxd_make_opkg_finish_impl
> +
> +
> +#
> +# create an opkg package
> +#
> +ptxd_make_opkg_finish() {
> +    local dep
> +
> +    # replace space with ", "
> +    dep="${pkg_xpkg_deps[*]}"
> +    dep="${dep// /, }"
> +
> +    sed -i -e "s:@DEPENDS@:${dep}:g" "${pkg_xpkg_control}" || return
> +
> +    local -a fake_args
> +    if [ -f "${pkg_fake_env}" ]; then
> +     fake_args=( "-i" "${pkg_fake_env}" )
> +    fi
> +    fake_args[${#fake_args[@]}]="-u"
> +
> +    export ${!pkg_*} ${!ptx_*}
> +    fakeroot "${fake_args[@]}" -- ptxd_make_opkg_finish_impl
> +}

This looks very much like ptxd_make_ipkg_finish.sh. Can't you change that
to ptxd_make_xpkg_finish.sh and use ${pkg_xpkg_type}?

Michael

> +export -f ptxd_make_opkg_finish
> diff --git a/scripts/lib/ptxd_make_xpkg_fixup.sh 
> b/scripts/lib/ptxd_make_xpkg_fixup.sh
> index 42cebda..a698e89 100644
> --- a/scripts/lib/ptxd_make_xpkg_fixup.sh
> +++ b/scripts/lib/ptxd_make_xpkg_fixup.sh
> @@ -2,6 +2,7 @@
>  #
>  # Copyright (C) 2005, 2006, 2007 Robert Schwebel <r.schwe...@pengutronix.de>
>  #               2008, 2009, 2010 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>
>  #
>  # See CREDITS for details about who has contributed to this project.
>  #
> @@ -25,7 +26,7 @@ ptxd_make_xpkg_fixup() {
>      esac
>  
>      echo -n "install_fixup:  @${pkg_xpkg_fixup_from}@ -> 
> ${pkg_xpkg_fixup_to} ... "
> -    sed -i -e "s,@$pkg_xpkg_fixup_from@,$pkg_xpkg_fixup_to,g" 
> "${pkg_ipkg_control}" || return
> +    sed -i -e "s,@$pkg_xpkg_fixup_from@,$pkg_xpkg_fixup_to,g" 
> "${pkg_xpkg_control}" || return
>      echo "done."
>  }
>  
> diff --git a/scripts/lib/ptxd_make_xpkg_prepare.sh 
> b/scripts/lib/ptxd_make_xpkg_prepare.sh
> index 5c72285..7a14c80 100644
> --- a/scripts/lib/ptxd_make_xpkg_prepare.sh
> +++ b/scripts/lib/ptxd_make_xpkg_prepare.sh
> @@ -2,6 +2,7 @@
>  #
>  # Copyright (C) 2005, 2006, 2007 Robert Schwebel <r.schwe...@pengutronix.de>
>  #               2008, 2009, 2010 by Marc Kleine-Budde <m...@pengutronix.de>
> +#               2011 by George McCollister <george.mccollis...@gmail.com>
>  #
>  # See CREDITS for details about who has contributed to this project.
>  #
> @@ -21,7 +22,7 @@ ptxd_make_xpkg_prepare() {
>       "${pkg_xpkg_cmds}" \
>       "${pkg_xpkg_perms}" \
>       "${pkg_xpkg_install_deps}" &&
> -    mkdir -p -- "${pkg_ipkg_control_dir}" &&
> +    mkdir -p -- "${pkg_xpkg_control_dir}" &&
>      touch "${pkg_xpkg_cmds}" || return
>  
>      #
> @@ -36,7 +37,7 @@ install_init:       @VERSION@ -> ${pkg_xpkg_version}"
>       PACKAGE="${pkg_xpkg}" \
>       VERSION="${pkg_xpkg_version}" \
>       ptxd_replace_magic "${PTXDIST_TOPDIR}/config/xpkg/ipkg.control" > \
> -     "${pkg_ipkg_control}" || return
> +     "${pkg_xpkg_control}" || return
>  
>      local script
>      for script in preinst postinst prerm postrm; do
> @@ -45,7 +46,7 @@ install_init:       @VERSION@ -> ${pkg_xpkg_version}"
>       if ptxd_in_path PTXDIST_PATH_RULES "${pkg_xpkg}.${script}"; then
>           install -m 0755 \
>               -D "${ptxd_reply}" \
> -             "${pkg_ipkg_control_dir}/${script}" || return
> +             "${pkg_xpkg_control_dir}/${script}" || return
>  
>           echo "packaging: '$(ptxd_print_path "${ptxd_reply}")'"
>  
> -- 
> 1.7.1
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to