From b00a59c0b953bf7688fc60a976bac74194886a0c Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 20 Mar 2022 11:45:31 +0100 Subject: dselect: Add https support Recognize the method and update the documentation and prompts. --- doc/guide.dbk | 1 + doc/method.dbk | 1 + doc/po/apt-doc.pot | 3 ++- doc/po/de.po | 2 ++ doc/po/es.po | 2 ++ doc/po/fr.po | 3 +++ doc/po/it.po | 2 ++ doc/po/ja.po | 2 ++ doc/po/nl.po | 2 ++ doc/po/pl.po | 2 ++ doc/po/pt.po | 2 ++ doc/po/pt_BR.po | 1 + dselect/desc.apt | 6 +++--- dselect/names | 2 +- dselect/setup | 5 +++-- 15 files changed, 29 insertions(+), 7 deletions(-) diff --git a/doc/guide.dbk b/doc/guide.dbk index bb314fdd5..32674ca14 100644 --- a/doc/guide.dbk +++ b/doc/guide.dbk @@ -223,6 +223,7 @@ use packages on your CD-ROM before downloading from the Internet. For example: file:/mnt/debian, + https://deb.debian.org/debian, http://deb.debian.org/debian, diff --git a/doc/method.dbk b/doc/method.dbk index 2ec1f3e3e..eb4ae407a 100644 --- a/doc/method.dbk +++ b/doc/method.dbk @@ -159,6 +159,7 @@ Some examples: file:/var/mirrors/debian/ ftp://ftp.example.org/debian +https://deb.debian.org/debian ftp://jgg:MooCow@localhost:21/debian nfs://bigred/var/mirrors/debian rsync://debian.midco.net/debian diff --git a/doc/po/apt-doc.pot b/doc/po/apt-doc.pot index 5801149de..bc4fbbce0 100644 --- a/doc/po/apt-doc.pot +++ b/doc/po/apt-doc.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 3.0.1\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2025-05-06 17:57+0200\n" +"POT-Creation-Date: 2025-05-19 17:43+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -9040,6 +9040,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" diff --git a/doc/po/de.po b/doc/po/de.po index e478dd2f0..2dd6d6a1b 100644 --- a/doc/po/de.po +++ b/doc/po/de.po @@ -12791,6 +12791,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" @@ -12803,6 +12804,7 @@ msgstr "" "\n" " Zum Beispiel:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" diff --git a/doc/po/es.po b/doc/po/es.po index 4b01f2511..48d4b78e1 100644 --- a/doc/po/es.po +++ b/doc/po/es.po @@ -12082,6 +12082,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" @@ -12094,6 +12095,7 @@ msgstr "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" diff --git a/doc/po/fr.po b/doc/po/fr.po index 0edf3c6ac..0e6b70114 100644 --- a/doc/po/fr.po +++ b/doc/po/fr.po @@ -12815,6 +12815,7 @@ msgstr "" #| "\n" #| " For example:\n" #| " file:/mnt/debian,\n" +#|" https://deb.debian.org/debian,\n" #| " ftp://ftp.debian.org/debian,\n" #| " http://ftp.de.debian.org/debian,\n" #| "\n" @@ -12828,6 +12829,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" @@ -12841,6 +12843,7 @@ msgstr "" " Exemple :\n" " file:/mnt/debian,\n" " ftp://ftp.debian.org/debian,\n" +" https://deb.debian.org/debian,\n" " http://ftp.de.debian.org/debian,\n" "\n" "\n" diff --git a/doc/po/it.po b/doc/po/it.po index 47271f4a6..3afd11924 100644 --- a/doc/po/it.po +++ b/doc/po/it.po @@ -12426,6 +12426,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" @@ -12438,6 +12439,7 @@ msgstr "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" diff --git a/doc/po/ja.po b/doc/po/ja.po index 5845814a6..a8d861404 100644 --- a/doc/po/ja.po +++ b/doc/po/ja.po @@ -11924,6 +11924,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" @@ -11936,6 +11937,7 @@ msgstr "" "\n" " 例:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" diff --git a/doc/po/nl.po b/doc/po/nl.po index 67c3c32d5..0e69452ff 100644 --- a/doc/po/nl.po +++ b/doc/po/nl.po @@ -12932,6 +12932,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" @@ -12944,6 +12945,7 @@ msgstr "" "\n" " Bijvoorbeeld:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" diff --git a/doc/po/pl.po b/doc/po/pl.po index 6a14d5b49..48d37fb2f 100644 --- a/doc/po/pl.po +++ b/doc/po/pl.po @@ -11273,6 +11273,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" @@ -11285,6 +11286,7 @@ msgstr "" "\n" " Przykłady:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://ftp.pl.debian.org/debian,\n" "\n" "\n" diff --git a/doc/po/pt.po b/doc/po/pt.po index d77ff1a03..646366232 100644 --- a/doc/po/pt.po +++ b/doc/po/pt.po @@ -12629,6 +12629,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" @@ -12641,6 +12642,7 @@ msgstr "" "\n" " Por exemplo:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" diff --git a/doc/po/pt_BR.po b/doc/po/pt_BR.po index e30868092..e7872b5c0 100644 --- a/doc/po/pt_BR.po +++ b/doc/po/pt_BR.po @@ -9401,6 +9401,7 @@ msgid "" "\n" " For example:\n" " file:/mnt/debian,\n" +" https://deb.debian.org/debian,\n" " http://deb.debian.org/debian,\n" "\n" "\n" diff --git a/dselect/desc.apt b/dselect/desc.apt index 5601919ac..dac14253c 100644 --- a/dselect/desc.apt +++ b/dselect/desc.apt @@ -1,8 +1,8 @@ The APT installation method encompasses most other installation methods under the umbrella of the new Package Acquisition code. This method allows -installation from locations in the filesystem, ftp and http URLs, supports -full installation ordering and dependency checking as well as multiple -sources. See the man pages apt-get(8) and sources.list(5) +installation from locations in the filesystem, https, http and ftp URLs, +supports full installation ordering and dependency checking as well as +multiple sources. See the man pages apt-get(8) and sources.list(5) HTTP proxies can be used by setting http_proxy="http://proxy:port/" before running DSelect. FTP proxies require special configuration detailed in diff --git a/dselect/names b/dselect/names index 8daa53782..58294c82d 100644 --- a/dselect/names +++ b/dselect/names @@ -1 +1 @@ -70 apt APT Acquisition [file,http,ftp] +70 apt APT Acquisition [file,https,http,ftp] diff --git a/dselect/setup b/dselect/setup index 522362e68..6b816ccfe 100755 --- a/dselect/setup +++ b/dselect/setup @@ -29,7 +29,7 @@ my $boldon=`setterm -bold on`; my $boldoff=`setterm -bold off`; my @known_types = ('deb'); -my @known_access = ('http', 'ftp', 'file'); +my @known_access = ('https', 'http', 'ftp', 'file'); my @typical_distributions = ('stable', 'unstable', 'testing'); my @typical_components = ('main', 'contrib', 'non-free', 'non-free-firmware'); @@ -118,7 +118,7 @@ sub get_source { } $type = 'deb'; - $urn = "http://deb.debian.org/debian" unless $urn; + $urn = "https://deb.debian.org/debian" unless $urn; $distribution = "stable" unless $distribution; $components = "main contrib non-free non-free-firmware" unless $components; @@ -232,6 +232,7 @@ sub get_sources { print " For example:\n"; print " file:/mnt/debian,\n"; print " ftp://ftp.example.org/debian,\n"; + print " https://deb.debian.org/debian,\n"; print " http://deb.debian.org/debian,\n"; # print " and the special mirror scheme,\n"; # print " mirror:http://www.debian.org/archivemirrors \n"; -- cgit v1.2.3-70-g09d2 From 4d6fcb1dddd5654e7ba8bfa2705bbb4f2c4a6884 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 20 Mar 2022 11:48:43 +0100 Subject: dselect: Pass available file from stdin to dpkg --update-avail The dpkg --update-avail command has supported reading from stdin since dpkg 1.17.7. This removes a temporary file which can be very big nowadays. --- dselect/update | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dselect/update b/dselect/update index 0ab317ee4..057e26e65 100755 --- a/dselect/update +++ b/dselect/update @@ -28,10 +28,11 @@ STATUS=1 if $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" update then echo $"Merging available information" + # XXX: Make sure we remove an old intermediate file that we used to feed + # to dpkg, until enough time has passed that we have some guarantee it + # is no longer left over in the cache directory (since apt 2.9.x). rm -f $CACHEDIR/available - $APTCACHE dumpavail > $CACHEDIR/available - $DPKG "$DPKG_OPTS" --update-avail $CACHEDIR/available - rm -f $CACHEDIR/available + $APTCACHE dumpavail | $DPKG "$DPKG_OPTS" --update-avail case "$CLEAN" in Pre-Auto|PreAuto|pre-auto) -- cgit v1.2.3-70-g09d2 From 45466eb7dff31b60b834bbc8b78d0b0bf562bba3 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 20 Mar 2022 12:00:22 +0100 Subject: dselect: Refactor bold printing into its own function --- dselect/setup | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/dselect/setup b/dselect/setup index 6b816ccfe..ba1a4ca33 100755 --- a/dselect/setup +++ b/dselect/setup @@ -36,6 +36,12 @@ my @typical_components = ('main', 'contrib', 'non-free', 'non-free-firmware') my %known_access = map {($_,$_)} @known_access; my %typical_distributions = map {($_,$_)} @typical_distributions; +sub print_bold { + my $msg = shift; + + print "$boldon$msg$boldoff"; +} + # Read the config file, creating source records sub read_config { my %params = @_; @@ -130,7 +136,7 @@ sub get_source { while (!$done) { print "\n"; - print "$boldon URL [$urn]: $boldoff"; + print_bold(" URL [$urn]: "); $answer=; chomp ($answer); @@ -159,10 +165,10 @@ sub get_source { print " Please give the distribution tag to get or a path to the\n"; print " package file ending in a /. The distribution\n"; - print " tags are typically something like:$boldon "; - print join(' ', @typical_distributions), "$boldoff\n"; + print " tags are typically something like: "; + print_bold(join(' ', @typical_distributions) . "\n"); print "\n"; - print "$boldon Distribution [$distribution]:$boldoff "; + print_bold(" Distribution [$distribution]: "); $answer=; chomp ($answer); $answer =~ s/\s*//og; @@ -193,10 +199,10 @@ sub get_components { print "\n"; print " Please give the components to get\n"; - print " The components are typically something like:$boldon "; - print join(' ', @typical_components), "$boldoff\n"; + print " The components are typically something like: "; + print_bold(join(' ', @typical_components) . "\n"); print "\n"; - print "$boldon Components [$default]:$boldoff "; + print_bold(" Components [$default]: "); $answer=; chomp ($answer); $answer =~ s/\s+/ /og; @@ -219,12 +225,12 @@ sub get_sources { @Oldconfig = &read_config('Filename' => $config_file) } - print "\t$boldon Set up a list of distribution source locations $boldoff \n"; + print_bold("\t Set up a list of distribution source locations\n"); print "\n"; print " Please give the base URL of the debian distribution.\n"; - print " The access schemes I know about are:$boldon "; - print join (' ', @known_access), "$boldoff\n"; + print " The access schemes I know about are: "; + print_bold(join (' ', @known_access) . "\n"); # print " The mirror scheme is special that it does not specify the\n"; # print " location of a debian archive but specifies the location\n"; # print " of a list of mirrors to use to access the archive.\n"; @@ -247,7 +253,7 @@ sub get_sources { push (@Config, &get_source()); } print "\n"; - print "$boldon Would you like to add another source?[y/N]$boldoff "; + print_bold(" Would you like to add another source? [y/N] "); my $answer = ; chomp ($answer); $answer =~ s/\s+/ /og; @@ -266,11 +272,11 @@ sub main { if (-e $config_file) { my @Oldconfig = &read_config('Filename' => $config_file); - print "$boldon I see you already have a source list.$boldoff\n"; + print_bold(" I see you already have a source list.\n"); print "-" x 72, "\n"; &print_config('Config' => \@Oldconfig); print "-" x 72, "\n"; - print "$boldon Do you wish to overwrite it? [y/N]$boldoff "; + print_bold(" Do you wish to overwrite it? [y/N] "); my $answer = ; chomp ($answer); $answer =~ s/\s+/ /og; -- cgit v1.2.3-70-g09d2 From d8f4038b45507620f7696fecd8527345f1f384db Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 20 Mar 2022 12:03:44 +0100 Subject: dselect: Use strict and warnings pragmas Move the warnings from the shebang into a proper pragma, so that we are sure it will be enabled regardless of the script being called explicitly without the flag. --- dselect/setup | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dselect/setup b/dselect/setup index ba1a4ca33..ac910d1c1 100755 --- a/dselect/setup +++ b/dselect/setup @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # -*- Mode: Perl -*- # setup.pl --- # Author : Manoj Srivastava ( srivasta@tiamat.datasync.com ) @@ -14,7 +14,8 @@ # This file is designed to go into /usr/lib/apt/methods/setup # -#use strict; +use strict; +use warnings; #use diagnostics; #printf STDERR "DEBUG: Arguments $ARGV[0];$ARGV[1];$ARGV[2];\n"; -- cgit v1.2.3-70-g09d2 From 372d90ec8a395b77f2aec94174054021231e695d Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 20 Mar 2022 12:06:50 +0100 Subject: dselect: Use Term::ANSIColor instead of forking setterm --- dselect/setup | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dselect/setup b/dselect/setup index ac910d1c1..3d4bc6309 100755 --- a/dselect/setup +++ b/dselect/setup @@ -20,14 +20,16 @@ use warnings; #printf STDERR "DEBUG: Arguments $ARGV[0];$ARGV[1];$ARGV[2];\n"; +use Term::ANSIColor; + # Handle the arguments my $vardir=$ARGV[0]; my $method=$ARGV[1]; my $option=$ARGV[2]; my $config_file = '/etc/apt/sources.list'; -my $boldon=`setterm -bold on`; -my $boldoff=`setterm -bold off`; +my $boldon = color('bold'); +my $boldoff = color('reset'); my @known_types = ('deb'); my @known_access = ('https', 'http', 'ftp', 'file'); -- cgit v1.2.3-70-g09d2 From 6eb1c4cff637caad5713dd3fb569dc460b59a579 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 20 Mar 2022 12:08:35 +0100 Subject: dselect: Use qw() instead of lists of quoted strings --- dselect/setup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dselect/setup b/dselect/setup index 3d4bc6309..cea4b9caf 100755 --- a/dselect/setup +++ b/dselect/setup @@ -31,10 +31,10 @@ my $config_file = '/etc/apt/sources.list'; my $boldon = color('bold'); my $boldoff = color('reset'); -my @known_types = ('deb'); -my @known_access = ('https', 'http', 'ftp', 'file'); -my @typical_distributions = ('stable', 'unstable', 'testing'); -my @typical_components = ('main', 'contrib', 'non-free', 'non-free-firmware'); +my @known_types = qw(deb); +my @known_access = qw(https http ftp file); +my @typical_distributions = qw(stable unstable testing); +my @typical_components = qw(main contrib non-free non-free-firmware); my %known_access = map {($_,$_)} @known_access; my %typical_distributions = map {($_,$_)} @typical_distributions; -- cgit v1.2.3-70-g09d2 From e17f8916fd32228009293087a6fdc6d8c9c9db9f Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 20 Mar 2022 12:23:18 +0100 Subject: dselect: Replaces obsolete file comment header with copyright and SPDX marker The information in the header was probably mostly useful to the author, but even then, it seems it has long past its usefulness once it got integrated into apt proper. --- dselect/setup | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/dselect/setup b/dselect/setup index cea4b9caf..aed7baa26 100755 --- a/dselect/setup +++ b/dselect/setup @@ -1,18 +1,7 @@ #!/usr/bin/perl -# -*- Mode: Perl -*- -# setup.pl --- -# Author : Manoj Srivastava ( srivasta@tiamat.datasync.com ) -# Created On : Wed Mar 4 15:11:47 1998 -# Created On Node : tiamat.datasync.com -# Last Modified By : Manoj Srivastava -# Last Modified On : Tue May 19 11:25:32 1998 -# Last Machine Used: tiamat.datasync.com -# Update Count : 87 -# Status : Unknown, Use with caution! -# HISTORY : -# Description : -# This file is designed to go into /usr/lib/apt/methods/setup -# +# Copyright (c) 1998 Manoj Srivastava +# +# SPDX-License-Identifier: GPL-2.0+ use strict; use warnings; -- cgit v1.2.3-70-g09d2