Your Release
files should contain a Codename
header to allow pinning by release name. From man apt_preferences
:
The Release file is normally found in the directory .../dists/dist-name: forexample, .../dists/stable/Release, or .../dists/wheezy/Release. It consists of asingle multi-line record which applies to all of the packages in the directorytree below its parent. Unlike the Packages file, nearly all of the lines in aRelease file are relevant for setting APT priorities:[...]the Codename: line names the codename to which all the packages in the directory tree belong. For example, the line "Codename: jessie" specifies that all of the packages in the directory tree below the parent of the Release file belong to a version named jessie. Specifying this value in the APT preferences file would require the line: Pin: release n=jessie
See for reference the Release
file of the official Xenial repository.