Bug#673625: cdebootstrap: Does not support InRelease files

2012-05-24 Thread Mehdi Dogguy

tags 673625 + patch
thanks

Joerg Jaspert jo...@debian.org wrote:


cdebootstrap currently does not support the use of InRelease files,
instead of the old Release/Release.gpg combination.

Please enable the InRelease files, as we want to drop the old way from
the main archive, short after wheezy.



Please find attached a patch that adds support for InRelease file to
cdebootstrap. It needs a patched libdebian-installer (See 674060 for
the needed patch). Using this patch, I've been able to create Squeeze
and Sid chroots. I hit #671177 initially but the proposed change
(i.e. -o Acquire::Languages=none) lets me create a usable chroot.

Regards,

--
Mehdi Dogguy

From 414c4de332cfa5c5a792deafb645e6c34f5e10d5 Mon Sep 17 00:00:00 2001
From: Mehdi Dogguy me...@debian.org
Date: Wed, 23 May 2012 17:28:50 +0200
Subject: [PATCH] Add support for InRelease files (Closes: #673625)

---
 debian/changelog |6 ++
 include/gpg.h|4 +++-
 include/log.h|1 +
 src/download.c   |   58 ++
 src/gpg.c|9 ++---
 src/log.c|5 +
 6 files changed, 62 insertions(+), 21 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 58e3c22..db29982 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+cdebootstrap (0.5.8+nmu1) UNRELEASED; urgency=low
+
+  * Add support for InRelease files (Closes: #673625)
+
+ -- Mehdi Dogguy me...@debian.org  Tue, 22 May 2012 20:42:07 +0200
+
 cdebootstrap (0.5.8) unstable; urgency=low
 
   * Support SHA1 checksums for release files. (closes: #614314)
diff --git a/include/gpg.h b/include/gpg.h
index dfee7e9..41c2291 100644
--- a/include/gpg.h
+++ b/include/gpg.h
@@ -25,7 +25,9 @@
 #ifndef GPG_H
 #define GPG_H
 
-int gpg_check_release (const char *file, const char *file_sig);
+#include stdbool.h
+
+int gpg_check_release (const char *file, const char *file_sig, const char *msg, bool in_release_mode);
 
 int gpg_init (const char **keyring_dirs, const char *keyring_name);
 
diff --git a/include/log.h b/include/log.h
index bb3d632..8d28950 100644
--- a/include/log.h
+++ b/include/log.h
@@ -33,6 +33,7 @@ typedef enum log_message_name
   LOG_MESSAGE_ERROR_DOWNLOAD_PARSE,
   LOG_MESSAGE_ERROR_DOWNLOAD_RETRIEVE,
   LOG_MESSAGE_ERROR_DOWNLOAD_VALIDATE,
+  LOG_MESSAGE_WARNING_DOWNLOAD_RETRIEVE,
   LOG_MESSAGE_WARNING_DOWNLOAD_VALIDATE,
   LOG_MESSAGE_INFO_DOWNLOAD_PARSE,
   LOG_MESSAGE_INFO_DOWNLOAD_RETRIEVE,
diff --git a/src/download.c b/src/download.c
index 499e21b..66be295 100644
--- a/src/download.c
+++ b/src/download.c
@@ -57,33 +57,57 @@ static int download_file (const char *source, const char *target, const char *me
 static di_release *download_release (void)
 {
   char source[256];
-  char target[4096], target1[4096];
+  char in_target[4096], sig_target[4096], target[4096];
+  bool in_release_mode = true;
   di_release *ret;
 
-  build_indices_root (Release, source, sizeof (source), target, sizeof (target));
+  build_indices_root (InRelease, source, sizeof (source), in_target, sizeof (in_target));
 
-  if (download_file (source, target, Release))
-log_message (LOG_MESSAGE_ERROR_DOWNLOAD_RETRIEVE, Release);
+  if (!download_file (source, in_target, InRelease))
+  {
+if (gpg_check_release (in_target, in_target, InRelease, in_release_mode))
+  log_message (authentication ? LOG_MESSAGE_ERROR_DOWNLOAD_VALIDATE : LOG_MESSAGE_WARNING_DOWNLOAD_VALIDATE, InRelease);
 
-  build_indices_root (Release.gpg, source, sizeof (source), target1, sizeof (target1));
+log_message (LOG_MESSAGE_INFO_DOWNLOAD_PARSE, InRelease);
 
-  if (download_file (source, target1, Release.gpg))
-  {
-if (authentication)
-  log_message (LOG_MESSAGE_ERROR_DOWNLOAD_RETRIEVE, Release.gpg);
+build_indices_root (Release, source, sizeof (source), target, sizeof (target));
+
+if (!(ret = di_release_read_file (in_target)))
+  log_message (LOG_MESSAGE_ERROR_DOWNLOAD_PARSE, InRelease);
+
+if (!suite  suite_use (ret-codename))
+  return NULL;
+
+return ret;
   }
-  else if (gpg_check_release (target, target1))
-log_message (authentication ? LOG_MESSAGE_ERROR_DOWNLOAD_VALIDATE : LOG_MESSAGE_WARNING_DOWNLOAD_VALIDATE, Release);
+  else
+  {
+log_message (LOG_MESSAGE_WARNING_DOWNLOAD_RETRIEVE, InRelease);
 
-  log_message (LOG_MESSAGE_INFO_DOWNLOAD_PARSE, Release);
+build_indices_root (Release, source, sizeof (source), target, sizeof (target));
+if (download_file (source, target, Release))
+  log_message (LOG_MESSAGE_ERROR_DOWNLOAD_RETRIEVE, Release);
 
-  if (!(ret = di_release_read_file (target)))
-log_message (LOG_MESSAGE_ERROR_DOWNLOAD_PARSE, Release);
+build_indices_root (Release.gpg, source, sizeof (source), sig_target, sizeof (sig_target));
 
-  if (!suite  suite_use (ret-codename))
-return NULL;
+if (download_file (source, sig_target, Release.gpg))
+{
+  if (authentication)
+log_message (LOG_MESSAGE_ERROR_DOWNLOAD_RETRIEVE, 

Bug#673625: cdebootstrap: Does not support InRelease files

2012-05-20 Thread Joerg Jaspert
Package: cdebootstrap
Version: 0.5.8
Severity: important

Dear Maintainer,

cdebootstrap currently does not support the use of InRelease files,
instead of the old Release/Release.gpg combination.

Please enable the InRelease files, as we want to drop the old way from
the main archive, short after wheezy.

Thanks.

-- 
bye, Joerg
holger Ganneff: Im confident in your ability to create flamewars.


pgpXLYFaRHGwJ.pgp
Description: PGP signature