From 49442a6a57676b933245b7f499c5a65ec4959cc4 Mon Sep 17 00:00:00 2001 From: anselmi@0a9758305bef5e058dd0263fa20a27b334b482c7 Date: Thu, 22 Dec 2016 17:23:58 +0000 Subject: Added a comment: Cache gpg passphrase. --- .../comment_1_4b732110f59f78f73fdfb745bdd9c0dd._comment | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 doc/forum/propellor_and_gpg2/comment_1_4b732110f59f78f73fdfb745bdd9c0dd._comment diff --git a/doc/forum/propellor_and_gpg2/comment_1_4b732110f59f78f73fdfb745bdd9c0dd._comment b/doc/forum/propellor_and_gpg2/comment_1_4b732110f59f78f73fdfb745bdd9c0dd._comment new file mode 100644 index 00000000..66c4cffa --- /dev/null +++ b/doc/forum/propellor_and_gpg2/comment_1_4b732110f59f78f73fdfb745bdd9c0dd._comment @@ -0,0 +1,13 @@ +[[!comment format=mdwn + username="anselmi@0a9758305bef5e058dd0263fa20a27b334b482c7" + nickname="anselmi" + avatar="http://cdn.libravatar.org/avatar/65b723eb35eb4e3b05fffafd3e13e0fd" + subject="Cache gpg passphrase." + date="2016-12-22T17:23:58Z" + content=""" +The bottom line on this is that gpg2 (via the agent and pinentry) doesn't prompt correctly when run from git. It does when run directly. + +One fix is to set GPG_TTY before running propellor: `export GPG_TTY=$(tty)` or some such. + +Anything else that caches the pass phrase in the agent works too since that removes the need to prompt. +"""]] -- cgit v1.2.3 From b046a63f49004b7439a5422e5ab51dfee7ba1958 Mon Sep 17 00:00:00 2001 From: db48x Date: Mon, 26 Dec 2016 14:07:33 +0000 Subject: moderately confused --- .../Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn diff --git a/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn new file mode 100644 index 00000000..fdba0576 --- /dev/null +++ b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn @@ -0,0 +1 @@ +I've managed to do a few useful things with propellor, but it feels a bit rough around the edges to me. It looked at first like the --check and --build options would be useful for checking that my configs would at least compile, but it turns out that --build doesn't even exist and --check just returns without doing anything. Should they just be removed, or do they need more work to finish them? -- cgit v1.2.3 From e3dacfc402108d2da408f843542d82dcab58157d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 26 Dec 2016 11:54:37 -0400 Subject: get usage and man page back in sync Remove --build which is no longer present. Order the list of options the same. Document --rm-key in man page. --- doc/usage.mdwn | 4 ++++ src/Propellor/CmdLine.hs | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/usage.mdwn b/doc/usage.mdwn index fec346ae..fc1f8391 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -66,6 +66,10 @@ and configured in haskell. using this key. Propellor requires signed commits when pulling from a central git repository. +* propellor --rm-key keyid + + Stops encrypting the privdata to a gpg key. + * propellor --list-fields Lists all privdata fields that are used by your propellor configuration. diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index fc256109..448abf62 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -25,19 +25,18 @@ usage h = hPutStrLn h $ unlines [ "Usage:" , " propellor --init" , " propellor" - , " propellor hostname" , " propellor --spin targethost [--via relayhost]" , " propellor --add-key keyid" , " propellor --rm-key keyid" , " propellor --list-fields" - , " propellor --dump field context" - , " propellor --edit field context" , " propellor --set field context" , " propellor --unset field context" , " propellor --unset-unused" + , " propellor --dump field context" + , " propellor --edit field context" , " propellor --merge" - , " propellor --build" , " propellor --check" + , " propellor hostname" ] usageError :: [String] -> IO a -- cgit v1.2.3 From 577ff36472956689ef5bebbefe6770357e2785f4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 26 Dec 2016 12:07:18 -0400 Subject: Added --build option, which makes propellor simply build itself. --- debian/changelog | 6 ++++++ doc/usage.mdwn | 8 ++++++++ src/Propellor/CmdLine.hs | 3 +++ src/Propellor/Types/CmdLine.hs | 1 + 4 files changed, 18 insertions(+) diff --git a/debian/changelog b/debian/changelog index cb313e2f..765f44c0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +propellor (3.2.4) UNRELEASED; urgency=medium + + * Added --build option, which makes propellor simply build itself. + + -- Joey Hess Mon, 26 Dec 2016 12:03:19 -0400 + propellor (3.2.3) unstable; urgency=medium * Improve extraction of gpg secret key id list, to work with gpg 2.1. diff --git a/doc/usage.mdwn b/doc/usage.mdwn index fc1f8391..3d32538f 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -55,6 +55,14 @@ and configured in haskell. The hostname given to --spin can be a short name, which is then looked up in the DNS to find the FQDN. +* propellor --build + + Causes propellor to build itself, checking that your config.hs, etc are + valid. + + You do not need to run this as a separate step; propellor automatically + builds itself when using things like --spin. + * propellor --add-key keyid Adds a gpg key, which is used to encrypt the privdata. diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index 448abf62..7840cc33 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -26,6 +26,7 @@ usage h = hPutStrLn h $ unlines , " propellor --init" , " propellor" , " propellor --spin targethost [--via relayhost]" + , " propellor --build" , " propellor --add-key keyid" , " propellor --rm-key keyid" , " propellor --list-fields" @@ -53,6 +54,7 @@ processCmdLine = go =<< getArgs <$> mapM hostname (reverse hs) <*> pure (Just r) _ -> Spin <$> mapM hostname ps <*> pure Nothing + go ("--build":[]) = return Build go ("--add-key":k:[]) = return $ AddKey k go ("--rm-key":k:[]) = return $ RmKey k go ("--set":f:c:[]) = withprivfield f c Set @@ -101,6 +103,7 @@ defaultMain hostlist = withConcurrentOutput $ do where go cr (Serialized cmdline) = go cr cmdline go _ Check = return () + go cr Build = buildFirst Nothing cr Build $ return () go _ (Set field context) = setPrivData field context go _ (Unset field context) = unsetPrivData field context go _ (UnsetUnused) = unsetPrivDataUnused hostlist diff --git a/src/Propellor/Types/CmdLine.hs b/src/Propellor/Types/CmdLine.hs index 558c6e8b..d712a456 100644 --- a/src/Propellor/Types/CmdLine.hs +++ b/src/Propellor/Types/CmdLine.hs @@ -28,4 +28,5 @@ data CmdLine | ChrootChain HostName FilePath Bool Bool | GitPush Fd Fd | Check + | Build deriving (Read, Show, Eq) -- cgit v1.2.3 From 1d868470e4ec6ec6211206003279ac4bc8465c4f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 26 Dec 2016 12:07:35 -0400 Subject: comment and close --- ...ck_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn | 2 ++ .../comment_1_7c2b2447254ad44ee1316b47eac130df._comment | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_1_7c2b2447254ad44ee1316b47eac130df._comment diff --git a/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn index fdba0576..52b3b998 100644 --- a/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn +++ b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__.mdwn @@ -1 +1,3 @@ I've managed to do a few useful things with propellor, but it feels a bit rough around the edges to me. It looked at first like the --check and --build options would be useful for checking that my configs would at least compile, but it turns out that --build doesn't even exist and --check just returns without doing anything. Should they just be removed, or do they need more work to finish them? + +[[done]] diff --git a/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_1_7c2b2447254ad44ee1316b47eac130df._comment b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_1_7c2b2447254ad44ee1316b47eac130df._comment new file mode 100644 index 00000000..392f0f1c --- /dev/null +++ b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_1_7c2b2447254ad44ee1316b47eac130df._comment @@ -0,0 +1,12 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2016-12-26T15:55:36Z" + content=""" +--check does just what it's supposed to do. This is used during bootstrap +to notice if the propellor binary has gotten broken by changes to eg system +libraries. + +--build seems to have been added without being implemented. But it does +seem useful to have a way to simply build propellor so implemented it now. +"""]] -- cgit v1.2.3 From ce6b81166498753903d4c9fd0b310a50a7810093 Mon Sep 17 00:00:00 2001 From: db48x Date: Mon, 26 Dec 2016 21:23:03 +0000 Subject: Added a comment: aha --- .../comment_2_b4910f50225a8b763566126861faea11._comment | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_2_b4910f50225a8b763566126861faea11._comment diff --git a/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_2_b4910f50225a8b763566126861faea11._comment b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_2_b4910f50225a8b763566126861faea11._comment new file mode 100644 index 00000000..0c594483 --- /dev/null +++ b/doc/todo/Are_--check_and_--build_on_the_way_in_or_on_the_way_out__63__/comment_2_b4910f50225a8b763566126861faea11._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="db48x" + avatar="http://cdn.libravatar.org/avatar/ad2688127feb555a92154b16d8eeb5d3" + subject="aha" + date="2016-12-26T21:23:03Z" + content=""" +Thanks! +"""]] -- cgit v1.2.3 From fa0e8d8389074c2cc08ca4911080fac0252acbd1 Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Mon, 26 Dec 2016 21:07:20 -0500 Subject: add a little more information to the usage text --- src/Propellor/CmdLine.hs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index f26e0834..9982372c 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -24,22 +24,22 @@ import Utility.FileSystemEncoding usage :: Handle -> IO () usage h = hPutStrLn h $ unlines [ "Usage:" - , " propellor --init" - , " propellor" - , " propellor --spin targethost [--via relayhost]" - , " propellor --build" - , " propellor --add-key keyid" - , " propellor --rm-key keyid" - , " propellor --list-fields" - , " propellor --set field context" - , " propellor --unset field context" - , " propellor --unset-unused" - , " propellor --dump field context" - , " propellor --edit field context" - , " propellor --merge" - , " propellor --check" - , " propellor hostname" - ] + , " --init\t\t initialize ~/.propellor" + , " \t\t\t with no arguments, provision the current host" + , " hostname\t\t provision the current host as if it had the specified hostname" + , " --spin targethost [--via relayhost] " + , " \t\t\t provision the specified host" + , " --build\t\t recompile using your current config" + , " --add-key keyid\t add an additional signing key to the private data" + , " --rm-key keyid\t remove a signing key from the private data" + , " --list-fields\t\t list private data fields" + , " --set field context\t set a private data field" + , " --unset field context\t clear a private data field" + , " --unset-unused\t clear unused fields from the private data" + , " --dump field context\t show the content of a private data field" + , " --edit field context\t edit the content of a private data field" + , " --merge\t\t combine multiple spins into a single git commit" + , " --check\t\t double-check that propellor can actually run here"] usageError :: [String] -> IO a usageError ps = do -- cgit v1.2.3 From eadfc8b972e09bd7173fbfffd57539eb3b8b394c Mon Sep 17 00:00:00 2001 From: db48x Date: Tue, 27 Dec 2016 02:12:10 +0000 Subject: --- doc/todo/usage__47__help_text_improvements.mdwn | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/todo/usage__47__help_text_improvements.mdwn diff --git a/doc/todo/usage__47__help_text_improvements.mdwn b/doc/todo/usage__47__help_text_improvements.mdwn new file mode 100644 index 00000000..8ffca2c0 --- /dev/null +++ b/doc/todo/usage__47__help_text_improvements.mdwn @@ -0,0 +1 @@ +I started out looking at how to make usage.mdwn into a man page, but that's a little more work than I wanted to do tonight. Instead, I added more information to the usage message. Commit is fa0e8d83 on iabak:~db48x/propellor if you want it. -- cgit v1.2.3 From 68bad5f2ee0488730d4ed77e2aa8dd50f4c02096 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 26 Dec 2016 22:45:56 -0400 Subject: clean up after merge --- config.hs | 2 +- privdata/relocate | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 privdata/relocate diff --git a/config.hs b/config.hs index 97d90636..ec313725 120000 --- a/config.hs +++ b/config.hs @@ -1 +1 @@ -joeyconfig.hs \ No newline at end of file +config-simple.hs \ No newline at end of file diff --git a/privdata/relocate b/privdata/relocate deleted file mode 100644 index 271692d8..00000000 --- a/privdata/relocate +++ /dev/null @@ -1 +0,0 @@ -.joeyconfig -- cgit v1.2.3 From 1107f528e0ddbaf62c7a171c7da26b00afb18944 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 26 Dec 2016 22:49:07 -0400 Subject: comment --- .../comment_1_66878945cdb57d06849337262d939701._comment | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 doc/todo/usage__47__help_text_improvements/comment_1_66878945cdb57d06849337262d939701._comment diff --git a/doc/todo/usage__47__help_text_improvements/comment_1_66878945cdb57d06849337262d939701._comment b/doc/todo/usage__47__help_text_improvements/comment_1_66878945cdb57d06849337262d939701._comment new file mode 100644 index 00000000..f30eae46 --- /dev/null +++ b/doc/todo/usage__47__help_text_improvements/comment_1_66878945cdb57d06849337262d939701._comment @@ -0,0 +1,13 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2016-12-27T02:46:19Z" + content=""" +I don't like the use of tabs in that; it may be that with some terminal +with an unusual tab stop, the things don't align. + +It would probably be simplest to put the description in the line under the +option. + +BTW, the Makefile can build propellor.1 out of usage.mdwn +"""]] -- cgit v1.2.3 From 289afbc22f3ac0f08b9c785ef4c8b996a404203f Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Tue, 27 Dec 2016 01:12:03 -0500 Subject: use fewer tabs --- src/Propellor/CmdLine.hs | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index 9982372c..a36ec7f5 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -24,22 +24,36 @@ import Utility.FileSystemEncoding usage :: Handle -> IO () usage h = hPutStrLn h $ unlines [ "Usage:" - , " --init\t\t initialize ~/.propellor" - , " \t\t\t with no arguments, provision the current host" - , " hostname\t\t provision the current host as if it had the specified hostname" - , " --spin targethost [--via relayhost] " - , " \t\t\t provision the specified host" - , " --build\t\t recompile using your current config" - , " --add-key keyid\t add an additional signing key to the private data" - , " --rm-key keyid\t remove a signing key from the private data" - , " --list-fields\t\t list private data fields" - , " --set field context\t set a private data field" - , " --unset field context\t clear a private data field" - , " --unset-unused\t clear unused fields from the private data" - , " --dump field context\t show the content of a private data field" - , " --edit field context\t edit the content of a private data field" - , " --merge\t\t combine multiple spins into a single git commit" - , " --check\t\t double-check that propellor can actually run here"] + , " with no arguments, provision the current host" + , "" + , " --init" + , " initialize ~/.propellor" + , " hostname" + , " provision the current host as if it had the specified hostname" + , " --spin targethost [--via relayhost]" + , " provision the specified host" + , " --build" + , " recompile using your current config" + , " --add-key keyid" + , " add an additional signing key to the private data" + , " --rm-key keyid" + , " remove a signing key from the private data" + , " --list-fields" + , " list private data fields" + , " --set field context" + , " set a private data field" + , " --unset field context" + , " clear a private data field" + , " --unset-unused" + , " clear unused fields from the private data" + , " --dump field context" + , " show the content of a private data field" + , " --edit field context" + , " edit the content of a private data field" + , " --merge" + , " combine multiple spins into a single git commit" + , " --check" + , " double-check that propellor can actually run here"] usageError :: [String] -> IO a usageError ps = do -- cgit v1.2.3 From d7faad78217ff4eeac98048a094fc6849b3c44a0 Mon Sep 17 00:00:00 2001 From: db48x Date: Tue, 27 Dec 2016 06:12:52 +0000 Subject: Added a comment --- .../comment_2_d531a45851cdef87a8f7b8182b3d04ce._comment | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 doc/todo/usage__47__help_text_improvements/comment_2_d531a45851cdef87a8f7b8182b3d04ce._comment diff --git a/doc/todo/usage__47__help_text_improvements/comment_2_d531a45851cdef87a8f7b8182b3d04ce._comment b/doc/todo/usage__47__help_text_improvements/comment_2_d531a45851cdef87a8f7b8182b3d04ce._comment new file mode 100644 index 00000000..62cf1fe4 --- /dev/null +++ b/doc/todo/usage__47__help_text_improvements/comment_2_d531a45851cdef87a8f7b8182b3d04ce._comment @@ -0,0 +1,12 @@ +[[!comment format=mdwn + username="db48x" + avatar="http://cdn.libravatar.org/avatar/ad2688127feb555a92154b16d8eeb5d3" + subject="comment 2" + date="2016-12-27T06:12:52Z" + content=""" +/me facepalms; of course it can. I guess I saw the 'git commit' in the install target and disregarded the rest. + +I removed the tabs from the usage. It's a lot longer, but I suppose it gets the job done. + + +"""]] -- cgit v1.2.3 From 3d5256bc1132a7ec94210fb2c9c7aa9af3baa4fa Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 28 Dec 2016 13:01:13 -0400 Subject: More informative usage message. Thanks, Daniel Brooks --- CHANGELOG | 1 + doc/todo/usage__47__help_text_improvements.mdwn | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f41c556f..eef6c1de 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ propellor (3.2.4) UNRELEASED; urgency=medium * GHC's fileSystemEncoding is used for all String IO, to avoid encoding-related crashes in eg, Propellor.Property.File. * Add --build option to simply build config.hs. + * More informative usage message. Thanks, Daniel Brooks -- Joey Hess Sat, 24 Dec 2016 15:06:36 -0400 diff --git a/doc/todo/usage__47__help_text_improvements.mdwn b/doc/todo/usage__47__help_text_improvements.mdwn index 8ffca2c0..80fffb3d 100644 --- a/doc/todo/usage__47__help_text_improvements.mdwn +++ b/doc/todo/usage__47__help_text_improvements.mdwn @@ -1 +1,3 @@ I started out looking at how to make usage.mdwn into a man page, but that's a little more work than I wanted to do tonight. Instead, I added more information to the usage message. Commit is fa0e8d83 on iabak:~db48x/propellor if you want it. + +> merged [[done]] tnx --[[Joey]] -- cgit v1.2.3 From 891ba4e31c8c382f7398ec6fd475309015975445 Mon Sep 17 00:00:00 2001 From: spwhitton Date: Sat, 31 Dec 2016 17:54:27 +0000 Subject: report bug --- ...opellor_broken_now_CHANGELOG_not_a_symlink.mdwn | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink.mdwn diff --git a/doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink.mdwn b/doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink.mdwn new file mode 100644 index 00000000..bfba8548 --- /dev/null +++ b/doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink.mdwn @@ -0,0 +1,36 @@ +In Joey's master branch, `CHANGELOG` is a real file, whereas previously it was a symlink. This breaks the `/usr/src/propellor` newer version check. + +Steps to reproduce: + +1. Install propellor 3.2.3 or older with apt on Debian or Ubuntu +2. `propellor --init` and select option `A` +3. Prepare a pseudorelease: merge Joey's master branch into [my Debian packaging branch](https://git.spwhitton.name/?p=propellor.git;a=shortlog;h=refs/heads/debian), `dch -v3.2.3+gitYYYYMMDD.fffffff`, `dpkg-buildpackage -uc -b`, `debi -u` +4. `propellor --spin` + +I haven't yet tried reproducing this by building a `.deb` from Joey's master branch, rather than my packaging branch. If the problem does not appear using a `.deb` from Joey's master branch, this is an internal Debian problem, rather than an upstream bug. However, perhaps Joey can immediately see a solution. + +Sample output: + + Auto-merging src/wrapper.hs + Auto-merging src/Utility/UserInfo.hs + Auto-merging src/Utility/SystemDirectory.hs + Auto-merging src/Utility/Misc.hs + Auto-merging src/Utility/FileSystemEncoding.hs + Auto-merging src/Utility/Exception.hs + Auto-merging src/Propellor/Types/CmdLine.hs + Auto-merging src/Propellor/Shim.hs + Auto-merging src/Propellor/Property/Gpg.hs + Auto-merging src/Propellor/Property/Debootstrap.hs + Auto-merging src/Propellor/Property.hs + Auto-merging src/Propellor/PrivData.hs + Auto-merging src/Propellor/Gpg.hs + Auto-merging src/Propellor/CmdLine.hs + Auto-merging debian/changelog + Auto-merging CHANGELOG + CONFLICT (add/add): Merge conflict in CHANGELOG + Automatic merge failed; fix conflicts and then commit the result. + propellor: Failed to run git ["merge","c590ddd8e2fa87baa409b6c29501d4473555ecfb","-s","recursive","-Xtheirs","--quiet","-m","merging upstream version","--allow-unrelated-histories"] + CallStack (from HasCallStack): + error, called at src/Propellor/DotDir.hs:425:17 in main:Propellor.DotDir + +--spwhitton -- cgit v1.2.3 From 0db84b872dd2f7831026b089645a01ce43ef70e0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jan 2017 17:32:31 -0400 Subject: comment --- .../comment_1_62b47d7c0530c2988b7e6e998878b920._comment | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink/comment_1_62b47d7c0530c2988b7e6e998878b920._comment diff --git a/doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink/comment_1_62b47d7c0530c2988b7e6e998878b920._comment b/doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink/comment_1_62b47d7c0530c2988b7e6e998878b920._comment new file mode 100644 index 00000000..886c2534 --- /dev/null +++ b/doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink/comment_1_62b47d7c0530c2988b7e6e998878b920._comment @@ -0,0 +1,11 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2017-01-01T21:29:52Z" + content=""" +I have reverted that change for now. + +I don't think the /usr/src/propellor/ merge has anything specific to do +with the changelog, so there is probably a general case where that merge +fails to work. I guess it involves a file's type changing. +"""]] -- cgit v1.2.3 From 8199e351fcaf8f30c53a251d304698baa3152d52 Mon Sep 17 00:00:00 2001 From: spwhitton Date: Tue, 3 Jan 2017 09:07:18 +0000 Subject: Added a comment --- .../comment_2_61463030200038542d293149754d36ed._comment | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink/comment_2_61463030200038542d293149754d36ed._comment diff --git a/doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink/comment_2_61463030200038542d293149754d36ed._comment b/doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink/comment_2_61463030200038542d293149754d36ed._comment new file mode 100644 index 00000000..b1b4a037 --- /dev/null +++ b/doc/todo/Merging_from___47__usr__47__src__47__propellor_broken_now_CHANGELOG_not_a_symlink/comment_2_61463030200038542d293149754d36ed._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="spwhitton" + avatar="http://cdn.libravatar.org/avatar/9c3f08f80e67733fd506c353239569eb" + subject="comment 2" + date="2017-01-03T09:07:18Z" + content=""" +Thanks for looking at this. Yes, it's probably the type-change. There is surely some way to instruct git to DTRT. +"""]] -- cgit v1.2.3 From 5b1d191a4fb9362ffe58fe11e98648dc60614cf3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 6 Jan 2017 00:47:10 -0400 Subject: too --- doc/todo/hostChroot.mdwn | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/todo/hostChroot.mdwn diff --git a/doc/todo/hostChroot.mdwn b/doc/todo/hostChroot.mdwn new file mode 100644 index 00000000..55fa6898 --- /dev/null +++ b/doc/todo/hostChroot.mdwn @@ -0,0 +1,4 @@ +Would be useful to have a `hostChroot :: Host -> Chroot`. + +For a Debian host, this would use debootstrapped and pass all the Host's +properties to it. --[[Joey]] -- cgit v1.2.3 From 626972d9ffa1821256065308555c50c465d44485 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 6 Jan 2017 10:57:28 -0400 Subject: update --- doc/todo/hostChroot.mdwn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/todo/hostChroot.mdwn b/doc/todo/hostChroot.mdwn index 55fa6898..eccfd641 100644 --- a/doc/todo/hostChroot.mdwn +++ b/doc/todo/hostChroot.mdwn @@ -2,3 +2,6 @@ Would be useful to have a `hostChroot :: Host -> Chroot`. For a Debian host, this would use debootstrapped and pass all the Host's properties to it. --[[Joey]] + +Would need to make privdata use the context of the input Host. And would +need to propigate privdata info, but not other info. --[[Joey]] -- cgit v1.2.3 From 979c37985bde31c57ec254a34d21f3c78d136da5 Mon Sep 17 00:00:00 2001 From: Félix Sipma Date: Wed, 18 Jan 2017 15:47:23 +0100 Subject: add Ord instance for Port --- src/Propellor/Types/OS.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Types/OS.hs b/src/Propellor/Types/OS.hs index b569a6e8..43371af1 100644 --- a/src/Propellor/Types/OS.hs +++ b/src/Propellor/Types/OS.hs @@ -143,7 +143,7 @@ userGroup :: User -> Group userGroup (User u) = Group u newtype Port = Port Int - deriving (Eq, Show) + deriving (Eq, Ord, Show) fromPort :: Port -> String fromPort (Port p) = show p -- cgit v1.2.3 From fd57dded8abdbd3eef6fef7f41a2ffc7aa98f45a Mon Sep 17 00:00:00 2001 From: Félix Sipma Date: Wed, 18 Jan 2017 15:52:48 +0100 Subject: Tor: enable multiple ports hidden services with hiddenService'/hiddenServiceAvailable' --- src/Propellor/Property/Tor.hs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs index ea9f39ed..52b38230 100644 --- a/src/Propellor/Property/Tor.hs +++ b/src/Propellor/Property/Tor.hs @@ -124,22 +124,30 @@ bandwidthRate' s divby = case readSize dataUnits s of -- If used without `hiddenServiceData`, tor will generate a new -- private key. hiddenService :: HiddenServiceName -> Port -> Property DebianLike -hiddenService hn (Port port) = ConfFile.adjustSection - (unwords ["hidden service", hn, "available on port", show port]) +hiddenService hn port = hiddenService' hn [port] + +hiddenService' :: HiddenServiceName -> [Port] -> Property DebianLike +hiddenService' hn ports = ConfFile.adjustSection + (unwords ["hidden service", hn, "available on ports", intercalate "," (map show ports')]) (== oniondir) (not . isPrefixOf "HiddenServicePort") - (const [oniondir, onionport]) - (++ [oniondir, onionport]) + (const (oniondir : onionports)) + (++ oniondir : onionports) mainConfig `onChange` restarted where oniondir = unwords ["HiddenServiceDir", varLib hn] - onionport = unwords ["HiddenServicePort", show port, "127.0.0.1:" ++ show port] + onionports = map onionport ports' + ports' = sort ports + onionport port = unwords ["HiddenServicePort", show port, "127.0.0.1:" ++ show port] -- | Same as `hiddenService` but also causes propellor to display -- the onion address of the hidden service. hiddenServiceAvailable :: HiddenServiceName -> Port -> Property DebianLike -hiddenServiceAvailable hn port = hiddenServiceHostName $ hiddenService hn port +hiddenServiceAvailable hn port = hiddenServiceAvailable' hn [port] + +hiddenServiceAvailable' :: HiddenServiceName -> [Port] -> Property DebianLike +hiddenServiceAvailable' hn ports = hiddenServiceHostName $ hiddenService hn ports where hiddenServiceHostName p = adjustPropertySatisfy p $ \satisfy -> do r <- satisfy -- cgit v1.2.3 From a2a07c8b6a3a9d73f32b8615ba0ce4e7127bbbb3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 19 Jan 2017 10:24:08 +1100 Subject: Tor.hiddenService' added to support multiple ports. Thanks, Félix Sipma. --- debian/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index eef6c1de..643df973 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ propellor (3.2.4) UNRELEASED; urgency=medium encoding-related crashes in eg, Propellor.Property.File. * Add --build option to simply build config.hs. * More informative usage message. Thanks, Daniel Brooks + * Tor.hiddenService' added to support multiple ports. + Thanks, Félix Sipma. -- Joey Hess Sat, 24 Dec 2016 15:06:36 -0400 -- cgit v1.2.3 From f00734ace53a291e64499f95e06c432af203f1b3 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 15 Jan 2017 18:55:54 -0700 Subject: add Apt.noPDiffs --- src/Propellor/Property/Apt.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 196fb345..c0d4ac82 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -349,5 +349,10 @@ hasForeignArch arch = check notAdded (add `before` update) add = cmdProperty "dpkg" ["--add-architecture", arch] `assume` MadeChange +-- | Disable the use of PDiffs for machines with high-bandwidth connections. +noPDiffs :: Property DebianLike +noPDiffs = tightenTargets $ "/etc/apt/apt.conf.d/20pdiffs" `File.hasContent` + [ "Acquire::PDiffs \"false\";" ] + dpkgStatus :: FilePath dpkgStatus = "/var/lib/dpkg/status" -- cgit v1.2.3 From 244a4c54cb6c83e6ceb101290fab1a3d85c1a1e6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 19 Jan 2017 12:03:18 +1100 Subject: Apt.noPDiffs added. Thanks, Sean Whitton. --- debian/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index 643df973..a79611b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ propellor (3.2.4) UNRELEASED; urgency=medium * More informative usage message. Thanks, Daniel Brooks * Tor.hiddenService' added to support multiple ports. Thanks, Félix Sipma. + * Apt.noPDiffs added. + Thanks, Sean Whitton. -- Joey Hess Sat, 24 Dec 2016 15:06:36 -0400 -- cgit v1.2.3 From 0b2db49c28a44cfd4f734135e4e55ba16afc139a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 21 Jan 2017 12:31:24 +1100 Subject: add --- doc/news/Linux.Conf.Au.presentation.mdwn | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/news/Linux.Conf.Au.presentation.mdwn diff --git a/doc/news/Linux.Conf.Au.presentation.mdwn b/doc/news/Linux.Conf.Au.presentation.mdwn new file mode 100644 index 00000000..00419554 --- /dev/null +++ b/doc/news/Linux.Conf.Au.presentation.mdwn @@ -0,0 +1,4 @@ + + +[video](http://mirror.linux.org.au/pub/linux.conf.au/2017/Type_driven_configuration_management_with_Propellor.webm) + -- cgit v1.2.3 From a004f14f447e341a07bee47a67fc88fb0e44b339 Mon Sep 17 00:00:00 2001 From: craige@a46118dff5bc0fad85259759970d8b4b9fc377d7 Date: Thu, 26 Jan 2017 05:54:22 +0000 Subject: Added a comment: Fixed! --- .../comment_2_5afe0f200d7139499ef4b01ea6445206._comment | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/forum/Modules_with_Multiple_cmdProperty_causing_build_failures/comment_2_5afe0f200d7139499ef4b01ea6445206._comment diff --git a/doc/forum/Modules_with_Multiple_cmdProperty_causing_build_failures/comment_2_5afe0f200d7139499ef4b01ea6445206._comment b/doc/forum/Modules_with_Multiple_cmdProperty_causing_build_failures/comment_2_5afe0f200d7139499ef4b01ea6445206._comment new file mode 100644 index 00000000..00f77116 --- /dev/null +++ b/doc/forum/Modules_with_Multiple_cmdProperty_causing_build_failures/comment_2_5afe0f200d7139499ef4b01ea6445206._comment @@ -0,0 +1,11 @@ +[[!comment format=mdwn + username="craige@a46118dff5bc0fad85259759970d8b4b9fc377d7" + nickname="craige" + avatar="http://cdn.libravatar.org/avatar/6d2207226de755da46aa2fdff9af70b2" + subject="Fixed!" + date="2017-01-26T05:54:22Z" + content=""" +The original suggestions did fix my problems. + +Apologies for the late response. +"""]] -- cgit v1.2.3 From a3cc90d2c5ae52264ffe1c4283a756fe48b86ef4 Mon Sep 17 00:00:00 2001 From: craige@a46118dff5bc0fad85259759970d8b4b9fc377d7 Date: Thu, 26 Jan 2017 05:55:58 +0000 Subject: --- doc/user/craige.mdwn | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/user/craige.mdwn diff --git a/doc/user/craige.mdwn b/doc/user/craige.mdwn new file mode 100644 index 00000000..775e2fb0 --- /dev/null +++ b/doc/user/craige.mdwn @@ -0,0 +1 @@ +It's been said I was the fourth user :-) -- cgit v1.2.3 From 4f6edf8f5e0dcd85efb23dc5f0fdef7994bdee0a Mon Sep 17 00:00:00 2001 From: craige@a46118dff5bc0fad85259759970d8b4b9fc377d7 Date: Thu, 26 Jan 2017 06:10:07 +0000 Subject: --- doc/forum/Inherited_Variables....mdwn | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 doc/forum/Inherited_Variables....mdwn diff --git a/doc/forum/Inherited_Variables....mdwn b/doc/forum/Inherited_Variables....mdwn new file mode 100644 index 00000000..1535ec77 --- /dev/null +++ b/doc/forum/Inherited_Variables....mdwn @@ -0,0 +1,26 @@ +I've got a server defined in config.hs as follows: + + myserver :: Host + myserver = host "myserver.mydomain" $ props + & standardSystem (Stable "jessie") X86_64 [ "Welcome to myserver!" ] + +I'm writing a module (to deploy Matrix, FWIW) which has a section like this: + + sources :: Property Debian + sources = File.hasContent "/etc/apt/sources.list.d/matrix.list" + [ "# Deployed by Propellor" + , "" + , "deb http://matrix.org/packages/debian/ jessie main" + ] `onChange` Apt.update + +What I would like to be able to do, for example, is pull "jessie" from the standardSystem line into the sources function. + +The host name is another I'd like to be able to pull in, so that I can abstract as much as possible and wind up with a line that looks not unlike this: + + & Matrix.server + +Instead of + + & Matrix.server hostname jessie + +Am I barking up the wrong tree and should I just embrace the latter? -- cgit v1.2.3 From 58553acacc151aa73ceb812722372c4ce602416d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 26 Jan 2017 02:47:58 -0400 Subject: response --- .../comment_1_082e5d5b8e25335bc90577abcfef1d21._comment | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 doc/forum/Inherited_Variables.../comment_1_082e5d5b8e25335bc90577abcfef1d21._comment diff --git a/doc/forum/Inherited_Variables.../comment_1_082e5d5b8e25335bc90577abcfef1d21._comment b/doc/forum/Inherited_Variables.../comment_1_082e5d5b8e25335bc90577abcfef1d21._comment new file mode 100644 index 00000000..e4b32398 --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_1_082e5d5b8e25335bc90577abcfef1d21._comment @@ -0,0 +1,15 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2017-01-26T06:39:35Z" + content=""" +This is where propellor's `Info` system comes in. `Propellor.Info.getOS` +can be run to get the OS info. + +It's also possible to add new properties that add new values with custom +types to `Info`. + +The hostname is not currently stored in `Info`, but it probably should be; +that would be a good simplification. Currently there's a +separate way to get the hostname: `asks hostName` (run in the Propellor monad) +"""]] -- cgit v1.2.3 From 81a51f728bc021ac6f0cbf227a39682439196b32 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 26 Jan 2017 02:54:00 -0400 Subject: example --- .../comment_2_988319ed6de46eff2eac0d5ef36382f9._comment | 15 +++++++++++++++ src/Propellor/Property/.Sbuild.hs.swp | Bin 0 -> 16384 bytes 2 files changed, 15 insertions(+) create mode 100644 doc/forum/Inherited_Variables.../comment_2_988319ed6de46eff2eac0d5ef36382f9._comment create mode 100644 src/Propellor/Property/.Sbuild.hs.swp diff --git a/doc/forum/Inherited_Variables.../comment_2_988319ed6de46eff2eac0d5ef36382f9._comment b/doc/forum/Inherited_Variables.../comment_2_988319ed6de46eff2eac0d5ef36382f9._comment new file mode 100644 index 00000000..676f41ac --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_2_988319ed6de46eff2eac0d5ef36382f9._comment @@ -0,0 +1,15 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 2""" + date="2017-01-26T06:50:39Z" + content=""" +A worked example: + + server :: Property Debian + server = property' "some description" $ \w -> do + os <- getOS + hostname <- asks hostName + ensureProperty w $ + File.hasContent "/etc/apt/sources.list.d/matrix.list" + (genSourcesList os hostname) +"""]] diff --git a/src/Propellor/Property/.Sbuild.hs.swp b/src/Propellor/Property/.Sbuild.hs.swp new file mode 100644 index 00000000..a361c431 Binary files /dev/null and b/src/Propellor/Property/.Sbuild.hs.swp differ -- cgit v1.2.3 From 394ca458814a63a24f53e78e536d223b768db5e2 Mon Sep 17 00:00:00 2001 From: craige Date: Fri, 27 Jan 2017 21:54:45 +0000 Subject: Added a comment: Thanks! --- .../comment_3_acf78fa9f732f070bf73c2ab601464ee._comment | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/forum/Inherited_Variables.../comment_3_acf78fa9f732f070bf73c2ab601464ee._comment diff --git a/doc/forum/Inherited_Variables.../comment_3_acf78fa9f732f070bf73c2ab601464ee._comment b/doc/forum/Inherited_Variables.../comment_3_acf78fa9f732f070bf73c2ab601464ee._comment new file mode 100644 index 00000000..fcdf923b --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_3_acf78fa9f732f070bf73c2ab601464ee._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="craige" + avatar="http://cdn.libravatar.org/avatar/64ac5816ea3a51347d1f699022d1fdc1" + subject="Thanks!" + date="2017-01-27T21:54:45Z" + content=""" +Thanks Joey. I think that's exactly what I need. Very helpful :-) +"""]] -- cgit v1.2.3 From 733ff94298a1efda158b5f587e49de7c4cc692f1 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 30 Jan 2017 17:10:12 -0700 Subject: pin property prototypes --- src/Propellor/Property/Apt.hs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index c0d4ac82..b3391866 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -100,6 +100,16 @@ stdSourcesList' suite more = tightenTargets $ setSourcesList where generators = [debCdn, kernelOrg, securityUpdates] ++ more +type PinPriority = Int + +-- | Adds an apt source for a suite, and pins that suite to a given pin value +-- (see apt_preferences(5)). Revert to drop the source and unpin the suite. +-- +-- If the requested suite is the host's OS suite, this property does nothing. +-- That apt source should already be available, or you can use a property like +-- 'Apt.stdSourcesList'. +suiteAvailablePinned :: DebianSuite -> PinPriority -> RevertableProperty Debian + setSourcesList :: [Line] -> Property DebianLike setSourcesList ls = sourcesList `File.hasContent` ls `onChange` update @@ -196,6 +206,18 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv where cmd = "cd '" ++ dir ++ "' && mk-build-deps debian/control --install --tool 'apt-get -y --no-install-recommends' --remove" +-- | Pins a list of packages and/or package wildcards to a given suite with a +-- given pin priority (see apt_preferences(5)). Revert to unpin. +-- +-- Note that this will have no effect unless there is an apt source for the +-- suite. One way to add an apt source is 'Apt.suiteAvailablePinned'. +-- +-- For example, to obtain all Emacs Lisp addon packages from sid, you could use +-- +-- > & Apt.suiteAvailablePinned Unstable +-- > & ["elpa-*"] `Apt.pinnedTo` Unstable 990 +pinnedTo :: [String] -> DebianSuite -> PinPriority -> RevertableProperty Debian + -- | Package installation may fail becuse the archive has changed. -- Run an update in that case and retry. robustly :: Property DebianLike -> Property DebianLike @@ -354,5 +376,11 @@ noPDiffs :: Property DebianLike noPDiffs = tightenTargets $ "/etc/apt/apt.conf.d/20pdiffs" `File.hasContent` [ "Acquire::PDiffs \"false\";" ] +suitePin :: DebianSuite -> String +suitePin s = prefix s ++ showSuite s + where + prefix (Stable _) = "n=" + prefix _ = "a=" + dpkgStatus :: FilePath dpkgStatus = "/var/lib/dpkg/status" -- cgit v1.2.3 From 27255d21f7f7691339c7f5ccea954b67908c09fe Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 30 Jan 2017 17:55:25 -0700 Subject: implement suiteAvailablePinned --- src/Propellor/Property/Apt.hs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index b3391866..593515a0 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -109,6 +109,30 @@ type PinPriority = Int -- That apt source should already be available, or you can use a property like -- 'Apt.stdSourcesList'. suiteAvailablePinned :: DebianSuite -> PinPriority -> RevertableProperty Debian +suiteAvailablePinned s pin = available unavailable + `onChange` update + where + available = withOS (desc True) $ \w o -> case o of + (Just (System (Debian _ hostSuite) _)) -> + if s == hostSuite then doNothing else ensureProperty w $ + File.hasContent sourceFile + (concatMap (\gen -> gen s) generators) + `requires` File.hasContent prefFile + [ "Package: *" + , "Pin: release " ++ suitePin s + , "Pin-Priority: " ++ show pin + ] + + unavailable = combineProperties (desc False) $ props + & File.notPresent sourceFile + & File.notPresent prefFile + + generators = [debCdn, kernelOrg, securityUpdates] + sourceFile = "/etc/apt/preferences.d/20" ++ showSuite s ++ ".pref" + prefFile = "/etc/apt/sources.list.d/" ++ showSuite s ++ ".list" + + desc True = "Debian " ++ showSuite s ++ " pinned, priority " ++ show pin + desc False = "Debian " ++ showSuite s ++ "not pinned" setSourcesList :: [Line] -> Property DebianLike setSourcesList ls = sourcesList `File.hasContent` ls `onChange` update -- cgit v1.2.3 From 8fcc618914716ad775f6bb800c9c598e51e349b9 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 30 Jan 2017 17:59:37 -0700 Subject: tweak stub --- src/Propellor/Property/Apt.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 593515a0..4eac6670 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -230,8 +230,9 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv where cmd = "cd '" ++ dir ++ "' && mk-build-deps debian/control --install --tool 'apt-get -y --no-install-recommends' --remove" --- | Pins a list of packages and/or package wildcards to a given suite with a --- given pin priority (see apt_preferences(5)). Revert to unpin. +-- | Pins a list of packages, package wildcards and/or regular expressions to a +-- given suite with a given pin priority (see apt_preferences(5)). Revert to +-- unpin. -- -- Note that this will have no effect unless there is an apt source for the -- suite. One way to add an apt source is 'Apt.suiteAvailablePinned'. @@ -241,6 +242,7 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv -- > & Apt.suiteAvailablePinned Unstable -- > & ["elpa-*"] `Apt.pinnedTo` Unstable 990 pinnedTo :: [String] -> DebianSuite -> PinPriority -> RevertableProperty Debian +pinnedTo = undefined -- | Package installation may fail becuse the archive has changed. -- Run an update in that case and retry. -- cgit v1.2.3 From e5a581fee717b770600767d59f6edf812967eaf2 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 30 Jan 2017 18:12:16 -0700 Subject: pin even if hostSuite == suite --- src/Propellor/Property/Apt.hs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 4eac6670..0990c83b 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -105,23 +105,26 @@ type PinPriority = Int -- | Adds an apt source for a suite, and pins that suite to a given pin value -- (see apt_preferences(5)). Revert to drop the source and unpin the suite. -- --- If the requested suite is the host's OS suite, this property does nothing. --- That apt source should already be available, or you can use a property like --- 'Apt.stdSourcesList'. +-- If the requested suite is the host's OS suite, the suite is pinned, but no +-- source is added. That apt source should already be available, or you can use +-- a property like 'Apt.stdSourcesList'. suiteAvailablePinned :: DebianSuite -> PinPriority -> RevertableProperty Debian suiteAvailablePinned s pin = available unavailable `onChange` update where - available = withOS (desc True) $ \w o -> case o of - (Just (System (Debian _ hostSuite) _)) -> - if s == hostSuite then doNothing else ensureProperty w $ - File.hasContent sourceFile + available = combineProperties (desc True) $ props + & File.hasContent prefFile + [ "Package: *" + , "Pin: release " ++ suitePin s + , "Pin-Priority: " ++ show pin + ] + & withOS (desc True) $ \w o -> case o of + (Just (System (Debian _ hostSuite) _)) -> + | s /= hostSuite = ensureProperty w $ + File.hasContent sourceFile (concatMap (\gen -> gen s) generators) - `requires` File.hasContent prefFile - [ "Package: *" - , "Pin: release " ++ suitePin s - , "Pin-Priority: " ++ show pin - ] + | otherwise = doNothing + _ -> doNothing unavailable = combineProperties (desc False) $ props & File.notPresent sourceFile -- cgit v1.2.3 From 77c1f36116b1e3a6c2d3936504dfdd7e8bdb5241 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 30 Jan 2017 18:38:39 -0700 Subject: refactor to fix type errors --- src/Propellor/Property/Apt.hs | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 0990c83b..56b42eb6 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -108,28 +108,37 @@ type PinPriority = Int -- If the requested suite is the host's OS suite, the suite is pinned, but no -- source is added. That apt source should already be available, or you can use -- a property like 'Apt.stdSourcesList'. -suiteAvailablePinned :: DebianSuite -> PinPriority -> RevertableProperty Debian +suiteAvailablePinned + :: DebianSuite + -> PinPriority + -> RevertableProperty Debian Debian suiteAvailablePinned s pin = available unavailable - `onChange` update where - available = combineProperties (desc True) $ props + available :: Property Debian + available = tightenTargets $ combineProperties (desc True) $ props & File.hasContent prefFile [ "Package: *" , "Pin: release " ++ suitePin s , "Pin-Priority: " ++ show pin ] - & withOS (desc True) $ \w o -> case o of - (Just (System (Debian _ hostSuite) _)) -> - | s /= hostSuite = ensureProperty w $ - File.hasContent sourceFile - (concatMap (\gen -> gen s) generators) - | otherwise = doNothing - _ -> doNothing - - unavailable = combineProperties (desc False) $ props + & setSourceFile + + unavailable :: Property Debian + unavailable = tightenTargets $ combineProperties (desc False) $ props & File.notPresent sourceFile + `onChange` update & File.notPresent prefFile + setSourceFile :: Property Debian + setSourceFile = withOS (desc True) $ \w o -> case o of + (Just (System (Debian _ hostSuite) _)) + | s /= hostSuite -> ensureProperty w $ + File.hasContent + sourceFile + (concatMap (\gen -> gen s) generators) + `onChange` update + _ -> noChange + generators = [debCdn, kernelOrg, securityUpdates] sourceFile = "/etc/apt/preferences.d/20" ++ showSuite s ++ ".pref" prefFile = "/etc/apt/sources.list.d/" ++ showSuite s ++ ".list" @@ -244,7 +253,7 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv -- -- > & Apt.suiteAvailablePinned Unstable -- > & ["elpa-*"] `Apt.pinnedTo` Unstable 990 -pinnedTo :: [String] -> DebianSuite -> PinPriority -> RevertableProperty Debian +pinnedTo :: [String] -> DebianSuite -> PinPriority -> RevertableProperty Debian Debian pinnedTo = undefined -- | Package installation may fail becuse the archive has changed. -- cgit v1.2.3 From 384d435868d2cec88c44a5b73c4a46ba114acde9 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 30 Jan 2017 18:48:21 -0700 Subject: fix swapped sourceFile & prefFile --- src/Propellor/Property/Apt.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 56b42eb6..b89d12c6 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -140,8 +140,8 @@ suiteAvailablePinned s pin = available unavailable _ -> noChange generators = [debCdn, kernelOrg, securityUpdates] - sourceFile = "/etc/apt/preferences.d/20" ++ showSuite s ++ ".pref" - prefFile = "/etc/apt/sources.list.d/" ++ showSuite s ++ ".list" + prefFile = "/etc/apt/preferences.d/20" ++ showSuite s ++ ".pref" + sourceFile = "/etc/apt/sources.list.d/" ++ showSuite s ++ ".list" desc True = "Debian " ++ showSuite s ++ " pinned, priority " ++ show pin desc False = "Debian " ++ showSuite s ++ "not pinned" -- cgit v1.2.3 From c64b712867e5c30b635184a351164ecb139249c4 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 30 Jan 2017 19:04:03 -0700 Subject: TODO --- src/Propellor/Property/Apt.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index b89d12c6..061bef83 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -114,6 +114,8 @@ suiteAvailablePinned -> RevertableProperty Debian Debian suiteAvailablePinned s pin = available unavailable where + -- TODO have to pin -backports too? is that sensible? maybe avoid + -- adding it, instead available :: Property Debian available = tightenTargets $ combineProperties (desc True) $ props & File.hasContent prefFile -- cgit v1.2.3 From ec22249085439af2f4dbcceafffd95afb17c57d1 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 30 Jan 2017 19:27:05 -0700 Subject: commented hacking --- src/Propellor/Property/Apt.hs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 061bef83..1de84b87 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -258,6 +258,29 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv pinnedTo :: [String] -> DebianSuite -> PinPriority -> RevertableProperty Debian Debian pinnedTo = undefined +-- ps `pinnedTo` suite pin = (f `File.containsLines` ls) (f `File.lacksLines` ls) +-- `describe` unwords (ps ++ ["pinned to " ++ showSuite suite]) +-- where +-- ls = [ "Package: " ++ unwords ps +-- , "Pin: release " ++ suitePin suite +-- , "Pin-Priority: " ++ show pin +-- ] +-- f = "/etc/apt/preferences.d/10propellor" + +-- -- Apt supports multiple entries in each "Package:" line, so we could use a +-- -- single configuration block for each pinnedTo property that is applied to the +-- -- host. However, that would make it hard to sensibly revert the pin. + +-- pinnedTo' :: String -> DebianSuite -> PinPriority -> RevertableProperty Debian +-- p `pinnedTo` suite pin = (f `File.containsLines` ls) (f `File.lacksLines` ls) +-- where +-- ls = [ "" +-- , "Package: " ++ p +-- , "Pin: release " ++ suitePin suite +-- , "Pin-Priority: " ++ show pin +-- ] +-- f = "/etc/apt/preferences.d/10" ++ p + -- | Package installation may fail becuse the archive has changed. -- Run an update in that case and retry. robustly :: Property DebianLike -> Property DebianLike -- cgit v1.2.3 From e6fd8b8631bc525ba085496344e0b94386e3eca3 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 30 Jan 2017 19:31:58 -0700 Subject: fix type error: hiddenService -> hiddenService' --- src/Propellor/Property/Tor.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs index 52b38230..db71c87a 100644 --- a/src/Propellor/Property/Tor.hs +++ b/src/Propellor/Property/Tor.hs @@ -147,7 +147,7 @@ hiddenServiceAvailable :: HiddenServiceName -> Port -> Property DebianLike hiddenServiceAvailable hn port = hiddenServiceAvailable' hn [port] hiddenServiceAvailable' :: HiddenServiceName -> [Port] -> Property DebianLike -hiddenServiceAvailable' hn ports = hiddenServiceHostName $ hiddenService hn ports +hiddenServiceAvailable' hn ports = hiddenServiceHostName $ hiddenService' hn ports where hiddenServiceHostName p = adjustPropertySatisfy p $ \satisfy -> do r <- satisfy -- cgit v1.2.3 From 6a6aa61b54966544987063df9337dc9d2ff058a5 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 19:58:49 -0700 Subject: document File.containsLines --- src/Propellor/Property/File.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs index 95fc6f81..b6f1a8d6 100644 --- a/src/Propellor/Property/File.hs +++ b/src/Propellor/Property/File.hs @@ -21,6 +21,12 @@ f `hasContent` newcontent = fileProperty containsLine :: FilePath -> Line -> Property UnixLike f `containsLine` l = f `containsLines` [l] +-- | Ensures that a list of lines are present in a file, adding any that are not +-- to the end of the file. +-- +-- Note that this property does not guarantee that the lines will appear +-- consecutively, nor in the order specified. If you need either of these, use +-- 'File.containsBlock'. containsLines :: FilePath -> [Line] -> Property UnixLike f `containsLines` ls = fileProperty (f ++ " contains:" ++ show ls) go f where -- cgit v1.2.3 From 4e08fe0a738617160c43c268c99441168aa7bd9b Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 19:59:00 -0700 Subject: add File.containsBlock --- src/Propellor/Property/File.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs index b6f1a8d6..f57480a3 100644 --- a/src/Propellor/Property/File.hs +++ b/src/Propellor/Property/File.hs @@ -6,6 +6,7 @@ import Propellor.Base import Utility.FileMode import qualified Data.ByteString.Lazy as L +import Data.List (isInfixOf, isPrefixOf) import System.Posix.Files import System.Exit @@ -32,6 +33,22 @@ f `containsLines` ls = fileProperty (f ++ " contains:" ++ show ls) go f where go content = content ++ filter (`notElem` content) ls +-- | Ensures that a block of consecutive lines is present in a file, adding it +-- to the end if not. Revert to ensure that the block is not present (though +-- the lines it contains could be present, non-consecutively). +containsBlock :: FilePath -> [Line] -> RevertableProperty UnixLike UnixLike +f `containsBlock` ls = + fileProperty (f ++ " contains block:" ++ show ls) add f + fileProperty (f ++ " lacks block:" ++ show ls) remove f + where + add content + | ls `isInfixOf` content = content + | otherwise = content ++ ls + remove [] = [] + remove content@(x:xs) + | ls `isPrefixOf` content = x : remove (drop (length ls) xs) + | otherwise = x : remove xs + -- | Ensures that a line is not present in a file. -- Note that the file is ensured to exist, so if it doesn't, an empty -- file will be written. -- cgit v1.2.3 From 04f237e8f336dc6501f8b3c3a8e0be72ffab25c3 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 20:06:35 -0700 Subject: implement Apt.pinnedTo --- src/Propellor/Property/Apt.hs | 45 +++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 1de84b87..6f8fb9dd 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -255,31 +255,26 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv -- -- > & Apt.suiteAvailablePinned Unstable -- > & ["elpa-*"] `Apt.pinnedTo` Unstable 990 -pinnedTo :: [String] -> DebianSuite -> PinPriority -> RevertableProperty Debian Debian -pinnedTo = undefined - --- ps `pinnedTo` suite pin = (f `File.containsLines` ls) (f `File.lacksLines` ls) --- `describe` unwords (ps ++ ["pinned to " ++ showSuite suite]) --- where --- ls = [ "Package: " ++ unwords ps --- , "Pin: release " ++ suitePin suite --- , "Pin-Priority: " ++ show pin --- ] --- f = "/etc/apt/preferences.d/10propellor" - --- -- Apt supports multiple entries in each "Package:" line, so we could use a --- -- single configuration block for each pinnedTo property that is applied to the --- -- host. However, that would make it hard to sensibly revert the pin. - --- pinnedTo' :: String -> DebianSuite -> PinPriority -> RevertableProperty Debian --- p `pinnedTo` suite pin = (f `File.containsLines` ls) (f `File.lacksLines` ls) --- where --- ls = [ "" --- , "Package: " ++ p --- , "Pin: release " ++ suitePin suite --- , "Pin-Priority: " ++ show pin --- ] --- f = "/etc/apt/preferences.d/10" ++ p +pinnedTo + :: [String] + -> DebianSuite + -> PinPriority + -> RevertableProperty UnixLike UnixLike +pinnedTo ps suite pin = (\p -> pinnedTo' p suite pin) `applyToList` ps + +pinnedTo' + :: String + -> DebianSuite + -> PinPriority + -> RevertableProperty UnixLike UnixLike +pinnedTo' p suite pin = + "/etc/apt/preferences.d/10propellor" `File.containsBlock` + [ "Package: " ++ p + , "Pin: release " ++ suitePin suite + , "Pin-Priority: " ++ show pin + ] + +-- TODO should be RevertableProperty Debian Debian -- | Package installation may fail becuse the archive has changed. -- Run an update in that case and retry. -- cgit v1.2.3 From f5d5a99e23e59dd010f8a1778dab75fa318a95c3 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 20:18:03 -0700 Subject: suiteAvailablePinned avoids pinning backports --- src/Propellor/Property/Apt.hs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 6f8fb9dd..d1958412 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -114,8 +114,6 @@ suiteAvailablePinned -> RevertableProperty Debian Debian suiteAvailablePinned s pin = available unavailable where - -- TODO have to pin -backports too? is that sensible? maybe avoid - -- adding it, instead available :: Property Debian available = tightenTargets $ combineProperties (desc True) $ props & File.hasContent prefFile @@ -123,27 +121,34 @@ suiteAvailablePinned s pin = available unavailable , "Pin: release " ++ suitePin s , "Pin-Priority: " ++ show pin ] - & setSourceFile + & setSourcesFile unavailable :: Property Debian unavailable = tightenTargets $ combineProperties (desc False) $ props - & File.notPresent sourceFile + & File.notPresent sourcesFile `onChange` update & File.notPresent prefFile - setSourceFile :: Property Debian - setSourceFile = withOS (desc True) $ \w o -> case o of + setSourcesFile :: Property Debian + setSourcesFile = withOS (desc True) $ \w o -> case o of (Just (System (Debian _ hostSuite) _)) | s /= hostSuite -> ensureProperty w $ - File.hasContent - sourceFile - (concatMap (\gen -> gen s) generators) - `onChange` update + File.hasContent sourcesFile sources + `onChange` update _ -> noChange + -- Unless we are pinning a backports suite, filter out any backports + -- sources that were added by our generators. The user probably doesn't + -- want those to be pinned to the same value + sources = dropBackports $ concatMap (\gen -> gen s) generators + where + dropBackports + | "-backports" `isSuffixOf` (showSuite s) = id + | otherwise = filter (not . isInfixOf "-backports") + generators = [debCdn, kernelOrg, securityUpdates] prefFile = "/etc/apt/preferences.d/20" ++ showSuite s ++ ".pref" - sourceFile = "/etc/apt/sources.list.d/" ++ showSuite s ++ ".list" + sourcesFile = "/etc/apt/sources.list.d/" ++ showSuite s ++ ".list" desc True = "Debian " ++ showSuite s ++ " pinned, priority " ++ show pin desc False = "Debian " ++ showSuite s ++ "not pinned" -- cgit v1.2.3 From 2220efc954a49a156942b3566350980ed483a64f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 20:27:23 -0700 Subject: pass a tuple to Apt.pinnedTo This permits calling Apt.pinnedTo infix --- src/Propellor/Property/Apt.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index d1958412..314cfef1 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -258,21 +258,19 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv -- -- For example, to obtain all Emacs Lisp addon packages from sid, you could use -- --- > & Apt.suiteAvailablePinned Unstable --- > & ["elpa-*"] `Apt.pinnedTo` Unstable 990 +-- > & Apt.suiteAvailablePinned Unstable (-10) +-- > & ["elpa-*"] `Apt.pinnedTo` (Unstable, 990) pinnedTo :: [String] - -> DebianSuite - -> PinPriority + -> (DebianSuite, PinPriority) -> RevertableProperty UnixLike UnixLike -pinnedTo ps suite pin = (\p -> pinnedTo' p suite pin) `applyToList` ps +pinnedTo ps (suite, pin) = (\p -> pinnedTo' p (suite, pin)) `applyToList` ps pinnedTo' :: String - -> DebianSuite - -> PinPriority + -> (DebianSuite, PinPriority) -> RevertableProperty UnixLike UnixLike -pinnedTo' p suite pin = +pinnedTo' p (suite, pin) = "/etc/apt/preferences.d/10propellor" `File.containsBlock` [ "Package: " ++ p , "Pin: release " ++ suitePin suite -- cgit v1.2.3 From ba5ae39d1a80e1741971571f7843e877a7a271ff Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 20:33:50 -0700 Subject: describe Apt.pinnedTo --- src/Propellor/Property/Apt.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 314cfef1..b18626c6 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -265,6 +265,7 @@ pinnedTo -> (DebianSuite, PinPriority) -> RevertableProperty UnixLike UnixLike pinnedTo ps (suite, pin) = (\p -> pinnedTo' p (suite, pin)) `applyToList` ps + `describe` unwords (("pinned to" ++ showSuite suite):ps) pinnedTo' :: String -- cgit v1.2.3 From c49aded57e0a01ed2fb3611a713f7292c619a09c Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 20:34:43 -0700 Subject: spacing --- src/Propellor/Property/Apt.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index b18626c6..eb74dc89 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -265,7 +265,7 @@ pinnedTo -> (DebianSuite, PinPriority) -> RevertableProperty UnixLike UnixLike pinnedTo ps (suite, pin) = (\p -> pinnedTo' p (suite, pin)) `applyToList` ps - `describe` unwords (("pinned to" ++ showSuite suite):ps) + `describe` unwords (("pinned to " ++ showSuite suite):ps) pinnedTo' :: String -- cgit v1.2.3 From 2f5a3ee09b78ec18df4e81f87644e5babb4dc2cc Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 20:38:58 -0700 Subject: neaten the prefs file Apt.pinnedTo generates --- src/Propellor/Property/Apt.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index eb74dc89..f3c21f98 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -272,10 +272,11 @@ pinnedTo' -> (DebianSuite, PinPriority) -> RevertableProperty UnixLike UnixLike pinnedTo' p (suite, pin) = - "/etc/apt/preferences.d/10propellor" `File.containsBlock` + "/etc/apt/preferences.d/10propellor.pref" `File.containsBlock` [ "Package: " ++ p , "Pin: release " ++ suitePin suite , "Pin-Priority: " ++ show pin + , "" ] -- TODO should be RevertableProperty Debian Debian -- cgit v1.2.3 From dce47e8fd085e60e359004fd22ff27e178d50af2 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 20:46:00 -0700 Subject: more spacing --- src/Propellor/Property/Apt.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index f3c21f98..8539c4a6 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -151,7 +151,7 @@ suiteAvailablePinned s pin = available unavailable sourcesFile = "/etc/apt/sources.list.d/" ++ showSuite s ++ ".list" desc True = "Debian " ++ showSuite s ++ " pinned, priority " ++ show pin - desc False = "Debian " ++ showSuite s ++ "not pinned" + desc False = "Debian " ++ showSuite s ++ " not pinned" setSourcesList :: [Line] -> Property DebianLike setSourcesList ls = sourcesList `File.hasContent` ls `onChange` update -- cgit v1.2.3 From 7ba44cc7fb3b0897fa396a5b66068a2db7961afb Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 31 Jan 2017 21:29:33 -0700 Subject: fix removal of blocks --- src/Propellor/Property/File.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs index f57480a3..9f73b14a 100644 --- a/src/Propellor/Property/File.hs +++ b/src/Propellor/Property/File.hs @@ -46,7 +46,7 @@ f `containsBlock` ls = | otherwise = content ++ ls remove [] = [] remove content@(x:xs) - | ls `isPrefixOf` content = x : remove (drop (length ls) xs) + | ls `isPrefixOf` content = remove (drop (length ls) content) | otherwise = x : remove xs -- | Ensures that a line is not present in a file. -- cgit v1.2.3 From 42f22dd483d31cd75012287e788b643487996604 Mon Sep 17 00:00:00 2001 From: spwhitton Date: Wed, 1 Feb 2017 04:39:40 +0000 Subject: submit branch --- doc/todo/new_apt_pinning_properties.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/todo/new_apt_pinning_properties.mdwn diff --git a/doc/todo/new_apt_pinning_properties.mdwn b/doc/todo/new_apt_pinning_properties.mdwn new file mode 100644 index 00000000..d32bcbb2 --- /dev/null +++ b/doc/todo/new_apt_pinning_properties.mdwn @@ -0,0 +1,8 @@ +My branch `pin` of repo `https://git.spwhitton.name/propellor` adds + +- `Apt.suiteAvailablePinned` +- `Apt.pinnedTo` +- `File.containsBlock` +- a haddock for `File.containsLines` + +There is one TODO in a comment that relates to propellor's algebraic data types. I'd be grateful for help with that. --spwhitton -- cgit v1.2.3 From ba10f91a450247191bb97b106a9d8b8670ad44a2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 1 Feb 2017 16:17:08 -0400 Subject: comment --- ...ent_1_fd9e6775868eaa8d6aee49d06944ef0c._comment | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 doc/todo/new_apt_pinning_properties/comment_1_fd9e6775868eaa8d6aee49d06944ef0c._comment diff --git a/doc/todo/new_apt_pinning_properties/comment_1_fd9e6775868eaa8d6aee49d06944ef0c._comment b/doc/todo/new_apt_pinning_properties/comment_1_fd9e6775868eaa8d6aee49d06944ef0c._comment new file mode 100644 index 00000000..4800608f --- /dev/null +++ b/doc/todo/new_apt_pinning_properties/comment_1_fd9e6775868eaa8d6aee49d06944ef0c._comment @@ -0,0 +1,38 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2017-02-01T20:00:47Z" + content=""" +I wonder if it would be better to separate `suiteAvailablePinned` +into `suiteAvailable` and `suitePinned`? The latter could require +the former. + +`pinnedTo` should probably be DebianLike not UnixLike. +And its `[String]` parameter ought to be `[Package]`. + +Is `File.containsBlock` necessary? Seems that if you care about +ordering of blocks in the file, you generally should use +`File.hasContent` to specify the full content. Rather than using +/etc/apt/preferences.d/10propellor.pref for multiple properties, +you could use a separate file for each `pinnedTo'` with the parameters +encoded in the filename. + +As to the TODO, I tried adding this: + + robustly' :: RevertableProperty DebianLike DebianLike -> RevertableProperty DebianLike DebianLike + robustly' p = p `fallback` (update `before` p) + +And the compiler tells me it's wrong because `update` is not revertable. +But of course, there's no need to revert apt-get update, so this compiles: + + robustly' :: RevertableProperty DebianLike DebianLike -> RevertableProperty DebianLike DebianLike + robustly' p = p `fallback` ((update (doNothing :: Property DebianLike)) `before` p) + +Cleaning it up left an an exersise for the reader. Might be possible +to combine `robustly` and `robustly'` into a single function, but I'm +not able to see how immediately. + +However.. Seems to me that whatever you wanted to use `robustly` with to +spur that TODO, you could just apply it to the first Property of the +RevertableProperty, and not to the second one? +"""]] -- cgit v1.2.3 From 64a79b979f3bfd555a85baf7e49dc9c9f6213268 Mon Sep 17 00:00:00 2001 From: craige@a46118dff5bc0fad85259759970d8b4b9fc377d7 Date: Thu, 2 Feb 2017 00:34:27 +0000 Subject: --- doc/forum/Docker.hs_will_Break_in_Stretch.mdwn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 doc/forum/Docker.hs_will_Break_in_Stretch.mdwn diff --git a/doc/forum/Docker.hs_will_Break_in_Stretch.mdwn b/doc/forum/Docker.hs_will_Break_in_Stretch.mdwn new file mode 100644 index 00000000..c89c995c --- /dev/null +++ b/doc/forum/Docker.hs_will_Break_in_Stretch.mdwn @@ -0,0 +1,16 @@ +G'day Joey! + +I'm in the process of deploying Docker infrastructure via Propellor on both Jessie and Stretch and I've come to discover that Docker.io did not make it into Stretch: + +* [docker.io REMOVED from testing](https://packages.qa.debian.org/d/docker.io/news/20161012T163916Z.html) +* [docker.io - Linux container runtime](https://tracker.debian.org/pkg/docker.io) +* [Excuse for docker.io](https://qa.debian.org/excuses.php?package=docker.io) + +So the below from Docker.hs will fail beyond Jessie: + + installed :: Property DebianLike + installed = Apt.installed ["docker.io"] + +Before I embarked on my own path to re-implement the above (probably based on [How to install Docker engine on Debian 9 Stretch Linux](https://linuxconfig.org/how-to-install-docker-engine-on-debian-9-stretch-linux)), I thought I'd see what you thought might be the way to resolve this, so that my work could be contributed upstream (if suitable). + +Thanks! -- cgit v1.2.3 From 720c69c385cdb28d536fc6d85033345f3f7b87bb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Feb 2017 13:30:52 -0400 Subject: comment --- .../comment_1_8a4f16ae6d04b9d4bedb437ef333562b._comment | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/forum/Docker.hs_will_Break_in_Stretch/comment_1_8a4f16ae6d04b9d4bedb437ef333562b._comment diff --git a/doc/forum/Docker.hs_will_Break_in_Stretch/comment_1_8a4f16ae6d04b9d4bedb437ef333562b._comment b/doc/forum/Docker.hs_will_Break_in_Stretch/comment_1_8a4f16ae6d04b9d4bedb437ef333562b._comment new file mode 100644 index 00000000..949f8d0c --- /dev/null +++ b/doc/forum/Docker.hs_will_Break_in_Stretch/comment_1_8a4f16ae6d04b9d4bedb437ef333562b._comment @@ -0,0 +1,11 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2017-02-02T17:28:49Z" + content=""" +Apparently the Debian way to install docker will be from backports. + + +Note that I'm no longer using any docker Properties myself, so +propellor users who are will need to send patches.. +"""]] -- cgit v1.2.3 From 5c170d3f8021b2120d3147103e23baf7bac6cc76 Mon Sep 17 00:00:00 2001 From: spwhitton Date: Thu, 2 Feb 2017 17:40:11 +0000 Subject: Added a comment: reply to review --- ...ent_2_c82f7e83f3fcc7648222d9dbf90e5ddd._comment | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 doc/todo/new_apt_pinning_properties/comment_2_c82f7e83f3fcc7648222d9dbf90e5ddd._comment diff --git a/doc/todo/new_apt_pinning_properties/comment_2_c82f7e83f3fcc7648222d9dbf90e5ddd._comment b/doc/todo/new_apt_pinning_properties/comment_2_c82f7e83f3fcc7648222d9dbf90e5ddd._comment new file mode 100644 index 00000000..4fd7c824 --- /dev/null +++ b/doc/todo/new_apt_pinning_properties/comment_2_c82f7e83f3fcc7648222d9dbf90e5ddd._comment @@ -0,0 +1,66 @@ +[[!comment format=mdwn + username="spwhitton" + avatar="http://cdn.libravatar.org/avatar/9c3f08f80e67733fd506c353239569eb" + subject="reply to review" + date="2017-02-02T17:40:11Z" + content=""" +Thank you for your feedback, Joey. + +> I wonder if it would be better to separate `suiteAvailablePinned` +> into `suiteAvailable` and `suitePinned`? The latter could require +> the former. + +I see how this could be useful, in particular if you want to make a +suite like Debian experimental available, which won't cause any packages +to be automatically upgraded. + +However, it makes it less convenient, and perhaps dangerous, to revert a +pinned suite. For example, suppose on my Debian testing system I have +`Apt.suitePinned Unstable 100`. If I revert this property, it will +remove the pin but not remove the source. Then my system might get +mass-upgraded to sid if I'm not careful. + +We couldn't have the revert of `Apt.suitePinned` remove the source +because then if I have both `& Apt.suiteAvailable Unstable` and `! +Apt.suitePinned Unstable 100`, the second property would cancel out the +first, which doesn't make sense. + +On balance, I think it's best to keep the current property. A property +adding sources to apt.sources.d should probably force the user to pick a +pin value, to avoid any unexpected upgrades. + +> `pinnedTo` should probably be DebianLike not UnixLike. + +This was my 'TODO'. (Since the property takes a `DebianSuite`, I think +it should be `Debian` not `DebianLike`.) + +I tried applying `tightenTargets` to `pinnedTo`, but that only seems to +affect one half of the revertable property. Do I need to implement a +new tightening function? + +> And its `[String]` parameter ought to be `[Package]`. + +I don't think so. The parameter to `pinnedTo` can be a wildcard +expression or a regex (per `apt_preferences(5)`). Neither of these are +accepted by other existing properties that take `[Package]`, such as +`Apt.installed`. I could add a new type alias, if you prefer. + +> Is `File.containsBlock` necessary? Seems that if you care about +> ordering of blocks in the file, you generally should use +> `File.hasContent` to specify the full content. Rather than using +> /etc/apt/preferences.d/10propellor.pref for multiple properties, +> you could use a separate file for each `pinnedTo'` with the parameters +> encoded in the filename. + +This was what I tried on my first attempt, but it gets very complicated +if the user passes a wildcard expression or a regex instead of a package +name. I would need to convert that wildcard expression or regex to a +cross-platform filename, and the conversion would need to be isomorphic +to avoid any clashes. The `File.containsBlock` seems more sane than +that. + +> As to the TODO, I tried adding this: [...] + +I don't understand how `robustly` is relevant to my TODO -- please see +above. +"""]] -- cgit v1.2.3 From b1f0bd05941f5d8c42a28d33316a0a0452a62476 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Feb 2017 15:40:30 -0400 Subject: Added Propellor.Property.File.configFileName and related functions to generate good filenames for config directories. spwhitton has a branch that could use this, and there are several places in propellor that do something ad-hoc that would have been better implemented using this. I was not able to switch any of the existing ad-hoc stuff, but this can be used going forward for new stuff. This commit was sponsored by Anthony DeRobertis on Patreon. --- debian/changelog | 2 ++ src/Propellor/Property/File.hs | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/debian/changelog b/debian/changelog index 0e5aa8d5..30af1b88 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,8 @@ propellor (3.2.4) UNRELEASED; urgency=medium Thanks, Sean Whitton. * stack.yaml: Compile with GHC 8.0.1 against lts-7.16. Thanks, Andrew Cowie. + * Added Propellor.Property.File.configFileName and related functions + to generate good filenames for config directories. -- Joey Hess Sat, 24 Dec 2016 15:06:36 -0400 diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs index 95fc6f81..fe2b1057 100644 --- a/src/Propellor/Property/File.hs +++ b/src/Propellor/Property/File.hs @@ -8,6 +8,7 @@ import Utility.FileMode import qualified Data.ByteString.Lazy as L import System.Posix.Files import System.Exit +import Data.Char type Line = String @@ -221,3 +222,42 @@ viaStableTmp a f = bracketIO setup cleanup go go tmpfile = do a tmpfile liftIO $ rename tmpfile f + +-- | Generates a base configuration file name from a String, which +-- can be put in a configuration directory, such as +-- /etc/apt/sources.list.d/ +-- +-- The generated file name is limited to using ASCII alphanumerics, +-- '_' and '.', so that programs that only accept a limited set of +-- characters will accept it. Any other characters will be encoded +-- in escaped form. +-- +-- Some file extensions, such as ".dpkg-new" may be filtered out by +-- programs that use configuration directories. To avoid such problems, +-- it's a good idea to add an static prefix and extension to the +-- result of this function. For example: +-- +-- > aptSource foo = "/etc/apt/sources.list.d" "propellor_" ++ configFileName foo <.> ".conf" +configFileName :: String -> FilePath +configFileName = concatMap escape + where + escape c + | isAscii c && isAlphaNum c = [c] + | c == '.' = [c] + | otherwise = '_' : show (ord c) + +-- | Applies configFileName to any value that can be shown. +showConfigFileName :: Show v => v -> FilePath +showConfigFileName = configFileName . show + +-- | Inverse of showConfigFileName. +readConfigFileName :: Read v => FilePath -> Maybe v +readConfigFileName = readish . unescape + where + unescape [] = [] + unescape ('_':cs) = case break (not . isDigit) cs of + ([], _) -> '_' : unescape cs + (ns, cs') -> case readish ns of + Nothing -> '_' : ns ++ unescape cs' + Just n -> chr n : unescape cs' + unescape (c:cs) = c : unescape cs -- cgit v1.2.3 From 5333f3fb5c1a2ac6c16c8217c52ede2c7f03333f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Feb 2017 15:44:20 -0400 Subject: response --- ...ent_3_58d323602f293471ce3d2d9b4d271130._comment | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 doc/todo/new_apt_pinning_properties/comment_3_58d323602f293471ce3d2d9b4d271130._comment diff --git a/doc/todo/new_apt_pinning_properties/comment_3_58d323602f293471ce3d2d9b4d271130._comment b/doc/todo/new_apt_pinning_properties/comment_3_58d323602f293471ce3d2d9b4d271130._comment new file mode 100644 index 00000000..b0ff271e --- /dev/null +++ b/doc/todo/new_apt_pinning_properties/comment_3_58d323602f293471ce3d2d9b4d271130._comment @@ -0,0 +1,23 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 3""" + date="2017-02-02T18:45:01Z" + content=""" +That example with reverting one property overriding another property +is a general problem propellor has with conflicting properties. +Normally I don't much worry about it, but I agree an accidental mass +upgrade is a good reason to avoid that problem here. + +Yes please add a new type alias for String (or an ADT) +if Package is not appropriate. + +I had misunderstood which function the TODO was for.. + +Nice surprise that tightenTargets works on RevertableProperty at all. +Since it does, you should be able to tighten one side, revert, tighten the +other side, and re-revert. Or, deconstruct the RevertableProperty, +tighten both sides individually, and reconstruct it. + +I've added a Propellor.Property.File.configFileName that +should be suitable for your purposes, and others.. +"""]] -- cgit v1.2.3 From c682c51e828b82b60443b3cf368114f6506b03e9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Feb 2017 15:51:49 -0400 Subject: haddock formatting --- src/Propellor/Property/File.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs index fe2b1057..388bcb6c 100644 --- a/src/Propellor/Property/File.hs +++ b/src/Propellor/Property/File.hs @@ -225,14 +225,14 @@ viaStableTmp a f = bracketIO setup cleanup go -- | Generates a base configuration file name from a String, which -- can be put in a configuration directory, such as --- /etc/apt/sources.list.d/ +-- -- -- The generated file name is limited to using ASCII alphanumerics, --- '_' and '.', so that programs that only accept a limited set of +-- \'_\' and \'.\' , so that programs that only accept a limited set of -- characters will accept it. Any other characters will be encoded -- in escaped form. -- --- Some file extensions, such as ".dpkg-new" may be filtered out by +-- Some file extensions, such as ".old" may be filtered out by -- programs that use configuration directories. To avoid such problems, -- it's a good idea to add an static prefix and extension to the -- result of this function. For example: -- cgit v1.2.3 From f861070a3ad159a60961292ccdb53e30524968cd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Feb 2017 15:52:52 -0400 Subject: better example --- src/Propellor/Property/File.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs index 388bcb6c..9241cb1b 100644 --- a/src/Propellor/Property/File.hs +++ b/src/Propellor/Property/File.hs @@ -237,7 +237,7 @@ viaStableTmp a f = bracketIO setup cleanup go -- it's a good idea to add an static prefix and extension to the -- result of this function. For example: -- --- > aptSource foo = "/etc/apt/sources.list.d" "propellor_" ++ configFileName foo <.> ".conf" +-- > aptConf foo = "/etc/apt/apt.conf.d" "propellor_" ++ configFileName foo <.> ".conf" configFileName :: String -> FilePath configFileName = concatMap escape where -- cgit v1.2.3 From 6b085cf6ecd379ca446e850b9967f21433bd7102 Mon Sep 17 00:00:00 2001 From: craige@a46118dff5bc0fad85259759970d8b4b9fc377d7 Date: Fri, 3 Feb 2017 00:04:05 +0000 Subject: Added a comment --- ...ment_4_5bf7b1f69b48b4d9c516d424e4438208._comment | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 doc/forum/Inherited_Variables.../comment_4_5bf7b1f69b48b4d9c516d424e4438208._comment diff --git a/doc/forum/Inherited_Variables.../comment_4_5bf7b1f69b48b4d9c516d424e4438208._comment b/doc/forum/Inherited_Variables.../comment_4_5bf7b1f69b48b4d9c516d424e4438208._comment new file mode 100644 index 00000000..3b691b2a --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_4_5bf7b1f69b48b4d9c516d424e4438208._comment @@ -0,0 +1,21 @@ +[[!comment format=mdwn + username="craige@a46118dff5bc0fad85259759970d8b4b9fc377d7" + nickname="craige" + avatar="http://cdn.libravatar.org/avatar/6d2207226de755da46aa2fdff9af70b2" + subject="comment 4" + date="2017-02-03T00:04:05Z" + content=""" +Ugh, sorry to ask again but I'm specifically stuck trying to extract the Debian suite only from this. Is this stored as a specific value I can draw on? I've been wading through the source and added in a swag of trial and error with no luck. + +I can see the suite listed in the output + + Just (System (Debian Linux (Stable \"jessie\")) + +but I was wondering if there was a method to pull out just the suite code name (ie: \"jessie\") that did not involve a regex looking for it amongst that output. + +The goal is to query Info so that a suite name can be added to a sources list. + +If I have to regex, that's OK, I just didn't want to go down that path if there was a smarted way. + +Thanks Joey :-) +"""]] -- cgit v1.2.3 From bd8396406c4f86fba598fb98e097d657e72f2ab0 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 2 Feb 2017 20:51:51 -0700 Subject: Apt.pinnedTo uses File.configFileName --- src/Propellor/Property/Apt.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 8539c4a6..ef3387ca 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -272,12 +272,16 @@ pinnedTo' -> (DebianSuite, PinPriority) -> RevertableProperty UnixLike UnixLike pinnedTo' p (suite, pin) = - "/etc/apt/preferences.d/10propellor.pref" `File.containsBlock` + (prefFile `File.hasContent` prefs) File.notPresent prefFile + where + prefs = [ "Package: " ++ p , "Pin: release " ++ suitePin suite , "Pin-Priority: " ++ show pin , "" ] + prefFile = "/etc/apt/preferences.d/10propellor_" + ++ File.configFileName p <.> "pref" -- TODO should be RevertableProperty Debian Debian -- cgit v1.2.3 From 10cb6c5c4e69d5d7617bedf2b439e371e4ff07ab Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 2 Feb 2017 20:56:29 -0700 Subject: AptPrefPackage type --- src/Propellor/Property/Apt.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index ef3387ca..e426b26f 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -249,6 +249,11 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv where cmd = "cd '" ++ dir ++ "' && mk-build-deps debian/control --install --tool 'apt-get -y --no-install-recommends' --remove" +-- | The name of a package, a glob to match the names of packages, or a regexp +-- surrounded by slashes to match the names of packages. See +-- apt_preferences(5), "Regular expressions and glob(7) syntax" +type AptPrefPackage = String + -- | Pins a list of packages, package wildcards and/or regular expressions to a -- given suite with a given pin priority (see apt_preferences(5)). Revert to -- unpin. @@ -261,14 +266,14 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv -- > & Apt.suiteAvailablePinned Unstable (-10) -- > & ["elpa-*"] `Apt.pinnedTo` (Unstable, 990) pinnedTo - :: [String] + :: [AptPrefPackage] -> (DebianSuite, PinPriority) -> RevertableProperty UnixLike UnixLike pinnedTo ps (suite, pin) = (\p -> pinnedTo' p (suite, pin)) `applyToList` ps `describe` unwords (("pinned to " ++ showSuite suite):ps) pinnedTo' - :: String + :: AptPrefPackage -> (DebianSuite, PinPriority) -> RevertableProperty UnixLike UnixLike pinnedTo' p (suite, pin) = -- cgit v1.2.3 From 0a2d07bae428d3be077daf028999bf3e669e6bb7 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 2 Feb 2017 20:59:28 -0700 Subject: fix type of Apt.pinnedTo --- src/Propellor/Property/Apt.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index e426b26f..c21931a9 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -268,16 +268,17 @@ type AptPrefPackage = String pinnedTo :: [AptPrefPackage] -> (DebianSuite, PinPriority) - -> RevertableProperty UnixLike UnixLike + -> RevertableProperty Debian Debian pinnedTo ps (suite, pin) = (\p -> pinnedTo' p (suite, pin)) `applyToList` ps `describe` unwords (("pinned to " ++ showSuite suite):ps) pinnedTo' :: AptPrefPackage -> (DebianSuite, PinPriority) - -> RevertableProperty UnixLike UnixLike + -> RevertableProperty Debian Debian pinnedTo' p (suite, pin) = - (prefFile `File.hasContent` prefs) File.notPresent prefFile + (tightenTargets $ prefFile `File.hasContent` prefs) + (tightenTargets $ File.notPresent prefFile) where prefs = [ "Package: " ++ p -- cgit v1.2.3 From 626f13c408deb7b8e6940b213f7a0081bbf8fe23 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 2 Feb 2017 21:04:58 -0700 Subject: drop a superfluous blank line in pref file --- src/Propellor/Property/Apt.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index c21931a9..ba5fd5e7 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -284,7 +284,6 @@ pinnedTo' p (suite, pin) = [ "Package: " ++ p , "Pin: release " ++ suitePin suite , "Pin-Priority: " ++ show pin - , "" ] prefFile = "/etc/apt/preferences.d/10propellor_" ++ File.configFileName p <.> "pref" -- cgit v1.2.3 From 2c53b0f0f098f3112782a52f4b9575ec36369b16 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 2 Feb 2017 21:06:47 -0700 Subject: add Explanation: lines to pref files --- src/Propellor/Property/Apt.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index ba5fd5e7..218c7197 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -117,7 +117,8 @@ suiteAvailablePinned s pin = available unavailable available :: Property Debian available = tightenTargets $ combineProperties (desc True) $ props & File.hasContent prefFile - [ "Package: *" + [ "Explanation: This file added by propellor" + , "Package: *" , "Pin: release " ++ suitePin s , "Pin-Priority: " ++ show pin ] @@ -281,7 +282,8 @@ pinnedTo' p (suite, pin) = (tightenTargets $ File.notPresent prefFile) where prefs = - [ "Package: " ++ p + [ "Explanation: This file added by propellor" + , "Package: " ++ p , "Pin: release " ++ suitePin suite , "Pin-Priority: " ++ show pin ] -- cgit v1.2.3 From 39afe530d4bd43c0e4f4142a03e375019222a8b8 Mon Sep 17 00:00:00 2001 From: spwhitton Date: Fri, 3 Feb 2017 04:07:58 +0000 Subject: Added a comment --- ...mment_4_add83ed58963e944ccd705a50e8b5a47._comment | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 doc/todo/new_apt_pinning_properties/comment_4_add83ed58963e944ccd705a50e8b5a47._comment diff --git a/doc/todo/new_apt_pinning_properties/comment_4_add83ed58963e944ccd705a50e8b5a47._comment b/doc/todo/new_apt_pinning_properties/comment_4_add83ed58963e944ccd705a50e8b5a47._comment new file mode 100644 index 00000000..9688672b --- /dev/null +++ b/doc/todo/new_apt_pinning_properties/comment_4_add83ed58963e944ccd705a50e8b5a47._comment @@ -0,0 +1,20 @@ +[[!comment format=mdwn + username="spwhitton" + avatar="http://cdn.libravatar.org/avatar/9c3f08f80e67733fd506c353239569eb" + subject="comment 4" + date="2017-02-03T04:07:58Z" + content=""" +> Yes please add a new type alias for String (or an ADT) if Package is not appropriate. + +Propellor won't be parsing any of the regexp or globs, so I've added a new type alias rather than an ADT. + +> Nice surprise that tightenTargets works on RevertableProperty at all. Since it does, you should be able to tighten one side, revert, tighten the other side, and re-revert. Or, deconstruct the RevertableProperty, tighten both sides individually, and reconstruct it. + +I don't understand what you're getting at with the first of these suggestions. + +In any case, now that I'm not using `File.containsBlock`, it's easy to just apply `tightenTargets` to each side. + +> I've added a Propellor.Property.File.configFileName that should be suitable for your purposes, and others.. + +Very nice :) I've updated my branch to use this. I haven't removed `File.containsBlock`, since it might be useful in the future, but you could of course revert the relevant commit. +"""]] -- cgit v1.2.3 From 442fa3706de3d7329552c78d314b5a8f653ca65d Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Mon, 26 Dec 2016 11:13:16 +0800 Subject: add types for Arch Linux Signed-off-by: Zihao Wang --- src/Propellor/Info.hs | 5 +++++ src/Propellor/Types.hs | 1 + src/Propellor/Types/MetaTypes.hs | 26 ++++++++++++++++++++++++-- src/Propellor/Types/OS.hs | 3 +++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/Propellor/Info.hs b/src/Propellor/Info.hs index 3d7f07a5..49ca689f 100644 --- a/src/Propellor/Info.hs +++ b/src/Propellor/Info.hs @@ -3,6 +3,7 @@ module Propellor.Info ( osDebian, osBuntish, + osArchLinux, osFreeBSD, setInfoProperty, addInfoProperty, @@ -106,6 +107,10 @@ osBuntish release arch = tightenTargets $ os (System (Buntish release) arch) osFreeBSD :: FreeBSDRelease -> Architecture -> Property (HasInfo + FreeBSD) osFreeBSD release arch = tightenTargets $ os (System (FreeBSD release) arch) +-- | Specifies that a host's operating system is Arch Linux +osArchLinux :: Architecture -> Property (HasInfo + ArchLinux) +osArchLinux arch = tightenTargets $ os (System (ArchLinux) arch) + os :: System -> Property (HasInfo + UnixLike) os system = pureInfoProperty ("Operating " ++ show system) (InfoVal system) diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs index 6d6b14ea..23066c18 100644 --- a/src/Propellor/Types.hs +++ b/src/Propellor/Types.hs @@ -24,6 +24,7 @@ module Propellor.Types ( , DebianLike , Debian , Buntish + , ArchLinux , FreeBSD , HasInfo , type (+) diff --git a/src/Propellor/Types/MetaTypes.hs b/src/Propellor/Types/MetaTypes.hs index e064d76f..2b347185 100644 --- a/src/Propellor/Types/MetaTypes.hs +++ b/src/Propellor/Types/MetaTypes.hs @@ -7,6 +7,7 @@ module Propellor.Types.MetaTypes ( DebianLike, Debian, Buntish, + ArchLinux, FreeBSD, HasInfo, MetaTypes, @@ -35,14 +36,24 @@ data MetaType deriving (Show, Eq, Ord) -- | Any unix-like system -type UnixLike = MetaTypes '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish, 'Targeting 'OSFreeBSD ] +type UnixLike = MetaTypes '[ 'Targeting 'OSDebian + , 'Targeting 'OSBuntish + , 'Targeting 'OSArchLinux + , 'Targeting 'OSFreeBSD + ] + -- | Any linux system -type Linux = MetaTypes '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish ] +type Linux = MetaTypes '[ 'Targeting 'OSDebian + , 'Targeting 'OSBuntish + , 'Targeting 'OSArchLinux + ] + -- | Debian and derivatives. type DebianLike = MetaTypes '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish ] type Debian = MetaTypes '[ 'Targeting 'OSDebian ] type Buntish = MetaTypes '[ 'Targeting 'OSBuntish ] type FreeBSD = MetaTypes '[ 'Targeting 'OSFreeBSD ] +type ArchLinux = MetaTypes '[ 'Targeting 'OSArchLinux ] -- | Used to indicate that a Property adds Info to the Host where it's used. type HasInfo = MetaTypes '[ 'WithInfo ] @@ -58,16 +69,19 @@ data instance Sing (x :: MetaType) where OSDebianS :: Sing ('Targeting 'OSDebian) OSBuntishS :: Sing ('Targeting 'OSBuntish) OSFreeBSDS :: Sing ('Targeting 'OSFreeBSD) + OSArchLinuxS :: Sing ('Targeting 'OSArchLinux) WithInfoS :: Sing 'WithInfo instance SingI ('Targeting 'OSDebian) where sing = OSDebianS instance SingI ('Targeting 'OSBuntish) where sing = OSBuntishS instance SingI ('Targeting 'OSFreeBSD) where sing = OSFreeBSDS +instance SingI ('Targeting 'OSArchLinux) where sing = OSArchLinuxS instance SingI 'WithInfo where sing = WithInfoS instance SingKind ('KProxy :: KProxy MetaType) where type DemoteRep ('KProxy :: KProxy MetaType) = MetaType fromSing OSDebianS = Targeting OSDebian fromSing OSBuntishS = Targeting OSBuntish fromSing OSFreeBSDS = Targeting OSFreeBSD + fromSing OSArchLinuxS = Targeting OSArchLinux fromSing WithInfoS = WithInfo -- | Convenience type operator to combine two `MetaTypes` lists. @@ -186,6 +200,14 @@ type instance EqT 'OSBuntish 'OSDebian = 'False type instance EqT 'OSBuntish 'OSFreeBSD = 'False type instance EqT 'OSFreeBSD 'OSDebian = 'False type instance EqT 'OSFreeBSD 'OSBuntish = 'False +type instance EqT 'OSArchLinux 'OSArchLinux = 'True +type instance EqT 'OSArchLinux 'OSDebian = 'False +type instance EqT 'OSArchLinux 'OSBuntish = 'False +type instance EqT 'OSArchLinux 'OSFreeBSD = 'False +type instance EqT 'OSDebian 'OSArchLinux = 'False +type instance EqT 'OSBuntish 'OSArchLinux = 'False +type instance EqT 'OSFreeBSD 'OSArchLinux = 'False + -- More modern version if the combinatiorial explosion gets too bad later: -- -- type family Eq (a :: MetaType) (b :: MetaType) where diff --git a/src/Propellor/Types/OS.hs b/src/Propellor/Types/OS.hs index 43371af1..696c36b0 100644 --- a/src/Propellor/Types/OS.hs +++ b/src/Propellor/Types/OS.hs @@ -33,6 +33,7 @@ data System = System Distribution Architecture data Distribution = Debian DebianKernel DebianSuite | Buntish Release -- ^ A well-known Debian derivative founded by a space tourist. The actual name of this distribution is not used in Propellor per + | ArchLinux | FreeBSD FreeBSDRelease deriving (Show, Eq) @@ -41,12 +42,14 @@ data Distribution data TargetOS = OSDebian | OSBuntish + | OSArchLinux | OSFreeBSD deriving (Show, Eq, Ord) systemToTargetOS :: System -> TargetOS systemToTargetOS (System (Debian _ _) _) = OSDebian systemToTargetOS (System (Buntish _) _) = OSBuntish +systemToTargetOS (System (ArchLinux) _) = OSArchLinux systemToTargetOS (System (FreeBSD _) _) = OSFreeBSD -- | Most of Debian ports are based on Linux. There also exist hurd-i386, -- cgit v1.2.3 From 44f7f7f1c3014586fd574ba1d10a1063204850a7 Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Fri, 3 Feb 2017 20:46:32 +0800 Subject: Bootstrap using Pacman Signed-off-by: Zihao Wang --- src/Propellor/Bootstrap.hs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs index 2c8fa95a..045e5256 100644 --- a/src/Propellor/Bootstrap.hs +++ b/src/Propellor/Bootstrap.hs @@ -60,6 +60,7 @@ depsCommand msys = "( " ++ intercalate " ; " (concat [osinstall, cabalinstall]) where osinstall = case msys of Just (System (FreeBSD _) _) -> map pkginstall fbsddeps + Just (System (ArchLinux) _) -> map pacmaninstall archlinuxdeps Just (System (Debian _ _) _) -> useapt Just (System (Buntish _) _) -> useapt -- assume a debian derived system when not specified @@ -74,6 +75,7 @@ depsCommand msys = "( " ++ intercalate " ; " (concat [osinstall, cabalinstall]) aptinstall p = "DEBIAN_FRONTEND=noninteractive apt-get -qq --no-upgrade --no-install-recommends -y install " ++ p pkginstall p = "ASSUME_ALWAYS_YES=yes pkg install " ++ p + pacmaninstall p = "pacman -S --noconfirm --needed " ++ p -- This is the same deps listed in debian/control. debdeps = @@ -112,6 +114,25 @@ depsCommand msys = "( " ++ intercalate " ; " (concat [osinstall, cabalinstall]) , "hs-text" , "gmake" ] + archlinuxdeps = + [ "gnupg" + , "ghc" + , "cabal-install" + , "haskell-async" + , "haskell-missingh" + , "haskell-hslogger" + , "haskell-unix-compat" + , "haskell-ansi-terminal" + , "haskell-hackage-security" + , "haskell-ifelse" + , "haskell-network" + , "haskell-mtl" + , "haskell-transformers-base" + , "haskell-exceptions" + , "haskell-stm" + , "haskell-text" + , "make" + ] installGitCommand :: Maybe System -> ShellCommand installGitCommand msys = case msys of @@ -121,6 +142,8 @@ installGitCommand msys = case msys of [ "ASSUME_ALWAYS_YES=yes pkg update" , "ASSUME_ALWAYS_YES=yes pkg install git" ] + (Just (System (ArchLinux) _)) -> use + [ "pacman -S --noconfirm --needed git"] -- assume a debian derived system when not specified Nothing -> use apt where -- cgit v1.2.3 From 5b946ea4e32657f64771f3e2ef8bc865afc4c1fc Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Wed, 28 Dec 2016 17:19:49 +0800 Subject: add property for Pacman Signed-off-by: Zihao Wang --- src/Propellor/Property/Pacman.hs | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/Propellor/Property/Pacman.hs diff --git a/src/Propellor/Property/Pacman.hs b/src/Propellor/Property/Pacman.hs new file mode 100644 index 00000000..60ed4bea --- /dev/null +++ b/src/Propellor/Property/Pacman.hs @@ -0,0 +1,68 @@ +-- | Maintainer: Zihao Wang +-- +-- Support for the Pacman package manager + +module Propellor.Property.Pacman where + +import Propellor.Base + +runPacman :: [String] -> UncheckedProperty ArchLinux +runPacman ps = tightenTargets $ cmdProperty "pacman" ps + +-- | Have pacman update its lists of packages, but without upgrading anything. +update :: Property ArchLinux +update = combineProperties ("pacman update") $ props + & runPacman ["-Sy", "--noconfirm"] + `assume` MadeChange + +upgrade :: Property ArchLinux +upgrade = combineProperties ("pacman upgrade") $ props + & runPacman ["-Syu", "--noconfirm"] + `assume` MadeChange + +type Package = String + +installed :: [Package] -> Property ArchLinux +installed = installed' ["--noconfirm"] + +installed' :: [String] -> [Package] -> Property ArchLinux +installed' params ps = check (not <$> isInstalled' ps) go + `describe` unwords ("pacman installed":ps) + where + go = runPacman (params ++ ["-S"] ++ ps) + +removed :: [Package] -> Property ArchLinux +removed ps = check (any (== IsInstalled) <$> getInstallStatus ps) + (runPacman (["-R", "--noconfirm"] ++ ps)) + `describe` unwords ("pacman removed":ps) + +isInstalled :: Package -> IO Bool +isInstalled p = isInstalled' [p] + +isInstalled' :: [Package] -> IO Bool +isInstalled' ps = all (== IsInstalled) <$> getInstallStatus ps + +data InstallStatus = IsInstalled | NotInstalled + deriving (Show, Eq) + +{- Returns the InstallStatus of packages that are installed + - or known and not installed. If a package is not known at all to apt + - or dpkg, it is not included in the list. -} +getInstallStatus :: [Package] -> IO [InstallStatus] +getInstallStatus ps = mapMaybe id <$> mapM status ps + where + status :: Package -> IO (Maybe InstallStatus) + status p = do + ifM (succeeds "pacman" ["-Q", p]) + (return (Just IsInstalled), + ifM (succeeds "pacman" ["-Sp", p]) + (return (Just NotInstalled), + return Nothing)) + +succeeds :: String -> [String] -> IO Bool +succeeds cmd args = (quietProcess >> return True) + `catchIO` (\_ -> return False) + where + quietProcess :: IO () + quietProcess = withQuietOutput createProcessSuccess p + p = (proc cmd args) -- cgit v1.2.3 From edf949ccfd577605f960e2cf5a2b46f5b49bbc0f Mon Sep 17 00:00:00 2001 From: wzhd Date: Fri, 3 Feb 2017 15:41:08 +0000 Subject: Arch Linux Port --- doc/todo/Arch_Linux_Port.mdwn | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 doc/todo/Arch_Linux_Port.mdwn diff --git a/doc/todo/Arch_Linux_Port.mdwn b/doc/todo/Arch_Linux_Port.mdwn new file mode 100644 index 00000000..a899dbb3 --- /dev/null +++ b/doc/todo/Arch_Linux_Port.mdwn @@ -0,0 +1,14 @@ +Hi all, I'm an Arch Linux user and I've been learning Haskell and working on an Arch Liux Port in the last several months. Here's my [GitHub fork](https://github.com/wzhd/propellor/tree/archlinux), and the branch is called archlinux. + +Currently, I've added types, modified Bootstrap.hs, and added a Property for the package manager Pacman. I've been using it for a while and it seems to be working. + +I've made some addtional minor changes to make propellor compile without errors: + +- User.nuked now has type Property Linux +- OS.cleanInstallOnce now has type Property DebianLike, because one of its dependencies, User.shadowConfig only supports DebianLike +- tightenTargets is added to Reboot.toDistroKernel to get the expeted type +- pattern for Arch Linux is added to Debootstrap.extractSuite to silence warning "non-exhaustive pattern match" +- several properties in Parted and Partition are converted to Property Linux +- Rsync.installed and Docker.installed now supports Pacman as well + +Hope you enjoy it! -- cgit v1.2.3 From 80431fe0439ec404878d0a236f277d8d9b684329 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 3 Feb 2017 15:28:28 -0400 Subject: review --- ...ent_1_8e39dc177e21e9e20c1b74b59b9926d2._comment | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 doc/todo/Arch_Linux_Port/comment_1_8e39dc177e21e9e20c1b74b59b9926d2._comment diff --git a/doc/todo/Arch_Linux_Port/comment_1_8e39dc177e21e9e20c1b74b59b9926d2._comment b/doc/todo/Arch_Linux_Port/comment_1_8e39dc177e21e9e20c1b74b59b9926d2._comment new file mode 100644 index 00000000..11869a2a --- /dev/null +++ b/doc/todo/Arch_Linux_Port/comment_1_8e39dc177e21e9e20c1b74b59b9926d2._comment @@ -0,0 +1,28 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2017-02-03T19:14:41Z" + content=""" +Wow, nice work! + +Seems that Propellor.Property.Partition.formatted' is still a DebianLike +property really, since it only supports using apt to install the mkfs +programs. It will fail at runtime on Arch. So, I think best to keep it +DebianLike until that's dealt with -- and then the type will be +`DebianLike + ArchLinux` rather than `LinuxLike` + +Same for Propellor.Property.Partition.kpartx. + +Several properties that were changed from DebianLike to Linux really +only support DebianLike and ArchLinux, not all linux distros, so their +types ought to be `DebianLike + ArchLinux`. This includes Docker.installed, +Parted.installed, Rsync.installed. + +A nicer way to inplement those multi-distro `installed` properties is like +this: + + installed :: Property (Debian + ArchLinux) + installed = Apt.installed ["foo"] `pickOS` Pacman.installed ["foo"] + +Make those changes and I will merge it. +"""]] -- cgit v1.2.3 From 34e3477ccc051b3a291331da7f2c5d1d2962a506 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 3 Feb 2017 15:31:08 -0400 Subject: Added Apt.suiteAvailablePinned, Apt.pinnedTo. Thanks, Sean Whitton. * Added Apt.suiteAvailablePinned, Apt.pinnedTo. Thanks, Sean Whitton. * Added File.containsBlock Thanks, Sean Whitton. --- debian/changelog | 4 ++++ doc/todo/new_apt_pinning_properties.mdwn | 2 ++ 2 files changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 30af1b88..81360402 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,10 @@ propellor (3.2.4) UNRELEASED; urgency=medium Thanks, Andrew Cowie. * Added Propellor.Property.File.configFileName and related functions to generate good filenames for config directories. + * Added Apt.suiteAvailablePinned, Apt.pinnedTo. + Thanks, Sean Whitton. + * Added File.containsBlock + Thanks, Sean Whitton. -- Joey Hess Sat, 24 Dec 2016 15:06:36 -0400 diff --git a/doc/todo/new_apt_pinning_properties.mdwn b/doc/todo/new_apt_pinning_properties.mdwn index d32bcbb2..8687b58a 100644 --- a/doc/todo/new_apt_pinning_properties.mdwn +++ b/doc/todo/new_apt_pinning_properties.mdwn @@ -6,3 +6,5 @@ My branch `pin` of repo `https://git.spwhitton.name/propellor` adds - a haddock for `File.containsLines` There is one TODO in a comment that relates to propellor's algebraic data types. I'd be grateful for help with that. --spwhitton + +> merged, thanks. [[done]] --[[Joey]] -- cgit v1.2.3 From b52c37df64ab2a3e261c7f9daba9e7b812e55706 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 3 Feb 2017 15:42:21 -0400 Subject: response --- ...mment_5_6fbd29f568ec8b97be47874e2aac57a3._comment | 20 ++++++++++++++++++++ src/Propellor/Property.hs | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 doc/forum/Inherited_Variables.../comment_5_6fbd29f568ec8b97be47874e2aac57a3._comment diff --git a/doc/forum/Inherited_Variables.../comment_5_6fbd29f568ec8b97be47874e2aac57a3._comment b/doc/forum/Inherited_Variables.../comment_5_6fbd29f568ec8b97be47874e2aac57a3._comment new file mode 100644 index 00000000..16819bd6 --- /dev/null +++ b/doc/forum/Inherited_Variables.../comment_5_6fbd29f568ec8b97be47874e2aac57a3._comment @@ -0,0 +1,20 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 5""" + date="2017-02-03T19:32:58Z" + content=""" +What you're looking for is not a regexp, but Haskell's [pattern +matching](https://www.haskell.org/tutorial/patterns.html). + +For example: + + myproperty :: Property Debian + myproperty = withOS "some desc here" $ \w o -> case o of + -- Pattern match on the OS, to get the Debian stable release + (Just (System (Debian _kernel (Stable release)) _arch)) -> + ensureProperty w $ Apt.setSourcesListD (sourcesLines release) "mysources" + _ -> unsupportedOS + + sourcesLines :: Release -> [Line] + sourcesLines release = undefined +"""]] diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs index 06145333..7860a3df 100644 --- a/src/Propellor/Property.hs +++ b/src/Propellor/Property.hs @@ -308,8 +308,8 @@ pickOS a b = c `addChildren` [toChildProperty a, toChildProperty b] -- -- > myproperty :: Property Debian -- > myproperty = withOS "foo installed" $ \w o -> case o of --- > (Just (System (Debian (Stable release)) arch)) -> ensureProperty w ... --- > (Just (System (Debian suite) arch)) -> ensureProperty w ... +-- > (Just (System (Debian kernel (Stable release)) arch)) -> ensureProperty w ... +-- > (Just (System (Debian kernel suite) arch)) -> ensureProperty w ... -- > _ -> unsupportedOS' -- -- Note that the operating system specifics may not be declared for all hosts, -- cgit v1.2.3 From 92168164943dcf033682b9f9a26f81beb3c537f4 Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Fri, 3 Feb 2017 17:28:38 +0800 Subject: addArchLinux support to Docker.installed Signed-off-by: Zihao Wang --- src/Propellor/Property/Docker.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index 2ef97438..0bfcc781 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -55,6 +55,7 @@ import Propellor.Container import qualified Propellor.Property.File as File import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Cmd as Cmd +import qualified Propellor.Property.Pacman as Pacman import qualified Propellor.Shim as Shim import Utility.Path import Utility.ThreadScheduler @@ -68,8 +69,8 @@ import Data.List.Utils import qualified Data.Map as M import System.Console.Concurrent -installed :: Property DebianLike -installed = Apt.installed ["docker.io"] +installed :: Property (DebianLike + ArchLinux) +installed = Apt.installed ["docker.io"] `pickOS` Pacman.installed ["docker"] -- | Configures docker with an authentication file, so that images can be -- pushed to index.docker.io. Optional. -- cgit v1.2.3 From 0b936d63931baa9cda6b243cf643ad1c71ce5c0b Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Fri, 3 Feb 2017 17:37:10 +0800 Subject: extend Rsync to support ArchLinux Signed-off-by: Zihao Wang --- src/Propellor/Property/Rsync.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Propellor/Property/Rsync.hs b/src/Propellor/Property/Rsync.hs index b40396de..53baa74e 100644 --- a/src/Propellor/Property/Rsync.hs +++ b/src/Propellor/Property/Rsync.hs @@ -2,6 +2,7 @@ module Propellor.Property.Rsync where import Propellor.Base import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.Pacman as Pacman type Src = FilePath type Dest = FilePath @@ -16,7 +17,7 @@ filesUnder d = Pattern (d ++ "/*") -- | Ensures that the Dest directory exists and has identical contents as -- the Src directory. -syncDir :: Src -> Dest -> Property DebianLike +syncDir :: Src -> Dest -> Property (DebianLike + ArchLinux) syncDir = syncDirFiltered [] data Filter @@ -43,7 +44,7 @@ newtype Pattern = Pattern String -- Rsync checks each name to be transferred against its list of Filter -- rules, and the first matching one is acted on. If no matching rule -- is found, the file is processed. -syncDirFiltered :: [Filter] -> Src -> Dest -> Property DebianLike +syncDirFiltered :: [Filter] -> Src -> Dest -> Property (DebianLike + ArchLinux) syncDirFiltered filters src dest = rsync $ [ "-av" -- Add trailing '/' to get rsync to sync the Dest directory, @@ -56,7 +57,7 @@ syncDirFiltered filters src dest = rsync $ , "--quiet" ] ++ map toRsync filters -rsync :: [String] -> Property DebianLike +rsync :: [String] -> Property (DebianLike + ArchLinux) rsync ps = cmdProperty "rsync" ps `assume` MadeChange - `requires` Apt.installed ["rsync"] + `requires` Apt.installed ["rsync"] `pickOS` Pacman.installed ["rsync"] -- cgit v1.2.3 From f95e4fc7dccb9691b8185166c44f83ce884463dc Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Fri, 3 Feb 2017 18:16:54 +0800 Subject: add some support for Arch Linux to Parted Signed-off-by: Zihao Wang --- src/Propellor/Property/Parted.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Propellor/Property/Parted.hs b/src/Propellor/Property/Parted.hs index bc8a256d..40af3357 100644 --- a/src/Propellor/Property/Parted.hs +++ b/src/Propellor/Property/Parted.hs @@ -23,6 +23,7 @@ module Propellor.Property.Parted ( import Propellor.Base import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.Pacman as Pacman import qualified Propellor.Property.Partition as Partition import Utility.DataUnits import Data.Char @@ -192,12 +193,12 @@ partitioned eep disk (PartTable tabletype parts) = property' desc $ \w -> do -- -- Parted is run in script mode, so it will never prompt for input. -- It is asked to use cylinder alignment for the disk. -parted :: Eep -> FilePath -> [String] -> Property DebianLike +parted :: Eep -> FilePath -> [String] -> Property (DebianLike + ArchLinux) parted YesReallyDeleteDiskContents disk ps = p `requires` installed where p = cmdProperty "parted" ("--script":"--align":"cylinder":disk:ps) `assume` MadeChange -- | Gets parted installed. -installed :: Property DebianLike -installed = Apt.installed ["parted"] +installed :: Property (DebianLike + ArchLinux) +installed = Apt.installed ["parted"] `pickOS` Pacman.installed ["parted"] -- cgit v1.2.3 From 93e93de20f29521c399a19bfeec1b359c1dadae9 Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Fri, 3 Feb 2017 18:27:40 +0800 Subject: make pattern-matching exhaustive Signed-off-by: Zihao Wang --- src/Propellor/Property/Debootstrap.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Propellor/Property/Debootstrap.hs b/src/Propellor/Property/Debootstrap.hs index db114e01..e21bcdff 100644 --- a/src/Propellor/Property/Debootstrap.hs +++ b/src/Propellor/Property/Debootstrap.hs @@ -96,6 +96,7 @@ built' installprop target system@(System _ arch) config = extractSuite :: System -> Maybe String extractSuite (System (Debian _ s) _) = Just $ Apt.showSuite s extractSuite (System (Buntish r) _) = Just r +extractSuite (System (ArchLinux) _) = Nothing extractSuite (System (FreeBSD _) _) = Nothing -- | Ensures debootstrap is installed. -- cgit v1.2.3 From 6995241840c72ad966494a780a65dd5076f2898a Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Fri, 3 Feb 2017 19:06:31 +0800 Subject: add tightenTargets probably because of "now :: Property Linux" Signed-off-by: Zihao Wang --- src/Propellor/Property/Reboot.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/Reboot.hs b/src/Propellor/Property/Reboot.hs index 31731dc2..3781cd7b 100644 --- a/src/Propellor/Property/Reboot.hs +++ b/src/Propellor/Property/Reboot.hs @@ -59,7 +59,7 @@ atEnd force resultok = property "scheduled reboot at end of propellor run" $ do -- See 'Propellor.Property.HostingProvider.DigitalOcean' -- for an example of how to do this. toDistroKernel :: Property DebianLike -toDistroKernel = check (not <$> runningInstalledKernel) now +toDistroKernel = tightenTargets $ check (not <$> runningInstalledKernel) now `describe` "running installed kernel" -- | Given a kernel version string @v@, reboots immediately if the running -- cgit v1.2.3 From 7781c8098f45481ac03c5ede989614eb8411a6aa Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Fri, 3 Feb 2017 20:31:57 +0800 Subject: cleanInstallOnce supports DebianLike only because of User.shadowConfig Signed-off-by: Zihao Wang --- src/Propellor/Property/OS.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/OS.hs b/src/Propellor/Property/OS.hs index d974cfbc..10d7afc0 100644 --- a/src/Propellor/Property/OS.hs +++ b/src/Propellor/Property/OS.hs @@ -64,7 +64,7 @@ import Control.Exception (throw) -- > & User.accountFor "joey" -- > & User.hasSomePassword "joey" -- > -- rest of system properties here -cleanInstallOnce :: Confirmation -> Property Linux +cleanInstallOnce :: Confirmation -> Property DebianLike cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $ go `requires` confirmed "clean install confirmed" confirmation where -- cgit v1.2.3 From 49071dc5a85966a9c5d2b8892e689542e86f3e76 Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Fri, 3 Feb 2017 20:35:27 +0800 Subject: CloudAtCost requires User.nuked to be Property Linux Signed-off-by: Zihao Wang --- src/Propellor/Property/User.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs index 76eae647..0c7e48f2 100644 --- a/src/Propellor/Property/User.hs +++ b/src/Propellor/Property/User.hs @@ -43,7 +43,7 @@ systemAccountFor' (User u) mhome mgroup = tightenTargets $ check nouser go ] -- | Removes user home directory!! Use with caution. -nuked :: User -> Eep -> Property DebianLike +nuked :: User -> Eep -> Property Linux nuked user@(User u) _ = tightenTargets $ check hashomedir go `describe` ("nuked user " ++ u) where -- cgit v1.2.3 From 2fede02be7f71270b43bc63a7b521f20cd397ec7 Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Sat, 4 Feb 2017 08:46:48 +0800 Subject: replace Linux with DebianLike to compile DiskImage Signed-off-by: Zihao Wang --- src/Propellor/Property/DiskImage.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 06dfa69c..c828211b 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -81,16 +81,16 @@ type DiskImage = FilePath -- chroot while the disk image is being built, which should prevent any -- daemons that are included from being started on the system that is -- building the disk image. -imageBuilt :: DiskImage -> (FilePath -> Chroot) -> TableType -> Finalization -> [PartSpec] -> RevertableProperty (HasInfo + Linux) Linux +imageBuilt :: DiskImage -> (FilePath -> Chroot) -> TableType -> Finalization -> [PartSpec] -> RevertableProperty (HasInfo + DebianLike) Linux imageBuilt = imageBuilt' False -- | Like 'built', but the chroot is deleted and rebuilt from scratch each -- time. This is more expensive, but useful to ensure reproducible results -- when the properties of the chroot have been changed. -imageRebuilt :: DiskImage -> (FilePath -> Chroot) -> TableType -> Finalization -> [PartSpec] -> RevertableProperty (HasInfo + Linux) Linux +imageRebuilt :: DiskImage -> (FilePath -> Chroot) -> TableType -> Finalization -> [PartSpec] -> RevertableProperty (HasInfo + DebianLike) Linux imageRebuilt = imageBuilt' True -imageBuilt' :: Bool -> DiskImage -> (FilePath -> Chroot) -> TableType -> Finalization -> [PartSpec] -> RevertableProperty (HasInfo + Linux) Linux +imageBuilt' :: Bool -> DiskImage -> (FilePath -> Chroot) -> TableType -> Finalization -> [PartSpec] -> RevertableProperty (HasInfo + DebianLike) Linux imageBuilt' rebuild img mkchroot tabletype final partspec = imageBuiltFrom img chrootdir tabletype final partspec `requires` Chroot.provisioned chroot @@ -124,7 +124,7 @@ cachesCleaned = "cache cleaned" ==> (Apt.cacheCleaned `pickOS` skipit) skipit = doNothing :: Property UnixLike -- | Builds a disk image from the contents of a chroot. -imageBuiltFrom :: DiskImage -> FilePath -> TableType -> Finalization -> [PartSpec] -> RevertableProperty (HasInfo + Linux) UnixLike +imageBuiltFrom :: DiskImage -> FilePath -> TableType -> Finalization -> [PartSpec] -> RevertableProperty (HasInfo + DebianLike) UnixLike imageBuiltFrom img chrootdir tabletype final partspec = mkimg rmimg where desc = img ++ " built from " ++ chrootdir @@ -150,7 +150,7 @@ imageBuiltFrom img chrootdir tabletype final partspec = mkimg rmimg imageFinalized final mnts mntopts devs parttable rmimg = File.notPresent img -partitionsPopulated :: FilePath -> [Maybe MountPoint] -> [MountOpts] -> [LoopDev] -> Property Linux +partitionsPopulated :: FilePath -> [Maybe MountPoint] -> [MountOpts] -> [LoopDev] -> Property DebianLike partitionsPopulated chrootdir mnts mntopts devs = property' desc $ \w -> mconcat $ zipWith3 (go w) mnts mntopts devs where -- cgit v1.2.3 From 25f6871e1dda3de252fbc6c8ac6962eb0cd9311a Mon Sep 17 00:00:00 2001 From: Zihao Wang Date: Fri, 3 Feb 2017 18:24:28 +0800 Subject: get rid of a compile-time error Signed-off-by: Zihao Wang --- src/Propellor/Property/SiteSpecific/JoeySites.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index 4f8b48af..445bce07 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -892,7 +892,7 @@ userDirHtml = File.fileProperty "apache userdir is html" (map munge) conf -- -- -- oncalendar example value: "*-*-* 7:30" -alarmClock :: String -> User -> String -> Property DebianLike +alarmClock :: String -> User -> String -> Property Linux alarmClock oncalendar (User user) command = combineProperties "goodmorning timer installed" $ props & "/etc/systemd/system/goodmorning.timer" `File.hasContent` [ "[Unit]" -- cgit v1.2.3 From 59626c761d2303c13553a0e6b425863c9985436e Mon Sep 17 00:00:00 2001 From: wzhd Date: Sat, 4 Feb 2017 01:53:49 +0000 Subject: Added a comment --- ...comment_2_cc4623c156a0d12c88461bc5deec07cd._comment | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 doc/todo/Arch_Linux_Port/comment_2_cc4623c156a0d12c88461bc5deec07cd._comment diff --git a/doc/todo/Arch_Linux_Port/comment_2_cc4623c156a0d12c88461bc5deec07cd._comment b/doc/todo/Arch_Linux_Port/comment_2_cc4623c156a0d12c88461bc5deec07cd._comment new file mode 100644 index 00000000..dc6e3eb1 --- /dev/null +++ b/doc/todo/Arch_Linux_Port/comment_2_cc4623c156a0d12c88461bc5deec07cd._comment @@ -0,0 +1,18 @@ +[[!comment format=mdwn + username="wzhd" + avatar="http://cdn.libravatar.org/avatar/d5a499b7c476ca9960cc8dccdf455bae" + subject="comment 2" + date="2017-02-04T01:53:49Z" + content=""" +Thanks! + + +I didn't find the right way to do it; `pickOS` is so much easier than `withOS` ! + + +`Propellor.Property.Partition` was modified to get rid of some compiling errors in DiskImage and didn't support anything new. So I removed the changes. + + +Instead, I changed some properties in DiskImage from Linux to DebianLike. Is it the correct way to do it? + +"""]] -- cgit v1.2.3 From eae8fe777c141b34ec586e9af5bde278a33cc0c3 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 4 Feb 2017 11:30:28 -0700 Subject: rm superfluous TODO --- src/Propellor/Property/Apt.hs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 218c7197..fef4a700 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -290,8 +290,6 @@ pinnedTo' p (suite, pin) = prefFile = "/etc/apt/preferences.d/10propellor_" ++ File.configFileName p <.> "pref" --- TODO should be RevertableProperty Debian Debian - -- | Package installation may fail becuse the archive has changed. -- Run an update in that case and retry. robustly :: Property DebianLike -> Property DebianLike -- cgit v1.2.3 From 3829c41dc936b742be6aaae885f771b560f3a96f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 4 Feb 2017 11:32:34 -0700 Subject: factor out suitePinBlock --- src/Propellor/Property/Apt.hs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index fef4a700..61596914 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -116,12 +116,7 @@ suiteAvailablePinned s pin = available unavailable where available :: Property Debian available = tightenTargets $ combineProperties (desc True) $ props - & File.hasContent prefFile - [ "Explanation: This file added by propellor" - , "Package: *" - , "Pin: release " ++ suitePin s - , "Pin-Priority: " ++ show pin - ] + & File.hasContent prefFile (suitePinBlock "*" s pin) & setSourcesFile unavailable :: Property Debian @@ -281,12 +276,7 @@ pinnedTo' p (suite, pin) = (tightenTargets $ prefFile `File.hasContent` prefs) (tightenTargets $ File.notPresent prefFile) where - prefs = - [ "Explanation: This file added by propellor" - , "Package: " ++ p - , "Pin: release " ++ suitePin suite - , "Pin-Priority: " ++ show pin - ] + prefs = suitePinBlock p suite pin prefFile = "/etc/apt/preferences.d/10propellor_" ++ File.configFileName p <.> "pref" @@ -454,5 +444,13 @@ suitePin s = prefix s ++ showSuite s prefix (Stable _) = "n=" prefix _ = "a=" +suitePinBlock :: AptPrefPackage -> DebianSuite -> PinPriority +suitePinBlock p suite pin = + [ "Explanation: This file added by propellor" + , "Package: " ++ p + , "Pin: release " ++ suitePin suite + , "Pin-Priority: " ++ show pin + ] + dpkgStatus :: FilePath dpkgStatus = "/var/lib/dpkg/status" -- cgit v1.2.3 From 50986da33afb5b170a5336e4714e79130959b6c9 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 4 Feb 2017 11:46:07 -0700 Subject: Apt.pinnedTo takes a list of suites and pin priorities --- src/Propellor/Property/Apt.hs | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 61596914..d0f25e81 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -251,32 +251,41 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv type AptPrefPackage = String -- | Pins a list of packages, package wildcards and/or regular expressions to a --- given suite with a given pin priority (see apt_preferences(5)). Revert to --- unpin. +-- list of suites and corresponding pin priorities (see apt_preferences(5)). +-- Revert to unpin. -- --- Note that this will have no effect unless there is an apt source for the --- suite. One way to add an apt source is 'Apt.suiteAvailablePinned'. +-- Each package, package wildcard or regular expression will be pinned to all of +-- the specified suites. -- --- For example, to obtain all Emacs Lisp addon packages from sid, you could use +-- Note that this will have no effect unless there is an apt source for each of +-- the suites. One way to add an apt source is 'Apt.suiteAvailablePinned'. -- +-- For example, to obtain Emacs Lisp addon packages not present in your release +-- of Debian from testing, falling back to sid if they're not available in +-- testing, you could use +-- +-- > & Apt.suiteAvailablePinned Testing (-10) -- > & Apt.suiteAvailablePinned Unstable (-10) --- > & ["elpa-*"] `Apt.pinnedTo` (Unstable, 990) +-- > & ["elpa-*"] `Apt.pinnedTo` [(Testing, 100), (Unstable, 50)] pinnedTo :: [AptPrefPackage] - -> (DebianSuite, PinPriority) + -> [(DebianSuite, PinPriority)] -> RevertableProperty Debian Debian -pinnedTo ps (suite, pin) = (\p -> pinnedTo' p (suite, pin)) `applyToList` ps - `describe` unwords (("pinned to " ++ showSuite suite):ps) +pinnedTo ps pins = (\p -> pinnedTo' p pins) `applyToList` ps + `describe` unwords (("pinned to " ++ showSuites):ps) + where + showSuites = intercalate "," $ showSuite . fst <$> pins pinnedTo' :: AptPrefPackage - -> (DebianSuite, PinPriority) + -> [(DebianSuite, PinPriority)] -> RevertableProperty Debian Debian -pinnedTo' p (suite, pin) = +pinnedTo' p pins = (tightenTargets $ prefFile `File.hasContent` prefs) (tightenTargets $ File.notPresent prefFile) where - prefs = suitePinBlock p suite pin + prefs = foldr step [] pins + step (suite, pin) ls = ls ++ suitePinBlock p suite pin ++ [""] prefFile = "/etc/apt/preferences.d/10propellor_" ++ File.configFileName p <.> "pref" @@ -444,7 +453,7 @@ suitePin s = prefix s ++ showSuite s prefix (Stable _) = "n=" prefix _ = "a=" -suitePinBlock :: AptPrefPackage -> DebianSuite -> PinPriority +suitePinBlock :: AptPrefPackage -> DebianSuite -> PinPriority -> [Line] suitePinBlock p suite pin = [ "Explanation: This file added by propellor" , "Package: " ++ p -- cgit v1.2.3 From 8638b56b36b8abf06cbb6d107a4bd058bd915437 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 4 Feb 2017 11:52:43 -0700 Subject: AptPrefPackage -> AptPackagePref This reads much better: it's an "apt package preference". --- src/Propellor/Property/Apt.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index d0f25e81..724f6d05 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -248,7 +248,7 @@ buildDepIn dir = cmdPropertyEnv "sh" ["-c", cmd] noninteractiveEnv -- | The name of a package, a glob to match the names of packages, or a regexp -- surrounded by slashes to match the names of packages. See -- apt_preferences(5), "Regular expressions and glob(7) syntax" -type AptPrefPackage = String +type AptPackagePref = String -- | Pins a list of packages, package wildcards and/or regular expressions to a -- list of suites and corresponding pin priorities (see apt_preferences(5)). @@ -268,7 +268,7 @@ type AptPrefPackage = String -- > & Apt.suiteAvailablePinned Unstable (-10) -- > & ["elpa-*"] `Apt.pinnedTo` [(Testing, 100), (Unstable, 50)] pinnedTo - :: [AptPrefPackage] + :: [AptPackagePref] -> [(DebianSuite, PinPriority)] -> RevertableProperty Debian Debian pinnedTo ps pins = (\p -> pinnedTo' p pins) `applyToList` ps @@ -277,7 +277,7 @@ pinnedTo ps pins = (\p -> pinnedTo' p pins) `applyToList` ps showSuites = intercalate "," $ showSuite . fst <$> pins pinnedTo' - :: AptPrefPackage + :: AptPackagePref -> [(DebianSuite, PinPriority)] -> RevertableProperty Debian Debian pinnedTo' p pins = @@ -453,7 +453,7 @@ suitePin s = prefix s ++ showSuite s prefix (Stable _) = "n=" prefix _ = "a=" -suitePinBlock :: AptPrefPackage -> DebianSuite -> PinPriority -> [Line] +suitePinBlock :: AptPackagePref -> DebianSuite -> PinPriority -> [Line] suitePinBlock p suite pin = [ "Explanation: This file added by propellor" , "Package: " ++ p -- cgit v1.2.3 From 5ff45a37b1ffde8fe9150815d81236354c89e20b Mon Sep 17 00:00:00 2001 From: spwhitton Date: Sat, 4 Feb 2017 18:53:27 +0000 Subject: submit merge request --- ...o_pin_a_package_to_multiple_suites_with_different_priorities.mdwn | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 doc/todo/modify_Apt.pinnedTo_to_pin_a_package_to_multiple_suites_with_different_priorities.mdwn diff --git a/doc/todo/modify_Apt.pinnedTo_to_pin_a_package_to_multiple_suites_with_different_priorities.mdwn b/doc/todo/modify_Apt.pinnedTo_to_pin_a_package_to_multiple_suites_with_different_priorities.mdwn new file mode 100644 index 00000000..047324ce --- /dev/null +++ b/doc/todo/modify_Apt.pinnedTo_to_pin_a_package_to_multiple_suites_with_different_priorities.mdwn @@ -0,0 +1,5 @@ +Please consider merging the `pin` branch of `https://git.spwhitton.name/propellor` (again). + +I've modified `Apt.pinnedTo` so that it can pin an `AptPrefPackage` to multiple suites with different pin priorities. I've included a sample use-case in the function's haddock. + +--spwhitton -- cgit v1.2.3 From cdfa8a919730b2e58e1ef243fd2472dec1ad67a3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 4 Feb 2017 17:14:08 -0400 Subject: improve layout --- src/Propellor/Types/MetaTypes.hs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Propellor/Types/MetaTypes.hs b/src/Propellor/Types/MetaTypes.hs index 2b347185..19d1998e 100644 --- a/src/Propellor/Types/MetaTypes.hs +++ b/src/Propellor/Types/MetaTypes.hs @@ -36,17 +36,19 @@ data MetaType deriving (Show, Eq, Ord) -- | Any unix-like system -type UnixLike = MetaTypes '[ 'Targeting 'OSDebian - , 'Targeting 'OSBuntish - , 'Targeting 'OSArchLinux - , 'Targeting 'OSFreeBSD - ] +type UnixLike = MetaTypes + '[ 'Targeting 'OSDebian + , 'Targeting 'OSBuntish + , 'Targeting 'OSArchLinux + , 'Targeting 'OSFreeBSD + ] -- | Any linux system -type Linux = MetaTypes '[ 'Targeting 'OSDebian - , 'Targeting 'OSBuntish - , 'Targeting 'OSArchLinux - ] +type Linux = MetaTypes + '[ 'Targeting 'OSDebian + , 'Targeting 'OSBuntish + , 'Targeting 'OSArchLinux + ] -- | Debian and derivatives. type DebianLike = MetaTypes '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish ] -- cgit v1.2.3 From 11a4f3d9f73738582c8c6781f72106711e167737 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 4 Feb 2017 17:16:33 -0400 Subject: add missing case for ArchLinux --- src/Propellor/Property/Chroot.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Propellor/Property/Chroot.hs b/src/Propellor/Property/Chroot.hs index cb693a73..5f2e6b32 100644 --- a/src/Propellor/Property/Chroot.hs +++ b/src/Propellor/Property/Chroot.hs @@ -93,6 +93,7 @@ instance ChrootBootstrapper Debootstrapped where buildchroot (Debootstrapped cf) system loc = case system of (Just s@(System (Debian _ _) _)) -> Right $ debootstrap s (Just s@(System (Buntish _) _)) -> Right $ debootstrap s + (Just (System ArchLinux _)) -> Left "Arch Linux not supported by debootstrap." (Just (System (FreeBSD _) _)) -> Left "FreeBSD not supported by debootstrap." Nothing -> Left "Cannot debootstrap; OS not specified" where -- cgit v1.2.3 From 2f50e5f3d1a556b8445fdcb7ac239f85cfe43f6c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 4 Feb 2017 17:18:26 -0400 Subject: Arch Linux is now supported by Propellor! Thanks to Zihao Wang for this port. * Arch Linux is now supported by Propellor! Thanks to Zihao Wang for this port. * Added Propellor.Property.Pacman for Arch's package manager. Maintained by Zihao Wang. * The types of some properties changed; eg from Property DebianLike to Property (DebianLike + ArchLinux). This could require updates to code using those properties, so is a minor API change. --- debian/changelog | 11 ++++++++-- doc/todo/Arch_Linux_Port.mdwn | 2 ++ ...ent_3_d917de766dfe7fded7317d7614d1467f._comment | 25 ++++++++++++++++++++++ propellor.cabal | 3 ++- 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment diff --git a/debian/changelog b/debian/changelog index 81360402..3a12ca70 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,12 @@ -propellor (3.2.4) UNRELEASED; urgency=medium - +propellor (3.3.0) UNRELEASED; urgency=medium + + * Arch Linux is now supported by Propellor! + Thanks to Zihao Wang for this port. + * Added Propellor.Property.Pacman for Arch's package manager. + Maintained by Zihao Wang. + * The types of some properties changed; eg from Property DebianLike + to Property (DebianLike + ArchLinux). This could require updates + to code using those properties, so is a minor API change. * GHC's fileSystemEncoding is used for all String IO, to avoid encoding-related crashes in eg, Propellor.Property.File. * Add --build option to simply build config.hs. diff --git a/doc/todo/Arch_Linux_Port.mdwn b/doc/todo/Arch_Linux_Port.mdwn index a899dbb3..ac3ee4dc 100644 --- a/doc/todo/Arch_Linux_Port.mdwn +++ b/doc/todo/Arch_Linux_Port.mdwn @@ -12,3 +12,5 @@ I've made some addtional minor changes to make propellor compile without errors: - Rsync.installed and Docker.installed now supports Pacman as well Hope you enjoy it! + +> [[merged|done]]; it was indeed enjoyable. thank you! --[[Joey]] diff --git a/doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment b/doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment new file mode 100644 index 00000000..27ef8078 --- /dev/null +++ b/doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment @@ -0,0 +1,25 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 3""" + date="2017-02-04T20:55:02Z" + content=""" +> Instead, I changed some properties in DiskImage from Linux to +> DebianLike. Is it the correct way to do it? + +Looking at it, kpartx is DebianLike-specific, so imageBuiltFrom which uses it +should be too. The only reason it wasn't marked as DebianLike already and +was type Linux is because Linux used to be the same as DebianLike and so +the type checker didn't see a difference. No longer, thanks to your patch. + +So, it makes complete sense that you have to change this. You're paying +the price of blazing the trail of the first non-DebianLike Linux distro in +Propellor.. + +--- + +Looks like your [[!commit 25f6871e1dda3de252fbc6c8ac6962eb0cd9311a]] +dealt with all my review suggestions. And so, I've merged it. + +Unless you have anything else that needs to be done, I'll release +propellor soon with the added Arch Linux support. Thank you very much! +"""]] diff --git a/propellor.cabal b/propellor.cabal index 1b5c46d6..a33b9824 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -1,5 +1,5 @@ Name: propellor -Version: 3.2.3 +Version: 3.3.0 Cabal-Version: >= 1.8 License: BSD2 Maintainer: Joey Hess @@ -128,6 +128,7 @@ Library Propellor.Property.Obnam Propellor.Property.OpenId Propellor.Property.OS + Propellor.Property.Pacman Propellor.Property.Parted Propellor.Property.Partition Propellor.Property.Postfix -- cgit v1.2.3 From c231169bb339a36655cf465552d1888d6a64cab4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 4 Feb 2017 17:30:44 -0400 Subject: arch --- .../comment_3_f2924708a819b962ba7ed690019601ed._comment | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 doc/forum/Supported_OS/comment_3_f2924708a819b962ba7ed690019601ed._comment diff --git a/doc/forum/Supported_OS/comment_3_f2924708a819b962ba7ed690019601ed._comment b/doc/forum/Supported_OS/comment_3_f2924708a819b962ba7ed690019601ed._comment new file mode 100644 index 00000000..c03f6cd9 --- /dev/null +++ b/doc/forum/Supported_OS/comment_3_f2924708a819b962ba7ed690019601ed._comment @@ -0,0 +1,7 @@ +[[!comment format=mdwn + username="joey" + subject="""Arch too!""" + date="2017-02-04T21:30:26Z" + content=""" +Propellor just got support for Arch Linux! +"""]] -- cgit v1.2.3 From 11c445a26743957e3e25755c1c6db3ee22f878ab Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 4 Feb 2017 17:32:36 -0400 Subject: mention Arch --- doc/Linux.mdwn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/Linux.mdwn b/doc/Linux.mdwn index 00276f69..ca0cfd65 100644 --- a/doc/Linux.mdwn +++ b/doc/Linux.mdwn @@ -1,5 +1,6 @@ Propellor was written to manage Linux systems. -It supports Debian and Debian-derived distributions. +It supports Debian and Debian-derived distributions, +as well as Arch Linux. Support for other distributions should not be too hard to add. Indeed, Propellor has been ported to [[FreeBSD]] now! -- cgit v1.2.3 From 56a6d545fa789d34cda9a4297272a7723702bc6d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 4 Feb 2017 17:34:24 -0400 Subject: close --- ...o_to_pin_a_package_to_multiple_suites_with_different_priorities.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/todo/modify_Apt.pinnedTo_to_pin_a_package_to_multiple_suites_with_different_priorities.mdwn b/doc/todo/modify_Apt.pinnedTo_to_pin_a_package_to_multiple_suites_with_different_priorities.mdwn index 047324ce..02be4ad7 100644 --- a/doc/todo/modify_Apt.pinnedTo_to_pin_a_package_to_multiple_suites_with_different_priorities.mdwn +++ b/doc/todo/modify_Apt.pinnedTo_to_pin_a_package_to_multiple_suites_with_different_priorities.mdwn @@ -3,3 +3,5 @@ Please consider merging the `pin` branch of `https://git.spwhitton.name/propello I've modified `Apt.pinnedTo` so that it can pin an `AptPrefPackage` to multiple suites with different pin priorities. I've included a sample use-case in the function's haddock. --spwhitton + +> merged, [[done]] --[[Joey]] -- cgit v1.2.3 From 5bacfe57915631be8b1ca5452bbfde1a6d073e57 Mon Sep 17 00:00:00 2001 From: wzhd Date: Sun, 5 Feb 2017 00:59:18 +0000 Subject: Added a comment --- .../comment_4_924c73c0ab6fb39c9b25ae51facf6bb6._comment | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/todo/Arch_Linux_Port/comment_4_924c73c0ab6fb39c9b25ae51facf6bb6._comment diff --git a/doc/todo/Arch_Linux_Port/comment_4_924c73c0ab6fb39c9b25ae51facf6bb6._comment b/doc/todo/Arch_Linux_Port/comment_4_924c73c0ab6fb39c9b25ae51facf6bb6._comment new file mode 100644 index 00000000..f69e2c80 --- /dev/null +++ b/doc/todo/Arch_Linux_Port/comment_4_924c73c0ab6fb39c9b25ae51facf6bb6._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="wzhd" + avatar="http://cdn.libravatar.org/avatar/d5a499b7c476ca9960cc8dccdf455bae" + subject="comment 4" + date="2017-02-05T00:59:18Z" + content=""" +That's great! Thank you so much! +"""]] -- cgit v1.2.3 From cd3466799b7dbba51f619314153ea739923ed934 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 7 Feb 2017 12:00:45 -0400 Subject: link to lwn article --- doc/news/Linux.Conf.Au.presentation.mdwn | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/news/Linux.Conf.Au.presentation.mdwn b/doc/news/Linux.Conf.Au.presentation.mdwn index 00419554..54180979 100644 --- a/doc/news/Linux.Conf.Au.presentation.mdwn +++ b/doc/news/Linux.Conf.Au.presentation.mdwn @@ -2,3 +2,4 @@ [video](http://mirror.linux.org.au/pub/linux.conf.au/2017/Type_driven_configuration_management_with_Propellor.webm) +Also see this writeup in [Linux Weekly News](https://lwn.net/Articles/713653/) -- cgit v1.2.3 From f4bfbe1917bef5a2fd7f7a4220941747d152d739 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 7 Feb 2017 12:07:13 -0400 Subject: improve wording --- debian/changelog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3a12ca70..ef092a59 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,9 @@ propellor (3.3.0) UNRELEASED; urgency=medium * Added Propellor.Property.Pacman for Arch's package manager. Maintained by Zihao Wang. * The types of some properties changed; eg from Property DebianLike - to Property (DebianLike + ArchLinux). This could require updates - to code using those properties, so is a minor API change. + to Property (DebianLike + ArchLinux). Also, DebianLike and Linux + are no longer type synonyms; propellor now knows that Linux includes + ArchLinux. This could require updates to code, so is a minor API change. * GHC's fileSystemEncoding is used for all String IO, to avoid encoding-related crashes in eg, Propellor.Property.File. * Add --build option to simply build config.hs. -- cgit v1.2.3 From 965c5013937485f5ba4891442dac651d6533e2fc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 7 Feb 2017 12:11:27 -0400 Subject: releasing package propellor version 3.3.0 --- debian/changelog | 4 ++-- src/Propellor/Property/.Sbuild.hs.swp | Bin 16384 -> 0 bytes 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 src/Propellor/Property/.Sbuild.hs.swp diff --git a/debian/changelog b/debian/changelog index ef092a59..7a2fe693 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -propellor (3.3.0) UNRELEASED; urgency=medium +propellor (3.3.0) unstable; urgency=medium * Arch Linux is now supported by Propellor! Thanks to Zihao Wang for this port. @@ -25,7 +25,7 @@ propellor (3.3.0) UNRELEASED; urgency=medium * Added File.containsBlock Thanks, Sean Whitton. - -- Joey Hess Sat, 24 Dec 2016 15:06:36 -0400 + -- Joey Hess Tue, 07 Feb 2017 12:09:24 -0400 propellor (3.2.3) unstable; urgency=medium diff --git a/src/Propellor/Property/.Sbuild.hs.swp b/src/Propellor/Property/.Sbuild.hs.swp deleted file mode 100644 index a361c431..00000000 Binary files a/src/Propellor/Property/.Sbuild.hs.swp and /dev/null differ -- cgit v1.2.3 From e808162a1af8d35331a754662e40cf7bb4cc1a5d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 7 Feb 2017 12:12:26 -0400 Subject: add news item for propellor 3.3.0 --- doc/news/version_3.1.2.mdwn | 22 ---------------------- doc/news/version_3.3.0.mdwn | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 22 deletions(-) delete mode 100644 doc/news/version_3.1.2.mdwn create mode 100644 doc/news/version_3.3.0.mdwn diff --git a/doc/news/version_3.1.2.mdwn b/doc/news/version_3.1.2.mdwn deleted file mode 100644 index b54b396a..00000000 --- a/doc/news/version_3.1.2.mdwn +++ /dev/null @@ -1,22 +0,0 @@ -propellor 3.1.2 released with [[!toggle text="these changes"]] -[[!toggleable text=""" - * [ Joey Hess ] - * Ssh.knownHost: Bug fix: Only fix up the owner of the known\_hosts - file after it exists. - * [ Sean Whitton ] - * Sbuild.keypairInsecurelyGenerated: Improved to be more robust. - * Pass --allow-unrelated-histories to git merge when run with git 2.9 or - newer. This fixes the /usr/bin/propellor wrapper with this version of git. - * Sbuild.built & Sbuild.builtFor no longer require Sbuild.keypairGenerated. - Transition guide: If you are using sbuild 0.70.0 or newer, you should - `rm -r /var/lib/sbuild/apt-keys`. Otherwise, you should add either - Sbuild.keypairGenerated or Sbuild.keypairInsecurelyGenerated to your host. - * Sbuild haddock improvements: - - State that we don't support squeeze and Buntish older than trusty. - This is due to our enhancements, such as eatmydata. - - State that you need sbuild 0.70.0 or newer to build for stretch. - This is due to gpg2 hitting Debian stretch. - - Explain when a keygen is required. - - Update sample ~/.sbuildrc for sbuild 0.71.0. - - Add hint for customising chroots with propellor. - - Update example usage of System type."""]] \ No newline at end of file diff --git a/doc/news/version_3.3.0.mdwn b/doc/news/version_3.3.0.mdwn new file mode 100644 index 00000000..19bd5664 --- /dev/null +++ b/doc/news/version_3.3.0.mdwn @@ -0,0 +1,26 @@ +propellor 3.3.0 released with [[!toggle text="these changes"]] +[[!toggleable text=""" + * Arch Linux is now supported by Propellor! + Thanks to Zihao Wang for this port. + * Added Propellor.Property.Pacman for Arch's package manager. + Maintained by Zihao Wang. + * The types of some properties changed; eg from Property DebianLike + to Property (DebianLike + ArchLinux). Also, DebianLike and Linux + are no longer type synonyms; propellor now knows that Linux includes + ArchLinux. This could require updates to code, so is a minor API change. + * GHC's fileSystemEncoding is used for all String IO, to avoid + encoding-related crashes in eg, Propellor.Property.File. + * Add --build option to simply build config.hs. + * More informative usage message. Thanks, Daniel Brooks + * Tor.hiddenService' added to support multiple ports. + Thanks, Félix Sipma. + * Apt.noPDiffs added. + Thanks, Sean Whitton. + * stack.yaml: Compile with GHC 8.0.1 against lts-7.16. + Thanks, Andrew Cowie. + * Added Propellor.Property.File.configFileName and related functions + to generate good filenames for config directories. + * Added Apt.suiteAvailablePinned, Apt.pinnedTo. + Thanks, Sean Whitton. + * Added File.containsBlock + Thanks, Sean Whitton."""]] \ No newline at end of file -- cgit v1.2.3 From 72f86ba4666c2f4cfbdca6da1425d35dd7a0f942 Mon Sep 17 00:00:00 2001 From: jack_doe@62fb45d0567681d9d4f419581571c513e225300d Date: Wed, 8 Feb 2017 21:15:21 +0000 Subject: Remove additional space in url. Was not cloneable by copy&paste. --- doc/install.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install.mdwn b/doc/install.mdwn index ad87cedc..f64519a7 100644 --- a/doc/install.mdwn +++ b/doc/install.mdwn @@ -1,4 +1,4 @@ -`git clone git://propellor.branchable.com/ propellor` +`git clone git://propellor.branchable.com/propellor` Or get it [from github](https://github.com/joeyh/propellor). Propellor is recently available in Debian. -- cgit v1.2.3 From da400e7af20bf418c13de4456822303d91af83a3 Mon Sep 17 00:00:00 2001 From: https://me.yahoo.com/a/8E0H4z8LxusTHab4gc2Y8vCD_ObsJE6JVG2Co64SEnICbAtrisRuZjznurYBvSKkr8V5ALg-#075db Date: Mon, 13 Feb 2017 15:49:21 +0000 Subject: removed --- ...ent_3_d917de766dfe7fded7317d7614d1467f._comment | 25 ---------------------- 1 file changed, 25 deletions(-) delete mode 100644 doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment diff --git a/doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment b/doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment deleted file mode 100644 index 27ef8078..00000000 --- a/doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment +++ /dev/null @@ -1,25 +0,0 @@ -[[!comment format=mdwn - username="joey" - subject="""comment 3""" - date="2017-02-04T20:55:02Z" - content=""" -> Instead, I changed some properties in DiskImage from Linux to -> DebianLike. Is it the correct way to do it? - -Looking at it, kpartx is DebianLike-specific, so imageBuiltFrom which uses it -should be too. The only reason it wasn't marked as DebianLike already and -was type Linux is because Linux used to be the same as DebianLike and so -the type checker didn't see a difference. No longer, thanks to your patch. - -So, it makes complete sense that you have to change this. You're paying -the price of blazing the trail of the first non-DebianLike Linux distro in -Propellor.. - ---- - -Looks like your [[!commit 25f6871e1dda3de252fbc6c8ac6962eb0cd9311a]] -dealt with all my review suggestions. And so, I've merged it. - -Unless you have anything else that needs to be done, I'll release -propellor soon with the added Arch Linux support. Thank you very much! -"""]] -- cgit v1.2.3 From 33767d2d86c81f285ce253459f34c9f8f3a285a1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 13 Feb 2017 12:28:04 -0400 Subject: deb.debian.org * Apt: Removed the mirrors.kernel.org line from stdSourcesList etc. The mirror CDN has a new implementation that should avoid the problems with httpredir that made an extra mirror sometimes be needed. * Switch Debian CDN address to deb.debian.org. httpredir.debian.org points to the same IPs as deb.debian.org now, so this shouldn't change anything except to use the now preferred name. --- debian/changelog | 9 +++++++++ src/Propellor/Property/Apt.hs | 12 +++--------- src/Propellor/Property/DebianMirror.hs | 2 +- src/Propellor/Property/Sbuild.hs | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7a2fe693..ef67c673 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +propellor (3.3.1) UNRELEASED; urgency=medium + + * Apt: Removed the mirrors.kernel.org line from stdSourcesList etc. + The mirror CDN has a new implementation that should avoid the problems + with httpredir that made an extra mirror sometimes be needed. + * Switch Debian CDN address to deb.debian.org. + + -- Joey Hess Mon, 13 Feb 2017 12:23:42 -0400 + propellor (3.3.0) unstable; urgency=medium * Arch Linux is now supported by Propellor! diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 724f6d05..9a55c367 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -62,10 +62,7 @@ binandsrc url suite = catMaybes return $ debLine bs url stdSections debCdn :: SourcesGenerator -debCdn = binandsrc "http://httpredir.debian.org/debian" - -kernelOrg :: SourcesGenerator -kernelOrg = binandsrc "http://mirrors.kernel.org/debian" +debCdn = binandsrc "http://deb.debian.org/debian" -- | Only available for Stable and Testing securityUpdates :: SourcesGenerator @@ -77,9 +74,6 @@ securityUpdates suite -- | Makes sources.list have a standard content using the Debian mirror CDN, -- with the Debian suite configured by the os. --- --- Since the CDN is sometimes unreliable, also adds backup lines using --- kernel.org. stdSourcesList :: Property Debian stdSourcesList = withOS "standard sources.list" $ \w o -> case o of (Just (System (Debian _ suite) _)) -> @@ -98,7 +92,7 @@ stdSourcesList' suite more = tightenTargets $ setSourcesList (concatMap (\gen -> gen suite) generators) `describe` ("standard sources.list for " ++ show suite) where - generators = [debCdn, kernelOrg, securityUpdates] ++ more + generators = [debCdn, securityUpdates] ++ more type PinPriority = Int @@ -142,7 +136,7 @@ suiteAvailablePinned s pin = available unavailable | "-backports" `isSuffixOf` (showSuite s) = id | otherwise = filter (not . isInfixOf "-backports") - generators = [debCdn, kernelOrg, securityUpdates] + generators = [debCdn, securityUpdates] prefFile = "/etc/apt/preferences.d/20" ++ showSuite s ++ ".pref" sourcesFile = "/etc/apt/sources.list.d/" ++ showSuite s ++ ".list" diff --git a/src/Propellor/Property/DebianMirror.hs b/src/Propellor/Property/DebianMirror.hs index d8a9c423..ad15f9a2 100644 --- a/src/Propellor/Property/DebianMirror.hs +++ b/src/Propellor/Property/DebianMirror.hs @@ -79,7 +79,7 @@ data DebianMirror = DebianMirror mkDebianMirror :: FilePath -> Cron.Times -> DebianMirror mkDebianMirror dir crontimes = DebianMirror - { _debianMirrorHostName = "httpredir.debian.org" + { _debianMirrorHostName = "deb.debian.org" , _debianMirrorDir = dir , _debianMirrorSuites = [] , _debianMirrorArchitectures = [] diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs index c3e55bbf..db5982cd 100644 --- a/src/Propellor/Property/Sbuild.hs +++ b/src/Propellor/Property/Sbuild.hs @@ -501,7 +501,7 @@ schrootFromSystem system@(System _ arch) = >>= \suite -> return $ SbuildSchroot suite arch stdMirror :: System -> Maybe Apt.Url -stdMirror (System (Debian _ _) _) = Just "http://httpredir.debian.org/debian" +stdMirror (System (Debian _ _) _) = Just "http://deb.debian.org/debian" stdMirror (System (Buntish _) _) = Just "mirror://mirrors.ubuntu.com/" stdMirror _ = Nothing -- cgit v1.2.3 From b29bab35747e6345a4818e5a77c53d029562e3c3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 13 Feb 2017 12:29:50 -0400 Subject: Revert "removed" This reverts commit da400e7af20bf418c13de4456822303d91af83a3. No idea why this comment was removed. Going to assume it was an accident unless it happens again.. --- ...ent_3_d917de766dfe7fded7317d7614d1467f._comment | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment diff --git a/doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment b/doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment new file mode 100644 index 00000000..27ef8078 --- /dev/null +++ b/doc/todo/Arch_Linux_Port/comment_3_d917de766dfe7fded7317d7614d1467f._comment @@ -0,0 +1,25 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 3""" + date="2017-02-04T20:55:02Z" + content=""" +> Instead, I changed some properties in DiskImage from Linux to +> DebianLike. Is it the correct way to do it? + +Looking at it, kpartx is DebianLike-specific, so imageBuiltFrom which uses it +should be too. The only reason it wasn't marked as DebianLike already and +was type Linux is because Linux used to be the same as DebianLike and so +the type checker didn't see a difference. No longer, thanks to your patch. + +So, it makes complete sense that you have to change this. You're paying +the price of blazing the trail of the first non-DebianLike Linux distro in +Propellor.. + +--- + +Looks like your [[!commit 25f6871e1dda3de252fbc6c8ac6962eb0cd9311a]] +dealt with all my review suggestions. And so, I've merged it. + +Unless you have anything else that needs to be done, I'll release +propellor soon with the added Arch Linux support. Thank you very much! +"""]] -- cgit v1.2.3