Re-create policycoreutils-rhat.patch from
03cfe4ebfa
- We need to cover file_context.XXX.homedir to have fixfiles with exclude_dirs working correctly.
- use dnf instead of yum - rhbz#1156547This commit is contained in:
		
							parent
							
								
									9d99a57696
								
							
						
					
					
						commit
						bb04b4de9b
					
				| @ -1,25 +0,0 @@ | |||||||
| From 0c71c12b54b0f201edf53f9956c8c9df8efbca41 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Miroslav Grepl <mgrepl@redhat.com> |  | ||||||
| Date: Tue, 20 May 2014 12:07:46 +0200 |  | ||||||
| Subject: [PATCH] Fix setfiles to work correctly if -r option is defined |  | ||||||
| 
 |  | ||||||
| ---
 |  | ||||||
|  policycoreutils/setfiles/setfiles.c | 2 +- |  | ||||||
|  1 file changed, 1 insertion(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c
 |  | ||||||
| index 85d8d68..b31df58 100644
 |  | ||||||
| --- a/policycoreutils/setfiles/setfiles.c
 |  | ||||||
| +++ b/policycoreutils/setfiles/setfiles.c
 |  | ||||||
| @@ -334,7 +334,7 @@ int main(int argc, char **argv)
 |  | ||||||
|  					argv[0]); |  | ||||||
|  				exit(-1); |  | ||||||
|  			} |  | ||||||
| -			set_rootpath(argv[optind++]);
 |  | ||||||
| +			set_rootpath(argv[optind]);
 |  | ||||||
|  			break; |  | ||||||
|  		case 's': |  | ||||||
|  			use_input_file = 1; |  | ||||||
| -- 
 |  | ||||||
| 1.9.0 |  | ||||||
| 
 |  | ||||||
| @ -654811,7 +654811,7 @@ index 97f3920..c92e394 100644 | |||||||
|  	} |  	} | ||||||
|   |   | ||||||
| diff --git a/policycoreutils-2.3/scripts/fixfiles b/policycoreutils-2.3/scripts/fixfiles
 | diff --git a/policycoreutils-2.3/scripts/fixfiles b/policycoreutils-2.3/scripts/fixfiles
 | ||||||
| index 5c29eb9..097152f 100755
 | index 5c29eb9..db53c0b 100755
 | ||||||
| --- a/policycoreutils-2.3/scripts/fixfiles
 | --- a/policycoreutils-2.3/scripts/fixfiles
 | ||||||
| +++ b/policycoreutils-2.3/scripts/fixfiles
 | +++ b/policycoreutils-2.3/scripts/fixfiles
 | ||||||
| @@ -116,6 +116,7 @@ exclude_dirs() {
 | @@ -116,6 +116,7 @@ exclude_dirs() {
 | ||||||
| @ -654828,7 +654828,7 @@ index 5c29eb9..097152f 100755 | |||||||
|   |   | ||||||
| +FC_SUB_DIST=${FC}.subs_dist
 | +FC_SUB_DIST=${FC}.subs_dist
 | ||||||
| +FC_SUB=${FC}.subs
 | +FC_SUB=${FC}.subs
 | ||||||
| +
 | +FC_HOMEDIRS=${FC}.homedirs
 | ||||||
|  # |  # | ||||||
|  # Log to either syslog or a LOGFILE |  # Log to either syslog or a LOGFILE | ||||||
|  # |  # | ||||||
| @ -654836,10 +654836,10 @@ index 5c29eb9..097152f 100755 | |||||||
|  		logit "skipping the directory ${p}" |  		logit "skipping the directory ${p}" | ||||||
|  	done |  	done | ||||||
|  FC=$TEMPFCFILE |  FC=$TEMPFCFILE | ||||||
| +/bin/cp -p ${TEMPFCFILE} ${TEMPFCFILE}.subs_dist &>/dev/null || exit
 |  | ||||||
| +/bin/cp -p ${FC_SUB_DIST} ${TEMPFCFILE}.subs_dist &>/dev/null || exit
 | +/bin/cp -p ${FC_SUB_DIST} ${TEMPFCFILE}.subs_dist &>/dev/null || exit
 | ||||||
| +/bin/cp -p ${TEMPFCFILE} ${TEMPFCFILE}.subs &>/dev/null || exit
 |  | ||||||
| +/bin/cp -p ${FC_SUB} ${TEMPFCFILE}.subs &>/dev/null || exit
 | +/bin/cp -p ${FC_SUB} ${TEMPFCFILE}.subs &>/dev/null || exit
 | ||||||
|  | +/bin/cp -p ${FC_HOMEDIRS} ${TEMPFCFILE}.homedirs &>/dev/null || exit
 | ||||||
|  | +
 | ||||||
|  fi |  fi | ||||||
|  if [ ! -z "$RPMFILES" ]; then |  if [ ! -z "$RPMFILES" ]; then | ||||||
|      for i in `echo "$RPMFILES" | sed 's/,/ /g'`; do |      for i in `echo "$RPMFILES" | sed 's/,/ /g'`; do | ||||||
| @ -654848,7 +654848,7 @@ index 5c29eb9..097152f 100755 | |||||||
|  fi |  fi | ||||||
|  echo "Cleaning up labels on /tmp" |  echo "Cleaning up labels on /tmp" | ||||||
| -rm -rf /tmp/gconfd-* /tmp/pulse-* /tmp/orbit-* $TEMPFCFILE
 | -rm -rf /tmp/gconfd-* /tmp/pulse-* /tmp/orbit-* $TEMPFCFILE
 | ||||||
| +rm -rf /tmp/gconfd-* /tmp/pulse-* /tmp/orbit-* $TEMPFCFILE ${TEMPFCFILE}.subs_dist ${TEMPFCFILE}.subs
 | +rm -rf /tmp/gconfd-* /tmp/pulse-* /tmp/orbit-* $TEMPFCFILE ${TEMPFCFILE}.subs_dist ${TEMPFCFILE}.subs ${TEMPFCFILE}.homedirs
 | ||||||
|   |   | ||||||
|  UNDEFINED=`get_undefined_type` || exit $? |  UNDEFINED=`get_undefined_type` || exit $? | ||||||
|  UNLABELED=`get_unlabeled_type` || exit $? |  UNLABELED=`get_unlabeled_type` || exit $? | ||||||
| @ -659099,7 +659099,7 @@ index 9b9a09a..ec3e67e 100755 | |||||||
|      return tlist |      return tlist | ||||||
|   |   | ||||||
| diff --git a/policycoreutils-2.3/sepolicy/sepolicy/generate.py b/policycoreutils-2.3/sepolicy/sepolicy/generate.py
 | diff --git a/policycoreutils-2.3/sepolicy/sepolicy/generate.py b/policycoreutils-2.3/sepolicy/sepolicy/generate.py
 | ||||||
| index 6b53035..32ea970 100644
 | index 6b53035..a27b17b 100644
 | ||||||
| --- a/policycoreutils-2.3/sepolicy/sepolicy/generate.py
 | --- a/policycoreutils-2.3/sepolicy/sepolicy/generate.py
 | ||||||
| +++ b/policycoreutils-2.3/sepolicy/sepolicy/generate.py
 | +++ b/policycoreutils-2.3/sepolicy/sepolicy/generate.py
 | ||||||
| @@ -27,21 +27,21 @@ import sepolicy
 | @@ -27,21 +27,21 @@ import sepolicy
 | ||||||
| @ -660096,7 +660096,7 @@ index 6b53035..32ea970 100644 | |||||||
|   |   | ||||||
|                  for i in self.in_tcp[PORTS] + self.out_tcp[PORTS]: |                  for i in self.in_tcp[PORTS] + self.out_tcp[PORTS]: | ||||||
|                      if self.find_port(i,"tcp") == None: |                      if self.find_port(i,"tcp") == None: | ||||||
| @@ -1167,88 +1170,88 @@ allow %s_t %s_t:%s_socket name_%s;
 | @@ -1167,97 +1170,99 @@ allow %s_t %s_t:%s_socket name_%s;
 | ||||||
|   |   | ||||||
|                  for i in self.in_udp[PORTS]: |                  for i in self.in_udp[PORTS]: | ||||||
|                      if self.find_port(i,"udp") == None: |                      if self.find_port(i,"udp") == None: | ||||||
| @ -660262,8 +660262,47 @@ index 6b53035..32ea970 100644 | |||||||
| +            return fcfile
 | +            return fcfile
 | ||||||
|   |   | ||||||
|          def __extract_rpms(self): |          def __extract_rpms(self): | ||||||
|              import yum | -            import yum
 | ||||||
| @@ -1316,10 +1319,10 @@ allow %s_t %s_t:%s_socket name_%s;
 | -            yb = yum.YumBase()
 | ||||||
|  | -            yb.setCacheDir()
 | ||||||
|  | +            import dnf
 | ||||||
|  | +            base = dnf.Base()
 | ||||||
|  | +            base.conf.cachedir = dnf.yum.misc.getCacheDir()
 | ||||||
|  | +            base.fill_sack()
 | ||||||
|  | +            installed = base.sack.query().installed()
 | ||||||
|  |   | ||||||
|  | -            for pkg in yb.rpmdb.searchProvides(self.program):
 | ||||||
|  | +            for pkg in installed.filter(file=self.program):
 | ||||||
|  |                  self.rpms.append(pkg.name) | ||||||
|  | -                for fname in pkg.dirlist + pkg.filelist + pkg.ghostlist:
 | ||||||
|  | +                for fname in pkg.files:
 | ||||||
|  |                      for b in self.DEFAULT_DIRS: | ||||||
|  |                          if b == "/etc": | ||||||
|  |                              continue | ||||||
|  | @@ -1267,8 +1272,9 @@ allow %s_t %s_t:%s_socket name_%s;
 | ||||||
|  |                              else: | ||||||
|  |                                  self.add_dir(fname) | ||||||
|  |   | ||||||
|  | -                for bpkg in yb.rpmdb.searchNames([pkg.base_package_name]):
 | ||||||
|  | -                    for fname in bpkg.dirlist + bpkg.filelist + bpkg.ghostlist:
 | ||||||
|  | +                pkg_basename = dnf.rpm.miscutils.splitFilename(pkg.sourcerpm)[0]
 | ||||||
|  | +                for bpkg in installed.filter(name=pkg_basename):
 | ||||||
|  | +                    for fname in bpkg.files:
 | ||||||
|  |                          for b in self.DEFAULT_DIRS: | ||||||
|  |                              if b == "/etc": | ||||||
|  |                                  continue | ||||||
|  | @@ -1281,8 +1287,8 @@ allow %s_t %s_t:%s_socket name_%s;
 | ||||||
|  |              # some packages have own systemd subpackage | ||||||
|  |              # tor-systemd for example | ||||||
|  |              binary_name = self.program.split("/")[-1] | ||||||
|  | -            for bpkg in yb.rpmdb.searchNames([ "%s-systemd" % binary_name ]):
 | ||||||
|  | -                for fname in bpkg.filelist + bpkg.ghostlist + bpkg.dirlist:
 | ||||||
|  | +            for bpkg in installed.filter(name="%s-systemd" % binary_name):
 | ||||||
|  | +                for fname in bpkg.files:
 | ||||||
|  |                      for b in self.DEFAULT_DIRS: | ||||||
|  |                          if b == "/etc": | ||||||
|  |                              continue | ||||||
|  | @@ -1316,10 +1322,10 @@ allow %s_t %s_t:%s_socket name_%s;
 | ||||||
|              if os.path.isfile("/etc/rc.d/init.d/%s"  % self.name): |              if os.path.isfile("/etc/rc.d/init.d/%s"  % self.name): | ||||||
|                  self.set_init_script("/etc/rc\.d/init\.d/%s"  % self.name) |                  self.set_init_script("/etc/rc\.d/init\.d/%s"  % self.name) | ||||||
|   |   | ||||||
| @ -660276,7 +660315,7 @@ index 6b53035..32ea970 100644 | |||||||
|                  temp_dirs = [] |                  temp_dirs = [] | ||||||
|                  try: |                  try: | ||||||
|                      temp_basepath = self.DEFAULT_DIRS[p][1][0] + "/" |                      temp_basepath = self.DEFAULT_DIRS[p][1][0] + "/" | ||||||
| @@ -1334,9 +1337,9 @@ allow %s_t %s_t:%s_socket name_%s;
 | @@ -1334,9 +1340,9 @@ allow %s_t %s_t:%s_socket name_%s;
 | ||||||
|   |   | ||||||
|                  if len(temp_dirs) is not 0: |                  if len(temp_dirs) is not 0: | ||||||
|                      for i in temp_dirs: |                      for i in temp_dirs: | ||||||
| @ -660288,7 +660327,7 @@ index 6b53035..32ea970 100644 | |||||||
|                              del(self.files[i]) |                              del(self.files[i]) | ||||||
|                          else: |                          else: | ||||||
|                              continue |                              continue | ||||||
| @@ -1358,10 +1361,10 @@ Warning %s does not exist
 | @@ -1358,10 +1364,10 @@ Warning %s does not exist
 | ||||||
|              for s in fd.read().split(): |              for s in fd.read().split(): | ||||||
|                  for b in self.symbols: |                  for b in self.symbols: | ||||||
|                      if s.startswith(b): |                      if s.startswith(b): | ||||||
| @ -663115,7 +663154,7 @@ index 2a7cfa3..95fba09 100644 | |||||||
|  			char path[PATH_MAX + 1]; |  			char path[PATH_MAX + 1]; | ||||||
|   |   | ||||||
| diff --git a/policycoreutils-2.3/setfiles/setfiles.c b/policycoreutils-2.3/setfiles/setfiles.c
 | diff --git a/policycoreutils-2.3/setfiles/setfiles.c b/policycoreutils-2.3/setfiles/setfiles.c
 | ||||||
| index ac1c39a..0ce821f 100644
 | index ac1c39a..184ef52 100644
 | ||||||
| --- a/policycoreutils-2.3/setfiles/setfiles.c
 | --- a/policycoreutils-2.3/setfiles/setfiles.c
 | ||||||
| +++ b/policycoreutils-2.3/setfiles/setfiles.c
 | +++ b/policycoreutils-2.3/setfiles/setfiles.c
 | ||||||
| @@ -153,6 +153,9 @@ int main(int argc, char **argv)
 | @@ -153,6 +153,9 @@ int main(int argc, char **argv)
 | ||||||
| @ -663143,6 +663182,15 @@ index ac1c39a..0ce821f 100644 | |||||||
|  		switch (opt) { |  		switch (opt) { | ||||||
|  		case 'c': |  		case 'c': | ||||||
|  			{ |  			{ | ||||||
|  | @@ -326,7 +334,7 @@ int main(int argc, char **argv)
 | ||||||
|  |  					argv[0]); | ||||||
|  |  				exit(-1); | ||||||
|  |  			} | ||||||
|  | -			set_rootpath(argv[optind++]);
 | ||||||
|  | +			set_rootpath(argv[optind]);
 | ||||||
|  |  			break; | ||||||
|  |  		case 's': | ||||||
|  |  			use_input_file = 1; | ||||||
| @@ -337,7 +345,7 @@ int main(int argc, char **argv)
 | @@ -337,7 +345,7 @@ int main(int argc, char **argv)
 | ||||||
|  			if (r_opts.progress) { |  			if (r_opts.progress) { | ||||||
|  				fprintf(stderr, |  				fprintf(stderr, | ||||||
|  | |||||||
| @ -20,7 +20,6 @@ Source4: sepolicy-icons.tgz | |||||||
| # use make-rhat-patches.sh to create following patches from https://github.com/fedora-selinux/selinux/ | # use make-rhat-patches.sh to create following patches from https://github.com/fedora-selinux/selinux/ | ||||||
| Patch:	 policycoreutils-rhat.patch | Patch:	 policycoreutils-rhat.patch | ||||||
| Patch1:  sepolgen-rhat.patch | Patch1:  sepolgen-rhat.patch | ||||||
| Patch2:	 0001-Fix-setfiles-to-work-correctly-if-r-option-is-define.patch |  | ||||||
| Obsoletes: policycoreutils < 2.0.61-2 | Obsoletes: policycoreutils < 2.0.61-2 | ||||||
| Conflicts: filesystem < 3 | Conflicts: filesystem < 3 | ||||||
| Provides: /sbin/fixfiles | Provides: /sbin/fixfiles | ||||||
| @ -52,9 +51,6 @@ to switch roles. | |||||||
| # create selinux/ directory and extract %{SOURCE0} there | # create selinux/ directory and extract %{SOURCE0} there | ||||||
| %setup -q -c -n selinux | %setup -q -c -n selinux | ||||||
| %patch -p1 -b .policycoreutils-rhat | %patch -p1 -b .policycoreutils-rhat | ||||||
| pushd policycoreutils-%{version}/ |  | ||||||
| %patch2 -p2 -b .setfiles |  | ||||||
| popd |  | ||||||
| cp %{SOURCE3} policycoreutils-%{version}/gui/ | cp %{SOURCE3} policycoreutils-%{version}/gui/ | ||||||
| tar -xvf %{SOURCE4} -C policycoreutils-%{version}/ | tar -xvf %{SOURCE4} -C policycoreutils-%{version}/ | ||||||
| # extract {%SOURCE1} in selinux/ directory | # extract {%SOURCE1} in selinux/ directory | ||||||
| @ -202,7 +198,7 @@ an SELinux environment. | |||||||
| Summary: SELinux policy core policy devel utilities | Summary: SELinux policy core policy devel utilities | ||||||
| Group:	 System Environment/Base | Group:	 System Environment/Base | ||||||
| Requires: policycoreutils-python = %{version}-%{release} | Requires: policycoreutils-python = %{version}-%{release} | ||||||
| Requires: /usr/bin/make yum | Requires: /usr/bin/make dnf | ||||||
| Requires: selinux-policy-devel | Requires: selinux-policy-devel | ||||||
| 
 | 
 | ||||||
| %description devel | %description devel | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user