Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#27)(#39)(#46)(#45) Rework and update the repository #47

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 36 additions & 8 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# AU template: https://github.com/majkinetor/au-packages-template

version: '{build}'
max_jobs: 1
image: WMF 5
image: Visual Studio 2022
TheCakeIsNaOH marked this conversation as resolved.
Show resolved Hide resolved
# History plugin requires complete log
#clone_depth: 5
branches:
Expand All @@ -13,7 +11,7 @@ branches:

environment:
# Set au version to use or omit to use the latest. Specify branch name to use development version from Github
au_version:
au_version: master
au_push: true
# Force test: use 1 to test all, or N to split testing into N groups
au_test_groups: 1
Expand Down Expand Up @@ -44,17 +42,37 @@ environment:
api_key:
secure: YOUR_CHOCO_API_KEY_HERE_ENCRYPTED_STRING # https://ci.appveyor.com/tools/encrypt

#Chocolatey version we want to use when checking for updates (usually latest).
choco_version: '2.2.2'
nupkg_cache_path: C:\packages

init:
- git config --global user.email "chocolatey@realdimensions.net"
- git config --global user.name "Chocolatey"
- git config --global user.name "Chocolatey-AU"
- git config --global core.safecrlf false

install:
- ps: |
$chocoVersion = $Env:choco_version
if (!(Test-Path "$env:nupkg_cache_path")) { mkdir -Force "$env:nupkg_cache_path" }
@{
'chocolatey' = $chocoVersion
# Uncomment and input the version if you are using any of these in AU scripts
# 'wormies-au-helpers' = 'VERSION_HERE'
# 'chocolatey-core.extension' = 'VERSION_HERE'
# 'autohotkey.install' = 'VERSION_HERE'
}.GetEnumerator() | % {
if (!(Test-Path "${env:nupkg_cache_path}\$($_.Key).$($_.Value).nupkg")) { rm "${env:nupkg_cache_path}\$($_.Key).*.nupkg" ; iwr "https://chocolatey.org/api/v2/package/$($_.Key)/$($_.Value)" -OutFile "${env:nupkg_cache_path}\$($_.Key).$($_.Value).nupkg" }
if ($_.Key -eq 'chocolatey') { choco upgrade $_.Key --version $_.Value --source ${env:nupkg_cache_path} --allow-downgrade --pre }
else { choco install $_.Key --version $_.Value --source ${env:nupkg_cache_path} --ignore-dependencies }
}
rm "$env:ChocolateyInstall\logs\*.log"
- ps: 'Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version'
- ps: $PSVersionTable
- git --version
- choco --version
- ps: |
git clone -q https://github.com/majkinetor/au.git $Env:TEMP/au
git clone -q https://github.com/chocolatey-community/chocolatey-au.git $Env:TEMP/au
. "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:au_version

- ps: |
Expand All @@ -81,7 +99,14 @@ build_script:
Write-Host ("{0}`n{1}`n" -f ('-'*60), "PACKAGE: $package")
$package_dir = ls -recurse | ? { $_.Name -eq "$package.nuspec"} | select -First 1 | % Directory
if (!$package_dir) { Write-Warning "Can't find package '$package'"; continue }
pushd $package_dir; choco pack; Push-Package; popd
try {
pushd $package_dir
if (Test-Path update.ps1 -ea 0) { ./update.ps1 }
choco pack
Push-Package
} finally {
popd
}
}
return
}
Expand All @@ -103,5 +128,8 @@ notifications:
on_build_failure: true
on_build_status_changed: true

cache:
- '%nupkg_cache_path% -> .appveyor.yml'

#on_finish:
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
53 changes: 4 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,83 +13,38 @@

This contains Chocolatey packages, both manually and automatically maintained.

You can choose to use one or both of the different methods currently supported in the Chocolatey community for automatic packaging. They are AU (Automatic Updater) and Ketarin/ChocolateyPackageUpdater.

### Folder Structure

* automatic - where automatic packaging and packages are kept. These are packages that are automatically maintained using either [AU](https://chocolatey.org/packages/au) or [Ketarin](https://chocolatey.org/packages/ketarin)/[ChocolateyPackageUpdater](https://chocolatey.org/packages/chocolateypackageupdater) combo.
* automatic - where automatic packaging and packages are kept. These are packages that are automatically maintained using [chocolatey-au](https://github.com/chocolatey-community/chocolatey-au).
* icons - Where you keep icon files for the packages. This is done to reduce issues when packages themselves move around.
* ketarin - where ketarin jobs (aka applications or searches) exported as XML are kept. This is done to allow ease of contribution.
* manual - where packages that are not automatic are kept.
* ops - scripts, jobs, and other items for ensuring automatic packaging.
* setup - items for prepping the system to ensure for auto packaging.

For setting up your own automatic package repository, please see [Automatic Packaging](https://chocolatey.org/docs/automatic-packages)

### Requirements

* Chocolatey (choco.exe)

#### Ketarin / ChocolateyPackageUpdater

* PowerShell v2+
* [Ketarin](https://chocolatey.org/packages/ketarin)
* [Chocolatey Package Updater](https://chocolatey.org/packages/chocolateypackageupdater)
* A Windows box somewhere - to run the updater on - appveyor can't work until the import of the settings can be automated

#### AU

* PowerShell v5+.
* The [AU module](https://chocolatey.org/packages/au).

For daily operations check out the AU packages [template README](https://github.com/majkinetor/au-packages-template/blob/master/README.md).
* The [chocolatey-au module](https://github.com/chocolatey-community/chocolatey-au).

### Getting started

1. Fork this repository and rename it to `chocolatey-packages` (on GitHub - go into Settings, Repository name and rename).
1. Click "Use this template" then "Create a new repository". Name it `chocolatey-packages`
1. Clone the repository locally.
1. Head into the `setup` folder and perform the proper steps for your choice of setup (or both if you plan to use both methods).
1. Head into the `setup` folder and perform the steps in the README there.
1. Edit this README. Update the badges at the top.


### Recommendation on Auto Packaging

AU provides more in the process of being completely automated, sending emails when things go wrong, and providing a nice report at the end. It doesn't have a bolt-on feeling to it that you see with Ketarin / ChocolateyPackageUdater, however the one thing it does lack in comparison is no visual feedback to seeing how searches for installers may be found. Other than that, it provides errors when things go wrong, where Ketarin doesn't consider anything that happens during "before run"/"post run updates" (where chocopkgup and checksumming occur) to be an error, even if those scripts error.

So for best visibility, enjoying the ease of using AppVeyor, and for a nice report of results, we recommend AU over Ketarin. You also don't need to deal with templates as AU works directly with the xml/ps1 files to do replacement.

### Adapting your current source repository to this source repository template

You want to bring in all of your packages into the proper folders. We suggest using some sort of diffing tool to look at the differences between your current solution and this solution and then making adjustments to it. Pay special attention to the setup folder.

1. Bring over the following files to your package source repository:
* `automatic\README.md`
* `icons\README.md`
* `ketarin\README.md`
* `ketarin\_KetarinChocolateyTemplate.xml`
* `manual\README.md`
* `ops\*.*`
* `setup\*.*`
* `.appveyor.yml`
1. Inspect the following file and add the differences:
* `.gitignore`

### Use Both Methodologies

The way this source repository is designed, you can use both AU and Ketarin/ChocolateyPackageUpdater together. This is especially helpful when migrating existing packages from one methodology to the other.

### Migrating existing Ketarin packages to AU

1. Add an update.ps1 to the package folder and determine how to update the package using [AU's instructions](https://github.com/majkinetor/au#creating-the-package-updater-script).
1. Remove the ketarin.xml file from the ketarin folder.
1. Ensure you also remove the package job from Ketarin itself as it doesn't automatically remove.

### Special Notes

#### Ketarin

* In `Settings -> Global variables` the variable `autoPackagesFolder` is used to determine where your automatic packages are. It doesn't matter what `chocopkgup` is using, this folder is passed through. Ensure this is set appropriately.
* In `Settings -> Global variables` the variable `saveDir` is used to determine where to save the downloaded files from Ketarin. Please ensure the folder exists.
* In `Settings -> Global variables` the variable `nopush` is set to `--nopush`, which allows checksum calculations to occur and then a custom script will push the files.
* In `Settings -> Global variables` the variable `cscript` is set to `2`, which means calculate checksums, rebuild, and push the packages. If you set this to `1` it will do everything except push the packages. Setting this to `1` is how you disable package pushing.
* In `Settings -> Global variables` the variable `checksum` is set to `{checksum}`. Do not change this, this is how the post update script replaces the literal value `{checksum}`. The same goes for `checksumx64`, `packageGuid`, and `url64`.
68 changes: 0 additions & 68 deletions automatic/1password/1password.nuspec

This file was deleted.

17 changes: 0 additions & 17 deletions automatic/1password/tools/chocolateyinstall.ps1

This file was deleted.

25 changes: 5 additions & 20 deletions automatic/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
## Automatic Folder

This is where you put your Chocolatey packages that are automatically packaged up by either [AU](https://chocolatey.org/packages/au) or [Ketarin](https://chocolatey.org/packages/ketarin)/[ChocolateyPackageUpdater](https://chocolatey.org/packages/chocolateypackageupdater).
This is where you put your Chocolatey packages that are automatically packaged up by [chocolatey-au](https://github.com/chocolatey-community/chocolatey-au).

### Ketarin / ChocolateyPackageUpdater (chocopkgup)
Execute `update_all.ps1` in the repository root to run [chocolatey-au](https://github.com/chocolatey-community/chocolatey-au) updater with default options.

You want to drop the actual Ketarin files (job file exports) in the top-level ketarin folder to keep them separate from the packages themselves.
To fully setup all the features ensure you perform the steps in the [setup/README.md](https://github.com/chocolatey/chocolatey-packages-template/blob/master/setup/README.md)

The following packages implement this strategy of auto updates:
To get the packages that implement chocolatey-au updater run `Get-AUPackages` or `lsau` in this directory.

* 1password
* git.install

There is also an _output folder where the automatic packaging files with tokens to do token replacment and output package files with actual values in this folder. This folder is necessary for chocopkgup to do its work. You can decide whether to commit this set of folders or not. We recommend committing it as it makes it easier to do one off fixes and contributors to submit fixes for a package.

### Automatic Updater (AU)

AU works with packages without automatic package tokens necessary. So you can treat the packages as normal.

Execute `update_all.ps1` in the repository root to run [AU](https://chocolatey.org/packages/au) updater with default options.

To fully setup all the features ensure you perform the steps in the [setup/README.md](https://github.com/chocolatey/chocolatey-packages-template/blob/master/setup/README.md#automatic-updater-au)

To get the packages that implement AU updater run `Get-AUPackages` or `lsau` in this directory.

**NOTE:** Ensure when you are creating packages for AU, you don't use `--auto` as the packaging files should be normal packages. AU doesn't need the tokens to do replacement.
**NOTE:** Ensure when you are creating packages for chocolatey-au, you don't use `--auto` as the packaging files should be normal packages. chocolatey-au doesn't need the tokens to do replacement.

Loading