Skip to content
Permalink
Browse files

Merge pull request #1142 from input-output-hk/dnadales/allow-software…

…-versions-to-start-from-0-or-1

Allow software versions to start from 0 or 1
  • Loading branch information
dnadales committed Jan 14, 2020
2 parents 706354e + 28848f5 commit 2aa807f4a4b6fd0ae0a511289586a2c2d18b56fb
@@ -14,7 +14,8 @@

import Build (LibraryName (LibraryName), Optimizations (Standard),
ShouldUploadCoverage (ShouldUploadCoverage),
StackExtraTestArgs (StackExtraTestArgs), TestRun (TestRun), doBuild)
StackExtraTestArgs (StackExtraTestArgs), TestRun (TestRun), Timeout (Timeout),
doBuild)
import BuildArgs (BuildArgs (BuildArgs, command, options),
Command (Build, CleanupCache, PurgeCache),
RebuildOpts (RebuildOpts, optBuildDirectory, optCacheDirectory, optDryRun),
@@ -41,3 +42,4 @@ main =
(ExtraShcArgs [])
(ExtraTixFilesDirectory ".")
)
(Timeout 45)
@@ -352,7 +352,7 @@ svCanFollow avs (an,av) =
(case Map.lookup an avs of
Nothing -> True
Just (x, _, _) -> av == x + 1
) && (an `Set.notMember` dom avs ==> av == ApVer 1)
) && (an `Set.notMember` dom avs ==> (av == ApVer 0 || av == ApVer 1))
where

------------------------------------------------------------------------
@@ -384,19 +384,17 @@ instance STS UPSVV where
let SwVer an av = up ^. upSwVer
apNameValid an ?! InvalidApplicationName
svCanFollow avs (an,av) ?! CannotFollowSv
(an, av) `notElem` fmap fstSnd (Map.elems raus) ?! AlreadyProposedSv
an `notElem` fmap fst' (Map.elems raus) ?! AlreadyProposedSv
all sTagValid (up ^. upSTags) ?! InvalidSystemTags
return $! raus [(up ^. upId, (an, av, up ^. upMdt))]
]
where
fst' (x, _, _) = x

apNameValid (ApName n) = all isAscii n && length n <= 12

sTagValid tag = all isAscii tag && length tag <= 10

fstSnd :: (a, b, c) -> (a, b)
fstSnd (x, y, _) = (x, y)


data UPPVV deriving (Generic, Data, Typeable)

instance STS UPPVV where
@@ -1930,6 +1928,10 @@ tamperWithUpdateProposal env st uprop = do
else do
(an, av) <- Gen.element registeredVersions
pure $! uprop & upSwVer .~ SwVer { _svName = an, _svVer = av }
where
fstSnd :: (a, b, c) -> (a, b)
fstSnd (x, y, _) = (x, y)


invalidSoftwareVersion :: Gen UProp
invalidSoftwareVersion =
@@ -498,11 +498,9 @@ \subsection{Update-proposals interface}

Also note that, unlike the rules of \cref{fig:rules:upi-ec}, we need not remove
other update proposals that refer to the software names whose versions were
changed in $\var{avs_{new}}$. The reason for this is that the map $\var{raus}$
can contain only one pair of the form $(\var{an}, \wcard)$ for any given
application name $\var{an}$: in Rule~\ref{eq:rule:up-av-validity} function
$\fun{svCanFollow}$ ensures that there is only one allowed version for any
given application name $\var{an}$.
changed in $\var{avs_{new}}$. The reason for this is that the range of $\var{raus}$
can contain only one pair of the form $(\var{an}, \wcard, \wcard)$ for any given
application name $\var{an}$ (see Rule~\ref{eq:rule:up-av-validity}).


\begin{figure}[htb]
@@ -342,7 +342,7 @@ \subsection{Update proposals registration}
\fun{svCanFollow}~\var{avs}~(\var{an}, \var{av}) & =
& (\var{an} \mapsto (\var{av_c}, \wcard, \wcard) \in \var{avs}
\Rightarrow \var{av} = \var{av_c} + 1)\\
& \wedge & (\var{an} \notin \dom~\var{avs} \Rightarrow \var{av} = 1)
& \wedge & (\var{an} \notin \dom~\var{avs} \Rightarrow \var{av} = 0 \vee \var{av} = 1)
\end{array}
\end{equation}
\caption{Update validity functions}
@@ -356,7 +356,7 @@ \subsection{Update proposals registration}
(\var{an}, \var{av}) \leteq \upSwVer{up}
& \fun{apNameValid}~\var{an}\\
& \fun{svCanFollow}~\var{avs}~(\var{an}, \var{av})
& (\var{an}, \var{av}, \wcard) \notin \range~\var{raus}\\
& (\var{an}, \wcard, \wcard) \notin \range~\var{raus}\\
\forall \var{t} \in \fun{upSTags}~\var{up} \cdot \fun{sTagValid}~t
}
{
@@ -1,7 +1,7 @@
{
"url": "https://github.com/input-output-hk/iohk-nix",
"rev": "f6b04c40eb2fc3473f440c1e8bce5f0cb6be1435",
"date": "2019-11-08T10:16:35+00:00",
"sha256": "0b0clvc57d8llgh62y7r1f9j01h4qacrv5mh9d5q3bfmlk7zy1n0",
"rev": "34750860998054b83f1f5b966b879d60347b3f7a",
"date": "2020-01-14T13:40:36+00:00",
"sha256": "1kba2wd517wwxfpbdf4dya1pyvf7mjj2i76s0p310s948b0pcbda",
"fetchSubmodules": false
}

0 comments on commit 2aa807f

Please sign in to comment.
You can’t perform that action at this time.