Accéder au contenu principal

The power of Perl, give us the 5 things missing to really help.

 My DpkgSearch.pl aim to really answer to my inspection. I want to see presence of de-installed file and are existing. Belong to an omission, the application is almost what I required to use to but... It did not use the Package Status akin to be "install" and "deinstall" a comparison between dpkg --get-selections did confirm it marshall all the install and de-install file. 


The proof:

 

       
maxiste@ubuntu-devlpt:~/Documents/perl$ dpkg --get-selections | grep "deinstall" | wc -l
49
maxiste@ubuntu-devlpt:~/Documents/perl$ dpkg --get-selections | grep "install" | grep -v "deinstall" | wc -l
3055
echo $(( 3055 + 49 ))
3104

###
### Now with the application : 
###

maxiste@ubuntu-devlpt:~/Documents/perl$ DSMD5Process=perl DSPkgStatus=deinstall  DSDisplay=package  DSSearch="^[a-zA-Z0-9]" DSIsRegExp=True DSLimit=0 ./DpkgSearch.pl | wc -l
3104
maxiste@ubuntu-devlpt:~/Documents/perl$ DSMD5Process=perl DSPkgStatus=install  DSDisplay=package  DSSearch="^[a-zA-Z0-9]" DSIsRegExp=True DSLimit=0 ./DpkgSearch.pl | wc -l
3104
       
 

 Ok, it's not even make comparison between a "install" state and "deinstall" state.

 

So after looking at the code. I found why and in 5 things easy addable, make perl great to easily enhance this programmation. But where 

2 Choices:

  1. Is it inside sub or function start()
  2. Is is inside sub or function ShowByItem() 

 

As inside start: 

At the foreach statement.

 

       

	foreach my $line ( @lines )
	{
		$IsShowTime="False" ;
		chomp($line); 
		if ( $MaxValuePrint > 0 )
		{
			if ( $IntCountMax <= ( $MaxValuePrint - 1 ) )
			{
				$IsShowTime="True" ;
			}
			$IntCountMax=$IntCountMax+$intStepAdd ; 
		}
		else
		{
			$IsShowTime="True" ;
		}
		if ( $IsShowTime =~ /True/ )
		{
			$intStepAdd=ShowByItem($line , 0 ) ;
           #^^^^^^^^^The entry is here and we can supply all the 
           #         stuff to make the filtering of install and 
           #         deinstall package. But how many line to add
           #         and probably adding twice whichs elements ?
		}
	}

       
 

 or

inside  ShowByItem()

 

       

sub ShowByItem
{
	my $RegExpMode=$ENV{"DSIsRegExp"} ; 
	my $RegExpSearch=$ENV{"DSSearch"} ; 
	### to add to allow Package status to be considered.
	my $PackageStatus=$ENV{"DSPkgStatus"} ; ### This one to add
	
	my $StringMatching ;
	my $intCountLine=0 ; 
	my $StrLine=$_[0] ;
	my $intPosField=$_[1] ; 
	$StringMatching=per_line_matches( $StrLine , $intPosField );
	### to add to allow Package status to be considered.
	### It's the official location where a line contain 
	### "PACKAGE\t\tSTATUS\n" format
	my $StrPackageStatus=per_line_matches( $StrLine , 1 ); ### This one to add
	
	if ( $StrPackageStatus eq $PackageStatus ) ### This one to add
	{
		if ( $RegExpMode =~ /True/ )
		{
			if( $StringMatching =~ /$RegExpSearch/ )
			{
				$intCountLine=TypeShow( $StrLine , $intPosField ) ; 
			}
			else
			{
				$intCountLine=0 ; 
			}
		}
		else
		{
		 if( $RegExpSearch ne "" )
		 {
			if( $StringMatching eq $RegExpSearch )
			{
				### At this level the Counting take or not the count, depending 
				### the number of match item being consider with variable DSLimit. 
				### Based on type of DSDisplay['package'] or DSDisplay['file']
				### It query the number of line for DSLimit by package will certify 
				### to analyse more package than DSLimit. But in file showing
				### we are not showing the package and only the file list.
				### in a case DSLimit=10 .  
				### These can take more than 10 lines per package but not exceding 
				### the limit of 10 for showing 10 package, so $intCountLine will 
				### always serve to count package but does not lime by the time 
				### all the file being show.
				$intCountLine=TypeShow( $StrLine , $intPosField ) ; 
			}
		 }
		 else
		 {
			$intCountLine=TypeShow( $StrLine , $intPosField ) ; ;
		 }
		}
	}
	else ### This one to add
	{
		$intCountLine=0 ; ### This one to add
	}
	return $intCountLine;
}

       
 

 Underneath the fact is 5 things to add to make it possible. I give you one more hint and it's triviality and the reason we are showing and we are not showing everything look like an "If" condition that simply require it's counter-part and in 5 - One "if" and One "else" it require 3 others to ad and make the application view the difference between install and de-install. 

like to note the behavior of the application at this function level. To return a number of line which is at least 1 or 0. Between showing something that fit inside the filter and 0, show nothing .

 In the important thing you have:

  1. To create a variable and it's environment from prompt predefined-variable
  2. Get the value of the actual package and create the if for it.

 

So in point 1 

my $PackageStatus=$ENV{"DSPkgStatus"} ;

In point 2

my $StrPackageStatus=per_line_matches( $StrLine , 1 ); 

The if

if ( $StrPackageStatus eq $PackageStatus ) 

 All the code inside the brace of this if, the else in gift.

	else ### This one to add
	{
		$intCountLine=0 ; ### This one to add
	}

 

 But those will getting from the github in Fnct.D won't even notice that problems.

And raise another point. Since we doubt having package in possible conflicts they are keep in dpkg database and still exist inside an configuration elsewhere ? Does it weight keeping them away but present. Sparing a size calculation to generate a size by package that include a size for de-installed package can eventually be an option since Perl is really handy. 

 

I am showing information, because the other edge of this application is the will to store some search request and will not do all the digest or getting the information being re-executed again for the same query. Unless there is an update . But using an application in my Ubuntu installed via snap, the DB browser for sqlite is also possible to develop database with perl and directly with sqlite and doing my first table and the code for perl I fall in a question of validation for DpkgSearch and fall into this little error. 

Table creation :

CREATE TABLE "PackageInformation" (
	"PkID"	INTEGER NOT NULL UNIQUE,
	"PackageName"	TEXT NOT NULL,
	"PackageStatus"	TEXT NOT NULL,
	PRIMARY KEY("PkID" AUTOINCREMENT)
);
     
 

 Being the first table it's important to not PackageStatus will be an only one introduction and in some it's true, if you have package being in the de-install statement inside dpkg it will enter into an insert with PackageStatus and "deinstall" and it have to be like this.  

It's more important to say it be never being touch too to infirm in a table that do require to get a notice of it's state, it should exist a package that start into the mode of "install" into "deinstall" and will require to really make another PkID with this package-name and having PackageStatus being "deinstall". Because it answer installation need. And changing and PkId relation and it's content make the relation being false if you simply update the same package information with new data. 

Because subsequent table will have correspondence. The Md5 table list depend of file and the digest but package too. And will depend of a valid installed package. 

While there is no chance to have file in a list all empty, the presence of package-id, id by-file, the File table will also match from a PkId of PackageInformation but not those from the Md5 table.  


Posts les plus consultés de ce blog

Does George Santos have receive money from Honest Gill.

 Back to five point of Honest Gill was :  76% of Americans say their representatives do a very bad job of listening to them. We used to aim big in this country – what happened? I’ll work hard to make sure 100% of Americans feel unrepresented.  I’ll make elections more representative for people who pay me. Ranked Choice Voting would disenfranchise campaign mega-donors and carelessly empower everyday Americans who don’t understand the wants and needs of the fundraising class. I’ll strengthen partisan gerry mandering. It’s better that politicians choose their voters, not the other way around, right ? Lobbyists spend $4 million per member of Congress. How are us poor Congress Members supposed to live on chump change? I pledge to continue to take gobs of cash from unscrupulous lobbyists. Just 4% of U.S. adults say the political system is working extremely or very well. Honest Gil will do his gosh darndest to get that number down to 0%.   To point 1, Honest Gil wi...

What are you doing here, another one ?

 Yeah, that's another one piece of Intel Corporation. Not in is box, already plugged somewhere. And now it's not sold with a board and not only wrap into a bubble bag. It come with the plastic box, and at least.    At 5.59$CA, if one of my board ares misconfiguration and lacking BIOS update to support higher than 10 Mb of memory, for family e5 2650v4 with 10 core rather than 14 and less than 20 Mb of L3 cache and will probably report only 60% of the memory is inaccessible rather than yelling for 66% of the memory if this one calculate the L3 memory as internal memory error for being unable to count the edge. Yes it's true an e5-2650 own 30Mb of L3 cache while the e5-2630 own 25 Mb. Ok it's not also the theoretical 2 cores in less. I seriously believe the second one will fail, for not having around 6 to 8 core and up to 15 Mb of memory on L3 cache. But apparently there is so many option withing the bios it let you disable the core. And mean I do request to investigate fo...

South Park Season 6 episode 8, Getting entry from everywhere, and talk that purge.

 Inside Red Hot Catholic love: Mostly engaged in a quest with old paper that compromise Vatican, we can empirically see the spider invade the Vatican as web that is origin of the sin and may compromise a story long of a big king willing to eat whole religion itself and there is drawn a idea the king will someday enter in the Vatican to invade it. But it's not the detailed reason, two other sub-talk from parent and delegation of believe do something strange among South Park resident.   Starting at the seventh minutes where Cartman challenge everyone. He not only winning but  got a slang talk to inherit from a strange symptoms against talk .     And manifestation of that symptoms lets people refluxing theirs 'expelation' back from the exit to normal way we are using to eat or express themselves.   We call it intro-digestion symptoms and beware of what you are doing it take you by surprise.  Accordingly to Stan report or Cartman slang to get a pooh out of...