pkgsrc-Bugs archive

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

pkg/53697: Introduction of 'tar.xz' extension for system sets requires modification to sysupgrade



>Number:         53697
>Category:       pkg
>Synopsis:       Introduction of 'tar.xz' extension for system sets requires modification to sysupgrade
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 03 14:15:00 +0000 2018
>Originator:     Chavdar Ivanov
>Release:        Current pkgsrc as of 2018/11/03
>Organization:
CI4 Consulting Ltd
>Environment:
NetBSD tarkus 8.99.25 NetBSD 8.99.25 (GENERIC) #0: Sat Nov  3 03:33:22 GMT 2018  sysbuild@ymir:/home/sysbuild/sysbuild/amd64/obj/home/sysbuild/src/sys/arch/amd64/compile/GENERIC amd64

>Description:
Until recently the system sets of a NetBSD distribution were in '.tgz' format. This was hardcoded in the sysutils/sysupgrade package. Now NetBSD-current uses '.tar.xz' extension with obviously different compression. The sysupgrade utility fails.i

The attached patch to sysupgrade,sh introduces support for '.tar.xz' while maintaining the ability to use '.tgz' as well. 
>How-To-Repeat:
Try to use sysupgrade with recent -current distribution using '.tar.xz' sets. 
>Fix:
--- sysupgrade.sh.orig	2018-11-03 13:02:13.466845937 +0000
+++ sysupgrade.sh	2018-11-03 13:01:17.707244783 +0000
@@ -39,7 +39,7 @@
 #
 # Please remember to update sysbuild(1) if you change this list.
 SYSUPGRADE_CONFIG_VARS="AUTOCLEAN CACHEDIR DESTDIR ETCUPDATE KERNEL
-                        POSTINSTALL_AUTOFIX RELEASEDIR SETS"
+                        POSTINSTALL_AUTOFIX RELEASEDIR SETS EXT"
 
 
 # Directory in which to keep downloaded release files.
@@ -163,18 +163,19 @@
 # The set to be extracted must have been previously fetched into the cache
 # directory by sysupgrade_fetch command.
 #
-# \param set_name Name of the set to extract, without the .tgz extension.
+# \param set_name Name of the set to extract, without the .tgz  or .tar.xz extension.
 extract_set() {
+    local extension="$(shtk_config_get EXT)"
     local set_name="${1}"; shift
 
-    require_cached_file "${set_name}.tgz"
+    require_cached_file "${set_name}${extension}"
 
     local destdir="$(shtk_config_get_default DESTDIR "")"
-    local set_tgz="$(get_cached_file "${set_name}.tgz")"
+    local set_ext="$(get_cached_file "${set_name}${extension}")"
 
     shtk_cli_info "Extracting ${set_name} into ${destdir}/"
     [ -z "${destdir}" ] || shtk_process_run mkdir -p "${destdir}"
-    progress -zf "${set_tgz}" tar -xp -C "${destdir}/" -f -
+    progress -zf "${set_ext}" tar -xp -C "${destdir}/" -f -
 }
 
 
@@ -188,10 +189,13 @@
     [ -z "${1}" ] || shtk_config_set "RELEASEDIR" "${1}"
 
     local releasedir="$(shtk_config_get RELEASEDIR)"
+    shtk_config_set EXT ".tgz"
+    [[ -f ${releasedir}/base${EXT} || shtk_config_set EXT '.tar.xz'
+    local extension="$(shtk_config_get EXT)"
     local cachedir="$(shtk_config_get CACHEDIR)"
     local fetch_files=
     for set_name in $(shtk_config_get SETS); do
-        fetch_files="${fetch_files} binary/sets/${set_name}.tgz"
+        fetch_files="${fetch_files} binary/sets/${set_name}${extension}"
     done
     if shtk_config_has KERNEL; then
         local kernel_name="$(shtk_config_get KERNEL)"
@@ -321,6 +325,7 @@
 # \param ... Names of the sets to extract, to override SETS.
 sysupgrade_sets() {
     local sets=
+    local extension="$(shtk_config_get EXT)"
     for set_name in "${@:-$(shtk_config_get SETS)}"; do
         case "${set_name}" in
             *etc) ;;  # Handled by etcupdate.
@@ -334,7 +339,7 @@
     done
 
     for set_name in ${sets}; do
-        require_cached_file "${set_name}.tgz"
+        require_cached_file "${set_name}${extension}"
     done
 
     shtk_cli_info "Upgrading base system"
@@ -346,6 +351,7 @@
 
 # Runs etcupdate to install new configuration files.
 sysupgrade_etcupdate() {
+    local extension="$(shtk_config_get EXT)"
     [ ${#} -eq 0 ] || shtk_cli_usage_error "etcupdate does not take any" \
         "arguments"
 
@@ -366,8 +372,8 @@
 
     local sflags=
     for set_name in ${sets}; do
-        require_cached_file "${set_name}.tgz"
-        sflags="${sflags} -s$(get_cached_file "${set_name}.tgz")"
+        require_cached_file "${set_name}${extension}"
+        sflags="${sflags} -s$(get_cached_file "${set_name}${extension}")"
     done
 
     shtk_cli_info "Upgrading /etc interactively"
@@ -379,6 +385,7 @@
 #
 # \param ... Arguments to pass to postinstall(8).
 sysupgrade_postinstall() {
+    local extension="$(shtk_config_get EXT)"
     local sets=
     local sets="$(shtk_list_filter '*etc' $(shtk_config_get SETS))"
     if [ -z "${sets}" ]; then
@@ -392,8 +399,8 @@
 
     local sflags=
     for set_name in ${sets}; do
-        require_cached_file "${set_name}.tgz"
-        sflags="${sflags} -s$(get_cached_file "${set_name}.tgz")"
+        require_cached_file "${set_name}${extension}"
+        sflags="${sflags} -s$(get_cached_file "${set_name}${extension}")"
     done
 
     shtk_cli_info "Performing postinstall checks"



Home | Main Index | Thread Index | Old Index