Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] automated building of Opkg repository
       [not found] <Add support for automated building of Opkg repository>
@ 2014-02-03 19:07 ` Vinay Malkani
  2014-02-03 19:07   ` [Buildroot] [PATCH] automated opkg repository building. Fixes Version, Description, and pkg-generic.mk Vinay Malkani
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vinay Malkani @ 2014-02-03 19:07 UTC (permalink / raw)
  To: buildroot

I updated the patch to work with Description and Version correctly (These were causing compilation errors).
In addition, I updated the patch to apply cleanly to pre-generic.mk 
I'm not sure if this is the correct process so I hope this is the correct way to do it.

Vinay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] automated opkg repository building. Fixes Version, Description, and pkg-generic.mk
  2014-02-03 19:07 ` [Buildroot] automated building of Opkg repository Vinay Malkani
@ 2014-02-03 19:07   ` Vinay Malkani
  2014-02-03 19:11   ` [Buildroot] automated building of Opkg repository vmalkani
  2014-02-03 21:42   ` Thomas Petazzoni
  2 siblings, 0 replies; 4+ messages in thread
From: Vinay Malkani @ 2014-02-03 19:07 UTC (permalink / raw)
  To: buildroot

---
 fs/Config.in                |  1 +
 fs/ipk/Config.in            | 13 +++++++
 fs/ipk/ipk.mk               | 22 +++++++++++
 package/pkg-generic.mk      |  2 +
 support/scripts/ipk-post.sh | 94 +++++++++++++++++++++++++++++++++++++++++++++
 support/scripts/ipk-pre.sh  | 31 +++++++++++++++
 6 files changed, 163 insertions(+)
 create mode 100644 fs/ipk/Config.in
 create mode 100644 fs/ipk/ipk.mk
 create mode 100755 support/scripts/ipk-post.sh
 create mode 100755 support/scripts/ipk-pre.sh

diff --git a/fs/Config.in b/fs/Config.in
index da4c5ff..7689cc2 100644
--- a/fs/Config.in
+++ b/fs/Config.in
@@ -11,5 +11,6 @@ source "fs/romfs/Config.in"
 source "fs/squashfs/Config.in"
 source "fs/tar/Config.in"
 source "fs/ubifs/Config.in"
+source "fs/ipk/Config.in"
 
 endmenu
diff --git a/fs/ipk/Config.in b/fs/ipk/Config.in
new file mode 100644
index 0000000..9087265
--- /dev/null
+++ b/fs/ipk/Config.in
@@ -0,0 +1,13 @@
+config BR2_TARGET_ROOTFS_IPK_REPO
+	bool "Ipk repository with packages"
+	default y
+	help
+	  Create a repository compatible with opkg/dpkg tools.
+
+	  Each selected packages is splitted in 4 parts:
+	     - main package with debug symbols stripped off
+	     - debug symbols
+	     - development files
+	     - documentation files
+	     - locales
+
diff --git a/fs/ipk/ipk.mk b/fs/ipk/ipk.mk
new file mode 100644
index 0000000..8b8d6f2
--- /dev/null
+++ b/fs/ipk/ipk.mk
@@ -0,0 +1,22 @@
+#############################################################
+#
+# Generate a repository for opkg
+#
+#############################################################
+
+define ROOTFS_IPK_REPO_CMD
+	mkdir -p $(BINARIES_DIR)/ipk_repository;                                                             \
+	( cd $(BINARIES_DIR)/ipk_repository && dpkg-scanpackages . ) > $(BINARIES_DIR)/ipk_repository/Packages; \
+	gzip < $(BINARIES_DIR)/ipk_repository/Packages      > $(BINARIES_DIR)/ipk_repository/Packages.gz;    \
+	echo "Archive: unstable"                           >> $(BINARIES_DIR)/ipk_repository/Release;        \
+	echo "Origin: Buildroot"                           >> $(BINARIES_DIR)/ipk_repository/Release;        \
+	echo "Label: Buildroot autogenerated repository"   >> $(BINARIES_DIR)/ipk_repository/Release;        \
+	echo "Architecture: $(ARCH)"                       >> $(BINARIES_DIR)/ipk_repository/Release;        \
+	echo "Your repository is ready.";                                                                    \
+	echo "If you use opkg, add this line to your /etc/opkg/buildroot.conf:";                             \
+	echo "   src/gz buildroot file://$(BINARIES_DIR)/ipk_repository";                                    \
+	echo "If you use apt, add this one to /etc/apt/sources.list.d/buildroot.list:";                      \
+	echo "   deb file://$(BINARIES_DIR)/ipk_repository .";
+endef
+
+$(eval $(call ROOTFS_TARGET,ipk_repo))
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 1b99c2a..c1c682f 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -216,6 +216,7 @@ $(BUILD_DIR)/%/.stamp_images_installed:
 $(BUILD_DIR)/%/.stamp_target_installed:
 	@$(call step_start,install-target)
 	@$(call MESSAGE,"Installing to target")
+	$(if $(BR2_TARGET_ROOTFS_IPK_REPO),support/scripts/ipk-pre.sh $(TARGET_DIR) $(BUILD_DIR) $($(PKG)_DIR_PREFIX) $($(PKG)_RAWNAME) $($(PKG)_VERSION)) $(ARCH) 
 	$(if $(BR2_INIT_SYSTEMD),\
 		$($(PKG)_INSTALL_INIT_SYSTEMD))
 	$(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
@@ -225,6 +226,7 @@ $(BUILD_DIR)/%/.stamp_target_installed:
 	$(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
 		$(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \
 	fi
+	$(if $(BR2_TARGET_ROOTFS_IPK_REPO),support/scripts/ipk-post.sh $(TARGET_DIR) $(BUILD_DIR) $($(PKG)_DIR_PREFIX) $($(PKG)_RAWNAME) $($(PKG)_VERSION)) $(ARCH) 
 	$(Q)touch $@
 	@$(call step_end,install-target)
 
diff --git a/support/scripts/ipk-post.sh b/support/scripts/ipk-post.sh
new file mode 100755
index 0000000..6b4eab3
--- /dev/null
+++ b/support/scripts/ipk-post.sh
@@ -0,0 +1,94 @@
+#!/bin/bash 
+#
+# Licence: GPL
+# Created: 2013-01-15 15:26:45+01:00
+# Main authors:
+#     - J?r?me Pouiller <[hidden email]>
+#     - Vinay Malkani	<[hidden email]>
+#
+# Second part of package building.
+#
+# Kill previously launched daemon. Using daemon result, create ipk files of
+# package.
+#
+
+TARGET_DIR=$1
+BUILD_DIR=$2
+PACKAGES_DIR=$3
+PKG_RAWNAME=$4
+PKG_VERSION=$5
+ARCH=$6
+PKG_DIR=$PACKAGES_DIR/$PKG_RAWNAME
+PKG_BUILD_DIR=$BUILD_DIR/$PKG_RAWNAME-$PKG_VERSION
+IPK_DIR=$BUILD_DIR/ipk_build
+PKG=$PKG_RAWNAME
+
+kill $(cat $PKG_BUILD_DIR/.ipk_inotify_pid)
+
+# Create DEBIAN/control files
+for P in $PKG $PKG-i18n $PKG-doc $PKG-dbg $PKG-dev; do
+    rm -fr $IPK_DIR/$P
+    mkdir -p $IPK_DIR/$P/DEBIAN
+    (
+        PKG_VERSION=`echo $PKG_VERSION | sed 's/^[a-Z]//g'`
+	echo "Package: $P"
+	echo "Version: $PKG_VERSION"
+	echo "Architecture: $ARCH"
+	echo "Maintainer: Buildroot Automated  <[no email]>"
+	[ $P == $PKG-i18n ] && echo "Depends: $PKG"
+	[ $P == $PKG-dev  ] && echo "Depends: $PKG"
+	[ $P == $PKG-dbg  ] && echo "Depends: $PKG"
+	[ $P == $PKG-doc  ] && echo "Recommends: $PKG"
+	echo "Description: $P"
+	sed '1,/help/d; /^$/Q' $PKG_DIR/Config.in
+        echo
+    ) > $IPK_DIR/$P/DEBIAN/control
+done
+
+# Place application files in package trees
+cut -f 2 $PKG_BUILD_DIR/.ipk_list_installed_files | sort | uniq | while read FILE_FULL; do
+  FILE=${FILE_FULL##$TARGET_DIR/}
+  DIR=${FILE%/*}
+  [[ -e $FILE_FULL ]] || continue
+  [[ -d $FILE_FULL ]] && continue
+  case /$FILE in
+    /usr/include/*|*.a|*.la|/usr/lib/pkgconfig/*|/usr/share/aclocal/*)
+      mkdir -p $IPK_DIR/$PKG-dev/$DIR
+      cp -pd $FILE_FULL $IPK_DIR/$PKG-dev/$FILE
+      ;;
+    /bin/*|/sbin/*|/lib/*.so*|/usr/bin/*|/usr/sbin/*|/usr/lib/*.so*)
+      mkdir -p $IPK_DIR/$PKG/$DIR
+      if [[ -L $FILE_FULL ]]; then
+          cp -pd $FILE_FULL $IPK_DIR/$PKG/$FILE
+      else
+          mkdir -p $IPK_DIR/$PKG-dbg/$DIR
+          strip $FILE_FULL -o $IPK_DIR/$PKG-dbg/$FILE.dbg --only-keep-debug
+          if [[ /$FILE == *thread*.so* ]]; then
+            strip $FILE_FULL -o $IPK_DIR/$PKG/$FILE --strip-debug
+          else
+            strip $FILE_FULL -o $IPK_DIR/$PKG/$FILE
+          fi
+      fi
+      ;;
+    /usr/*doc/*|/usr/*man/*|/usr/*info/*|/usr/*gtk-doc/*)
+      mkdir -p $IPK_DIR/$PKG-doc/$DIR
+      cp -pd $FILE_FULL $IPK_DIR/$PKG-doc/$FILE
+      ;;
+    /usr/share/locale/*)
+      mkdir -p $IPK_DIR/$PKG-i18n/$DIR
+      cp -pd $FILE_FULL $IPK_DIR/$PKG-i18n/$FILE
+      ;;
+    *)
+      mkdir -p $IPK_DIR/$PKG/$DIR
+      cp -pd $FILE_FULL $IPK_DIR/$PKG/$FILE
+      ;;
+  esac
+done
+
+# Create .deb (same than .ipk) file
+mkdir -p $BUILD_DIR/../images/ipk_repository
+for P in $PKG $PKG-i18n $PKG-doc $PKG-dbg $PKG-dev; do
+   if [[ $(ls $IPK_DIR/$P | wc -l) -gt 1 ]]; then
+       dpkg-deb -b $IPK_DIR/$P $BUILD_DIR/../images/ipk_repository
+   fi
+done
diff --git a/support/scripts/ipk-pre.sh b/support/scripts/ipk-pre.sh
new file mode 100755
index 0000000..31f54bc
--- /dev/null
+++ b/support/scripts/ipk-pre.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Licence: GPL
+# Created: 2013-01-15 15:25:52+01:00
+# Main authors:
+#     - J?r?me Pouiller <[hidden email]>
+#     - Vinay Malkani <[hidden email]>
+#
+# First part of package building.
+#
+# It launches a daemon to spy write acces to target. Results are written to
+# .ipk_list_installed_files in build subdirectory of package.
+#
+
+TARGET_DIR=$1
+BUILD_DIR=$2
+PACKAGES_DIR=$3
+PKG_RAWNAME=$4
+PKG_VERSION=$5
+PKG_DIR=$PACKAGES_DIR/$PKG_RAWNAME
+PKG_BUILD_DIR=$BUILD_DIR/$PKG_RAWNAME-$PKG_VERSION
+IPK_DIR=$BUILD_DIR/ipk_build
+PKG=$PKG_RAWNAME
+
+inotifywait -mr $TARGET_DIR -e create -e modify -e moved_to --format '%e	%w%f' >  $PKG_BUILD_DIR/.ipk_list_installed_files &
+echo $! > $PKG_BUILD_DIR/.ipk_inotify_pid
+# FIXME Be sure inotifywait is started
+#sleep 3
+
+
+
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] automated building of Opkg repository
  2014-02-03 19:07 ` [Buildroot] automated building of Opkg repository Vinay Malkani
  2014-02-03 19:07   ` [Buildroot] [PATCH] automated opkg repository building. Fixes Version, Description, and pkg-generic.mk Vinay Malkani
@ 2014-02-03 19:11   ` vmalkani
  2014-02-03 21:42   ` Thomas Petazzoni
  2 siblings, 0 replies; 4+ messages in thread
From: vmalkani @ 2014-02-03 19:11 UTC (permalink / raw)
  To: buildroot

Hi,

I updated the patch to work with Description and Version correctly (These
were causing compilation errors).
In addition, I updated the patch to apply cleanly to pre-generic.mk
I'm not sure if this is the correct process so I hope this is the correct
way to do it.

Vinay



--
View this message in context: http://buildroot-busybox.2317881.n4.nabble.com/automated-building-of-Opkg-repository-tp61315p61317.html
Sent from the Buildroot (busybox) mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] automated building of Opkg repository
  2014-02-03 19:07 ` [Buildroot] automated building of Opkg repository Vinay Malkani
  2014-02-03 19:07   ` [Buildroot] [PATCH] automated opkg repository building. Fixes Version, Description, and pkg-generic.mk Vinay Malkani
  2014-02-03 19:11   ` [Buildroot] automated building of Opkg repository vmalkani
@ 2014-02-03 21:42   ` Thomas Petazzoni
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2014-02-03 21:42 UTC (permalink / raw)
  To: buildroot

Dear Vinay Malkani,

On Mon,  3 Feb 2014 19:07:52 +0000, Vinay Malkani wrote:

> I updated the patch to work with Description and Version correctly (These were causing compilation errors).
> In addition, I updated the patch to apply cleanly to pre-generic.mk 
> I'm not sure if this is the correct process so I hope this is the correct way to do it.

Thanks for this contribution. I am not sure where the original patch
came from (you're saying that you updated the patch), but
unfortunately, the Buildroot community has collectively decided quite
some time ago that we would not support binary packages suck as ipkg
packages, due to the significant additional complexity that it would
add to the package infrastructure. The problem being that supporting
binary packages is *much* more complicated than just grouping the files
that each Buildroot package installs into different .ipk files.

Yann is currently working on adding a FAQ entry on this topic, see:

  http://lists.busybox.net/pipermail/buildroot/2014-January/086084.html

You can also find a more detailed explanation by reading the chapter
"Package management" in the report of a past Buildroot Developers
Meeting at
http://lists.busybox.net/pipermail/buildroot/2011-November/047229.html.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-03 21:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Add support for automated building of Opkg repository>
2014-02-03 19:07 ` [Buildroot] automated building of Opkg repository Vinay Malkani
2014-02-03 19:07   ` [Buildroot] [PATCH] automated opkg repository building. Fixes Version, Description, and pkg-generic.mk Vinay Malkani
2014-02-03 19:11   ` [Buildroot] automated building of Opkg repository vmalkani
2014-02-03 21:42   ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox