upgrade debootstrap package
authorLuka Perkov <luka@openwrt.org>
Fri, 6 May 2011 18:16:05 +0000 (18:16 +0000)
committerLuka Perkov <luka@openwrt.org>
Fri, 6 May 2011 18:16:05 +0000 (18:16 +0000)
SVN-Revision: 26839

admin/debootstrap/Makefile
admin/debootstrap/files/pkgdetails.c
admin/debootstrap/patches/00-no_dpkg_deb.diff [deleted file]
admin/debootstrap/patches/100-busybox_fix.patch [new file with mode: 0644]

index 8543f286940926e543e737122551dc584fc8aa29..bbf24a663a124011305cd0f8a3e27c53666a5480 100644 (file)
@@ -1,5 +1,6 @@
 #
 # Copyright (C) 2010 Gianluigi Tiesi <sherpya@netfarm.it>
+# Copyright (C) 2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,40 +9,46 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=debootstrap
-PKG_VERSION:=1.0.28
+PKG_VERSION:=1.0.30
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-udeb_$(PKG_VERSION)_all.udeb
 PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/d/debootstrap
-PKG_MD5SUM:=dee0dc77573d88af80b225d8810ab7a1
+PKG_MD5SUM:=d87b35670aa735ae5b7d3f8bf1b76245
 
-#UNPACK_CMD=dpkg-deb --fsys-tarfile $(DL_DIR)/$(PKG_SOURCE) | ( cd $(1) && tar -xf - )
 UNPACK_CMD=ar -p "$(DL_DIR)/$(PKG_SOURCE)" data.tar.gz | ( cd $(1) && tar -xzf - )
 
 include $(INCLUDE_DIR)/package.mk
 
 define Package/debootstrap
-       SECTION:=admin
-       CATEGORY:=Administration
-       TITLE:=Bootstrap a basic Debian system
-       URL:=http://wiki.debian.org/Debootstrap
-       DEPENDS:=+coreutils-chroot
-       MAINTAINER:=Gianluigi Tiesi <sherpya@netfarm.it>
+  SECTION:=admin
+  CATEGORY:=Administration
+  TITLE:=Bootstrap a basic Debian system
+  URL:=http://wiki.debian.org/Debootstrap
+  DEPENDS:=+coreutils-chroot +coreutils-sha1sum
+  MAINTAINER:=Luka Perkov <openwrt@lukaperkov.net>
 endef
 
 define Package/debootstrap/description
- debootstrap is used to create a Debian base system from scratch,
- without requiring the availability of dpkg or apt. It does this by
- downloading .deb files from a mirror site, and carefully unpacking them
- into a directory which can eventually be chrooted into.
+ debootstrap is used to create a Debian base system from scratch, without
+ requiring the availability of dpkg or apt. It does this by downloading .deb
+ files from a mirror site, and carefully unpacking them into a directory which
+ can eventually be chrooted into. 
 endef
 
 define Build/Compile
+# file pkgdetails.c was imported from debian package base-installer version 1.119
        $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) ./files/pkgdetails.c -o $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails
 endef
 
 define Package/debootstrap/install
-       cd $(PKG_BUILD_DIR) && ( $(FIND) usr | cpio -pd $(1) )
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/usr/share/debootstrap
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails $(1)/usr/share/debootstrap
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/usr/share/debootstrap/functions $(1)/usr/share/debootstrap
+       $(INSTALL_DIR) $(1)/usr/share/debootstrap/scripts
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/usr/share/debootstrap/scripts/* $(1)/usr/share/debootstrap/scripts
 endef
 
 $(eval $(call BuildPackage,debootstrap))
index e4a8bc018615dcda4afb15bb016bdb4ebb5d256e..1154089eaa429a80a55fd9693ac56b522d968b69 100644 (file)
@@ -6,6 +6,8 @@
 #define MAX_LINE 1000
 #define MAX_PKGS 100
 
+char *checksum_field=NULL;
+
 static char *fieldcpy(char *dst, char *fld) {
     while (*fld && *fld != ':') 
         fld++;
@@ -84,7 +86,7 @@ static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile,
     char cur_ver[MAX_LINE];
     char cur_arch[MAX_LINE];
     char cur_size[MAX_LINE];
-    char cur_md5[MAX_LINE];
+    char cur_checksum[MAX_LINE];
     char cur_filename[MAX_LINE];
     char *pkgs[MAX_PKGS];
     int i;
@@ -112,8 +114,9 @@ static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile,
             fieldcpy(cur_arch, buf);
         } else if (strncasecmp(buf, "Size:", 5) == 0) {
             fieldcpy(cur_size, buf);
-        } else if (strncasecmp(buf, "MD5sum:", 7) == 0) {
-            fieldcpy(cur_md5, buf);
+        } else if (strncasecmp(buf, checksum_field, strlen(checksum_field)) == 0
+                  && buf[strlen(checksum_field)] == ':') {
+            fieldcpy(cur_checksum, buf);
         } else if (strncasecmp(buf, "Filename:", 9) == 0) {
             fieldcpy(cur_filename, buf);
         } else if (!*buf) {
@@ -122,7 +125,7 @@ static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile,
                if (!pkgs[i]) continue;
                any = 1;
                 if (strcmp(cur_field, pkgs[i]) == 0) {
-                    printf("%s %s %s %s %s %s %s\n", cur_pkg, cur_ver, cur_arch, mirror, cur_filename, cur_md5, cur_size);
+                    printf("%s %s %s %s %s %s %s\n", cur_pkg, cur_ver, cur_arch, mirror, cur_filename, cur_checksum, cur_size);
                     if (uniq) pkgs[i] = NULL;
                    break;
                }
@@ -230,6 +233,11 @@ static int dotranslatewgetpercent(int low, int high, int end, char *str) {
 }
 
 int main(int argc, char *argv[]) {
+    checksum_field=getenv("DEBOOTSTRAP_CHECKSUM_FIELD");
+    if (checksum_field == NULL) {
+        checksum_field="MD5sum";
+    }
+
     if ((argc == 6 || argc == 5) && strcmp(argv[1], "WGET%") == 0) {
        if (dotranslatewgetpercent(atoi(argv[2]), atoi(argv[3]), 
                                   atoi(argv[4]), argc == 6 ? argv[5] : NULL))
diff --git a/admin/debootstrap/patches/00-no_dpkg_deb.diff b/admin/debootstrap/patches/00-no_dpkg_deb.diff
deleted file mode 100644 (file)
index 181c189..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- debootstrap-1.0.26/usr/share/debootstrap/functions 2010-11-12 13:07:47.000000000 +0100
-+++ debootstrap-1.0.26/usr/share/debootstrap/functions 2010-11-26 21:55:06.440000562 +0100
-@@ -800,8 +800,9 @@
-       if [ -n "$EXTRACTOR_OVERRIDE" ]; then
-               extractor="$EXTRACTOR_OVERRIDE"
--      elif type dpkg-deb >/dev/null 2>&1; then
--              extractor="dpkg-deb"
-+#     busybox's dpkg-deb is not suitable for this script
-+#     elif type dpkg-deb >/dev/null 2>&1; then
-+#             extractor="dpkg-deb"
-       else
-               extractor="ar"
-       fi
diff --git a/admin/debootstrap/patches/100-busybox_fix.patch b/admin/debootstrap/patches/100-busybox_fix.patch
new file mode 100644 (file)
index 0000000..cf0e9af
--- /dev/null
@@ -0,0 +1,13 @@
+Index: debootstrap-1.0.30/usr/share/debootstrap/functions
+===================================================================
+--- debootstrap-1.0.30.orig/usr/share/debootstrap/functions    2011-04-28 15:29:13.595340023 +0200
++++ debootstrap-1.0.30/usr/share/debootstrap/functions 2011-04-28 15:29:23.658843887 +0200
+@@ -800,8 +800,6 @@
+       if [ -n "$EXTRACTOR_OVERRIDE" ]; then
+               extractor="$EXTRACTOR_OVERRIDE"
+-      elif type dpkg-deb >/dev/null 2>&1; then
+-              extractor="dpkg-deb"
+       else
+               extractor="ar"
+       fi