Merge ~alexmurray/ubuntu-cve-tracker:fix-packages-mirror-context-handling-to-fix-source-map-cache-generation into ubuntu-cve-tracker:master

Proposed by Alex Murray
Status: Merged
Merged at revision: 5fd4465fa32923d45e03c6f6aa9c2a5a79319821
Proposed branch: ~alexmurray/ubuntu-cve-tracker:fix-packages-mirror-context-handling-to-fix-source-map-cache-generation
Merge into: ubuntu-cve-tracker:master
Diff against target: 46 lines (+7/-1)
2 files modified
.launchpad.yaml (+1/-0)
scripts/packages-mirror (+6/-1)
Reviewer Review Type Date Requested Status
Steve Beattie Approve
Review via email: mp+465985@code.launchpad.net

Commit message

scripts/packages-mirror: restore context to fix source map cache gen

Previously packages-mirror would cd to the "$debianPath" in some cases but would
then fail to restore the working directory - as such the resulting
gen-source-map-cache script would not be found and the source map cache would
never be generated. So use pushd/popd to avoid this rather than cd. Also whilst
debugging this it was also found that in one case packages-mirror would
overwrite the value of "$verbosity_args" and not restore it, so make sure this
is also restored to respect the users use of -v or not.

Signed-off-by: Alex Murray <email address hidden>

To post a comment you must log in.
Revision history for this message
Steve Beattie (sbeattie) wrote :

Ack, thanks, pushd/popd are bashisms, but the script is already bash-specific so no harm there.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.launchpad.yaml b/.launchpad.yaml
2index c3f14db..9c21a2b 100644
3--- a/.launchpad.yaml
4+++ b/.launchpad.yaml
5@@ -61,6 +61,7 @@ jobs:
6 - rsync
7 - wget
8 run-before: |
9+ export UCT=$(pwd)
10 # configure a basic ~/.ubuntu-cve-tracker.conf and setup packages-mirror
11 # for source_map
12 echo plb_authentication=/dev/null > ~/.ubuntu-cve-tracker.conf
13diff --git a/scripts/packages-mirror b/scripts/packages-mirror
14index c62eda6..fc69277 100755
15--- a/scripts/packages-mirror
16+++ b/scripts/packages-mirror
17@@ -322,6 +322,7 @@ fi
18 #
19 if [ "$only_ubuntu" = "no" ]; then
20 if [ -z "$very_verbose" ]; then
21+ old_verbosity_args="$verbosity_args"
22 verbosity_args="-q"
23 fi
24
25@@ -330,7 +331,7 @@ if [ "$only_ubuntu" = "no" ]; then
26 # Sync Sources from Debian testing
27 timestamp="${debianPath}.timestamp"
28 if [ ! -e "${debianPath}/dists" ] || do_use_timestamp "$timestamp" 6 ; then
29- cd "$debianPath"
30+ pushd "$debianPath" >/dev/null
31 for i in main contrib non-free
32 do
33 wget $verbosity_args -N -R '*=*' -R 'Contents*' -X '/debian/dists/testing/*/source/Sources.diff,/debian/dists/testing/*/source/by-hash' -np -r "http://$debian/debian/dists/testing/$i/source/"
34@@ -344,8 +345,12 @@ if [ "$only_ubuntu" = "no" ]; then
35 else
36 rm -f "$timestamp"
37 fi
38+ popd >/dev/null
39 fi
40 fi
41+ if [ -z "$very_verbose" ]; then
42+ verbosity_args="$old_verbosity_args"
43+ fi
44 fi
45
46 # generate source package lists for umt grep

Subscribers

People subscribed via source and target branches