Skip to content

Commit

Permalink
Temporarily Revert "2.3-only: Warn that the 0.1 protocol is deprecated"
Browse files Browse the repository at this point in the history
This reverts commit 6412747.
  • Loading branch information
julian-klode committed Apr 29, 2021
1 parent c61d791 commit b60cda7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
1 change: 0 additions & 1 deletion apt-private/private-json-hooks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ bool RunJsonHook(std::string const &option, std::string const &method, const cha

if (strstr(line, "\"0.1\""))
{
_error->Warning("Hook %s uses deprecated 0.1 protocol", Opts->Value.c_str());
hookVersion = 0x010;
}
else if (strstr(line, "\"0.2\""))
Expand Down
18 changes: 7 additions & 11 deletions test/integration/test-apt-cli-json-hooks
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ HOOK: BYE' apt dist-upgrade -s
################## version 0.1 #########################
TEST_HOOK_VERSION=0.1

testequal 'Reading package lists...
testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
HOOK: HELLO
Expand Down Expand Up @@ -231,11 +231,7 @@ HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"par
HOOK: empty
HOOK: request {"jsonrpc":"2.0","method":"org.debian.apt.hooks.install.post","params":{"command":"dist-upgrade","search-terms":[],"unknown-packages":[],"packages":[{"id":1,"name":"upgrade","architecture":"i386","mode":"install","automatic":false,"versions":{"candidate":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"install":{"id":1,"version":"2.0","architecture":"i386","pin":500,"origins":[{"archive":"testing","codename":"testing","origin":"Oranges","label":"Lemons","site":""}]},"current":{"id":4,"version":"1.0","architecture":"i386","pin":100,"origins":[]}}}]}}
HOOK: empty
HOOK: BYE
W: Hook '$HOOK' uses deprecated 0.1 protocol
W: Hook '$HOOK' uses deprecated 0.1 protocol
W: Hook '$HOOK' uses deprecated 0.1 protocol
W: Hook '$HOOK' uses deprecated 0.1 protocol' apt dist-upgrade -s
HOOK: BYE' apt dist-upgrade -s


################## Wrong version #########################
Expand Down Expand Up @@ -267,7 +263,7 @@ while true; do
read empty <&\$APT_HOOK_SOCKET
if echo "\$request" | grep -q ".hello"; then
printf '{"jsonrpc": "2.0", "error": {"version": "0.2"}, "id": 0}\n\n' >&\$APT_HOOK_SOCKET
printf '{"jsonrpc": "2.0", "error": {"version": "0.1"}, "id": 0}\n\n' >&\$APT_HOOK_SOCKET
break
fi
done
Expand All @@ -277,8 +273,8 @@ EOF

testfailureequal 'Reading package lists...
Building dependency tree...
E: Hook '$HOOK' reported an error during hello: {"jsonrpc": "2.0", "error": {"version": "0.2"}, "id": 0}
E: Hook '$HOOK' reported an error during hello: {"jsonrpc": "2.0", "error": {"version": "0.2"}, "id": 0}' apt install foo -s
E: Hook '$HOOK' reported an error during hello: {"jsonrpc": "2.0", "error": {"version": "0.1"}, "id": 0}
E: Hook '$HOOK' reported an error during hello: {"jsonrpc": "2.0", "error": {"version": "0.1"}, "id": 0}' apt install foo -s

################## Missing separator line #########################
cat > json-hook.sh << EOF
Expand All @@ -290,7 +286,7 @@ while true; do
read empty <&\$APT_HOOK_SOCKET
if echo "\$request" | grep -q ".hello"; then
printf '{"jsonrpc": "2.0", "result": {"version": "0.2"}, "id": 0}\n' >&\$APT_HOOK_SOCKET
printf '{"jsonrpc": "2.0", "result": {"version": "0.1"}, "id": 0}\n' >&\$APT_HOOK_SOCKET
break
fi
done
Expand All @@ -313,7 +309,7 @@ while true; do
read empty <&\$APT_HOOK_SOCKET
if echo "\$request" | grep -q ".hello"; then
printf '{"jsonrpc": "2.0", "result": {"version": "0.2"}, "id": 0}\nXX' >&\$APT_HOOK_SOCKET
printf '{"jsonrpc": "2.0", "result": {"version": "0.1"}, "id": 0}\nXX' >&\$APT_HOOK_SOCKET
break
fi
done
Expand Down

0 comments on commit b60cda7

Please sign in to comment.