aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/README4
-rwxr-xr-xscripts/build/combine_libs10
-rwxr-xr-xscripts/ci/ci-driver.sh146
-rwxr-xr-xscripts/git/git-list-tor-branches.sh11
-rwxr-xr-xscripts/git/git-pull-all.sh18
-rwxr-xr-xscripts/git/git-push-all.sh2
-rwxr-xr-xscripts/git/git-setup-dirs.sh21
-rw-r--r--scripts/maint/checkOptionDocs.pl.in9
-rwxr-xr-xscripts/maint/code-format.sh6
-rwxr-xr-xscripts/maint/format_changelog.py2
-rw-r--r--scripts/maint/geoip/geoip-db-tool/Cargo.lock110
-rw-r--r--scripts/maint/geoip/geoip-db-tool/src/db.rs16
-rw-r--r--scripts/maint/geoip/geoip-db-tool/src/main.rs11
-rwxr-xr-xscripts/maint/geoip/update_geoip.sh14
-rwxr-xr-xscripts/maint/update_versions.py5
15 files changed, 130 insertions, 255 deletions
diff --git a/scripts/README b/scripts/README
index 9cd6e74ac7..4cb49370f5 100644
--- a/scripts/README
+++ b/scripts/README
@@ -12,7 +12,7 @@ never used.
maint/checkOptionDocs.pl -- Make sure that Tor options are documented in the
manpage, and that the manpage only documents real Tor options.
-maint/checkSpaces.pl -- Style checker for the Tor source code. Mainly checks
+maint/checkSpace.pl -- Style checker for the Tor source code. Mainly checks
whitespace.
maint/findMergedChanges.pl -- Find a set of changes/* files that have been
@@ -23,7 +23,7 @@ maint/format_changelog.py -- Flow the changelog into the proper format.
maint/redox.py -- Find places that should have DOCDOC comments to indicate a
need for doxygen comments, and put those comments there.
-maint/updateVersions.pl -- Update the version number in the .nsi and windows
+maint/update_versions.py -- Update the version number in the .nsi and windows
orconfig.h files.
diff --git a/scripts/build/combine_libs b/scripts/build/combine_libs
index a855171dc7..9dec483602 100755
--- a/scripts/build/combine_libs
+++ b/scripts/build/combine_libs
@@ -11,6 +11,15 @@ abspath() {
echo "$(cd "$(dirname "$1")" >/dev/null && pwd)/$(basename "$1")"
}
+apple_symdef_fix() {
+ # On modern macOS and iOS we need to remove the "__.SYMDEF" and "__.SYMDEF
+ # SORTED" before we repack the archive.
+ # See: tor#40683.
+ if [ "$(uname -s)" = "Darwin" ] ; then
+ find . -name "__.SYMDEF*" -delete
+ fi
+}
+
TARGET=$(abspath "$1")
shift
@@ -25,6 +34,7 @@ for input in "$@"; do
done
cd "$TMPDIR" >/dev/null
+apple_symdef_fix
"${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/**
"${RANLIB:-ranlib}" library.tmp.a
mv -f library.tmp.a "$TARGET"
diff --git a/scripts/ci/ci-driver.sh b/scripts/ci/ci-driver.sh
index b5a9c5cbf1..15eab04d41 100755
--- a/scripts/ci/ci-driver.sh
+++ b/scripts/ci/ci-driver.sh
@@ -37,6 +37,7 @@ ALL_BUGS_ARE_FATAL="${ALL_BUGS_ARE_FATAL:-no}"
DISABLE_DIRAUTH="${DISABLE_DIRAUTH:-no}"
DISABLE_RELAY="${DISABLE_RELAY:-no}"
NSS="${NSS:-no}"
+GPL="${GPL:-no}"
# Options for which tests to run. All should be yes/no.
CHECK="${CHECK:-yes}"
@@ -86,6 +87,7 @@ function error()
{
echo "${T_BOLD}${T_RED}ERROR:${T_RESET} $*" 1>&2
}
+
function die()
{
echo "${T_BOLD}${T_RED}FATAL ERROR:${T_RESET} $*" 1>&2
@@ -158,27 +160,27 @@ function show_git_version()
if [[ "${ON_GITLAB}" == "yes" ]]; then
function start_section()
{
- local label="$1"
- local stamp
- stamp=$(date +%s)
- printf "section_start:%s:%s\r\e[0K" "$stamp" "$label"
- echo "${T_BOLD}${T_GREEN}========= $label${T_RESET}"
+ local label="$1"
+ local stamp
+ stamp=$(date +%s)
+ printf "section_start:%s:%s\r\e[0K" "$stamp" "$label"
+ echo "${T_BOLD}${T_GREEN}========= $label${T_RESET}"
}
function end_section()
{
- local label="$1"
- local stamp
- stamp=$(date +%s)
- printf "section_end:%s:%s\r\e[0K" "$stamp" "$label"
+ local label="$1"
+ local stamp
+ stamp=$(date +%s)
+ printf "section_end:%s:%s\r\e[0K" "$stamp" "$label"
}
else
function start_section()
{
- true
+ true
}
function end_section()
{
- true
+ true
}
fi
@@ -199,6 +201,7 @@ yes_or_no ALL_BUGS_ARE_FATAL
yes_or_no DISABLE_DIRAUTH
yes_or_no DISABLE_RELAY
yes_or_no NSS
+yes_or_no GPL
yes_or_no RUN_STAGE_CONFIGURE
yes_or_no RUN_STAGE_BUILD
@@ -261,6 +264,9 @@ fi
if [[ "$NSS" == "yes" ]]; then
configure_options+=("--enable-nss")
fi
+if [[ "$GPL" == "yes" ]]; then
+ configure_options+=("--enable-gpl")
+fi
#############################################################################
# Tell the user about our versions of different tools and packages.
@@ -292,27 +298,11 @@ TOR_VER_AT_LEAST_044=no
# These are the currently supported Tor versions; no need to work with anything
# ancient in this script.
case "$TOR_VERSION" in
- 0.3.*)
- TOR_VER_AT_LEAST_043=no
- TOR_VER_AT_LEAST_044=no
- ;;
- 0.4.[012].*)
- TOR_VER_AT_LEAST_043=no
- TOR_VER_AT_LEAST_044=no
- ;;
- 0.4.3.*)
- TOR_VER_AT_LEAST_043=yes
- TOR_VER_AT_LEAST_044=no
- ;;
- 0.4.4.*)
+ 0.4.7.*)
TOR_VER_AT_LEAST_043=yes
TOR_VER_AT_LEAST_044=yes
;;
- 0.4.5.*)
- TOR_VER_AT_LEAST_043=yes
- TOR_VER_AT_LEAST_044=yes
- ;;
- 0.4.6.*)
+ 0.4.8.*)
TOR_VER_AT_LEAST_043=yes
TOR_VER_AT_LEAST_044=yes
;;
@@ -349,18 +339,18 @@ if [[ "$RUN_STAGE_CONFIGURE" = "yes" ]]; then
start_section "Configure"
if ! runcmd "${CI_SRCDIR}"/configure "${configure_options[@]}" ; then
- error "Here is the end of config.log:"
- runcmd tail config.log
- die "Unable to continue"
+ error "Here is the end of config.log:"
+ runcmd tail config.log
+ die "Unable to continue"
fi
end_section "Configure"
else
debug "Skipping configure stage. Making sure that ${CI_BUILDDIR}/config.log exists."
if [[ ! -d "${CI_BUILDDIR}" ]]; then
- die "Build directory ${CI_BUILDDIR} did not exist!";
+ die "Build directory ${CI_BUILDDIR} did not exist!"
fi
if [[ ! -f "${CI_BUILDDIR}/config.log" ]]; then
- die "Tor was not configured in ${CI_BUILDDIR}!";
+ die "Tor was not configured in ${CI_BUILDDIR}!"
fi
cp config.log "${CI_SRCDIR}"/artifacts
@@ -374,26 +364,26 @@ fi
if [[ "$RUN_STAGE_BUILD" = "yes" ]] ; then
if [[ "$DISTCHECK" = "no" ]]; then
- start_section "Build"
- runcmd make "${make_options[@]}" all
+ start_section "Build"
+ runcmd make "${make_options[@]}" all
cp src/app/tor "${CI_SRCDIR}"/artifacts
- end_section "Build"
+ end_section "Build"
else
- export DISTCHECK_CONFIGURE_FLAGS="${configure_options[*]}"
- # XXXX Set make options?
- start_section Distcheck
- if runcmd make "${make_options[@]}" distcheck ; then
+ export DISTCHECK_CONFIGURE_FLAGS="${configure_options[*]}"
+ # XXXX Set make options?
+ start_section Distcheck
+ if runcmd make "${make_options[@]}" distcheck ; then
hooray "Distcheck was successful. Nothing further will be done."
# We have to exit early here, since we can't do any other tests.
cp tor-*.tar.gz "${CI_SRCDIR}"/artifacts
- exit 0
- else
+ else
error "Diagnostics:"
runcmd make show-distdir-testlog || true
runcmd make show-distdir-core || true
die "Unable to continue."
- fi
- end_section Distcheck
+ fi
+ end_section Distcheck
+ exit 0
fi
fi
@@ -411,9 +401,9 @@ if [[ "${DOXYGEN}" = 'yes' ]]; then
start_section Doxygen
if [[ "${TOR_VER_AT_LEAST_043}" = 'yes' ]]; then
if runcmd make doxygen; then
- hooray "make doxygen has succeeded."
+ hooray "make doxygen has succeeded."
else
- FAILED_TESTS="${FAILED_TESTS} doxygen"
+ FAILED_TESTS="${FAILED_TESTS} doxygen"
fi
else
skipping "make doxygen: doxygen is broken for Tor < 0.4.3"
@@ -457,43 +447,43 @@ if [[ "${CHUTNEY}" = "yes" ]]; then
runcmd "${CHUTNEY_PATH}"/tools/diagnostics.sh || true
# XXXX These next two should be part of a make target.
runcmd ls test_network_log || true
- runcmd cat test_network_log || true
+ runcmd head -n -0 test_network_log/* || true
FAILED_TESTS="${FAILED_TESTS} chutney"
fi
end_section "Chutney"
fi
if [[ "${STEM}" = "yes" ]]; then
- start_section "Stem"
- # 0.3.5 and onward have now disabled onion service v2 so we need to exclude
- # these Stem tests from now on.
- EXCLUDE_TESTS="--exclude-test control.controller.test_ephemeral_hidden_services_v2 --exclude-test control.controller.test_hidden_services_conf --exclude-test control.controller.test_with_ephemeral_hidden_services_basic_auth --exclude-test control.controller.test_without_ephemeral_hidden_services --exclude-test control.controller.test_with_ephemeral_hidden_services_basic_auth_no_credentials"
- if [[ "${TOR_VER_AT_LEAST_044}" = 'yes' ]]; then
- # XXXX This should probably be part of some test-stem make target.
-
- # Disable the check around EXCLUDE_TESTS that requires double quote. We
- # need it to be expanded.
- # shellcheck disable=SC2086
- if runcmd timelimit -p -t 520 -s USR1 -T 30 -S ABRT \
- python3 "${STEM_PATH}/run_tests.py" \
- --tor src/app/tor \
- --integ --test control.controller \
- $EXCLUDE_TESTS \
- --test control.base_controller \
- --test process \
- --log TRACE \
- --log-file stem.log ; then
- hooray "Stem tests have succeeded"
- else
- error "Stem output:"
- runcmd tail -1000 "${STEM_PATH}"/test/data/tor_log
- runcmd grep -v "SocketClosed" stem.log | tail -1000
- FAILED_TESTS="${FAILED_TESTS} stem"
- fi
- else
- skipping "Stem: broken with <= 0.4.3. See bug tor#40077"
- fi
- end_section "Stem"
+ start_section "Stem"
+ # 0.3.5 and onward have now disabled onion service v2 so we need to exclude
+ # these Stem tests from now on.
+ EXCLUDE_TESTS="--exclude-test control.controller.test_ephemeral_hidden_services_v2 --exclude-test control.controller.test_hidden_services_conf --exclude-test control.controller.test_with_ephemeral_hidden_services_basic_auth --exclude-test control.controller.test_without_ephemeral_hidden_services --exclude-test control.controller.test_with_ephemeral_hidden_services_basic_auth_no_credentials --exclude-test control.controller.test_with_detached_ephemeral_hidden_services --exclude-test control.controller.test_with_invalid_ephemeral_hidden_service_port --exclude-test control.controller.test_ephemeral_hidden_services_v3"
+ if [[ "${TOR_VER_AT_LEAST_044}" = 'yes' ]]; then
+ # XXXX This should probably be part of some test-stem make target.
+
+ # Disable the check around EXCLUDE_TESTS that requires double quote. We
+ # need it to be expanded.
+ # shellcheck disable=SC2086
+ if runcmd timelimit -p -t 520 -s USR1 -T 30 -S ABRT \
+ python3 "${STEM_PATH}/run_tests.py" \
+ --tor src/app/tor \
+ --integ --test control.controller \
+ $EXCLUDE_TESTS \
+ --test control.base_controller \
+ --test process \
+ --log TRACE \
+ --log-file stem.log ; then
+ hooray "Stem tests have succeeded"
+ else
+ error "Stem output:"
+ runcmd tail -1000 "${STEM_PATH}"/test/data/tor_log
+ runcmd grep -v "SocketClosed" stem.log | tail -1000
+ FAILED_TESTS="${FAILED_TESTS} stem"
+ fi
+ else
+ skipping "Stem: broken with <= 0.4.3. See bug tor#40077"
+ fi
+ end_section "Stem"
fi
# TODO: Coverage
diff --git a/scripts/git/git-list-tor-branches.sh b/scripts/git/git-list-tor-branches.sh
index 29e91dd1b6..61e7b4a947 100755
--- a/scripts/git/git-list-tor-branches.sh
+++ b/scripts/git/git-list-tor-branches.sh
@@ -143,14 +143,11 @@ finish() {
# List of all branches. These must be in order, from oldest to newest, with
# maint before release.
-branch maint-0.3.5
-branch release-0.3.5
+branch maint-0.4.7
+branch release-0.4.7
-branch maint-0.4.5
-branch release-0.4.5
-
-branch maint-0.4.6
-branch release-0.4.6
+branch maint-0.4.8
+branch release-0.4.8
branch main
diff --git a/scripts/git/git-pull-all.sh b/scripts/git/git-pull-all.sh
index bbe2576d8e..12a0372f73 100755
--- a/scripts/git/git-pull-all.sh
+++ b/scripts/git/git-pull-all.sh
@@ -168,19 +168,6 @@ function fetch_origin
fi
}
-# Fetch tor-gitlab pull requests. No arguments.
-function fetch_tor_gitlab
-{
- local cmd="git fetch tor-gitlab"
- printf "%s Fetching tor-gitlab..." "$MARKER"
- if [ $DRY_RUN -eq 0 ]; then
- msg=$( eval "$cmd" 2>&1 )
- validate_ret $? "$msg"
- else
- printf "\\n %s\\n" "${IWTH}$cmd${CNRM}"
- fi
-}
-
###############
# Entry point #
###############
@@ -188,10 +175,7 @@ function fetch_tor_gitlab
# Get into our origin repository.
goto_repo "$ORIGIN_PATH"
-# First, fetch tor-gitlab
-fetch_tor_gitlab
-
-# Then, fetch the origin.
+# Fetch the origin.
fetch_origin
# Go over all configured worktree.
diff --git a/scripts/git/git-push-all.sh b/scripts/git/git-push-all.sh
index e5c16e615f..0eac616000 100755
--- a/scripts/git/git-push-all.sh
+++ b/scripts/git/git-push-all.sh
@@ -80,7 +80,7 @@ if [ "$TOR_FULL_GIT_PATH" ]; then
fi
# git push command and default arguments
GIT_PUSH=${TOR_GIT_PUSH:-"git push --atomic"}
-# The upstream remote which git.torproject.org/tor.git points to.
+# The upstream remote which gitlab.torproject.org/tpo/core/tor.git points to.
DEFAULT_UPSTREAM_REMOTE=${TOR_UPSTREAM_REMOTE_NAME:-"upstream"}
# Push to a different upstream remote using -r <remote-name>
UPSTREAM_REMOTE=${DEFAULT_UPSTREAM_REMOTE}
diff --git a/scripts/git/git-setup-dirs.sh b/scripts/git/git-setup-dirs.sh
index c502f74f58..f8a85c4928 100755
--- a/scripts/git/git-setup-dirs.sh
+++ b/scripts/git/git-setup-dirs.sh
@@ -40,10 +40,6 @@ function usage()
echo " (current: $GITHUB_PULL)"
echo " TOR_GITHUB_PUSH: the tor-github remote push URL"
echo " (current: $GITHUB_PUSH)"
- echo " TOR_GITLAB_PULL: the tor-gitlab remote pull URL"
- echo " (current: $GITLAB_PULL)"
- echo " TOR_GITLAB_PUSH: the tor-gitlab remote push URL"
- echo " (current: $GITLAB_PUSH)"
echo " TOR_EXTRA_CLONE_ARGS: extra arguments to git clone"
echo " (current: $TOR_EXTRA_CLONE_ARGS)"
echo " TOR_EXTRA_REMOTE_NAME: the name of an extra remote"
@@ -72,9 +68,9 @@ TOR_MASTER_NAME=${TOR_MASTER_NAME:-"tor"}
TOR_WKT_NAME=${TOR_WKT_NAME:-"tor-wkt"}
# Origin repositories
-GIT_ORIGIN_PULL=${TOR_GIT_ORIGIN_PULL:-"https://git.torproject.org/tor.git"}
+GIT_ORIGIN_PULL=${TOR_GIT_ORIGIN_PULL:-"https://gitlab.torproject.org/tpo/core/tor.git"}
GIT_ORIGIN_PUSH=${TOR_GIT_ORIGIN_PUSH:-"git@git-rw.torproject.org:tor.git"}
-# The upstream remote which git.torproject.org/tor.git points to.
+# The upstream remote which gitlab.torproject.org/tpo/core/tor.git points to.
DEFAULT_UPSTREAM_REMOTE=${TOR_UPSTREAM_REMOTE_NAME:-"upstream"}
# Copy the URLs from origin
GIT_UPSTREAM_PULL="$GIT_ORIGIN_PULL"
@@ -87,10 +83,6 @@ fi
GITHUB_PULL=${TOR_GITHUB_PULL:-"https://github.com/torproject/tor.git"}
GITHUB_PUSH=${TOR_GITHUB_PUSH:-"No_Pushing_To_GitHub"}
-# GitLab repositories
-GITLAB_PULL=${TOR_GITLAB_PULL:-"https://gitlab.torproject.org/tpo/core/tor.git"}
-GITLAB_PUSH=${TOR_GITLAB_PUSH:-"No_Pushing_To_GitLab"}
-
##########################
# Git branches to manage #
##########################
@@ -493,15 +485,6 @@ set_tor_github_pr_fetch_config
# Now fetch them all
fetch_remote "tor-github"
-# GitLab remote
-printf "%s Setting up remote %s\\n" "$MARKER" "${BYEL}tor-gitlab${CNRM}"
-add_remote "tor-gitlab" "$GITLAB_PULL"
-set_remote_push "tor-gitlab" "$GITLAB_PUSH"
-# Add custom fetch for MRs
-set_tor_gitlab_mr_fetch_config
-# Now fetch them all
-fetch_remote "tor-gitlab"
-
# Extra remote
if [ "$TOR_EXTRA_REMOTE_NAME" ]; then
printf "%s Setting up remote %s\\n" "$MARKER" \
diff --git a/scripts/maint/checkOptionDocs.pl.in b/scripts/maint/checkOptionDocs.pl.in
index 2d4a7884f5..d2c2a838d6 100644
--- a/scripts/maint/checkOptionDocs.pl.in
+++ b/scripts/maint/checkOptionDocs.pl.in
@@ -41,9 +41,16 @@ loadTorrc("@abs_top_srcdir@/src/config/torrc.sample.in", \%torrcSampleOptions);
my $considerNextLine = 0;
open(F, "@abs_top_srcdir@/doc/man/tor.1.txt") or die;
while (<F>) {
- if (m!^(?:\[\[([A-za-z0-9_]+)\]\] *)?\*\*([A-Za-z0-9_]+)\*\*!) {
+ if (m!^(?:\[\[([A-za-z0-9_]+)\]\] *)?\*\*([A-Za-z0-9_]+)\*\*! && $considerNextLine) {
$manPageOptions{$2} = 1;
print "Missing an anchor: $2\n" unless (defined $1 or $2 eq 'tor');
+ $considerNextLine = 1;
+ } elsif (m!^\s*$! or
+ m!^\s*\+\s*$! or
+ m!^\s*//!) {
+ $considerNextLine = 1;
+ } else {
+ $considerNextLine = 0;
}
}
close F;
diff --git a/scripts/maint/code-format.sh b/scripts/maint/code-format.sh
index d8f597d70d..5998e96f68 100755
--- a/scripts/maint/code-format.sh
+++ b/scripts/maint/code-format.sh
@@ -160,11 +160,17 @@ if [[ $GITIDX = 1 ]]; then
# partially staged.
note "Stashing unstaged changes"
git stash -q --keep-index
+ # For some reasons, shellcheck is not seeing that we can call this
+ # function from the trap below.
+ # shellcheck disable=SC2317
function restoregit() {
note "Restoring git state"
git stash pop -q
}
else
+ # For some reasons, shellcheck is not seeing that we can call this
+ # function from the trap below.
+ # shellcheck disable=SC2317
function restoregit() {
true
}
diff --git a/scripts/maint/format_changelog.py b/scripts/maint/format_changelog.py
index 93ab56e257..32b47ffcbb 100755
--- a/scripts/maint/format_changelog.py
+++ b/scripts/maint/format_changelog.py
@@ -424,7 +424,7 @@ def bug_html(m):
try:
disp_prefix, url_prefix = ISSUE_PREFIX_MAP[prefix]
except KeyError:
- print("Can't figure out URL for {}{}".formt(prefix,bugno),
+ print("Can't figure out URL for {}{}".format(prefix,bugno),
file=sys.stderr)
return "{} {}{}".format(kind, prefix, bugno)
diff --git a/scripts/maint/geoip/geoip-db-tool/Cargo.lock b/scripts/maint/geoip/geoip-db-tool/Cargo.lock
deleted file mode 100644
index ba610d4fc3..0000000000
--- a/scripts/maint/geoip/geoip-db-tool/Cargo.lock
+++ /dev/null
@@ -1,110 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-[[package]]
-name = "argh"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91792f088f87cdc7a2cfb1d617fa5ea18d7f1dc22ef0e1b5f82f3157cdc522be"
-dependencies = [
- "argh_derive",
- "argh_shared",
-]
-
-[[package]]
-name = "argh_derive"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4eb0c0c120ad477412dc95a4ce31e38f2113e46bd13511253f79196ca68b067"
-dependencies = [
- "argh_shared",
- "heck",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "argh_shared"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "781f336cc9826dbaddb9754cb5db61e64cab4f69668bd19dcc4a0394a86f4cb1"
-
-[[package]]
-name = "geoip-db-tool"
-version = "0.1.0"
-dependencies = [
- "argh",
- "ipnetwork",
- "rangemap",
-]
-
-[[package]]
-name = "heck"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
-dependencies = [
- "unicode-segmentation",
-]
-
-[[package]]
-name = "ipnetwork"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02c3eaab3ac0ede60ffa41add21970a7df7d91772c03383aac6c2c3d53cc716b"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.24"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
-dependencies = [
- "unicode-xid",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "rangemap"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90531bef860f96441c4cb74a1e43c281cd1366143928f944546ef0b1c60392b0"
-
-[[package]]
-name = "serde"
-version = "1.0.123"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae"
-
-[[package]]
-name = "syn"
-version = "1.0.60"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-xid",
-]
-
-[[package]]
-name = "unicode-segmentation"
-version = "1.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
-
-[[package]]
-name = "unicode-xid"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
diff --git a/scripts/maint/geoip/geoip-db-tool/src/db.rs b/scripts/maint/geoip/geoip-db-tool/src/db.rs
index 316182d823..3d631a3f98 100644
--- a/scripts/maint/geoip/geoip-db-tool/src/db.rs
+++ b/scripts/maint/geoip/geoip-db-tool/src/db.rs
@@ -13,9 +13,9 @@ where
}
pub enum AnyBlock {
- NetBlock(NetBlock),
- AsBlock(AsBlock),
- OtherBlock,
+ Net(NetBlock),
+ As(AsBlock),
+ Other,
}
impl<I> BlockReader<I>
@@ -50,13 +50,13 @@ where
fn get_block(&mut self) -> Option<std::io::Result<AnyBlock>> {
let mut kv = HashMap::new();
- while let Some(line) = self.iter.next() {
+ for line in self.iter.by_ref() {
//dbg!(&line);
if let Err(e) = line {
return Some(Err(e));
}
let line_orig = line.unwrap();
- let line = line_orig.splitn(2, '#').next().unwrap().trim();
+ let line = line_orig.split('#').next().unwrap().trim();
if line.is_empty() {
if kv.is_empty() {
continue;
@@ -80,13 +80,13 @@ where
let asn = kv.get("aut-num").unwrap(); // XXXX handle error better
assert!(asn.starts_with("AS"));
let asn = asn[2..].parse().unwrap();
- return Some(Ok(AnyBlock::AsBlock(AsBlock { name, asn })));
+ return Some(Ok(AnyBlock::As(AsBlock { name, asn })));
}
let net = if let Some(net) = kv.get("net") {
net.parse().unwrap() //XXXX handle the error better.
} else {
- return Some(Ok(AnyBlock::OtherBlock));
+ return Some(Ok(AnyBlock::Other));
};
let asn = if let Some(asn) = kv.get("aut-num") {
@@ -113,7 +113,7 @@ where
let is_anycast = is_true(kv.get("is-anycast-proxy"));
let is_satellite = is_true(kv.get("is-satellite-provider"));
- Some(Ok(AnyBlock::NetBlock(NetBlock {
+ Some(Ok(AnyBlock::Net(NetBlock {
net,
asn,
cc,
diff --git a/scripts/maint/geoip/geoip-db-tool/src/main.rs b/scripts/maint/geoip/geoip-db-tool/src/main.rs
index 9a22598a35..cbadd6623f 100644
--- a/scripts/maint/geoip/geoip-db-tool/src/main.rs
+++ b/scripts/maint/geoip/geoip-db-tool/src/main.rs
@@ -122,8 +122,11 @@ impl NetDefn {
const PROLOGUE: &str = "\
# This file has been converted from the IPFire Location database
-# using Tor's geoip-db-tool. For more information on the data, see
-# https://location.ipfire.org/.
+# using Tor's geoip-db-tool, which is available in the
+# scripts/maint/geoip/geoip-db-tool directory in the Tor source
+# code repository at https://gitlab.torproject.org/tpo/core/tor/ .
+#
+# For more information on the data, see https://location.ipfire.org/.
#
# Below is the header from the original export:
#
@@ -149,8 +152,8 @@ fn convert(args: Args) -> std::io::Result<()> {
// Read blocks, and then sort them by specificity and address.
for nb in reader {
match nb {
- db::AnyBlock::AsBlock(a) => networks.push(a),
- db::AnyBlock::NetBlock(n) => blocks.push(n),
+ db::AnyBlock::As(a) => networks.push(a),
+ db::AnyBlock::Net(n) => blocks.push(n),
_ => {}
}
}
diff --git a/scripts/maint/geoip/update_geoip.sh b/scripts/maint/geoip/update_geoip.sh
index 743683ab62..c48f4b1b45 100755
--- a/scripts/maint/geoip/update_geoip.sh
+++ b/scripts/maint/geoip/update_geoip.sh
@@ -5,12 +5,22 @@ set -e
DIR=$(cd "$(dirname "$0")" && pwd)
TMP=$(mktemp -d)
-location --quiet update
+DB_PATH="/var/lib/location/database.db"
+
+# In case it exists as a dead symlink.
+if [ -h "$DB_PATH" ]; then
+ unlink "$DB_PATH"
+elif [ -e "$DB_PATH" ]; then
+ rm -f "$DB_PATH"
+fi
+
+curl -o "$DB_PATH.xz" "https://location.ipfire.org/databases/1/location.db.xz"
+xz -d "$DB_PATH.xz"
location dump "$TMP/geoip-dump.txt"
OLDDIR=$(pwd)
cd "$DIR/geoip-db-tool/"
-cargo build --release
+cargo build --release --target-dir "target"
cd "$OLDDIR"
"$DIR/geoip-db-tool/target/release/geoip-db-tool" -i "$TMP/geoip-dump.txt"
diff --git a/scripts/maint/update_versions.py b/scripts/maint/update_versions.py
index 07de1c343a..361dbe2cd3 100755
--- a/scripts/maint/update_versions.py
+++ b/scripts/maint/update_versions.py
@@ -129,8 +129,3 @@ update_file(P("contrib/win32build/tor-mingw.nsi.in"),
re.compile(r'!define VERSION .*'),
u'!define VERSION "{}"'.format(version),
encoding="iso-8859-1")
-
-# In src/win32/orconfig.h, we replace the definition of VERSION.
-update_file(P("src/win32/orconfig.h"),
- re.compile(r'#define VERSION .*'),
- u'#define VERSION "{}"'.format(version))