Browse code

Adds new tag for testonly packages in package lists

Also introduces a new parameter INSTALL_TESTONLY_PACKAGES
in the stackrc with False as default value. Setting it to
True stack.sh will install all packages tagged with the tag
testonly in the package lists.

Includes needed packages for Ubuntu and Fedora

fixes bug #1203680

Change-Id: I911a6601819a34262853bba0658f6751148bfbec

Christian Berendt authored on 2013/07/22 18:37:42
Showing 4 changed files
... ...
@@ -1,5 +1,10 @@
1 1
 gcc
2
+libffi-dev          # testonly
3
+libmysqlclient-dev  # testonly
4
+libpq-dev           # testonly
5
+libssl-dev          # testonly
2 6
 libxml2-dev
7
+libxslt1-dev        # testonly
3 8
 python-dev
4 9
 python-eventlet
5 10
 python-routes
... ...
@@ -10,3 +15,4 @@ python-wsgiref
10 10
 python-pastedeploy
11 11
 python-xattr
12 12
 python-iso8601
13
+zlib1g-dev           # testonly
... ...
@@ -1,5 +1,10 @@
1 1
 gcc
2
+libffi-devel        # testonly
2 3
 libxml2-devel
4
+libxslt-devel       # testonly
5
+mysql-devel         # testonly
6
+openssl-devel       # testonly
7
+postgresql-devel    # testonly
3 8
 python-argparse
4 9
 python-devel
5 10
 python-eventlet
... ...
@@ -9,3 +14,4 @@ python-routes
9 9
 python-sqlalchemy
10 10
 python-wsgiref
11 11
 pyxattr
12
+zlib-devel          # testonly
... ...
@@ -317,16 +317,36 @@ function get_packages() {
317 317
                 continue
318 318
             fi
319 319
 
320
+            # Assume we want this package
321
+            package=${line%#*}
322
+            inst_pkg=1
323
+
324
+            # Look for # dist:xxx in comment
320 325
             if [[ $line =~ (.*)#.*dist:([^ ]*) ]]; then
321 326
                 # We are using BASH regexp matching feature.
322 327
                 package=${BASH_REMATCH[1]}
323 328
                 distros=${BASH_REMATCH[2]}
324 329
                 # In bash ${VAR,,} will lowecase VAR
325
-                [[ ${distros,,} =~ ${DISTRO,,} ]] && echo $package
326
-                continue
330
+                # Look for a match in the distro list
331
+                if [[ ! ${distros,,} =~ ${DISTRO,,} ]]; then
332
+                    # If no match then skip this package
333
+                    inst_pkg=0
334
+                fi
335
+            fi
336
+
337
+            # Look for # testonly in comment
338
+            if [[ $line =~ (.*)#.*testonly.* ]]; then
339
+                package=${BASH_REMATCH[1]}
340
+                # Are we installing test packages? (test for the default value)
341
+                if [[ $INSTALL_TESTONLY_PACKAGES = "False" ]]; then
342
+                    # If not installing test packages the skip this package
343
+                    inst_pkg=0
344
+                fi
327 345
             fi
328 346
 
329
-            echo ${line%#*}
347
+            if [[ $inst_pkg = 1 ]]; then
348
+                echo $package
349
+            fi
330 350
         done
331 351
         IFS=$OIFS
332 352
     done
... ...
@@ -275,6 +275,9 @@ USE_SCREEN=${SCREEN_DEV:-$USE_SCREEN}
275 275
 # Set default screen name
276 276
 SCREEN_NAME=${SCREEN_NAME:-stack}
277 277
 
278
+# Do not install packages tagged with 'testonly' by default
279
+INSTALL_TESTONLY_PACKAGES=${INSTALL_TESTONLY_PACKAGES:-False}
280
+
278 281
 # Local variables:
279 282
 # mode: shell-script
280 283
 # End: