diff -uNr a/v/v.pl b/v/v.pl --- a/v/v.pl 5fc781391183934125154ce25c932b651b9b49f1a6bed879e124f6f9a2ad7c16543b0763731147634a224832206e94d1fcd3119c074b4d4fc225c4252257032d +++ b/v/v.pl c97446d52e0e61e4453130bf0c3e3dfceb4c03ab336718629be96ba1e364313dd3f8d1787f40ac235df4dedad50d6e64c1c78709d4545a73c0217450591ad750 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# (C) 2014 - 2017 The Bitcoin Foundation. You do not have, nor can you ever +# (C) 2014 - 2018 The Bitcoin Foundation. You do not have, nor can you ever # acquire the right to use, copy or distribute this software ; Should you use # this software for any purpose, or copy and distribute it to anyone or in any # manner, you are breaking the laws of whatever soi-disant jurisdiction, and @@ -10,24 +10,32 @@ use strict; -my $version = "99994 K "; +my $version = "99993 K "; -my $tdir = get_homedir() . "/.gnupgtmp"; +my $tdir = ""; my $graph; my %wot = (); my %map = (); my %tmp_map = (); my %banners = (); +my %ante_map = (); my %desc_map = (); my %vp_map = (); my ($pdir, $sdir, $wdir) = ""; my (@pfiles, @sfiles, @wfiles) = (); -sub get_homedir { - my $home = `echo \$HOME`; chomp($home); - return $home; +my @dep_bins = ("cat", "echo", "gpg", "ls", "mkdir", "patch", "pwd", + "rm", "sha512sum", "sort", "wget", "which", "mktemp"); + +sub check_required_bins { + my (@bins) = @_; + + foreach my $bin (@bins) { + my $res = `command -v $bin >&1`; chomp($res); + death("Dependent program not found! : $bin\n") if $res eq ""; + } } sub get_pwd { @@ -271,7 +279,28 @@ } @flow = toposort(%desc_map); %map = scrub_map(@flow); - return @flow; + return reverse @flow; +} + +sub calc_press_path { + my ($head) = @_; + traverse_press_path($head); + return toposort(%ante_map); +} + +sub traverse_press_path { + my ($vp) = @_; + + my %ante = antecedents($vp); + + if(%ante) { + $ante_map{$vp} = [keys %ante]; + foreach my $a (keys %ante) { + traverse_press_path($a); + } + } else { + $ante_map{$vp} = []; + } } sub scrub_map { @@ -387,7 +416,7 @@ death("Cyclic Graph!\n"); } } - return reverse @flow; + return @flow; } sub press_vpatches { @@ -395,9 +424,10 @@ my @press = @{$p}; my $v = 1 and shift @press if $press[0] =~ /^v$|^verbose$/i; death("HEAD: $press[1] not found in flow\n") if !grep /^$press[1]$/, @flow; - `rm -rf $press[0]` if -d $press[0]; + my @pp = calc_press_path($press[1]); + death("Directory $press[0] already exists! Halting press.\n") if -d $press[0]; `mkdir -p $press[0]`; - foreach my $vp (@flow) { + foreach my $vp (@pp) { if($v) { my @out = `patch -F 0 -E --dir $press[0] -p1 < $pdir/$vp 2>&1`; print "$vp\n"; @@ -553,8 +583,9 @@ } sub make_tmpdir { - my ($dir) = @_; - `mkdir -p $dir && chmod 0700 $dir` if !-d $dir or die "$dir exists! $!"; + if(-d "/tmp") { $tdir = `mktemp -d`; } else { $tdir = `mktemp -d -p .`; } + chomp($tdir); + death("Failed to create tempdir!\n") if $tdir eq ""; } sub death { @@ -694,6 +725,12 @@ foreach(@flow) { print "$_ " . get_signatories($_) . "\n"; } } +sub print_press_path { + my ($head) = @_; + my @pp = calc_press_path($head); + foreach(@pp) { print "$_ " . get_signatories($_) . "\n"; } +} + sub get_version { my $version_text = << "END_VERSION_TEXT"; ################################################################################ @@ -729,6 +766,7 @@ # (l | leafs) # # (f | flow) # # (p | press) ( ) # +# (pp | press-path) () # # (ss | sync-seals) ( ) # # (sv | sync-vpatches) ( ... ) # # (sa | sync-all-vpatches) ( ) # @@ -738,7 +776,7 @@ # (o | origin) () # # (g | graph) ( []) # # (v | version) # -# (h | ? | help) # +# (h | help) # # # END_SHORT_HELP my $l = "########################################" . @@ -753,8 +791,9 @@ # Commands: # # m, mirrors () # # Will attempt to retrieve, cryptographically verify and print entries # -# in this list for usage in other commands. Mirrors command my only be # -# invoked by itself. [See: sync-seals, sync-vpatches, sync-everything] # +# in this list for usage in other commands. Mirrors command may only # +# be invoked by itself. [See: sync-seals, sync-vpatches, # +# sync-everything] # # # # i, init () [( )] # # init should be run as the first command executed with V. init only # @@ -803,6 +842,10 @@ # is supplied immediately after ( p | press ) option. # # See: ( f | flow ) to view the topological ordering. # # # +# pp, press-path () # +# Print the actual path to be pressed, given a found in the # +# flow. # +# # # ss, sync-seals ( ) # # Given required options of and output directory # # will pull all of the available seal files from the given mirror into # @@ -845,7 +888,7 @@ # v, version # # Prints the version message. # # # -# h, ?, help # +# h, help # # Prints this full help message. # # # ################################################################################ @@ -854,11 +897,12 @@ } sub main { + check_required_bins(@dep_bins); + my $cmd; if(@ARGV > 0) { $cmd = shift @ARGV; } else { print "Unknown or missing option!\n"; print short_help("t"); return; } - my $home = get_homedir(); my $pwd = get_pwd(); $wdir = "$pwd/.wot"; $pdir = "$pwd/patches"; @@ -900,7 +944,7 @@ @wfiles = set_files($wdir); build_wot(); - if($cmd =~ /^h$|^help$|^\?$/) { print long_help(); return; } + if($cmd =~ /^h$|^help$/) { print long_help(); return; } if($cmd =~ /^i$|^init$/) { if(@ARGV == 1) { init(@ARGV, $pdir, $sdir); return; @@ -927,6 +971,7 @@ if ($cmd =~ /^r$|^roots$/) { print_roots(); } elsif($cmd =~ /^l$|^leafs$/) { print_leafs(); } elsif($cmd =~ /^f$|^flow$/) { print_flow(@flow); } + elsif($cmd =~ /^pp$|^press-path$/) { print_press_path(@ARGV); } elsif($cmd =~ /^p$|^press$/) { if(@ARGV < 2) { print "$cmd requires two arguments: ( )\n\n"; @@ -964,6 +1009,6 @@ else { print "Unknown option: \"$cmd\"\n"; print short_help("t"); } } -make_tmpdir($tdir); +make_tmpdir(); main(); remove_tmpdir($tdir); diff -uNr a/v/v_quick_start.txt b/v/v_quick_start.txt --- a/v/v_quick_start.txt 48d9a73b6bc7aebc3a70bfff5bd8568db21a641bd28d0042ceb0e0bcbc397aedf7291670c4b4987ed952471d62f450ffbebd1c9134e70eb040cabfc0637c3b3e +++ b/v/v_quick_start.txt 4e168b252c971a33e205e6e2b7026bb20b968c5f8f286c6b2c27c9884864f0bd5d8218c628a573ac062c163c428cdb2581f42fa7446f4830e5f8f801a04befc2 @@ -1,7 +1,7 @@ ..::[ The Bitcoin Foundation: V Quick Start ]::.. - Doc Version: 99994 K + Doc Version: 99993 K Author: mod6 Fingerprint: 0x027A8D7C0FB8A16643720F40721705A8B71EADAF @@ -18,24 +18,35 @@ 0x011: cpan | cpanm [CPAN | cpanminus] 0x012: Graph::Easy [Nice to have, not required] 0x013: graphviz [Nice to have, not required] - 0x014: gpg [GnuPG] + 0x014: gpg [GnuPG 1.4.x] 0x015: wget + 0x016: cat + 0x017: echo + 0x018: ls + 0x019: mkdir + 0x01A: patch + 0x01B: pwd + 0x01C: rm + 0x01D: sha512sum + 0x01E: sort + 0x01F: which + 0x020: mktmp 0x02]: Where do I get V ? - curl -s http://thebitcoin.foundation/v/V-20170317.tar.gz \ - -o V-20170317.tar.gz - curl -s http://thebitcoin.foundation/v/V-20170317.tar.gz.mod6.sig \ - -o V-20170317.tar.gz.mod6.sig + curl -s http://thebitcoin.foundation/v/V-20180222.tar.gz \ + -o V-20180222.tar.gz + curl -s http://thebitcoin.foundation/v/V-20180222.tar.gz.mod6.sig \ + -o V-20180222.tar.gz.mod6.sig gpg --keyserver pool.sks-keyservers.net \ --recv-keys 0x027A8D7C0FB8A16643720F40721705A8B71EADAF - gpg --verify V-20170317.tar.gz.mod6.sig V-20170317.tar.gz + gpg --verify V-20180222.tar.gz.mod6.sig V-20180222.tar.gz If the signature is good, now extract the archive. - tar -xf V-20170317.tar.gz + tar -xf V-20180222.tar.gz 0x03]: How do I setup V? @@ -59,7 +70,7 @@ ./v.pl m mirrors - Then run the intial sync of the vpatches and seals from a given mirror: + Then run the initial sync of the vpatches and seals from a given mirror: ./v.pl i http://thebitcoin.foundation diff -uNr a/v/v_users_manual.txt b/v/v_users_manual.txt --- a/v/v_users_manual.txt 12cca3d90b11ad346b6224e009e263be37361b8eb80e523c3b3f694586ab4e057b07b191ecdabaf4f73db778f1c23d7fc78241f48d1cb5e1de566a7f1beecbb0 +++ b/v/v_users_manual.txt 37ef9b4da1f2d0d09343dac421fc3d4497f210ea669f602ed6d73539f3df3b62dc3f68d8b12ba28f1bed130fbe2e3da3227a29669a55e1f131a08c830c58dbe6 @@ -1,7 +1,7 @@ ..::[ The Bitcoin Foundation: V Users Manual ]::.. - Doc Version: 99994 K + Doc Version: 99993 K Author: mod6 Fingerprint: 0x027A8D7C0FB8A16643720F40721705A8B71EADAF @@ -44,16 +44,14 @@ Graph::Easy perl library can be installed. Ubuntu: - apt-get install cpanminus cpanm -i Graph::Easy Gentoo [x86-64]: - emerge g-cpan - [ NOTE: Copy the next nine lines exacty as they are presented here and ] - [ then paste them into the shell. ] + [ NOTE: Copy the next nine lines exactly as they are presented here and ] + [ then paste them into the shell. ] cat < /etc/portage/package.accept_keywords # required by perl-gcpan/JSON-MaybeXS-1.003005::x-g-cpan @@ -89,6 +87,33 @@ Gentoo: emerge wget + [ Additional UNIX Commands Required ]: + + Recent distributions of Linux seem ship without tools that one would + automatically imagine are included by default. Unfortunate users have + found this out the hard way. You will need the following binaries + on your system, or V will not run. If V does not find one of these + binaries on your system, it will report which one it can not find and exit. + + They are, as follows (instructions on `gpg` and `wget are posted above): + + gpg [GnuPG] + wget + cat + echo + ls + mkdir + patch + pwd + rm + sha512sum + sort + which + mktmp + + If you do not have one of these binaries on your system, for whatever + reason, consult your OS documentation to determine how to install it. + [ Install GraphViz ]: In addition to Graph::Easy, if you wish to have V automatically build the @@ -103,12 +128,18 @@ etc-update [ enter -5 when prompted ] emerge -a graphviz [ Answer Yes at prompt ] + NOTE: Some people have had issue with getting a proper graphviz installed, + and subsequently no `dot` binary on their system. It may be resolved by + doing the following: + + emerge media-gfx/graphviz + [ Download V Archive ]: Now you must obtain the V archive & signature from: - http://thebitcoin.foundation/v/V-20170317.tar.gz - http://thebitcoin.foundation/v/V-20170317.tar.gz.mod6.sig + http://thebitcoin.foundation/v/V-20180222.tar.gz + http://thebitcoin.foundation/v/V-20180222.tar.gz.mod6.sig Then check the PGP signatures supplied: @@ -117,11 +148,11 @@ [ Key Fingerprint: 0x027A8D7C0FB8A16643720F40721705A8B71EADAF ] - gpg --verify V-20170317.tar.gz.mod6.sig V-20170317.tar.gz + gpg --verify V-20180222.tar.gz.mod6.sig V-20180222.tar.gz Then unpack the archive: - tar -xf V-20170317.tar.gz + tar -xf V-20180222.tar.gz [ Start V for the first time ]: @@ -155,7 +186,7 @@ 0x01]: V Usage At this point the user has installed all of V's requirements, performed a - lookup of available signed mirrors, and sync'd the WoT, Patches and Seals. + look up of available signed mirrors, and sync'd the WoT, Patches and Seals. What follows are usages and definitions of V's options with examples. @@ -171,7 +202,7 @@ The m or mirrors command is available to connect to the main V site: http://thebitcoin.foundation Here, V can connect and pull the list of available mirrors, signed by mirror administrators with L1 trust with - assbot and are in good standing in the WoT. Ask mod6 about this if you + deedbot and are in good standing in the WoT. Ask mod6 about this if you want to run an authorized, signed mirror of V. The mirrors command takes one required argument, an output directory for the @@ -194,7 +225,7 @@ directory) and Seals (.seals in the current working directory) directories by not setting the two or options -- only passing a mirror URL argument to the init command. If the user wishes to use their own named - directories, simply pass in those arguements in the exact order specified. + directories, simply pass in those arguments in the exact order specified. Example: ./v.pl i http://thebitcoin.foundation @@ -257,11 +288,11 @@ Options: [ finger ] - The w or wot command will build a list of WoT entities eligable for + The w or wot command will build a list of WoT entities eligible for creating seals for approved vpatches. If a specific vpatch has not been signed by a WoT entity, it is considered a 'WILD' vpatch, and will be - ignored. A vpatch must be signed by both Co-Chairs of The Bitcoin Foundation - to be considered approved for release. + ignored. A vpatch must be signed by both Co-Chairs of The Bitcoin Foundation + to be considered approved for release. Example: ./v.pl w @@ -269,7 +300,6 @@ ben_vulpes:4F7907942CA8B89B01E25A762AFA1A9FD2D031DA:Ben Vulpes mircea_popescu:6160E1CAC8A3C52966FD76998A736F0E2FB7B452:Mircea Popescu (Acest articol are apriori avantajul aliteralitatii alaturi.) mod6:027A8D7C0FB8A16643720F40721705A8B71EADAF:mod6 (mod6) - punkman:F28E0095843B91CB22E7D65533588BE08B232B13:punkman trinque:FC66C0C5D98C42A1D4A98B6B42F9985AFAB953C4:Michael Trinque ./v.pl w finger @@ -277,7 +307,6 @@ ben_vulpes-2AFA1A9FD2D031DA:4F7907942CA8B89B01E25A762AFA1A9FD2D031DA:Ben Vulpes mircea_popescu-8A736F0E2FB7B452:6160E1CAC8A3C52966FD76998A736F0E2FB7B452:Mircea Popescu (Acest articol are apriori avantajul aliteralitatii alaturi.) mod6-721705A8B71EADAF:027A8D7C0FB8A16643720F40721705A8B71EADAF:mod6 (mod6) - punkman-33588BE08B232B13:F28E0095843B91CB22E7D65533588BE08B232B13:punkman trinque-42F9985AFAB953C4:FC66C0C5D98C42A1D4A98B6B42F9985AFAB953C4:Michael Trinque [ r | roots ]: @@ -298,8 +327,8 @@ [ l | leafs ]: The l or leafs command takes no options or arguments, unless a different - pd or patchdir is specified. It simply traverses the vpatch directories - contained vpatches and returns any leaf vpatches found in the topological + pd or patchdir is specified. It simply traverses the vpatches in the + vpatch directory and returns any leaf vpatches found in the topological order. Examples: @@ -313,7 +342,7 @@ [ f | flow ]: - The f or flow command prints a topoligical flow of vpatches based on + The f or flow command prints a topological flow of vpatches based on precedence. By default will look for the 'patches' directory in the present working directory of V and print the flow to stdout. @@ -353,12 +382,12 @@ ( ) The p or press command is available to apply vpatches up through in - topological order (see flow command) to an output directory . - There are two required arguments; an output directory for applied patches - and a vpatch as the tip of the tree to press up through. - By default, no output is shown; however if the user supplies `v' or - `verbose' directly after the p or press command then the output from the - patching applcation process will be directed to stdout. + topological order (see press-path command) to an output directory + . There are two required arguments; an output directory for + applied patches and a vpatch as the tip of the tree to + press up through. By default, no output is shown; however if the user + supplies `v' or `verbose' directly after the p or press command then the + output from the patching application process will be directed to stdout. Example: ./v.pl p press_output genesis.vpatch @@ -382,12 +411,28 @@ patching file bitcoin/src/init.cpp ... + + *** SEE ALSO 'press-path' *** + + [ pp | press-path ]: + + Arguments: + () + + The pp or press-path command is available to allow the user to view (via + stdout) the actual path to be pressed, given a found in the flow. + + It is encouraged that a V user run this command before pressing to a given + . From release 99993 forward, the flow is no longer used to calculate + the press path from a given . Instead, with a given , recurse + all of the 's antecedents and press those only. + [ ss | sync-seals ]: Arguments: ( ) - The ss or sync-seals command is avilable to allow the user to sync seal to + The ss or sync-seals command is available to allow the user to sync seal to an alternative directory. Two arguments are required; the from which to sync and the alternative or existing seals directory . @@ -400,7 +445,7 @@ Arguments: ( ... ) - The sv or sync-vpatches command is availabe to allow the user to sync one or + The sv or sync-vpatches command is available to allow the user to sync one or more individual vpatches to a alternative output directory. Three arguments are required; the from which to sync, the alternative or existing directory and one or more . @@ -419,7 +464,7 @@ Arguments: ( ) - The sa or sync-all-vpatches command is avilable to allow the user to sync + The sa or sync-all-vpatches command is available to allow the user to sync all vpatches from a given mirror to an alternative output directory. Two arguments are required; the from which to sync and the alternative or existing patches directory . @@ -492,7 +537,7 @@ Arguments: () - The o or origin command is avaliable to allow the user to pass a sha512 + The o or origin command is available to allow the user to pass a sha512 hash and view where the given hash originated in the source tree. [ g | graph ]: @@ -500,7 +545,7 @@ Arguments & Options: ( []) - The g or graph command is available to produce a topoligical flow graph in + The g or graph command is available to produce a topological flow graph in SVG format. The command has a required argument, the . The output Dot language file can be used to generate the SVG HTML output file with the `dot` binary. To produce the output Dot language file, the @@ -510,7 +555,7 @@ should be available for V to invoke and generate the SVG HTML output for the user automatically. If it is not possible for the user to install 'graphviz' on the local environment for whatever reason, the Dot language - output file can be copied to a seperate environment where 'graphviz' can be + output file can be copied to a separate environment where 'graphviz' can be installed. A command like this is used to generate the SVG HTML output with the `dot` binary: `dot -Tsvg v-graph.dot > v-graph.html`. @@ -530,7 +575,7 @@ The v or version command simply prints the current version of V to stdout. This command takes no options or arguments. - [ h | ? | help ]: + [ h | help ]: - The h or ? or help command will print a longer, more verbose help message + The h or help command will print a longer, more verbose help message to stdout. This command takes no options or arguments.