Package: cdebootstrap
Version: 0.3.15
Severity: wishlist
Tags: patch

Subject: cdebootstrap: [PATCH] - Optional Release.gpg & Alternate main catagory.
Package: cdebootstrap
Version: 0.3.15
Severity: wishlist

Please integrate the attached patch to enable the use of cdebootstrap
with a 'non-standard' company archive that does not have a 'Release.gpg'
file and just two catagories, 'debian' and 'non-debian'.
The patch provides two new features:
- A new comand line switch, --gpg-optional, that makes the 'Release.gpg'
  file optional. If it is not present, there will be a warning, no
  fatal exit.
- A new commandline switch, --main-catagory=NAME, which makes the name
  'main' just the default and use NAME if provided.


Thanks,
        Matthijs Melchior.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages cdebootstrap depends on:
ii  libc6                        2.3.6.ds1-7 GNU C Library: Shared libraries
ii  libdebian-installer-extra4   0.45        Library of some extra debian-insta
ii  libdebian-installer4         0.45        Library of common debian-installer
ii  wget                         1.10.2-2    retrieves files from the web

cdebootstrap recommends no packages.

-- no debconf information

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages cdebootstrap depends on:
ii  libc6                        2.3.6.ds1-7 GNU C Library: Shared libraries
ii  libdebian-installer-extra4   0.45        Library of some extra debian-insta
ii  libdebian-installer4         0.45        Library of common debian-installer
ii  wget                         1.10.2-2    retrieves files from the web

cdebootstrap recommends no packages.

-- no debconf information
diff -r -u ../cdebootstrap-0.3.15/src/check.c src/check.c
--- ../cdebootstrap-0.3.15/src/check.c	2006-08-24 23:32:21.000000000 +0200
+++ src/check.c	2006-11-05 20:01:46.000000000 +0100
@@ -35,6 +35,8 @@
 #include "frontend.h"
 #include "suite.h"
 
+extern char *main_catagory;
+
 int check_deb (const char *target, di_package *p, const char *message)
 {
   return check_md5 (target, p->md5sum, message);
@@ -70,7 +72,7 @@
   di_rstring key;
 
   snprintf (buf_name, sizeof (buf_name), "Packages%s", ext);
-  snprintf (buf_file, sizeof (buf_file), "main/binary-%s/Packages%s", arch, ext);
+  snprintf (buf_file, sizeof (buf_file), "%s/binary-%s/Packages%s", main_catagory, arch, ext);
   key.string = (char *) buf_file;
   key.size = strlen (buf_file);
   item = di_hash_table_lookup (rel->md5sum, &key);
diff -r -u ../cdebootstrap-0.3.15/src/download.c src/download.c
--- ../cdebootstrap-0.3.15/src/download.c	2006-10-20 17:26:44.000000000 +0200
+++ src/download.c	2006-11-05 19:40:36.000000000 +0100
@@ -38,6 +38,8 @@
 #include "packages.h"
 #include "prepare.h"
 
+extern bool gpg_optional;
+
 int decompress_file (const char *file, const char *extension)
 {
   char buf[1024];
@@ -61,8 +63,12 @@
   build_indices_root ("Release.gpg", source, sizeof (source), target, sizeof (target));
 
   if (download_file (source, target, "Release.gpg"))
-    log_message (LOG_MESSAGE_ERROR_DOWNLOAD, "Release.gpg");
-
+  {
+    if (gpg_optional)
+      log_message (LOG_MESSAGE_WARNING_DOWNLOAD, "Release.gpg");
+    else
+      log_message (LOG_MESSAGE_ERROR_DOWNLOAD, "Release.gpg");
+  }
   build_indices_root ("Release", source, sizeof (source), target, sizeof (target));
 
   if (download_file (source, target, "Release"))
diff -r -u ../cdebootstrap-0.3.15/src/frontend/debian-installer/main.c src/frontend/debian-installer/main.c
--- ../cdebootstrap-0.3.15/src/frontend/debian-installer/main.c	2006-10-20 17:26:44.000000000 +0200
+++ src/frontend/debian-installer/main.c	2006-11-05 20:04:57.000000000 +0100
@@ -35,6 +35,10 @@
 #include <libgen.h>
 #include <stdio.h>
 
+bool gpg_optional = false;
+char *main_catagory = "main";
+
+
 struct debconfclient *client;
 
 int frontend_download (const char *source, const char *target)
diff -r -u ../cdebootstrap-0.3.15/src/frontend/standalone/main.c src/frontend/standalone/main.c
--- ../cdebootstrap-0.3.15/src/frontend/standalone/main.c	2006-10-20 17:39:21.000000000 +0200
+++ src/frontend/standalone/main.c	2006-11-05 20:00:39.000000000 +0100
@@ -50,6 +50,9 @@
 int quiet = 0;
 int verbose = 0;
 
+bool gpg_optional = false;
+char *main_catagory = "main";
+
 #ifdef DEB_ARCH
 char *const default_arch = DEB_ARCH;
 #endif
@@ -73,8 +76,10 @@
   {"download-only", no_argument, 0, 'd'},
   {"flavour", required_argument, 0, 'f'},
   {"variant", required_argument, 0, GETOPT_COMPAT_VARIANT},
+  {"gpg-optional", no_argument, 0, 'g'},
   {"helperdir", required_argument, 0, 'H'},
   {"include", required_argument, 0, 'i'},
+  {"main-catagory", required_argument, 0, 'm'},
   {"quiet", no_argument, 0, 'q'},
   {"suite-config", required_argument, 0, 's'},
   {"verbose", no_argument, 0, 'v'},
@@ -133,7 +138,7 @@
   if (!out)
     return 1;
 
-  if (!fprintf (out, "deb %s %s main\n", mirror, suite_name))
+  if (!fprintf (out, "deb %s %s %s\n", mirror, suite_name, main_catagory))
     return 1;
 
   if (fclose (out))
@@ -161,8 +166,12 @@
       --debug                  enable debug\n\
   -d, --download-only          download packages, but don't perform installation\n\
   -f, --flavour=FLAVOUR        select the flavour to use\n\
+  -g, --gpg-optional           'Release.gpg' file is optional\n\
   -H, --helperdir=DIR          set the helper directory\n\
+  -i, --include=PKG            include this package\n\
+  -m, --main-catagory=NAME     use thia name as the main catagory name\n\
   -q, --quiet                  be quiet\n\
+  -s, --suite-config=NAME      use this suite's config info\n\
   -v, --verbose                be verbose\n\
   -h, --help                   display this help and exit\n\
       --version                output version information and exit\n\
@@ -200,7 +209,7 @@
 
   program_name = argv[0];
 
-  while ((c = getopt_long (argc, argv, "a:c:df:hH:i:s:qv", long_opts, NULL)) != -1)
+  while ((c = getopt_long (argc, argv, "a:c:df:ghH:i:m:s:qv", long_opts, NULL)) != -1)
   {
     switch (c)
     {
@@ -218,6 +227,9 @@
       case 'f':
         flavour = optarg;
         break;
+      case 'g':
+	gpg_optional = true;
+	break;
       case 'h':
         usage (EXIT_SUCCESS);
         break;
@@ -242,6 +254,9 @@
           include[include_len++] = strdup (optarg);
         }
         break;
+      case 'm':
+	main_catagory = optarg;
+	break;
       case 's':
         suite_config = optarg;
         break;
diff -r -u ../cdebootstrap-0.3.15/src/install.c src/install.c
--- ../cdebootstrap-0.3.15/src/install.c	2006-08-24 21:40:20.000000000 +0200
+++ src/install.c	2006-11-05 19:56:05.000000000 +0100
@@ -240,7 +240,7 @@
   if (!out)
     return 1;
 
-  if (!fputs ("deb bootstrap: . main\n", out))
+  if (fprintf (out, "deb bootstrap: . %s\n", main_catagory) < 0)
     return 1;
 
   if (fclose (out))
diff -r -u ../cdebootstrap-0.3.15/src/log.c src/log.c
--- ../cdebootstrap-0.3.15/src/log.c	2005-01-14 22:34:27.000000000 +0100
+++ src/log.c	2006-11-05 19:09:29.000000000 +0100
@@ -62,6 +62,11 @@
     "Couldn't parse %s!",
     DI_LOG_LEVEL_ERROR,
   },
+  [LOG_MESSAGE_WARNING_DOWNLOAD] =
+  {
+    "Couldn't download %s!",
+    DI_LOG_LEVEL_WARNING,
+  },
   [LOG_MESSAGE_INFO_DOWNLOAD_RETRIEVE] =
   {
     "Retrieving %s",

Reply via email to