From ea05f0f00307d87f07b6fff9251c9be29f75b96b Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Wed, 22 Mar 2023 23:06:40 -0500 Subject: [PATCH] Revise global storage for serials file name The serials file is now stored in the package state directory and is named relative to that directory in the configuration. --- gatekeeper.pl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index f66f77b..75d11cb 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -326,7 +326,7 @@ BEGIN { our $package_config_base =File::Spec->catdir($base, 'packages'); our $package_state_base = $base; - our $serials_path = File::Spec->catfile($base, 'serial.txt'); + our $serials_name = 'serial.txt'; our $Inbox_dir = File::Spec->catdir($base, 'inbox'); our $Scratch_dir = File::Spec->catdir($base, 'scratch'); @@ -384,10 +384,7 @@ BEGIN { our $package_config_base = $ZoneConfig{pkgconfdir}; our $package_state_base = $ZoneConfig{pkgstatedir}; - our $serials_path; - $serials_path= File::Spec->catfile($ZoneConfig{pkgstatedir}, - $ZoneConfig{serials}) - if $ZoneConfig{pkgstatedir} && $ZoneConfig{serials}; + our $serials_name = $ZoneConfig{serials}; our $Inbox_dir = $ZoneConfig{inboxdir}; our $Scratch_dir = $ZoneConfig{scratchdir}; @@ -399,7 +396,7 @@ BEGIN { if ($CheckConfigurationParse) { our $email_blacklist; our $maintainers_bypkg; our $Public_Upload_Archive_Inbox; our $Internal_Report_Inbox; - our $zone_tag; our $Log_Tag; our $serials_path; + our $zone_tag; our $Log_Tag; our $serials_name; our $package_config_base; our $package_state_base; our $Inbox_dir; our $Scratch_dir; our $Stage_dir; our $Public_dir; our $Archive_dir; @@ -413,8 +410,7 @@ BEGIN { foreach my $item ([tag => $zone_tag], [logtag => $Log_Tag], [pkgconfdir => $package_config_base], [pkgstatedir => $package_state_base], - [serials => $serials_path - ? (File::Spec->splitpath($serials_path))[2] : undef], + [serials => $serials_name], [inboxdir => $Inbox_dir], [scratchdir => $Scratch_dir], [stagedir => $Stage_dir], [publicdir => $Public_dir], [archivedir => $Archive_dir]) @@ -482,7 +478,6 @@ our $zone_tag; our $package_config_base; our $email_blacklist; our $maintainers_bypkg; -our $serials_path; # syslog destination use constant SYSLOG_APP_IDENT => 'gatekeeper'; @@ -2385,6 +2380,11 @@ sub advance_timestamp_ratchet { my $full_filename = shift; my $new_epoch = shift; + # scaffolding + our $package_state_base; our $serials_name; + return unless defined $serials_name; + my $serials_path = File::Spec->catfile($package_state_base, $serials_name); + # Now we need to flock the our 'serials' file; # verify the epoch value there/update it, etc. my %serials = (); -- 2.25.1