Bug 9726 - solaris.py needs to use new service for /etc/security/*attr files in build 118
: solaris.py needs to use new service for /etc/security/*attr files in build 118
Status: RESOLVED FIXINSOURCE
Product: pkg
importer
: unspecified
: ANY/Generic All
: P2 major (vote)
: ---
Assigned To: Bart Smaalders
: pkg/importer watcher
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2009-06-26 19:14 UTC by Bart Smaalders
Modified: 2009-07-02 20:02 UTC (History)
1 user (show)

See Also:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description Bart Smaalders 2009-06-26 19:14:55 UTC
For example, a SVr4 package FOO delivering 

/etc/user_attr 

when converted to IPS package BAR/BAZ

needs to deliver  the same contents to /etc/user_attr.d/BAR%2FBAZ.

The simplest way of doing this is to provide a special macro that is
the urllib.quote(pkgname, ""), and set up some global chattrs.  In
addition, we need to no longer drop the *attr files, and do so in a 
way such that this change only affects post 117 build operations.
Comment 1 Bart Smaalders 2009-06-26 20:09:24 UTC
Initial implementation
-----------------------------

diff -r 3e4c11dc0133 src/util/distro-import/118/attrs
--- /dev/null    Thu Jan 01 00:00:00 1970 +0000
+++ b/src/util/distro-import/118/attrs    Fri Jun 26 19:58:21 2009 -0700
@@ -0,0 +1,7 @@
+chattr_glob etc/user_attr path=etc/user_attr.d/$(PKGNAME)
+chattr_glob etc/security/auth_attr path=etc/security/auth_attr.d/$(PKGNAME)
+chattr_glob etc/security/prof_attr path=etc/security/prof_attr.d/$(PKGNAME)
+chattr_glob etc/security/exec_attr path=etc/security/exec_attr.d/$(PKGNAME)
+
+
+
diff -r 3e4c11dc0133 src/util/distro-import/118/common/SUNWcs
--- /dev/null    Thu Jan 01 00:00:00 1970 +0000
+++ b/src/util/distro-import/118/common/SUNWcs    Fri Jun 26 19:58:21 2009
-0700
@@ -0,0 +1,88 @@
+package SUNWcs
+classification "System/Core"
+import SUNWcsu exclude usr/openwin
+# BEGIN NON-REDISTRIBUTABLE
+drop usr/bin/ksh
+drop usr/bin/pfksh
+drop usr/bin/rksh
+add link path=usr/bin/rksh target=rksh93
+# END NON-REDISTRIBUTABLE
+# /usr/has
+add dir path=usr/has mode=0755 owner=root group=bin
+add dir path=usr/has/bin mode=0755 owner=root group=bin
+add dir path=usr/has/man mode=0755 owner=root group=bin
+add dir path=usr/has/man/man1 mode=0755 owner=root group=bin
+# Replace BSD vi with vim
+drop usr/bin/ex
+drop usr/bin/vi
+drop usr/bin/view
+# Use the 32-bit ksh93 as a replacement /bin/sh
+drop usr/bin/pfsh
+add link path=usr/bin/pfsh target=../has/bin/sh
+from SUNWman import
+usr/share/man/man1/ex.1
+usr/share/man/man1/sh.1
+usr/share/man/man1/vi.1
+usr/share/man/man1/view.1
+chattr usr/share/man/man1/ex.1 path=usr/has/man/man1/ex.1
+chattr usr/share/man/man1/sh.1 path=usr/has/man/man1/sh.1
+chattr usr/share/man/man1/vi.1 path=usr/has/man/man1/vi.1
+chattr usr/share/man/man1/view.1 path=usr/has/man/man1/view.1
+end import
+# XXX until new clofi hits nevada
+drop usr/sbin/lofiadm
+from SUNWclofi import
+usr/sbin/lofiadm
+end import
+import SUNWcsr
+drop etc/inet/hosts
+drop etc/nsswitch.conf
+drop etc/pam.conf
+drop etc/passwd
+drop etc/security/policy.conf
+drop etc/shadow
+drop etc/skel/.profile
+drop var/svc/profile/generic_limited_net.xml
+drop var/svc/profile/generic_open.xml
+# Use the 32-bit ksh93 as a replacement /bin/sh
+drop sbin/pfsh
+drop sbin/sh
+add link path=sbin/pfsh target=../usr/has/bin/sh
+add link path=sbin/sh target=../usr/bin/$(ARCH32)/ksh93
+from SUNWfixes import
+# until the necessary actions are available
+etc/inet/services
+# switch to gdm
+var/svc/profile/generic_open.xml
+var/svc/profile/generic_limited_net.xml
+# customizations for indiana
+etc/inet/hosts
+etc/mailcap
+etc/mime.types
+etc/nsswitch.conf
+etc/pam.conf
+etc/passwd
+etc/security/policy.conf
+etc/shadow
+etc/skel/.bashrc
+etc/skel/.profile
+root
+root/.bashrc
+root/.profile
+usr/bin/ksh
+usr/has/bin/ex
+usr/has/bin/sh
+usr/has/bin/vi
+usr/has/bin/view
+end import
+# include etc/ftpd/ftpusers in base package
+from SUNWftpr import
+etc/ftpd/ftpusers
+end import
+depend SUNWperl584core
+# add new directories for *attr files
+add dir path=etc/user_attr.d mode=0755 owner=root group=bin
+add dir path=etc/security/auth_attr.d mode=0755 owner=root group=bin
+add dir path=etc/security/exec_attr.d mode=0755 owner=root group=bin
+add dir path=etc/security/prof_attr.d mode=0755 owner=root group=bin
+end package
diff -r 3e4c11dc0133 src/util/distro-import/Makefile
--- a/src/util/distro-import/Makefile    Fri Jun 26 17:38:35 2009 -0700
+++ b/src/util/distro-import/Makefile    Fri Jun 26 19:58:21 2009 -0700
@@ -97,6 +97,7 @@
 GLOBAL_CHATTRS_111a = $(GLOBAL_CHATTRS_106)
 GLOBAL_CHATTRS_116 = $(GLOBAL_CHATTRS_106)
 GLOBAL_CHATTRS_117 = $(GLOBAL_CHATTRS_106)
+GLOBAL_CHATTRS_118 = $(GLOBAL_CHATTRS_106) attrs
 GLOBAL_CHATTRS = $(GLOBAL_CHATTRS_$(BUILDID))

 SOLARIS.PY=PYTHONPATH=$(PROTO_AREA)/usr/lib/python2.4/vendor-packages \
@@ -114,14 +115,17 @@
     etc/hba.conf            \
     etc/ima.conf            \
     etc/inet/services        \
-    etc/mpapi.conf            \
+    etc/mpapi.conf
+
+ELIDED_FILES_ATTR =     \
     etc/security/auth_attr        \
     etc/security/exec_attr        \
     etc/security/prof_attr        \
     etc/user_attr

-ELIDED_FILES_86 = $(ELIDED_FILES_BASE) etc/devlink.tab
-ELIDED_FILES_89 = $(ELIDED_FILES_BASE) kernel/drv/sd.conf etc/devlink.tab
+
+ELIDED_FILES_86 = $(ELIDED_FILES_BASE) $(ELIDED_FILES_ATTR) etc/devlink.tab
+ELIDED_FILES_89 = $(ELITED_FILES_86) kernel/drv/sd.conf
 ELIDED_FILES_90 = $(ELIDED_FILES_89)
 ELIDED_FILES_91 = $(ELIDED_FILES_89)
 ELIDED_FILES_92 = $(ELIDED_FILES_89)
@@ -132,19 +136,20 @@
 ELIDED_FILES_97 = $(ELIDED_FILES_89)
 ELIDED_FILES_98 = $(ELIDED_FILES_89)
 ELIDED_FILES_99 = $(ELIDED_FILES_89)
-ELIDED_FILES_100a = $(ELIDED_FILES_BASE) kernel/drv/sd.conf
+ELIDED_FILES_100a = $(ELIDED_FILES_BASE) $(ELIDED_FILES_ATTR)
kernel/drv/sd.conf
 ELIDED_FILES_101 = $(ELIDED_FILES_100a)
 ELIDED_FILES_101a = $(ELIDED_FILES_100a)
 ELIDED_FILES_105 = $(ELIDED_FILES_100a)
-ELIDED_FILES_106 = $(ELIDED_FILES_BASE)
-ELIDED_FILES_107 = $(ELIDED_FILES_BASE)
-ELIDED_FILES_108 = $(ELIDED_FILES_BASE)
-ELIDED_FILES_109 = $(ELIDED_FILES_BASE)
-ELIDED_FILES_110 = $(ELIDED_FILES_BASE)
-ELIDED_FILES_111 = $(ELIDED_FILES_BASE)
-ELIDED_FILES_111a = $(ELIDED_FILES_BASE)
-ELIDED_FILES_116 = $(ELIDED_FILES_BASE)
-ELIDED_FILES_117 = $(ELIDED_FILES_BASE)
+ELIDED_FILES_106 = $(ELIDED_FILES_BASE) $(ELIDED_FILES_ATTR)
+ELIDED_FILES_107 = $(ELIDED_FILES_107)
+ELIDED_FILES_108 = $(ELIDED_FILES_107)
+ELIDED_FILES_109 = $(ELIDED_FILES_107)
+ELIDED_FILES_110 = $(ELIDED_FILES_107)
+ELIDED_FILES_111 = $(ELIDED_FILES_107)
+ELIDED_FILES_111a = $(ELIDED_FILES_107)
+ELIDED_FILES_116 = $(ELIDED_FILES_107)
+ELIDED_FILES_117 = $(ELIDED_FILES_107)
+ELIDED_FILES_118 = $(ELIDED_FILES_BASE)
 ELIDED_FILES = $(ELIDED_FILES_$(BUILDID))

 #
diff -r 3e4c11dc0133 src/util/distro-import/solaris.py
--- a/src/util/distro-import/solaris.py    Fri Jun 26 17:38:35 2009 -0700
+++ b/src/util/distro-import/solaris.py    Fri Jun 26 19:58:21 2009 -0700
@@ -451,6 +451,7 @@


 def start_package(pkgname):
+        set_macro("PKGNAME", urllib.quote(pkgname, ""))
         return package(pkgname)

 def end_package(pkg):
@@ -460,6 +461,7 @@
         elif "-" not in pkg.version:
                 pkg.version += "-%s" % pkg_branch

+        clear_macro("PKGNAME")
         print "Package '%s'" % pkg.name
         print "  Version:", pkg.version
         print "  Description:", pkg.desc
@@ -1027,7 +1029,7 @@
                 just_these_pkgs.append(arg)
         elif opt == "-m":
                 _a = arg.split("=", 1)
-                macro_definitions.update([("$(%s)" % _a[0], _a[1])])
+                set_macro(_a[0], _a[1])
         elif opt == "-n":
                 nopublish = True
         elif opt == "-p":
@@ -1164,6 +1166,10 @@
                 else:
                         break # no more substitutable tokens
         return s
+def set_macro(key, value):
+        macro_definitions.update([("$(%s)" % key, value)])
+def clear_macro(key):
+        del macro_defintions[key]

 def sourcehook(filename):
         """ implement include hierarchy """
Comment 2 Bart Smaalders 2009-06-30 18:03:32 UTC
code review is pending: http://cr.opensolaris.org/~barts/9726/
Comment 3 Bart Smaalders 2009-07-02 20:02:58 UTC
Fix in 7b5fe788678cabf9cd16a39d40cfea8f29b245fa