[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#632438: [Popcon-developers] Bug#681721: #632438: popularity-contest: a way to exclude certain packages



Control: tags -1 patch

Hi,

I've attached a simple PoC patch to exclude certain packages.
patch is generated against 1.70.

It may be better spec or implementation, but just works for me.

--- popularity-contest-1.70.orig/popularity-contest	2020-03-31 02:47:56.000000000 +0900
+++ popularity-contest-1.70/popularity-contest	2020-09-20 13:08:25.858919252 +0900
@@ -28,6 +28,7 @@
 my $dpkg_db="/var/lib/dpkg/info";
 my $dpkg_origin="/etc/dpkg/origins/default";
 my $popcon_conf="/etc/popularity-contest.conf";
+my $donotsend_conf="/etc/popularity-contest.donotsend.conf";
 
 # $popcon_conf is in shell-script format
 my $HOSTID = qx(unset MY_HOSTID; . $popcon_conf; echo \$MY_HOSTID );
@@ -204,6 +205,19 @@
 
 close PACKAGES;
 
+# We do not send package name which is listed on /etc/popularity-contest.donotsend.conf.
+if ( -r $donotsend_conf && -s $donotsend_conf ) {
+    open DONOTSEND, $donotsend_conf;
+    while (<DONOTSEND>) {
+	chomp $_;
+	my $name = $_;
+	if (exists $popcon{$name}) {
+	    delete $popcon{$name};
+	}
+    }
+    close (DONOTSEND);
+}
+
 # We're not done yet.  Sort the output in reverse by atime, and
 # add a header/footer.
 

Reply to: