debootstrap: upgrade to version 1.0.38
authorLuka Perkov <luka@openwrt.org>
Sat, 18 Feb 2012 23:55:02 +0000 (23:55 +0000)
committerLuka Perkov <luka@openwrt.org>
Sat, 18 Feb 2012 23:55:02 +0000 (23:55 +0000)
SVN-Revision: 30641

admin/debootstrap/Makefile
admin/debootstrap/files/pkgdetails.c
admin/debootstrap/patches/100-busybox_fix.patch

index bbf24a663a124011305cd0f8a3e27c53666a5480..82c81e95d147a3c6f0680d9cd30357382d87cad3 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Copyright (C) 2010 Gianluigi Tiesi <sherpya@netfarm.it>
-# Copyright (C) 2011 OpenWrt.org
+# Copyright (C) 2011-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,12 +9,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=debootstrap
-PKG_VERSION:=1.0.30
+PKG_VERSION:=1.0.38
 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:=d87b35670aa735ae5b7d3f8bf1b76245
+PKG_MD5SUM:=9bc9c55504c73bad27105aeed1a94f42
 
 UNPACK_CMD=ar -p "$(DL_DIR)/$(PKG_SOURCE)" data.tar.gz | ( cd $(1) && tar -xzf - )
 
@@ -37,7 +37,7 @@ define Package/debootstrap/description
 endef
 
 define Build/Compile
-# file pkgdetails.c was imported from debian package base-installer version 1.119
+# file pkgdetails.c was imported from debian package base-installer version 1.122
        $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) ./files/pkgdetails.c -o $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails
 endef
 
index 1154089eaa429a80a55fd9693ac56b522d968b69..359807badc169124624f6078087fb3d0c7485bd6 100644 (file)
@@ -2,12 +2,41 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <stdarg.h>
+#include <errno.h>
 
 #define MAX_LINE 1000
 #define MAX_PKGS 100
 
 char *checksum_field=NULL;
 
+static void oom_die(void)
+{
+    fprintf(stderr, "Out of memory!\n");
+    exit(1);
+}
+
+static char *xvasprintf(const char *fmt, va_list ap) {
+    char *ret;
+
+    if (vasprintf (&ret, fmt, ap) < 0) {
+        if (errno == ENOMEM)
+            oom_die();
+        return NULL;
+    }
+    return ret;
+}
+
+static char *xasprintf(const char *fmt, ...) {
+    va_list ap;
+    char *ret;
+
+    va_start(ap, fmt);
+    ret = xvasprintf(fmt, ap);
+    va_end(ap);
+    return ret;
+}
+
 static char *fieldcpy(char *dst, char *fld) {
     while (*fld && *fld != ':') 
         fld++;
@@ -17,16 +46,36 @@ static char *fieldcpy(char *dst, char *fld) {
     return strcpy(dst, fld);
 }
 
+static void outputdeps(char *deps) {
+    char *pch = deps;
+
+    while (1) {
+        while (isspace(*pch)) pch++;
+        if (!*pch) break;
+
+        while (*pch && *pch != '(' && *pch != '|' && *pch != ','
+               && !isspace(*pch))
+        {
+            fputc(*pch++, stdout);
+        }
+        fputc('\n', stdout);
+        while (*pch && *pch++ != ',') (void)NULL;
+    }
+}
+
 static void dogetdeps(char *pkgsfile, char **in_pkgs, int pkgc) {
     char buf[MAX_LINE];
     char cur_pkg[MAX_LINE];
     char cur_deps[MAX_LINE];
+    char cur_predeps[MAX_LINE];
+    char prev_pkg[MAX_LINE];
     char *pkgs[MAX_PKGS];
     int i;
     int skip;
     FILE *f;
+    int output_pkg = -1;
 
-    cur_pkg[0] = cur_deps[0] = '\0';
+    cur_pkg[0] = cur_deps[0] = cur_predeps[0] = prev_pkg[0] = '\0';
 
     for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i];
 
@@ -43,37 +92,36 @@ static void dogetdeps(char *pkgsfile, char **in_pkgs, int pkgc) {
             int any = 0;
             skip = 1;
             fieldcpy(cur_pkg, buf);
+            if (strcmp(cur_pkg, prev_pkg) != 0) {
+                if (output_pkg != -1)
+                    pkgs[output_pkg] = NULL;
+                if (cur_deps[0])
+                    outputdeps(cur_deps);
+                if (cur_predeps[0])
+                    outputdeps(cur_predeps);
+                strcpy(prev_pkg, cur_pkg);
+            }
+            cur_deps[0] = cur_predeps[0] = '\0';
+            output_pkg = -1;
            for (i = 0; i < pkgc; i++) {
                if (!pkgs[i]) continue;
                any = 1;
                 if (strcmp(cur_pkg, pkgs[i]) == 0) {
                     skip = 0;
-                    pkgs[i] = NULL;
+                    output_pkg = i;
                     break;
                 }
             }
             if (!any) break;
-        } else if (!skip && 
-            (strncasecmp(buf, "Depends:", 8) == 0 || 
-             strncasecmp(buf, "Pre-Depends:", 12) == 0)) 
-        {
-            char *pch;
+        } else if (!skip && strncasecmp(buf, "Depends:", 8) == 0)
             fieldcpy(cur_deps, buf);
-            pch = cur_deps;
-            while (1) {
-                while (isspace(*pch)) pch++;
-                if (!*pch) break;
-
-                while (*pch && *pch != '(' && *pch != '|' && *pch != ','
-                       && !isspace(*pch))
-                {
-                    fputc(*pch++, stdout);
-                }
-                fputc('\n', stdout);
-                while (*pch && *pch++ != ',') (void)NULL;
-            }
-        }
+        else if (!skip && strncasecmp(buf, "Pre-Depends:", 12) == 0)
+            fieldcpy(cur_predeps, buf);
     }
+    if (cur_deps[0])
+        outputdeps(cur_deps);
+    if (cur_predeps[0])
+        outputdeps(cur_predeps);
     fclose(f);
 }
 
@@ -88,11 +136,14 @@ static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile,
     char cur_size[MAX_LINE];
     char cur_checksum[MAX_LINE];
     char cur_filename[MAX_LINE];
+    char prev_pkg[MAX_LINE];
     char *pkgs[MAX_PKGS];
     int i;
     FILE *f;
+    char *output = NULL;
+    int output_pkg = -1;
 
-    cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = '\0';
+    cur_field[0] = cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = prev_pkg[0] = '\0';
 
     for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i];
 
@@ -108,6 +159,16 @@ static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile,
        }
         if (strncasecmp(buf, "Package:", 8) == 0) {
             fieldcpy(cur_pkg, buf);
+            if (strcmp(cur_pkg, prev_pkg) != 0) {
+                if (output)
+                    fputs(output, stdout);
+                if (uniq && output_pkg != -1)
+                    pkgs[output_pkg] = NULL;
+                strcpy(prev_pkg, cur_pkg);
+            }
+            free(output);
+            output = NULL;
+            output_pkg = -1;
         } else if (strncasecmp(buf, "Version:", 8) == 0) {
             fieldcpy(cur_ver, buf);
         } else if (strncasecmp(buf, "Architecture:", 13) == 0) {
@@ -125,14 +186,20 @@ 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_checksum, cur_size);
-                    if (uniq) pkgs[i] = NULL;
+                    free(output);
+                    output = xasprintf("%s %s %s %s %s %s %s\n", cur_pkg, cur_ver, cur_arch, mirror, cur_filename, cur_checksum, cur_size);
+                    output_pkg = i;
                    break;
                }
             }
            if (!any) break;
+            cur_field[0] = '\0';
         }
     }
+    if (output)
+        fputs(output, stdout);
+    if (uniq && output_pkg != -1)
+        pkgs[output_pkg] = NULL;
     fclose(f);
 
     /* any that weren't found are returned as "pkg -" */
@@ -145,12 +212,6 @@ static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile,
     }
 }
 
-static void oom_die(void)
-{
-    fprintf(stderr, "Out of memory!\n");
-    exit(1);
-}
-
 static void dopkgstanzas(char *pkgsfile, char **pkgs, int pkgc)
 {
     char buf[MAX_LINE];
index cf0e9af0f7c03bda1b7dbfddf79ae8d9e3128152..124d7a42592a7ccf92ad73736920b4e44c620191 100644 (file)
@@ -1,8 +1,6 @@
-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 @@
+--- a/usr/share/debootstrap/functions
++++ b/usr/share/debootstrap/functions
+@@ -839,8 +839,6 @@ choose_extractor () {
  
        if [ -n "$EXTRACTOR_OVERRIDE" ]; then
                extractor="$EXTRACTOR_OVERRIDE"