Merge lp:~mgunes/whatchanged/package-name-validation into lp:whatchanged

Proposed by Murat Gunes
Status: Merged
Merged at revision: 6
Proposed branch: lp:~mgunes/whatchanged/package-name-validation
Merge into: lp:whatchanged
Diff against target: 43 lines (+11/-1)
1 file modified
whatchanged (+11/-1)
To merge this branch: bzr merge lp:~mgunes/whatchanged/package-name-validation
Reviewer Review Type Date Requested Status
Murat Gunes Approve
Review via email: mp+39678@code.launchpad.net

Description of the change

Merge after some testing - looks good

To post a comment you must log in.
Revision history for this message
Murat Gunes (mgunes) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'whatchanged'
2--- whatchanged 2010-10-30 01:34:56 +0000
3+++ whatchanged 2010-10-30 03:02:39 +0000
4@@ -37,7 +37,7 @@
5 SOURCE_PACKAGE_NAME=$(apt-cache madison ${PACKAGE_NAME} | grep Sources | tail -n 1 | awk '{print $1}')
6 INSTALLED_VERSION=$(apt-cache policy $PACKAGE_NAME | grep Installed: | cut -c 14-)
7 CANDIDATE_VERSION=$(apt-cache policy $PACKAGE_NAME | grep Candidate: | cut -c 14-)
8-
9+ VALIDATION_BOOL=$(dpkg -l $PACKAGE_NAME &> /dev/null)$?
10
11 # ----------------------------------------------------------------
12 # ----------------------------------------------------------------
13@@ -166,6 +166,13 @@
14 # ----------------------------------------------------------------
15 # ----------------------------------------------------------------
16
17+function validate_name
18+# Check whether this is a valid package name
19+{
20+ if [ "$VALIDATION_BOOL" = "1" ]; then
21+ error_exit "${PACKAGE_NAME} is not a valid Ubuntu package. Exiting."
22+ fi
23+}
24
25 function check_candidate
26 {
27@@ -214,6 +221,8 @@
28
29 check_root
30
31+validate_name
32+
33 # Trap TERM, HUP, and INT signals and properly exit
34
35 trap "signal_exit TERM" TERM HUP
36@@ -256,6 +265,7 @@
37 # echo $PACKAGE_NAME
38 # sleep 2000
39
40+
41 # Exit
42
43 proper_exit

Subscribers

People subscribed via source and target branches

to all changes: