Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Support sets in .tar.xz format



details:   https://anonhg.NetBSD.org/src/rev/e49bfd27b1db
branches:  trunk
changeset: 836263:e49bfd27b1db
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Oct 06 18:45:37 2018 +0000

description:
Support sets in .tar.xz format

diffstat:

 usr.sbin/sysinst/Makefile.inc |    4 +-
 usr.sbin/sysinst/defs.h       |   10 +++-
 usr.sbin/sysinst/main.c       |    5 +-
 usr.sbin/sysinst/net.c        |   16 +++--
 usr.sbin/sysinst/util.c       |  109 +++++++++++++++++++++++++----------------
 5 files changed, 90 insertions(+), 54 deletions(-)

diffs (truncated from 312 to 300 lines):

diff -r 6610b7829433 -r e49bfd27b1db usr.sbin/sysinst/Makefile.inc
--- a/usr.sbin/sysinst/Makefile.inc     Sat Oct 06 17:46:46 2018 +0000
+++ b/usr.sbin/sysinst/Makefile.inc     Sat Oct 06 18:45:37 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.13 2018/09/20 12:27:42 rin Exp $
+#      $NetBSD: Makefile.inc,v 1.14 2018/10/06 18:45:37 martin Exp $
 #
 # Makefile for sysinst
 
@@ -47,9 +47,11 @@
 UNIF_AWK=      ${.CURDIR}/../../unif.awk
 MSG_XLAT_SH=   ${.CURDIR}/../../msg_xlat.sh
 
+SETS_TAR_SUFF=${"${USE_XZ_SETS:Uno}"!="no":?"tar.xz":"tgz"}
 
 CATALOGDIR=    /usr/share/sysinst/catalog
 CPPFLAGS+=     -I. -I${.CURDIR}/../.. -I${.CURDIR} \
+               -DSETS_TAR_SUFF=${SETS_TAR_SUFF:Q} \
                -DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
                -DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
                ${NODISKLABEL:D-DNO_DISKLABEL} \
diff -r 6610b7829433 -r e49bfd27b1db usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Sat Oct 06 17:46:46 2018 +0000
+++ b/usr.sbin/sysinst/defs.h   Sat Oct 06 18:45:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.19 2018/09/20 12:27:42 rin Exp $    */
+/*     $NetBSD: defs.h,v 1.20 2018/10/06 18:45:37 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -192,6 +192,7 @@
 typedef struct distinfo {
        const char      *name;
        uint            set;
+       bool            force_tgz;      /* this set is always in .tgz format */
        const char      *desc;
        const char      *marker_file;   /* set assumed installed if exists */
 } distinfo;
@@ -376,6 +377,10 @@
 #define SYSINST_PKGSRC_HTTP_HOST       SYSINST_PKG_HTTP_HOST
 #endif
 
+#ifndef SETS_TAR_SUFF
+#define        SETS_TAR_SUFF    "tgz"
+#endif
+
 /* Abs. path we extract binary sets from */
 char ext_dir_bin[STRSIZE];
 
@@ -433,6 +438,7 @@
 int  mnt2_mounted;
 
 char dist_postfix[SSTRSIZE];
+char dist_tgz_postfix[SSTRSIZE];
 
 /* needed prototypes */
 void set_menu_numopts(int, int);
@@ -579,6 +585,8 @@
 void   do_coloring (unsigned int, unsigned int);
 int set_menu_select(menudesc *, void *);
 const char *safectime(time_t *);
+bool   use_tgz_for_set(const char*);
+const char *set_postfix(const char*);
 
 /* from target.c */
 #if defined(DEBUG)  || defined(DEBUG_ROOT)
diff -r 6610b7829433 -r e49bfd27b1db usr.sbin/sysinst/main.c
--- a/usr.sbin/sysinst/main.c   Sat Oct 06 17:46:46 2018 +0000
+++ b/usr.sbin/sysinst/main.c   Sat Oct 06 18:45:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.10 2018/09/20 12:27:42 rin Exp $    */
+/*     $NetBSD: main.c,v 1.11 2018/10/06 18:45:37 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -107,7 +107,8 @@
        {"local fs", "ffs", localfs_fs, sizeof localfs_fs},
        {"local dir", "release", localfs_dir, sizeof localfs_dir},
        {"targetroot mount", "/targetroot", targetroot_mnt, sizeof targetroot_mnt},
-       {"dist postfix", ".tgz", dist_postfix, sizeof dist_postfix},
+       {"dist postfix", "." SETS_TAR_SUFF, dist_postfix, sizeof dist_postfix},
+       {"dist tgz postfix", ".tgz", dist_tgz_postfix, sizeof dist_tgz_postfix},
        {"diskname", "mydisk", bsddiskname, sizeof bsddiskname},
        {"pkg host", SYSINST_PKG_HOST, pkg.xfer_host[XFER_FTP], sizeof pkg.xfer_host[XFER_FTP]},
        {"pkg http host", SYSINST_PKG_HTTP_HOST, pkg.xfer_host[XFER_HTTP], sizeof pkg.xfer_host[XFER_HTTP]},
diff -r 6610b7829433 -r e49bfd27b1db usr.sbin/sysinst/net.c
--- a/usr.sbin/sysinst/net.c    Sat Oct 06 17:46:46 2018 +0000
+++ b/usr.sbin/sysinst/net.c    Sat Oct 06 18:45:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.25 2018/09/11 08:05:18 martin Exp $  */
+/*     $NetBSD: net.c,v 1.26 2018/10/06 18:45:37 martin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -909,23 +909,24 @@
 
 
 /* ftp_fetch() and pkgsrc_fetch() are essentially the same, with a different
- * ftpinfo var. */
-static int do_ftp_fetch(const char *, struct ftpinfo *);
+ * ftpinfo var and pkgsrc always using .tgz suffix, while for
+ * regular sets we only use .tgz for source sets on some architectures. */
+static int do_ftp_fetch(const char *, bool, struct ftpinfo *);
 
 static int
 ftp_fetch(const char *set_name)
 {
-       return do_ftp_fetch(set_name, &ftp);
+       return do_ftp_fetch(set_name, use_tgz_for_set(set_name), &ftp);
 }
 
 static int
 pkgsrc_fetch(const char *set_name)
 {
-       return do_ftp_fetch(set_name, &pkgsrc);
+       return do_ftp_fetch(set_name, true, &pkgsrc);
 }
 
 static int
-do_ftp_fetch(const char *set_name, struct ftpinfo *f)
+do_ftp_fetch(const char *set_name, bool force_tgz, struct ftpinfo *f)
 {
        const char *ftp_opt;
        char url[STRSIZE];
@@ -944,7 +945,8 @@
        make_url(url, f, set_dir_for_set(set_name));
        rval = run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_XFER_DIR,
                    "/usr/bin/ftp %s%s/%s%s",
-                   ftp_opt, url, set_name, dist_postfix);
+                   ftp_opt, url, set_name,
+                   force_tgz ? dist_tgz_postfix : dist_postfix);
 
        return rval ? SET_RETRY : SET_OK;
 }
diff -r 6610b7829433 -r e49bfd27b1db usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c   Sat Oct 06 17:46:46 2018 +0000
+++ b/usr.sbin/sysinst/util.c   Sat Oct 06 18:45:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.11 2018/06/24 19:53:35 christos Exp $       */
+/*     $NetBSD: util.c,v 1.12 2018/10/06 18:45:37 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -95,75 +95,75 @@
 
 distinfo dist_list[] = {
 #ifdef SET_KERNEL_1_NAME
-       {SET_KERNEL_1_NAME,     SET_KERNEL_1,           MSG_set_kernel_1, NULL},
+       {SET_KERNEL_1_NAME,     SET_KERNEL_1,           false, MSG_set_kernel_1, NULL},
 #endif
 #ifdef SET_KERNEL_2_NAME
-       {SET_KERNEL_2_NAME,     SET_KERNEL_2,           MSG_set_kernel_2, NULL},
+       {SET_KERNEL_2_NAME,     SET_KERNEL_2,           false, MSG_set_kernel_2, NULL},
 #endif
 #ifdef SET_KERNEL_3_NAME
-       {SET_KERNEL_3_NAME,     SET_KERNEL_3,           MSG_set_kernel_3, NULL},
+       {SET_KERNEL_3_NAME,     SET_KERNEL_3,           false, MSG_set_kernel_3, NULL},
 #endif
 #ifdef SET_KERNEL_4_NAME
-       {SET_KERNEL_4_NAME,     SET_KERNEL_4,           MSG_set_kernel_4, NULL},
+       {SET_KERNEL_4_NAME,     SET_KERNEL_4,           false, MSG_set_kernel_4, NULL},
 #endif
 #ifdef SET_KERNEL_5_NAME
-       {SET_KERNEL_5_NAME,     SET_KERNEL_5,           MSG_set_kernel_5, NULL},
+       {SET_KERNEL_5_NAME,     SET_KERNEL_5,           false, MSG_set_kernel_5, NULL},
 #endif
 #ifdef SET_KERNEL_6_NAME
-       {SET_KERNEL_6_NAME,     SET_KERNEL_6,           MSG_set_kernel_6, NULL},
+       {SET_KERNEL_6_NAME,     SET_KERNEL_6,           false, MSG_set_kernel_6, NULL},
 #endif
 #ifdef SET_KERNEL_7_NAME
-       {SET_KERNEL_7_NAME,     SET_KERNEL_7,           MSG_set_kernel_7, NULL},
+       {SET_KERNEL_7_NAME,     SET_KERNEL_7,           false, MSG_set_kernel_7, NULL},
 #endif
 #ifdef SET_KERNEL_8_NAME
-       {SET_KERNEL_8_NAME,     SET_KERNEL_8,           MSG_set_kernel_8, NULL},
+       {SET_KERNEL_8_NAME,     SET_KERNEL_8,           false, MSG_set_kernel_8, NULL},
 #endif
 #ifdef SET_KERNEL_9_NAME
-       {SET_KERNEL_9_NAME,     SET_KERNEL_9,           MSG_set_kernel_9, NULL},
+       {SET_KERNEL_9_NAME,     SET_KERNEL_9,           false, MSG_set_kernel_9, NULL},
 #endif
 
-       {"modules",             SET_MODULES,            MSG_set_modules, NULL},
-       {"base",                SET_BASE,               MSG_set_base, NULL},
-       {"etc",                 SET_ETC,                MSG_set_system, NULL},
-       {"comp",                SET_COMPILER,           MSG_set_compiler, NULL},
-       {"games",               SET_GAMES,              MSG_set_games, NULL},
-       {"man",                 SET_MAN_PAGES,          MSG_set_man_pages, NULL},
-       {"misc",                SET_MISC,               MSG_set_misc, NULL},
-       {"tests",               SET_TESTS,              MSG_set_tests, NULL},
-       {"text",                SET_TEXT_TOOLS,         MSG_set_text_tools, NULL},
+       {"modules",             SET_MODULES,            false, MSG_set_modules, NULL},
+       {"base",                SET_BASE,               false, MSG_set_base, NULL},
+       {"etc",                 SET_ETC,                false, MSG_set_system, NULL},
+       {"comp",                SET_COMPILER,           false, MSG_set_compiler, NULL},
+       {"games",               SET_GAMES,              false, MSG_set_games, NULL},
+       {"man",                 SET_MAN_PAGES,          false, MSG_set_man_pages, NULL},
+       {"misc",                SET_MISC,               false, MSG_set_misc, NULL},
+       {"tests",               SET_TESTS,              false, MSG_set_tests, NULL},
+       {"text",                SET_TEXT_TOOLS,         false, MSG_set_text_tools, NULL},
 
-       {NULL,                  SET_GROUP,              MSG_set_X11, NULL},
-       {"xbase",               SET_X11_BASE,           MSG_set_X11_base, NULL},
-       {"xcomp",               SET_X11_PROG,           MSG_set_X11_prog, NULL},
-       {"xetc",                SET_X11_ETC,            MSG_set_X11_etc, NULL},
-       {"xfont",               SET_X11_FONTS,          MSG_set_X11_fonts, NULL},
-       {"xserver",             SET_X11_SERVERS,        MSG_set_X11_servers, NULL},
-       {NULL,                  SET_GROUP_END,          NULL, NULL},
+       {NULL,                  SET_GROUP,              false, MSG_set_X11, NULL},
+       {"xbase",               SET_X11_BASE,           false, MSG_set_X11_base, NULL},
+       {"xcomp",               SET_X11_PROG,           false, MSG_set_X11_prog, NULL},
+       {"xetc",                SET_X11_ETC,            false, MSG_set_X11_etc, NULL},
+       {"xfont",               SET_X11_FONTS,          false, MSG_set_X11_fonts, NULL},
+       {"xserver",             SET_X11_SERVERS,        false, MSG_set_X11_servers, NULL},
+       {NULL,                  SET_GROUP_END,          false, NULL, NULL},
 
 #ifdef SET_MD_1_NAME
-       {SET_MD_1_NAME,         SET_MD_1,               MSG_set_md_1, NULL},
+       {SET_MD_1_NAME,         SET_MD_1,               false, MSG_set_md_1, NULL},
 #endif
 #ifdef SET_MD_2_NAME
-       {SET_MD_2_NAME,         SET_MD_2,               MSG_set_md_2, NULL},
+       {SET_MD_2_NAME,         SET_MD_2,               false, MSG_set_md_2, NULL},
 #endif
 #ifdef SET_MD_3_NAME
-       {SET_MD_3_NAME,         SET_MD_3,               MSG_set_md_3, NULL},
+       {SET_MD_3_NAME,         SET_MD_3,               false, MSG_set_md_3, NULL},
 #endif
 #ifdef SET_MD_4_NAME
-       {SET_MD_4_NAME,         SET_MD_4,               MSG_set_md_4, NULL},
+       {SET_MD_4_NAME,         SET_MD_4,               false, MSG_set_md_4, NULL},
 #endif
 
-       {NULL,                  SET_GROUP,              MSG_set_source, NULL},
-       {"syssrc",              SET_SYSSRC,             MSG_set_syssrc, NULL},
-       {"src",                 SET_SRC,                MSG_set_src, NULL},
-       {"sharesrc",            SET_SHARESRC,           MSG_set_sharesrc, NULL},
-       {"gnusrc",              SET_GNUSRC,             MSG_set_gnusrc, NULL},
-       {"xsrc",                SET_XSRC,               MSG_set_xsrc, NULL},
-       {"debug",               SET_DEBUG,              MSG_set_debug, NULL},
-       {"xdebug",              SET_X11_DEBUG,          MSG_set_xdebug, NULL},
-       {NULL,                  SET_GROUP_END,          NULL, NULL},
+       {NULL,                  SET_GROUP,              true, MSG_set_source, NULL},
+       {"syssrc",              SET_SYSSRC,             true, MSG_set_syssrc, NULL},
+       {"src",                 SET_SRC,                true, MSG_set_src, NULL},
+       {"sharesrc",            SET_SHARESRC,           true, MSG_set_sharesrc, NULL},
+       {"gnusrc",              SET_GNUSRC,             true, MSG_set_gnusrc, NULL},
+       {"xsrc",                SET_XSRC,               true, MSG_set_xsrc, NULL},
+       {"debug",               SET_DEBUG,              false, MSG_set_debug, NULL},
+       {"xdebug",              SET_X11_DEBUG,          false, MSG_set_xdebug, NULL},
+       {NULL,                  SET_GROUP_END,          false, NULL, NULL},
 
-       {NULL,                  SET_LAST,               NULL, NULL},
+       {NULL,                  SET_LAST,               false, NULL, NULL},
 };
 
 #define MAX_CD_INFOS   16      /* how many media can be found? */
@@ -342,7 +342,8 @@
                if (run_program(RUN_DISPLAY,
                            "sh -c '/bin/cat /mnt2/%s.%s %s %s/%s/%s%s'",
                            set_name, post, write_mode,
-                           target_prefix(), xfer_dir, set_name, dist_postfix))
+                           target_prefix(), xfer_dir, set_name,
+                           set_postfix(set_name)))
                        /* XXX: a read error will give a corrupt file! */
                        continue;
 
@@ -887,7 +888,7 @@
                make_target_dir(xfer_dir);
 
        (void)snprintf(path, sizeof path, "%s/%s%s",
-           ext_dir_for_set(dist->name), dist->name, dist_postfix);
+           ext_dir_for_set(dist->name), dist->name, set_postfix(dist->name));
 
        owd = getcwd(NULL, 0);
 
@@ -907,7 +908,7 @@
         * characters and check again
         */
        (void)snprintf(path, sizeof path, "%s/%.8s%.4s", /* 4 as includes '.' */
-           ext_dir_for_set(dist->name), dist->name, dist_postfix);
+           ext_dir_for_set(dist->name), dist->name, set_postfix(dist->name));
                if (!file_exists_p(path)) {
 #endif /* SUPPORT_8_3_SOURCE_FILESYSTEM */
 
@@ -1743,3 +1744,25 @@
        process_menu(MENU_noyes, &p);
        return p.rv;
 }
+
+bool
+use_tgz_for_set(const char *set_name)
+{
+       const struct distinfo *dist;
+       
+       for (dist = dist_list; dist->set != SET_LAST; dist++) {
+               if (dist->name == NULL)
+                       continue;
+               if (strcmp(set_name, dist->name) == 0)



Home | Main Index | Thread Index | Old Index