summaryrefslogtreecommitdiff
path: root/scripts/maint
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/maint')
-rw-r--r--scripts/maint/checkOptionDocs.pl.in9
-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
6 files changed, 35 insertions, 130 deletions
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/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))