src/tests/cli/t_pkg_temp_sources.py
changeset 2339 aa5954c06b9d
parent 2336 b318adf82ae0
child 2414 ce704b29a50c
equal deleted inserted replaced
2338:63a4d56416c6 2339:aa5954c06b9d
    46         need_ro_data = True
    46         need_ro_data = True
    47 
    47 
    48         foo_pkg = """
    48         foo_pkg = """
    49             open pkg://test/[email protected]
    49             open pkg://test/[email protected]
    50             add set name=pkg.summary value="Example package foo."
    50             add set name=pkg.summary value="Example package foo."
       
    51             add set name=variant.debug.foo value=true value=false
    51             add dir mode=0755 owner=root group=bin path=lib
    52             add dir mode=0755 owner=root group=bin path=lib
    52             add dir mode=0755 owner=root group=bin path=usr
    53             add dir mode=0755 owner=root group=bin path=usr
    53             add dir mode=0755 owner=root group=bin path=usr/bin
    54             add dir mode=0755 owner=root group=bin path=usr/bin
    54             add dir mode=0755 owner=root group=bin path=usr/local
    55             add dir mode=0755 owner=root group=bin path=usr/local
    55             add dir mode=0755 owner=root group=bin path=usr/local/bin
    56             add dir mode=0755 owner=root group=bin path=usr/local/bin
   120                             os.path.join(dest_dir, name))
   121                             os.path.join(dest_dir, name))
   121 
   122 
   122         def image_create(self, *args, **kwargs):
   123         def image_create(self, *args, **kwargs):
   123                 pkg5unittest.ManyDepotTestCase.image_create(self,
   124                 pkg5unittest.ManyDepotTestCase.image_create(self,
   124                     *args, **kwargs)
   125                     *args, **kwargs)
   125                 self.ta_dir = os.path.join(self.img_path, "etc/certs/CA")
   126                 self.ta_dir = os.path.join(self.img_path(), "etc/certs/CA")
   126                 os.makedirs(self.ta_dir)
   127                 os.makedirs(self.ta_dir)
   127 
   128 
   128         def __publish_packages(self, rurl):
   129         def __publish_packages(self, rurl):
   129                 """Private helper function to publish packages needed for
   130                 """Private helper function to publish packages needed for
   130                 testing.
   131                 testing.
   611 
   612 
   612                 self.pkg("contents -mr -g %s foo" % self.foo_arc, su_wrap=True)
   613                 self.pkg("contents -mr -g %s foo" % self.foo_arc, su_wrap=True)
   613                 expected = """\
   614                 expected = """\
   614 set name=pkg.fmri value=%s
   615 set name=pkg.fmri value=%s
   615 set name=pkg.summary value="Example package foo."
   616 set name=pkg.summary value="Example package foo."
       
   617 set name=variant.debug.foo value=true value=false
   616 dir group=bin mode=0755 owner=root path=lib
   618 dir group=bin mode=0755 owner=root path=lib
   617 dir group=bin mode=0755 owner=root path=usr
   619 dir group=bin mode=0755 owner=root path=usr
   618 dir group=bin mode=0755 owner=root path=usr/bin
   620 dir group=bin mode=0755 owner=root path=usr/bin
   619 dir group=bin mode=0755 owner=root path=usr/local
   621 dir group=bin mode=0755 owner=root path=usr/local
   620 dir group=bin mode=0755 owner=root path=usr/local/bin
   622 dir group=bin mode=0755 owner=root path=usr/local/bin
   793                 self.pkg("install -g %s foo" % self.foo_arc)
   795                 self.pkg("install -g %s foo" % self.foo_arc)
   794 
   796 
   795                 #
   797                 #
   796                 # Verify change-facet can use temporary origins.
   798                 # Verify change-facet can use temporary origins.
   797                 #
   799                 #
   798                 fpath = os.path.join(self.img_path, "usr/share/man/man1/foo.1")
   800                 fpath = os.path.join(self.img_path(),
       
   801                     "usr/share/man/man1/foo.1")
   799                 assert os.path.exists(fpath)
   802                 assert os.path.exists(fpath)
   800 
   803 
   801                 # Now set facet.doc.man to false and verify faceted item is
   804                 # Now set facet.doc.man to false and verify faceted item is
   802                 # gone.
   805                 # gone.
   803                 self.pkg("change-facet facet.doc.man=false")
   806                 self.pkg("change-facet facet.doc.man=false")
   822                 assert os.path.exists(fpath)
   825                 assert os.path.exists(fpath)
   823 
   826 
   824                 #
   827                 #
   825                 # Verify change-variant can use temporary origins.
   828                 # Verify change-variant can use temporary origins.
   826                 #
   829                 #
   827                 vpath = os.path.join(self.img_path, "lib/libfoo.so.1")
   830                 vpath = os.path.join(self.img_path(),
       
   831                     "lib/libfoo.so.1")
   828                 assert os.path.exists(vpath)
   832                 assert os.path.exists(vpath)
   829                 self.assertEqual(os.stat(vpath).st_size, 15)
   833                 self.assertEqual(os.stat(vpath).st_size, 15)
   830 
   834 
   831                 # Now attempt to change the debug variant; this should fail.
   835                 # Now attempt to change the debug variant; this should fail.
   832                 self.pkg("change-variant -vv variant.debug.foo=true", exit=1)
   836                 self.pkg("change-variant -vv variant.debug.foo=true", exit=1)