Added option to build images from the ipkg repository.

Signed-off-by: George McCollister <[email protected]>
---
 platforms/image_ipkg.in                          |   12 +++++++++++
 rules/post/ptxd_make_image_prepare_work_dir.make |    6 ++++-
 rules/post/ptxd_make_world_common.make           |    1 +
 scripts/ipkg-push                                |   24 ++++++++++++++++++---
 scripts/lib/ptxd_make_image_common.sh            |   13 ++++++++++-
 5 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/platforms/image_ipkg.in b/platforms/image_ipkg.in
index ef36984..caafb24 100644
--- a/platforms/image_ipkg.in
+++ b/platforms/image_ipkg.in
@@ -24,6 +24,18 @@ config IMAGE_IPKG_FORCED_PUSH
          If this option is checked, this is done by default. This
          is most useful for development purposes.
 
+config IMAGE_INSTALL_FROM_IPKG_REPOSITORY
+       bool
+       select IMAGE_IPKG_PUSH_TO_REPOSITORY
+       select IMAGE_IPKG_FORCED_PUSH
+       prompt "make images: install packets from ipkg-repository"
+       help
+         If this option is checked the packet files from the
+         ipkg-repository are used to create the images
+         
+         Please note, that the ipkg-repository is currently a
+         local directory on your machine.
+
 config IMAGE_IPKG_INDEX
        bool "generate ipkg.index"
        default y
diff --git a/rules/post/ptxd_make_image_prepare_work_dir.make 
b/rules/post/ptxd_make_image_prepare_work_dir.make
index 0bdb0d3..0991efd 100644
--- a/rules/post/ptxd_make_image_prepare_work_dir.make
+++ b/rules/post/ptxd_make_image_prepare_work_dir.make
@@ -8,11 +8,15 @@
 # see the README file.
 #
 
+ifdef PTXCONF_IMAGE_INSTALL_FROM_IPKG_REPOSITORY
+IMAGE_REQUIRES := $(STATEDIR)/ipkg-push
+endif
+
 #
 # extract all current ipkgs into the working directory
 #
 PHONY += $(STATEDIR)/image_working_dir
-$(STATEDIR)/image_working_dir:
+$(STATEDIR)/image_working_dir: $(IMAGE_REQUIRES)
        @$(call image/env) \
        ptxd_make_image_prepare_work_dir
        @$(call touch, $@)
diff --git a/rules/post/ptxd_make_world_common.make 
b/rules/post/ptxd_make_world_common.make
index 19f0a70..8f6f988 100644
--- a/rules/post/ptxd_make_world_common.make
+++ b/rules/post/ptxd_make_world_common.make
@@ -26,6 +26,7 @@ ptx/env = \
        ptx_lib_dir="$(call ptx/escape,$(PTXDIST_LIB_DIR))"                     
\
        ptx_pkg_dir="$(call ptx/escape,$(PKGDIR))"                              
\
        ptx_pkg_dev_dir="$(call ptx/escape,$(PTXDIST_DEVPKG_PLATFORMDIR))"      
\
+       ptx_repo_dist_dir="$(call 
ptx/escape,$(PTXCONF_SETUP_IPKG_REPOSITORY)/$(call 
remove_quotes,$(PTXCONF_PROJECT))/dists/$(call 
remove_quotes,$(PTXCONF_PROJECT))$(call 
remove_quotes,$(PTXCONF_PROJECT_VERSION)))"\
                                                                                
\
        ptx_path_target="$(call ptx/escape,$(CROSS_PATH))"                      
\
        ptx_conf_env_target="$(call ptx/escape,$(CROSS_ENV))"                   
\
diff --git a/scripts/ipkg-push b/scripts/ipkg-push
index 48025cd..4c8d224 100755
--- a/scripts/ipkg-push
+++ b/scripts/ipkg-push
@@ -119,9 +119,15 @@ for package in $IPKG_PACKAGES; do
                # this package wasn't there before, re-revision to -1
                newpackage=`$SCRIPTDIR/ipkg-revision $POOL/$package - 1`
                if [ -n "$DIST" ]; then 
+                       cp -f "$IPKGDIR/../state/${IPKG_NAME}.perms" 
"$POOL/${newpackage%.ipk}.perms"
+
                        echo "  linking.source...: ../../pool/$newpackage"
                        echo "  linking.to.......: 
$REPODIR/$PROJECT/dists/$DIST/$newpackage"
-                       ln -sf ../../pool/$newpackage 
$REPODIR/$PROJECT/dists/$DIST/$newpackage
+                       ln -sf ../../pool/${newpackage} 
$REPODIR/$PROJECT/dists/$DIST/$newpackage
+
+                       echo "  perms linking.source...: 
../../pool/${newpackage%.ipk}.perms"
+                       echo "  perms linking.to.......: 
$REPODIR/$PROJECT/dists/$DIST/${newpackage%.ipk}.perms"
+                       ln -sf ../../pool/${newpackage%.ipk}.perms 
$REPODIR/$PROJECT/dists/$DIST/${newpackage%.ipk}.perms
                fi
 
        else
@@ -149,7 +155,11 @@ for package in $IPKG_PACKAGES; do
                        if [ -n "$DIST" ]; then 
                                echo "  linking.source...: 
../../pool/$latest_pkg"
                                echo "  linking.to.......: 
$REPODIR/$PROJECT/dists/$DIST/$latest_pkg"
-                               ln -sf ../../pool/$latest_pkg 
$REPODIR/$PROJECT/dists/$DIST/$latest_pkg
+                               ln -sf ../../pool/${latest_pkg} 
$REPODIR/$PROJECT/dists/$DIST/$latest_pkg
+
+                               echo "  perms linking.source...: 
../../pool/${latest_pkg%.ipk}.perms"
+                               echo "  perms linking.to.......: 
$REPODIR/$PROJECT/dists/$DIST/${latest_pkg%.ipk}.perms"
+                               ln -sf ../../pool/${latest_pkg%.ipk}.perms 
$REPODIR/$PROJECT/dists/$DIST/${latest_pkg%.ipk}.perms
                        fi
                        continue
                fi
@@ -159,10 +169,16 @@ for package in $IPKG_PACKAGES; do
 
                newpackage=`$SCRIPTDIR/ipkg-revision $POOL/$package - 
$(($IPKG_REV_PACKAGE+1))`
                echo "RSC2: newpackage=$newpackage"
-               if [ -n "$DIST" ]; then 
+               if [ -n "$DIST" ]; then
+                       cp -f "$IPKGDIR/../state/${IPKG_NAME}.perms" 
"$POOL/${newpackage%.ipk}.perms"
+
                        echo "  linking.source...: ../../pool/$newpackage"
                        echo "  linking.to.......: 
$REPODIR/$PROJECT/dists/$DIST/$newpackage"
-                       ln -sf ../../pool/$newpackage 
$REPODIR/$PROJECT/dists/$DIST/$newpackage
+                       ln -sf ../../pool/${newpackage} 
$REPODIR/$PROJECT/dists/$DIST/$newpackage
+       
+                       echo "  perms linking.source...: 
../../pool/${newpackage%.ipk}.perms"
+                       echo "  perms linking.to.......: 
$REPODIR/$PROJECT/dists/$DIST/${newpackage%.ipk}.perms"
+                       ln -sf ../../pool/${newpackage%.ipk}.perms 
$REPODIR/$PROJECT/dists/$DIST/${newpackage%.ipk}.perms
                fi
 
        fi
diff --git a/scripts/lib/ptxd_make_image_common.sh 
b/scripts/lib/ptxd_make_image_common.sh
index 035afb7..42ccf19 100644
--- a/scripts/lib/ptxd_make_image_common.sh
+++ b/scripts/lib/ptxd_make_image_common.sh
@@ -38,7 +38,11 @@ ptxd_get_ipkg_files() {
        # take first hit
        if ptxd_get_path "${ipkg_files[@]}"; then
            ptxd_reply_ipkg_files[${#ptxd_reply_ipkg_files[@]}]="${ptxd_reply}"
-           
ptxd_reply_perm_files[${#ptxd_reply_perm_files[@]}]="${ptxd_reply%/*/*}/state/${1}.perms"
+           if [ -z "$(ptxd_get_ptxconf 
PTXCONF_IMAGE_INSTALL_FROM_IPKG_REPOSITORY)" ]; then
+               
ptxd_reply_perm_files[${#ptxd_reply_perm_files[@]}]="${ptxd_reply%/*/*}/state/${1}.perms"
+           else
+               
ptxd_reply_perm_files[${#ptxd_reply_perm_files[@]}]="${ptxd_reply%.ipk}.perms"
+           fi
        else
            ptxd_bailout "\
 
@@ -57,7 +61,12 @@ export -f ptxd_get_ipkg_files
 # initialize variables needed for image creation
 #
 ptxd_make_image_init() {
-    image_ipkg_repo_dirs=( "${ptx_pkg_dir}" )
+    if [ -z "$(ptxd_get_ptxconf PTXCONF_IMAGE_INSTALL_FROM_IPKG_REPOSITORY)" 
]; then
+       image_ipkg_repo_dirs=( "${ptx_pkg_dir}" )
+    else
+       image_ipkg_repo_dirs=( "${ptx_repo_dist_dir}" )
+    fi
+
     if [ -n "${PTXDIST_BASE_PLATFORMDIR}" ]; then
        
image_ipkg_repo_dirs[${#image_ipkg_repo_dirs[@]}]="${PTXDIST_BASE_PLATFORMDIR}/packages"
     fi
-- 
1.7.1


-- 
ptxdist mailing list
[email protected]

Reply via email to